Method and device for calibrating position relation between laser camera and printing head of 3D printer
By printing a specific calibration model in a 3D printing system and scanning the intersection of the laser line and the model, combined with image analysis, the problem of difficult calibration of infrared laser cameras under natural ambient light was solved, achieving efficient and low-cost camera and print head position calibration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2026-03-31
AI Technical Summary
Existing infrared laser cameras cannot obtain clear images under natural ambient light, making accurate calibration impossible and requiring additional infrared supplementary lights or visual tags.
A specific calibration model is printed by a printhead, and a laser line is emitted by a laser to scan the calibration model. The coordinates of the intersection point between the laser line and the calibration model are calculated by combining the scanned image and topology map acquired by the camera, and the positional relationship between the camera and the printhead is determined.
Without the need for additional supplementary lighting or visual labels, it achieves low-cost and efficient calibration of the positional relationship between the camera and the printhead.
Smart Images

Figure CN121756592A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D printing technology, and in particular to a method and apparatus for calibrating the positional relationship between a laser camera and the print head of a 3D printer. Background Technology
[0002] In vision systems, calibrating the camera's position is a crucial step. Existing calibration methods include hand-eye calibration and checkerboard calibration. To achieve high-precision calibration, these methods all require the camera to capture a clear label pattern. However, for infrared laser cameras, because they only receive infrared light, a clear image cannot be obtained in natural ambient light unless an additional infrared supplementary light is installed, thus hindering accurate calibration under natural ambient light conditions. Summary of the Invention
[0003] The purpose of this application is to provide a method and apparatus for calibrating the positional relationship between a laser camera and a 3D printer printhead. A specific model is printed by the printhead, and a specific calibration model is printed by the printhead. A camera captures a scanned image under laser illumination. By combining the topological map formed by the intersection of the laser line and the calibration model, and the printhead camera information, the positional relationship between the camera and the printhead can be calibrated. This method is low in cost and highly efficient.
[0004] In a first aspect, this application provides a method for calibrating the positional relationship between a laser camera and a 3D printer print head. The method is applied to a 3D printing system, which includes a printing platform and a print head, a camera, and a laser connected sequentially. The method includes: printing a calibration model on the printing platform using the print head; the calibration model includes a rectangular border line and lines connecting a preset point on one border line to two vertices on the opposite border line; scanning the calibration model using laser lines emitted by the laser, following a direction from the border line to the opposite border line, and acquiring multiple scan images during the scanning process using the camera; forming a topological graph of the relationship between the model and the laser lines by the intersections of the laser lines and the calibration model; determining the pixel coordinates of multiple intersection points of the laser lines and the calibration model for each scan image; performing calculations based on the pixel coordinates of the multiple intersection points and the mechanical coordinates of model points in the topological graph to obtain the mechanical coordinates of a specified intersection point; calculating the camera-print head offset distance with the specified intersection point as a reference based on the mechanical coordinates of the specified intersection point, the mechanical coordinates of the print head, and the pixel coordinates of the camera center; and determining the calibration distance between the 3D printer print head and the camera based on the camera-print head offset distances calculated for each of the multiple scan images.
[0005] Furthermore, the intersection of the laser line and the calibration model appears as a notch in the scanned image. The step of determining the pixel coordinates of multiple intersection points of the laser line and the calibration model based on the scanned image includes: converting the scanned image into a binary image; determining the centerline coordinates of the laser line in the binary image; performing a row-by-row traversal search of the binary image using the centerline coordinates as the starting point to determine the pixel coordinates corresponding to multiple notch edge points; identifying multiple pairs of edge points from the multiple notch edge points; each pair of edge points includes an adjacent left edge point and a right edge point of the notch; for each pair of edge points, calculating the midpoint coordinates of the notch based on the pixel coordinates corresponding to the adjacent left and right edge points of the notch, and using these coordinates as the pixel coordinates of the intersection point corresponding to that pair of edge points.
[0006] Furthermore, the above-mentioned step of performing a row-by-row traversal search on the binary image using the centerline coordinates as the starting point to determine the pixel coordinates corresponding to multiple notch edge points includes: using the centerline coordinates as the starting point, performing a row-by-row traversal pixel detection on the binary image from left to right; if no target laser pixel is detected in the right neighbor of the current pixel, the pixel coordinates corresponding to the current pixel are determined as the pixel coordinates corresponding to the left edge point of the notch; the target laser pixel is a laser pixel with a pixel value of 255; if no target laser pixel is detected in the left neighbor of the current pixel, but there is a target laser pixel in the right neighbor, the pixel coordinates corresponding to the current pixel are determined as the pixel coordinates corresponding to the right edge point of the notch.
[0007] Further, the step of calculating the mechanical coordinates of a specified intersection point based on the pixel coordinates of multiple intersection points and the mechanical coordinates of model points in the topology graph includes: determining the first triangle and the second triangle in the calibration model; the three sides of the first triangle include: the first target border line through which the laser line passes in the calibration model, and the line segments between the preset point and two vertices of the target border line; the three vertices of the second triangle include: the first intersection point between the laser line and the target border line, the second intersection point between the laser line and the line connecting the preset point to the target border line, and the third intersection point between the target border line and the connecting line; calculating the first distance between the two intersection points based on the pixel coordinates corresponding to the first and second intersection points respectively; calculating the first angle value corresponding to the third intersection point in the second triangle based on the mechanical coordinates of the three vertices of the first triangle; determining the second angle value corresponding to the second intersection point in the second triangle based on the pixel coordinates corresponding to the first and second intersection points respectively, and the pixel coordinates of the first intersection point in each binary image; calculating the second distance between the first and third intersection points based on the first distance, the first angle value, and the second angle value; and calculating the mechanical coordinates corresponding to the first intersection point based on the mechanical coordinates of the third intersection point and the second distance.
[0008] Furthermore, the above method also includes: flipping the topology diagram vertically, calculating the mechanical coordinates corresponding to the fourth intersection point according to the above process, the fourth intersection point being the intersection point of the laser line before the topology diagram is flipped and the second target border line of the model; the second target border line is the border line opposite to the first target border line.
[0009] Furthermore, the step of determining the second angle value corresponding to the second intersection point in the second triangle based on the pixel coordinates corresponding to the first and second intersection points, respectively, and the pixel coordinates of the first intersection point in each binary image, includes: performing least squares fitting based on the pixel coordinates corresponding to the first and second intersection points to obtain a first straight line; fitting based on the pixel coordinates of the first intersection point in each binary image to obtain a second straight line; calculating the third angle value corresponding to the first intersection point in the second triangle based on the first and second straight lines; and determining the second angle value corresponding to the second intersection point in the second triangle based on the third angle value and the first angle value.
[0010] Furthermore, the step of calculating the camera printhead offset distance based on the specified intersection point, the printhead's mechanical coordinates, and the camera center's pixel coordinates, includes: taking the Y and X directions in the mechanical coordinates as the current directions, and performing the following steps in each direction: calculating the first offset distance of the specified intersection point relative to the printhead in the current direction based on the current direction's mechanical coordinates of the specified intersection point and the printhead's current direction's mechanical coordinates; calculating the second offset distance of the specified intersection point relative to the camera in the current direction based on the current direction's pixel coordinates of the specified intersection point and the camera center's current direction's pixel coordinates; and obtaining the difference between the first and second offset distances to obtain the camera printhead offset distance in the current direction based on the specified intersection point.
[0011] Further, the step of calculating the second offset distance of the specified intersection point relative to the camera in the current direction based on the pixel coordinates of the specified intersection point in the current direction and the pixel coordinates of the camera center in the current direction includes: calculating the pixel difference between the pixel coordinates of the specified intersection point in the current direction and the pixel coordinates of the camera center in the current direction; determining the second offset distance of the specified intersection point relative to the camera in the current direction based on the pixel difference and a pre-calibrated conversion coefficient of the current direction; wherein the conversion coefficient is used to characterize the number of pixels corresponding to a unit distance or the distance corresponding to a single pixel.
[0012] Secondly, this application also provides a calibration device for the positional relationship between a laser camera and a 3D printer print head. The method is applied to a 3D printing system, which includes a printing platform and a print head, a camera, and a laser connected sequentially. The device includes: printing a calibration model on the printing platform using the print head; the calibration model includes: a rectangular border line and lines connecting a preset point on one border line to two vertices of the opposite border line; a laser scanning module for scanning the calibration model using laser lines emitted by the laser, in a direction from the border line to the opposite border line, and acquiring multiple scan images during the scanning process using the camera; and the laser lines and the calibration model are aligned. The system includes: a topology diagram showing the relationship between the model and the laser line; an offset calculation module, used for each scanned image to determine the pixel coordinates of multiple intersection points between the laser line and the calibration model; calculations based on the pixel coordinates of multiple intersection points and the mechanical coordinates of model points in the topology diagram to obtain the mechanical coordinates of a specified intersection point; calculation of the camera printhead offset distance with the specified intersection point as the reference, based on the mechanical coordinates of the specified intersection point, the mechanical coordinates of the printhead, and the pixel coordinates of the camera center; and a distance calibration module, used to determine the calibration distance between the 3D printer printhead and the camera based on the camera printhead offset distances calculated for multiple scanned images.
[0013] Thirdly, this application also provides a 3D printing system, which includes: a printing platform and a print head, a camera and a laser connected in sequence; the 3D printing system is used to perform the method described in the first aspect.
[0014] This application provides a method and apparatus for calibrating the positional relationship between a laser camera and a 3D printer print head. The method is applied to a 3D printing system, which includes a printing platform and a print head, a camera, and a laser connected in sequence. First, a calibration model is printed on the printing platform using the print head. The calibration model includes a rectangular border line and lines connecting a preset point on one border line to two vertices on the opposite border line. A laser line emitted by the laser scans the calibration model in a direction from the border line to the opposite border line, and the camera acquires multiple scan images during the scanning process. A topological graph of the relationship between the model and the laser line is formed by the intersection of the laser line and the calibration model. For each scan image, the pixel coordinates of multiple intersection points of the laser line and the calibration model are determined. Based on the pixel coordinates of the multiple intersection points and the mechanical coordinates of the model points in the topological graph, calculations are performed to obtain the mechanical coordinates of a specified intersection point. Based on the mechanical coordinates of the specified intersection point, the mechanical coordinates of the print head, and the pixel coordinates of the camera center, the camera-print head offset distance with the specified intersection point as a reference is calculated. Based on the camera-print head offset distances calculated for each of the multiple scan images, the calibration distance between the 3D printer print head and the camera is determined. In this method, a specific calibration model is printed by the print head, and a scanned image under the illumination of the laser line is captured by the camera. By combining the topology map formed by the intersection of the laser line and the calibration model, as well as the print head camera information, the positional relationship between the camera and the print head can be determined. There is no need to install additional supplementary lighting components or additional visual labels, which is low in cost and high in efficiency. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the structure of a 3D printing system provided in an embodiment of this application;
[0017] Figure 2 A flowchart illustrating a method for calibrating the positional relationship between a laser camera and a 3D printer printhead, provided in an embodiment of this application;
[0018] Figure 3 A schematic diagram of a calibration model provided in an embodiment of this application;
[0019] Figure 4 A topology diagram of a calibration model provided in an embodiment of this application;
[0020] Figure 5A schematic diagram of a scanned image provided for an embodiment of this application;
[0021] Figure 6 A flowchart illustrating the process of determining intersection coordinates is provided in an embodiment of this application.
[0022] Figure 7 A schematic diagram of a binary image provided in an embodiment of this application;
[0023] Figure 8 This is a schematic diagram of pixel neighborhood detection provided in an embodiment of this application;
[0024] Figure 9 This application provides a schematic diagram for solving camera printhead offset.
[0025] Figure 10 A schematic diagram of a sticker model provided in an embodiment of this application;
[0026] Figure 11 This is a structural block diagram of a device for calibrating the positional relationship between a laser camera and a 3D printer printhead, provided in an embodiment of this application. Detailed Implementation
[0027] The technical solutions of this application will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] To address the problem that existing camera printhead distance calibration methods require additional infrared fill lights for infrared laser camera calibration, otherwise clear images cannot be obtained and accurate calibration cannot be performed, this application provides a method and apparatus for calibrating the positional relationship between a laser camera and a 3D printer printhead. A specific calibration model is printed by the printhead, and a scanned image under laser illumination is captured by the camera. Combining this with the topological map formed by the intersection of the laser line and the calibration model, and the printhead camera information, the positional relationship between the camera and the printhead can be calibrated. No additional fill lights or visual labels are required, resulting in low cost and high efficiency.
[0029] To facilitate understanding of this embodiment, a method for calibrating the positional relationship between a laser camera and a 3D printer printhead, as disclosed in this application embodiment, will first be described in detail.
[0030] This application provides a method for calibrating the positional relationship between a laser camera and a 3D printer print head. This method is applied to a 3D printing system. See [link to relevant documentation]. Figure 1As shown, the 3D printing system includes: a printing platform 14 and a print head 11, a camera 12, and a laser 13 connected in sequence; see also Figure 2 The flowchart shown illustrates the method for calibrating the positional relationship between the laser camera and the 3D printer head, specifically including the following steps:
[0031] Step S202: Print the calibration model on the printing platform using the print head; the calibration model includes: a rectangular border line and lines connecting a preset point on one border line to two vertices on the opposite border line.
[0032] A schematic diagram of the above calibration model is shown below. Figure 3 As shown, the model consists of rectangle FCDE, line segments IC and ID, and point I is a point on the border line FE. In this model, the mechanical coordinates (gcode coordinates) of the five points FCDEI are all available, i.e., known. For ease of calculation, point I can be set as the midpoint of the FE border line.
[0033] Step S204: The laser emitted by the laser scans the calibration model in the direction from the edge line to the opposite edge line, and the camera captures multiple scan images during the scanning process; a topological map of the relationship between the model and the laser line is formed by the intersection of the laser line and the calibration model.
[0034] In practice, the laser line scans from the FE border line to the CD border line, or from the CD border line to the FE border line. During the scan, the topology formed by the intersection of the laser line and the model is as follows: Figure 4 As shown, HG represents the state of the laser line illuminating the model; the four intersection points of the laser line HG and the model are A, B, J, and K, respectively. The actual image of the laser illuminating the calibration model, that is, the scanned image captured by the camera, is shown below. Figure 5 As shown, points K, J, B, and A are respectively connected to... Figure 4 The points with the same number in the middle correspond one-to-one.
[0035] Step S206: For each scanned image, determine the pixel coordinates of multiple intersection points between the laser line and the calibration model based on the scanned image; perform calculations based on the pixel coordinates of the multiple intersection points and the mechanical coordinates of the model points in the topology diagram to obtain the mechanical coordinates of the specified intersection point; calculate the camera printhead offset distance with the specified intersection point as the reference based on the mechanical coordinates of the specified intersection point, the mechanical coordinates of the printhead, and the pixel coordinates of the camera center.
[0036] First, based on the binary image of the scanned image, the pixel coordinates of multiple intersection points A, B, J, and K between the laser line and the calibration model are calculated. Then, combined with the mechanical coordinates of the model points in the topology diagram, such as the mechanical coordinates of the four vertices F, C, D, and E and the midpoint I, the mechanical coordinates of the specified intersection points (such as points A and / or K) are calculated. Further, based on the mechanical coordinates of the specified intersection points (such as points A and / or K), the known mechanical coordinates of the printhead, and the known pixel coordinates of the camera center, the camera-printhead offset distance with the specified intersection points (such as points A and / or K) as the reference is calculated. The specific calculation process will be detailed later.
[0037] Step S208: Based on the camera printhead offset distance calculated for each of the multiple scanned images, determine the calibration distance between the 3D printer printhead and the camera.
[0038] For example, the median or average value of the camera printhead offset distances calculated from multiple scanned images can be used to obtain the calibration distance between the 3D printer printhead and the camera.
[0039] The method for calibrating the positional relationship between a laser camera and a 3D printer print head provided in this application uses a specially designed calibration model to acquire scanned images. Based on the scanned images and topology map, the method performs analysis and calculation to calibrate the positional relationship between the camera and the print head. It does not require the installation of additional supplementary lighting components or additional visual labels, resulting in low calibration cost and high efficiency.
[0040] The entire calculation process will be explained in detail below:
[0041] The implementation process of the sub-step "determining the pixel coordinates of multiple intersection points between the laser line and the calibration model based on the scanned image" in step S206 above is as follows:
[0042] The intersection of the laser line and the calibration model appears as a notch in the scanned image, with one intersection corresponding to one notch;
[0043] (1) Convert the scanned image into a binary image;
[0044] (2) Determine the centerline coordinates of the laser line in the binary image;
[0045] (3) Using the centerline coordinates as the starting point for retrieval, perform a row-by-row traversal retrieval of the binary image to determine the pixel coordinates corresponding to the multiple gap edge points;
[0046] In one implementation, the binary image is traversed row by row to detect pixels, starting from the center line coordinates. If no target laser pixel is detected in the right neighboring region of the current pixel, the pixel coordinates of the current pixel are determined as the pixel coordinates of the left edge of the notch. The target laser pixel is a laser pixel with a pixel value of 255. If no target laser pixel is detected in the left neighboring region of the current pixel, but there is a target laser pixel in the right neighboring region, the pixel coordinates of the current pixel are determined as the pixel coordinates of the right edge of the notch.
[0047] (4) Identify multiple pairs of edge points from multiple gap edge points; a pair of edge points includes the adjacent left edge point and right edge point of the gap;
[0048] (5) For each pair of edge points, calculate the coordinates of the midpoint of the gap based on the pixel coordinates of the left edge point and the right edge point of the gap, respectively, and use them as the pixel coordinates of the intersection point of the pair of edge points.
[0049] For specific implementation, please refer to Figure 6 As shown, first input a binary image, such as... Figure 7 As shown, the laser line appears as a white band. The coordinates (m) of the laser line's centerline need to be calculated. Figure 7 The line is composed of small and medium-sized black dots, meaning that m represents the median Y-coordinate of the entire laser center line. Starting from (0, m), pixel-by-pixel searches are performed row by row from left to right to determine the edge of the laser line notch. The neighborhood of each searched pixel is then evaluated, as shown in the table below. Figure 8 As shown. If there is no pixel with a value of 255 in the right neighboring region, then the current pixel coordinates (A1, L1) of the laser pixel are recorded as the left edge point of the notch. If there is no laser pixel in the left neighboring region but there is one in the right neighboring region, then the current pixel coordinates (A2, L2) are recorded as the right edge point of the notch. The final intersection point coordinates are the midpoints of the two notch edges gapACents=[(A1+A2) / 2,(L1+L2) / 2)].
[0050] In step S206 above, the sub-step of calculating the mechanical coordinates of a specified intersection point based on the pixel coordinates of multiple intersection points and the mechanical coordinates of model points in the topology graph is implemented as follows:
[0051] (1) Determine the first triangle △FIC and the second triangle △ABC in the calibration model; the three sides of the first triangle △FIC include: the first target border line FC through which the laser line passes through the calibration model, and the line segments IC and IF between the preset point and the two vertices of the target border line respectively; the three vertices of the second triangle △ABC include: the first intersection point A between the laser line HG and the target border line FC, the second intersection point B between the laser line HG and the line IC connecting the preset point I to the target border line FC, and the third intersection point C between the target border line FC and the connecting line IC;
[0052] (2) Calculate the first distance c between the two intersection points based on the pixel coordinates corresponding to the first intersection point A and the second intersection point B (which have been calculated previously);
[0053] (3) Based on the mechanical coordinates of the three vertices (F, I, C) of the first triangle △FIC, calculate the first angle value ∠ACB corresponding to the third intersection point C in the second triangle △ABC;
[0054] (4) Based on the pixel coordinates corresponding to the first intersection point A and the second intersection point B respectively, and the pixel coordinates of the first intersection point A in each binary image, determine the second angle value ∠ABC corresponding to the second intersection point B in the second triangle △ABC;
[0055] Specifically, this is achieved through the following process:
[0056] (4.1) Based on the pixel coordinates corresponding to the first intersection point A and the second intersection point B respectively, the least squares method is used to fit the first line, that is, the line where AB is located;
[0057] (4.2) Fit the pixel coordinates of the first intersection point A in each binary image to obtain the second straight line, which is the line where FC is located;
[0058] (4.3) Based on the first and second lines, calculate the third angle value ∠CAB corresponding to the first intersection point A in the second triangle △ABC;
[0059] (4.4) Based on the third angle value ∠CAB and the first angle value ∠ACB, determine the second angle value ∠ABC corresponding to the second intersection point B in the second triangle △ABC.
[0060] (5) Calculate the second distance b between the first intersection point A and the third intersection point C based on the first distance c, the first angle value ∠ACB, and the second angle value ∠ABC;
[0061] Specifically, according to the formula for the area of a triangle:
[0062] According to ∠b, According to the three ABCs;
[0063] It can be seen that,
[0064] (6) Based on the mechanical coordinates of the third intersection point C and the second distance b, the mechanical coordinates corresponding to the first intersection point A are calculated.
[0065] For example, the coordinates of point C obtained in the gcode file are (ptC.x, ptC.y), and the coordinates of the intersection point A in the XYZ coordinate system are: ptOfGcode = (ptC.xb, ptC.y).
[0066] Furthermore, the above method also includes: flipping the topology diagram where the laser line intersects the model vertically, and calculating the mechanical coordinates corresponding to the fourth intersection point according to the above process. The fourth intersection point is the intersection point K of the laser line HG and the second target border line ED of the model before the topology diagram is flipped.
[0067] In other words, for each scanned image, the mechanical coordinates corresponding to two specified intersection points A and K can be calculated by combining the topology map. Then, the camera printhead offset distance based on A and K can be calculated respectively.
[0068] The following example, using intersection point A, illustrates the process of calculating the camera printhead offset distance:
[0069] The implementation process of the sub-step in step S206 above, which calculates the camera-printhead offset distance based on the specified intersection point, the machine coordinates of the printhead, and the pixel coordinates of the camera center, is as follows:
[0070] Using the Y and X directions in the machine coordinate system as the current directions, perform the following steps:
[0071] (1) Calculate the first offset distance of the specified intersection point relative to the print head in the current direction based on the mechanical coordinates of the specified intersection point in the current direction and the mechanical coordinates of the print head in the current direction;
[0072] (2) Calculate the second offset distance of the specified intersection point relative to the camera in the current direction based on the pixel coordinates of the specified intersection point in the current direction and the pixel coordinates of the camera center in the current direction;
[0073] Specifically, the pixel difference between the pixel coordinates of the specified intersection point in the current direction and the pixel coordinates of the camera center in the current direction is calculated; based on the pixel difference and the pre-calibrated conversion coefficients of the current direction, the second offset distance of the specified intersection point relative to the camera in the current direction is determined; wherein, the conversion coefficients are used to characterize the number of pixels corresponding to a unit distance or the distance corresponding to a single pixel.
[0074] (3) Calculate the difference between the first offset distance and the second offset distance to obtain the camera printhead offset distance in the current direction with the specified intersection point as the reference.
[0075] Finally, we can obtain the first camera printhead offset distance ΔY in the Y direction based on the specified intersection point, which is the first offset ΔY between the laser pixel center and the nozzle of the printhead assembly in the Y-axis direction, and the second camera printhead offset distance ΔX in the X direction based on the specified intersection point, which is the second offset ΔX between the laser pixel center and the nozzle of the printhead assembly in the X-axis direction.
[0076] The following explanation uses the X direction as an example. Figure 9 As shown, first calculate the first offset distance nozzleOffset of point A in the X direction relative to the print head. X nozzleOffset X =ptOfGcode X -nozzlePos X Among them, ptOfGcode X This represents the mechanical coordinate in the X direction corresponding to intersection point A, nozzlePos X This represents the mechanical coordinates of the print head in the X direction.
[0077] Then, based on the pixel coordinates in the X direction of the specified intersection point and the pixel coordinates in the X direction of the camera center, calculate the second offset distance lightCentOffset of the specified intersection point relative to the camera in the X direction. X ;
[0078] Specifically, the pixel difference between the pixel coordinates in the X direction of the specified intersection point and the pixel coordinates in the X direction of the camera center is calculated; based on the pixel difference and the pre-calibrated transformation coefficients in the X direction, the second offset distance of the specified intersection point relative to the camera in the X direction is determined, as shown in the following formula:
[0079] lightCentOffset X =(gapACents X -lightCent X )*pixSize X ;
[0080] Among them, gapACents X The pixel coordinates in the X direction of intersection point A are represented; lightCentX represents the pixel coordinates in the X direction of the camera center; pixelSizeX represents the reciprocal of the pre-calibrated number of pixels per millimeter in the X direction, or the number of pixels per millimeter.
[0081] Finally, calculate the first offset distance nozzleOffset. X The second offset distance is lightCentOffset XThe difference is used to obtain the camera printhead offset distance ΔX in the X direction with the specified intersection point as the reference (as shown in camOffset in the figure). X ):
[0082] For example: ΔX = nozzleOffset X -lightCentOffset X .
[0083] The calculation method for the first offset ΔY is the same as above, except that the corresponding mechanical coordinates in the Y direction, pixel coordinates in the Y direction, and conversion coefficients in the Y direction are replaced, which will not be repeated here.
[0084] In this embodiment, the mechanical coordinates of intersection point A are used as intermediate variables to solve for the offset of the camera printhead. By solving for the positional relationship between point A and the printhead and the camera, the positional relationship between the camera and the printhead can be solved.
[0085] The calibration process for the conversion coefficients in the X and Y directions is as follows:
[0086] The camera captures images of a specified model on the printing platform; the specified model includes at least two points in the Y-axis or X-axis direction; the captured images are identified to determine the pixel values between the centers of the two points; the pixel values are divided by the distance between the centers of the two points to obtain the transformation coefficients in the Y-axis or X-axis direction of the pixel coordinate system.
[0087] The following example illustrates the calibration process using the number of pixels per millimeter along the Y-axis in the pixel coordinate system.
[0088] The system uses a camera to capture images, either photographing or scanning the outer contour of a target at a known fixed distance at a scanning height. Figure 10 The sticker shown is affixed to a printing platform. For example, the horizontal or vertical center-to-center distance between any two dots in the image is 5mm. A camera is used to photograph the sticker, obtaining an image. By identifying the dots in the image, the pixel difference between the centers of any two horizontally aligned dots is calculated. For example, if the calculated pixel difference is 30, and the distance between the horizontally aligned center and the actual center is 5mm, then the number of pixels per millimeter in the Y-axis direction is K. Y =30 corresponds to a single; K Y This means that if the measured object has a pixel difference of 6 pixels in the direction of the horizontal coordinate of the pixel coordinate system, then the measured object has a length of 1mm in the Y direction of the XYZ coordinate system.
[0089] The method for calibrating the positional relationship between a laser camera and a 3D printer printhead provided in this application involves printing a specific calibration model through the printhead, acquiring a scanned image under laser illumination through a camera, and combining the topological map formed by the intersection of the laser line and the calibration model, as well as printhead camera information, such as the mechanical coordinates of the printhead and the center pixel coordinates of the camera, to calibrate the positional relationship between the camera and the printhead. This method is low in cost and highly efficient.
[0090] Based on the above method embodiments, this application also provides a device for calibrating the positional relationship between a laser camera and a 3D printer print head. The method is applied to a 3D printing system, which includes a printing platform and a print head, a camera, and a laser connected in sequence. See also... Figure 11 As shown, the device includes: a model printing module 112, used to print a calibration model on a printing platform via a print head; the calibration model includes: a rectangular border line and lines connecting a preset point on one border line to two vertices of the opposite border line; a laser scanning module 114, used to scan the calibration model using laser lines emitted by the laser, in the direction from the border line to the opposite border line, and to acquire multiple scan images during the scanning process using a camera; a topological graph of the relationship between the model and the laser lines is formed by the intersection of the laser lines and the calibration model; an offset calculation module 116, used to determine the pixel coordinates of multiple intersection points of the laser lines and the calibration model for each scan image; to perform calculations based on the pixel coordinates of the multiple intersection points and the mechanical coordinates of the model points in the topological graph to obtain the mechanical coordinates of a specified intersection point; to calculate the camera print head offset distance with the specified intersection point as a reference based on the mechanical coordinates of the specified intersection point, the mechanical coordinates of the print head, and the pixel coordinates of the camera center; and a distance calibration module 118, used to determine the calibration distance between the 3D printer print head and the camera based on the camera print head offset distances calculated for the multiple scan images.
[0091] Furthermore, the intersection of the laser line and the calibration model appears as a notch in the scanned image; the offset calculation module 116 is used to convert the scanned image into a binary image; determine the center line coordinates corresponding to the laser line in the binary image; perform a row-by-row traversal search on the binary image using the center line coordinates as the starting point to determine the pixel coordinates corresponding to multiple notch edge points; determine multiple pairs of edge points from the multiple notch edge points; a pair of edge points includes an adjacent left edge point and a right edge point of the notch; for each pair of edge points, calculate the midpoint coordinates of the notch based on the pixel coordinates corresponding to the adjacent left edge point and right edge point of the notch, and use these as the pixel coordinates of the intersection point corresponding to the pair of edge points.
[0092] Furthermore, the aforementioned offset calculation module 116 is used to perform row-by-row pixel detection on the binary image from left to right, starting from the center line coordinates; if no target laser pixel is detected in the right neighboring region corresponding to the current pixel, the pixel coordinates corresponding to the current pixel are determined as the pixel coordinates corresponding to the left edge of the notch; the target laser pixel is a laser pixel with a pixel value of 255; if no target laser pixel is detected in the left neighboring region corresponding to the current pixel, but there is a target laser pixel in the right neighboring region, the pixel coordinates corresponding to the current pixel are determined as the pixel coordinates corresponding to the right edge of the notch.
[0093] Further, the aforementioned offset calculation module 116 is used to determine the first triangle and the second triangle in the calibration model; the three sides of the first triangle include: the first target border line through which the laser line passes in the calibration model, and the line segments between the preset point and the two vertices of the target border line; the three vertices of the second triangle include: the first intersection point between the laser line and the target border line, the second intersection point between the laser line and the line connecting the preset point to the target border line, and the third intersection point between the target border line and the connecting line; the first distance between the two intersection points is calculated based on the pixel coordinates corresponding to the first and second intersection points respectively; the first angle value corresponding to the third intersection point in the second triangle is calculated based on the mechanical coordinates of the three vertices of the first triangle; the second angle value corresponding to the second intersection point in the second triangle is determined based on the pixel coordinates corresponding to the first and second intersection points respectively, and the pixel coordinates of the first intersection point in each binary image; the second distance between the first intersection point and the third intersection point is calculated based on the first distance, the first angle value, and the second angle value; the mechanical coordinates corresponding to the first intersection point are calculated based on the mechanical coordinates of the third intersection point and the second distance.
[0094] Furthermore, the aforementioned offset calculation module 116 is used to flip the topology map vertically and calculate the mechanical coordinates corresponding to the fourth intersection point according to the above process. The fourth intersection point is the intersection point of the laser line before the topology map is flipped and the second target border line of the model; the second target border line is the border line opposite to the first target border line.
[0095] Furthermore, the aforementioned offset calculation module 116 is used to perform least squares fitting based on the pixel coordinates corresponding to the first intersection point and the second intersection point respectively to obtain a first straight line; to fit the pixel coordinates of the first intersection point in each binary image to obtain a second straight line; to calculate the third angle value corresponding to the first intersection point in the second triangle based on the first straight line and the second straight line; and to determine the second angle value corresponding to the second intersection point in the second triangle based on the third angle value and the first angle value.
[0096] Furthermore, the aforementioned offset calculation module 116 is used to take the Y and X directions in the mechanical coordinates as the current directions, and perform the following steps in each direction: calculate the first offset distance of the specified intersection point relative to the print head in the current direction based on the mechanical coordinates of the specified intersection point in the current direction and the mechanical coordinates of the print head in the current direction; calculate the second offset distance of the specified intersection point relative to the camera in the current direction based on the pixel coordinates of the specified intersection point in the current direction and the pixel coordinates of the camera center in the current direction; and obtain the difference between the first offset distance and the second offset distance to get the camera print head offset distance in the current direction based on the specified intersection point.
[0097] Furthermore, the aforementioned offset calculation module 116 is used to calculate the pixel difference between the pixel coordinates of the specified intersection point in the current direction and the pixel coordinates of the camera center in the current direction; based on the pixel difference and the pre-calibrated conversion coefficient of the current direction, it determines the second offset distance of the specified intersection point relative to the camera in the current direction.
[0098] The device provided in this application embodiment has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts of the device embodiment not mentioned can be referred to the corresponding content in the aforementioned method embodiment.
[0099] Based on the above method embodiments, this application also provides a 3D printing system, see [link to relevant documentation]. Figure 2 As shown, the 3D printing system includes: a printing platform and a print head, a camera, and a laser connected in sequence; the 3D printing system is used to perform the method described in the foregoing method embodiments.
[0100] The system provided in this application embodiment has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the system embodiment can be referred to the corresponding content in the aforementioned method embodiment.
[0101] This application also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above-described method. For specific implementation details, please refer to the foregoing method embodiments, which will not be repeated here.
[0102] The computer program products of the methods, apparatus, and electronic devices provided in the embodiments of this application include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementations, please refer to the method embodiments, which will not be repeated here.
[0103] Unless otherwise specifically stated, the relative steps, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of this application.
[0104] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0105] In the description of this application, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0106] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the technical scope disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A method for calibrating the positional relationship between a laser camera and a 3D printer print head, characterized in that, The method is applied to a 3D printing system, the 3D printing system comprising: a printing platform and a printing head, a camera and a laser connected in sequence; the method comprising: printing a calibration model on the printing platform through the printing head; the calibration model comprising: a rectangular frame line and a connecting line from a preset point on one frame line to two vertices of the opposite frame line; scanning the calibration model in the direction from the frame line to the opposite frame line through the laser line emitted by the laser, and collecting a plurality of scanning images in the scanning process through the camera; the intersection of the laser line and the calibration model forming a topological graph of the relationship between the model and the laser line; for each scanning image, determining the pixel coordinates of a plurality of intersection points of the laser line and the calibration model according to the scanning image; based on the pixel coordinates of a plurality of the intersection points and the mechanical coordinates of the model points in the topological graph, performing calculation to obtain the mechanical coordinates of a specified intersection point; according to the mechanical coordinates of the specified intersection point, the mechanical coordinates of the printing head and the pixel coordinates of the camera center, calculating the camera-printing head offset distance with the specified intersection point as the reference; based on the camera-printing head offset distances respectively calculated for a plurality of scanning images, determining the calibration distance between the printing head and the camera of the 3D printer.
2. The method of claim 1, wherein, The intersection of the laser line and the calibration model appears as a notch in the scanning image; the step of determining the pixel coordinates of a plurality of intersection points of the laser line and the calibration model according to the scanning image comprises: converting the scanning image into a binary image; determining the center line coordinates corresponding to the laser line in the binary image; taking the center line coordinates as the retrieval starting point, performing line-by-line traversal retrieval on the binary image to determine the pixel coordinates corresponding to a plurality of notch edge points respectively; determining a plurality of pairs of edge points from the plurality of notch edge points; a pair of edge points comprises an adjacent notch left edge point and a notch right edge point; for each pair of edge points, calculating the notch midpoint coordinates as the pixel coordinates of the intersection point corresponding to the pair of edge points according to the pixel coordinates corresponding to the adjacent notch left edge point and the notch right edge point respectively.
3. The method of claim 2, wherein, The step of taking the center line coordinates as the retrieval starting point, performing line-by-line traversal retrieval on the binary image to determine the pixel coordinates corresponding to a plurality of notch edge points respectively comprises: taking the center line coordinates as the retrieval starting point, performing line-by-line traversal pixel point detection on the binary image in the direction from left to right; if no target laser pixel point is detected in the right neighborhood of the current pixel point, then determining the pixel coordinates corresponding to the current pixel point as the pixel coordinates corresponding to the notch left edge point; the target laser pixel point is a laser pixel point with a pixel value of 255; if no target laser pixel point is detected in the left neighborhood of the current pixel point, and a target laser pixel point is detected in the right neighborhood, then determining the pixel coordinates corresponding to the current pixel point as the pixel coordinates corresponding to the notch right edge point.
4. The method of claim 1, wherein, The step of performing calculation based on the pixel coordinates of a plurality of the intersection points and the mechanical coordinates of the model points in the topological graph to obtain the mechanical coordinates of a specified intersection point comprises: determining a first triangle and a second triangle in the topological graph; three edges of the first triangle include a first target edge of the calibration model intersected by the laser line, and two line segments between the preset point and two vertices of the target edge, respectively; three vertices of the second triangle include a first intersection between the laser line and the target edge, a second intersection between the laser line and a line connecting the preset point and the target edge, and a third intersection between the target edge and the line; calculating a first distance between the first intersection and the second intersection according to pixel coordinates corresponding to the first intersection and the second intersection, respectively; and calculating a first angle value corresponding to the third intersection in the second triangle according to mechanical coordinates of the three vertices of the first triangle; determining a second angle value corresponding to the second intersection in the second triangle based on the pixel coordinates corresponding to the first intersection and the second intersection, respectively, and the pixel coordinates of the first intersection in each binary image; calculating a second distance between the first intersection and the third intersection according to the first distance, the first angle value, and the second angle value; and calculating the mechanical coordinates of the first intersection according to the mechanical coordinates of the third intersection and the second distance.
5. The method of claim 4, wherein, The method further comprises: inverting the topological graph upside down, and calculating the mechanical coordinates of a fourth intersection according to the above process, the fourth intersection being an intersection between the laser line and a second target edge of the model before the topological graph is inverted; and the second target edge being an edge opposite to the first target edge.
6. The method of claim 4, wherein, The step of determining the second angle value corresponding to the second intersection in the second triangle based on the pixel coordinates corresponding to the first intersection and the second intersection, respectively, and the pixel coordinates of the first intersection in each binary image, comprises: performing least square fitting based on the pixel coordinates corresponding to the first intersection and the second intersection, respectively, to obtain a first straight line; performing fitting according to the pixel coordinates of the first intersection in each binary image to obtain a second straight line; calculating a third angle value corresponding to the first intersection in the second triangle according to the first straight line and the second straight line; determining the second angle value corresponding to the second intersection in the second triangle according to the third angle value and the first angle value.
7. The method of claim 1, wherein, The step of calculating the camera-printer head offset distance based on the mechanical coordinates of the specified intersection, the mechanical coordinates of the printer head, and the pixel coordinates of the camera center, comprises: respectively taking the Y direction and the X direction in the mechanical coordinates as a current direction, and performing the following steps: calculating a first offset distance of the specified intersection to the printer head in the current direction according to the mechanical coordinates of the specified intersection in the current direction and the mechanical coordinates of the printer head in the current direction; calculating a second offset distance of the specified intersection to the camera in the current direction according to the pixel coordinates of the specified intersection in the current direction and the pixel coordinates of the camera center in the current direction; and The difference between the first offset distance and the second offset distance is calculated to obtain a camera-printer head offset distance in the current direction with the specified intersection point as a reference.
8. The method of claim 7, wherein, The step of calculating the second offset distance of the specified intersection point in the current direction of the camera includes: calculating a pixel difference between the pixel coordinate of the specified intersection point in the current direction and the pixel coordinate of the camera center in the current direction; determining the second offset distance of the specified intersection point in the current direction of the camera based on the pixel difference and a conversion coefficient in the current direction pre-calibrated, wherein the conversion coefficient is used to represent a pixel number corresponding to a unit distance or a distance corresponding to a single pixel.
9. A device for calibrating the positional relationship between a laser camera and a 3D printer print head, characterized in that, The device is applied to a 3D printing system, and the 3D printing system includes a printing platform and a printer head, a camera and a laser connected in sequence; the device includes: a model printing module configured to print a calibration model on the printing platform by the printer head; the calibration model includes a rectangular frame line and a line connecting a preset point on one frame line to two vertices of an opposite frame line; a laser scanning module configured to scan the calibration model by a laser line emitted by the laser in a direction from the frame line to the opposite frame line, and collect a plurality of scanning images in a scanning process by the camera; a topological graph of a model-laser line relationship is formed by intersections of the laser line and the calibration model; an offset calculation module configured to determine, for each scanning image, pixel coordinates of a plurality of intersections of the laser line and the calibration model according to the scanning image; calculate mechanical coordinates of a specified intersection based on the pixel coordinates of the plurality of intersections and mechanical coordinates of model points in the topological graph; and calculate a camera-printer head offset distance with the specified intersection as a reference based on the mechanical coordinates of the specified intersection, mechanical coordinates of the printer head and pixel coordinates of the camera center; a distance calibration module configured to determine a calibration distance between a printer head and the camera of a 3D printer based on camera-printer head offset distances calculated for a plurality of scanning images respectively.
10. A 3D printing system, characterized by The 3D printing system includes a printing platform and a printer head, a camera and a laser connected in sequence; and the 3D printing system is configured to perform the method according to any one of claims 1-8.