Calibration method and device for linear array camera
By acquiring the shooting of the calibration substrate and laser patterns by the linear array camera, and combining the least squares method to calculate the target conversion matrix, the problem of low calibration accuracy and inconsistent scenes of the linear array camera is solved, and high-precision linear array camera calibration and moving object positioning are achieved .
Patent Information
- Application Number
- CN202110699865.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-23
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-06-23
AI Technical Summary
Linear array camera calibration requires specific calibration targets, resulting in low calibration accuracy and inability to be applied in moving objects scenes. The prior art cannot guarantee the consistency between calibration state and usage state.
By obtaining the linear array camera to photograph the markers on the calibration substrate and the pattern depicted by the laser, the target conversion matrix is determined, including the conversion matrix between the pixel coordinate system and the calibration substrate coordinate system and the laser coordinate system and the calibration substrate coordinate system and the calibration substrate coordinate system. The conversion matrix of the target conversion matrix is combined with the least squares method calculation to achieve the determination of the target conversion matrix.
The calibration accuracy of the linear array camera can be improved without a specific calibration target. It is suitable for moving object scenes and ensures the consistency between the calibration state and the usage state.
Smart Images

Figure CN113570670B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a calibration method and device for a linear array camera. Background Art
[0002] Visual positioning is an important technology in the field of machine vision. In visual positioning applications, camera calibration is necessary to determine the relationship between the world coordinates of a point on the surface of a spatial object and the corresponding point in the image. Camera calibration is one of the key technologies in machine vision, and the accuracy of camera calibration directly affects the accuracy of visual positioning results. Linear array cameras have only one column of pixels, so they only output one-dimensional image information, achieving the characteristics of wide field of view, high resolution, and high sampling frequency. However, due to the particularity of single-column imaging of linear array cameras, there are few solutions for high-precision calibration of linear array cameras, and it is time-consuming.
[0003] The existing technology requires specific calibration targets, cannot realize the positioning of moving objects, and has a complicated calibration process. It can only be limited to a specific calibration system, and the calibration scene is inconsistent with the actual application scene, and it cannot ensure that the calibration state of the line array camera is consistent with the usage state.
[0004] In the related art, there is no effective solution to the problem of low calibration accuracy of line array cameras due to the need for specific calibration targets. Summary of the invention
[0005] The embodiments of the present invention provide a calibration method and device for a line array camera, so as to at least solve the problem of low calibration accuracy of the line array camera caused by the need for a specific calibration target in the related art.
[0006] According to one embodiment of the present invention, a calibration method for a line array camera is provided, comprising: obtaining a first calibration image by photographing a marker on a calibration substrate with the line array camera; obtaining a second calibration image by photographing a pattern engraved by a laser with the line array camera; and determining a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image.
[0007] Optionally, a target transformation matrix for calibrating the line array camera is determined through the first calibration image and the second calibration image, including: determining a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system; determining a second transformation matrix between a laser coordinate system of the second calibration image and the calibration substrate coordinate system; and determining the target transformation matrix based on the first transformation matrix and the second transformation matrix.
[0008] Optionally, determining a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system includes: establishing the pixel coordinate system with a first vertex of the first calibration image as a coordinate origin; establishing the calibration substrate coordinate system with a first marker in the first calibration image as a coordinate origin; and calculating the first transformation matrix from the pixel coordinate system to the calibration substrate coordinate system by a least squares method.
[0009] Optionally, determining a second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system includes: establishing the laser coordinate system with the second marker in the second calibration image as the coordinate origin; determining the translation coordinates and rotation angle between the laser coordinate system and the calibration substrate coordinate system; and determining the second transformation matrix based on the translation coordinates and the rotation angle.
[0010] Optionally, obtaining a first calibration image by photographing the markers on the calibration substrate with the line array camera includes: photographing the markers on the calibration substrate with the line array camera to obtain a first image; extracting a target area from the first image, wherein the target area includes at least two of the markers; and performing binarization and spot detection on the target area to obtain the first calibration image.
[0011] Optionally, obtaining a second calibration image by photographing the pattern engraved by the laser with the linear array camera includes: controlling the laser to engrave a pattern at the origin of the laser coordinate system, a first preset position of the horizontal axis and a second preset position of the vertical axis; using the linear array camera to photograph the pattern engraved by the laser to obtain the second calibration image.
[0012] Optionally, after determining the target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image, the method further includes: acquiring the target image captured by the line array camera; determining the first coordinates of the pixel points in the target image in the pixel coordinate system; and transforming the first coordinates according to the target transformation matrix to obtain the second coordinates of the pixel points in the laser coordinate system.
[0013] According to another embodiment of the present invention, a calibration device for a line array camera is provided, comprising: a first acquisition module, used to acquire a first calibration image obtained by the line array camera photographing a marker on a calibration substrate; a second acquisition module, used to acquire a second calibration image obtained by the line array camera photographing a pattern engraved by a laser; and a determination module, used to determine a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image.
[0014] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0015] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0016] According to the present invention, the first calibration image is obtained by taking a line array camera to photograph a marker on a calibration substrate; the second calibration image is obtained by taking a line array camera to photograph a pattern carved by a laser; and the target conversion matrix for calibrating the line array camera is determined by the first calibration image and the second calibration image. The purpose of calibrating the line array camera without a specific calibration target can be achieved. Therefore, the problem of low calibration accuracy of the line array camera can be solved, and the effect of improving the calibration accuracy of the line array camera can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of a mobile terminal of a linear array camera calibration method according to an embodiment of the present invention;
[0019] Figure 2 is a flow chart of a calibration method for a line scan camera according to an embodiment of the present invention;
[0020] Figure 3 is a schematic diagram of a calibration substrate according to an optional embodiment of the present invention;
[0021] Figure 4 is a schematic diagram of a region of interest according to an optional embodiment of the present invention;
[0022] Figure 5 is a schematic diagram of a region of interest subjected to binarization and morphological processing according to an optional embodiment of the present invention;
[0023] Figure 6 is a schematic diagram of a pattern carved by a laser according to an optional embodiment of the present invention;
[0024] Figure 7 is a schematic diagram of a pixel coordinate system and a calibration substrate coordinate system according to an optional embodiment of the present invention;
[0025] Figure 8is a schematic diagram of coordinate point conversion in a calibration substrate coordinate system according to an optional embodiment of the present invention;
[0026] Fig. 9 4 is a structural block diagram of a calibration device for a line array camera according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0029] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a linear array camera calibration method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0030] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the calibration method of the linear array camera in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal 10 via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] In this embodiment, a calibration method for a line array camera running on the above mobile terminal is provided. Figure 2 is a flow chart of a calibration method for a line scan camera according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0033] Step S202, obtaining a first calibration image by photographing a marker on a calibration substrate with a linear array camera;
[0034] Step S204, obtaining a second calibration image by photographing the pattern carved by the laser with the linear array camera;
[0035] Step S206: determining a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image.
[0036] Through the above steps, the first calibration image is obtained by taking a line array camera to photograph the marker on the calibration substrate; the second calibration image is obtained by taking a line array camera to photograph the pattern carved by the laser; and the target conversion matrix for calibrating the line array camera is determined by the first calibration image and the second calibration image. The purpose of calibrating the line array camera without a specific calibration target can be achieved. Therefore, the problem of low calibration accuracy of the line array camera can be solved, and the effect of improving the calibration accuracy of the line array camera can be achieved.
[0037] Optionally, the execution subject of the above steps may be a terminal, etc., but is not limited thereto.
[0038] As an optional implementation, obtaining a first calibration image by photographing a marker on a calibration substrate with a line array camera may include the following steps:
[0039] Step S21, for the image acquired by the circular calibration plate under the linear array camera, a region of interest (ROI) is set on the image as a candidate area for extracting the circular marker. Setting the ROI can effectively reduce the algorithm processing time, and the algorithm can be processed only for the region, and the non-candidate region is not processed. Figure 3 FIG. 1 is a schematic diagram of a calibration substrate according to an optional embodiment of the present invention. Figure 3 ROI is cut out from Figure 4 The figure shows a schematic diagram of a region of interest according to an optional embodiment of the present invention, that is, the ROI region is a candidate region, the image of the calibration substrate is inside the ROI region, and the object loading platform is outside the ROI region.
[0040] Step S22, image binarization and morphological processing are performed on the calibrated substrate ROI area to remove small isolated dots on the image. The morphological processing uses an opening operation, such as Figure 5 Shown is a schematic diagram of a region of interest for binarization and morphological processing according to an optional embodiment of the present invention, wherein the black circular spots are circular markers on the calibration substrate, and the white part in the figure is the background of the calibration substrate.
[0041] Step S23, Figure 5 The image is subjected to spot detection to preliminarily obtain the centroid of all circular markers in the ROI region, and the spot detection is an existing technology. The circle represents the spot region detected by the spot detection algorithm, and the spot detection is an existing technology and will not be described in detail here.
[0042] Step S24, use the circle-finding tool to accurately extract the coordinates of the center of the circle on the original image. The circle-finding tool is an existing technology, and the algorithm implementation of the circle-finding tool is not described in detail. To use the circle-finding tool, two parameters, the desired center of the circle and the desired radius, need to be provided. The rough center of mass of each circular marker is obtained based on spot detection, and the rough center of mass of the marker is set as the desired center of the circle of the circle-finding tool. The desired radius is set according to the image, and the size of the setting can be determined according to the actual situation, for example, it can be 100 pixels. The circle-finding tool will obtain the true center and radius of the circular marker in the original image. The first calibration image includes multiple circular markers, and thus the first calibration image can be obtained.
[0043] As an optional implementation, the second calibration image can be obtained by capturing the pattern carved by the laser with the linear array camera in the following manner: the circular pattern carved by the laser is captured by the linear array camera to form a second calibration image. The process of the laser carving the circular pattern is to control the laser to carve a circle at the center of the laser coordinate system, move 1mm along the horizontal axis direction of the laser coordinate system, and move 1mm along the vertical axis direction of the laser coordinate system. The above 1mm is only for the purpose of illustrating this embodiment. The specific moving distance can be determined according to the actual situation, for example, it can be 2mm, 3mm, 5mm, etc. Figure 6 FIG. 1 is a schematic diagram of a pattern carved by a laser according to an optional embodiment of the present invention. The second calibration image may be Figure 6 Schematic diagram of the pattern carved by the laser shown in FIG. In the figure, point K is the coordinate of the center of the circle carved by the laser with the origin of the laser coordinate system as the center in the pixel coordinate system. Points J and L are the coordinates of the center of the circle carved by the laser in the pixel coordinate system. The horizontal axis of the laser coordinate system is represented by points K and J in the pixel coordinate system. The vertical axis of the laser coordinate system is represented by the K point and the L point in the pixel coordinate system.
[0044] Optionally, a target transformation matrix for calibrating the line array camera is determined through the first calibration image and the second calibration image, including: determining a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system; determining a second transformation matrix between a laser coordinate system of the second calibration image and the calibration substrate coordinate system; and determining the target transformation matrix based on the first transformation matrix and the second transformation matrix.
[0045] As an optional implementation, determining a target transformation matrix for calibrating a line array camera may include the following steps:
[0046] Step S31, using a conventional image processing detection module to locate the coordinates of the circular calibration object on the calibration substrate in the pixel coordinate system, and calculating the first transformation matrix between the pixel coordinates and the calibration substrate coordinate system by mathematical deduction. The circular calibration object on the calibration substrate is an image obtained by the linear array camera taking a picture of the calibration substrate.
[0047] Step S32, locate the pixel coordinates of the circular pattern carved by the laser through a conventional image processing detection module, and transform the circular pattern carved by the laser into the calibration substrate coordinate system through a second conversion matrix. The circular pattern carved by the laser is an image obtained by taking a picture of the circular pattern carved by the laser by a linear array camera.
[0048] Step S33, through mathematical calculation and derivation, the pixel coordinates and the laser coordinates are transformed to obtain a target transformation matrix.
[0049] Optionally, determining a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system includes: establishing the pixel coordinate system with a first vertex of the first calibration image as a coordinate origin; establishing the calibration substrate coordinate system with a first marker in the first calibration image as a coordinate origin; and calculating the first transformation matrix from the pixel coordinate system to the calibration substrate coordinate system by a least squares method.
[0050] As an optional implementation, determining a first transformation matrix between a pixel coordinate system and a calibration substrate coordinate system may include the following steps:
[0051] Step S41: The pixel coordinate system is a coordinate system established with the first vertex of the first calibration image as the origin, wherein the first vertex can be any vertex in the first calibration image, for example, the upper left corner. Figure 7 The figure shows a schematic diagram of a pixel coordinate system and a calibration substrate coordinate system according to an optional embodiment of the present invention. The upper left corner point in the first calibration image is taken as the origin of the pixel coordinate system, u represents the horizontal coordinate of the pixel, u is the column number of the pixel point in the image, v represents the vertical coordinate of the pixel, v is the row number of the pixel point in the image, and O is the origin of the pixel coordinate system. Figure 7 The coordinate system represented by u, O, and v is the pixel coordinate system.
[0052] Step S42, the calibration substrate coordinate system is a coordinate system established with the first marker in the first calibration image as the coordinate origin, wherein the first calibration image may include at least two markers, the first marker may be any marker of the at least two markers, for example, it may be a circular marker in the upper left corner, and a Cartesian coordinate system is established with the center of the circular marker in the upper left corner as the origin of the calibration substrate, such as Figure 7 X is the x-axis of the calibration substrate coordinate system, Y is the Y-axis of the calibration substrate coordinate system, and point OO is the origin of the calibration substrate coordinate system. The coordinate system represented by X, OO, and Y in the figure is the calibration substrate coordinate system.
[0053] Step S43, calculate the first transformation matrix H from the pixel coordinate system (uv) to the calibration substrate coordinate system. The least squares method is used to calculate the homography transformation matrix H from the pixel coordinate system to the calibration substrate coordinate system as the first transformation matrix. The least squares method is an existing technology and will not be described in detail here.
[0054] Optionally, determining a second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system includes: establishing the laser coordinate system with the second marker in the second calibration image as the coordinate origin; determining the translation coordinates and rotation angle between the laser coordinate system and the calibration substrate coordinate system; and determining the second transformation matrix based on the translation coordinates and the rotation angle.
[0055] As an optional implementation, determining a second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system may include the following steps:
[0056] Step S51, calculate the rotation and translation relationship between the calibration substrate coordinate system and the laser coordinate system. The three points K, J and L of the laser coordinate system in the image are obtained by the linear array camera. Any point among K, J and L can be used as the origin of the laser coordinate system. For example, the laser coordinate system can be established with K as the origin of the coordinate.
[0057] Step S52: transform the K point, J point and L point to the calibration substrate coordinate system by matrix multiplication with the homography transformation matrix H, and obtain three points, namely K' point, J' point and L' point. Figure 8 The figure is a schematic diagram of coordinate point conversion in the calibration substrate coordinate system according to an optional embodiment of the present invention. Assuming that the coordinate of point K' is (j 0 ,l 0 ), the coordinates of point OO are (x 0 ,y 0 ), the coordinates of point J' are (j 1 ,l 1 ), the translation coordinate relationship between the calibration substrate coordinate system and the laser coordinate system is calculated as:
[0058] Δx=j 0 -x 0
[0059] Δy=l 0 -y 0
[0060] The rotation angle between the calibration substrate coordinate system and the laser coordinate system is calculated as: The angle θ with the horizontal axis of the calibration substrate coordinate system:
[0061] Step S53 , converting the calibration substrate coordinate system to the laser coordinate system according to the translation and rotation relationship between the calibration substrate coordinate system and the laser coordinate system, and obtaining a second conversion matrix.
[0062] Optionally, obtaining a first calibration image by photographing the markers on the calibration substrate with the line array camera includes: photographing the markers on the calibration substrate with the line array camera to obtain a first image; extracting a target area from the first image, wherein the target area includes at least two of the markers; and performing binarization and spot detection on the target area to obtain the first calibration image.
[0063] Optionally, obtaining a second calibration image by photographing the pattern engraved by the laser with the linear array camera includes: controlling the laser to engrave a pattern at the origin of the laser coordinate system, a first preset position of the horizontal axis and a second preset position of the vertical axis; using the linear array camera to photograph the pattern engraved by the laser to obtain the second calibration image.
[0064] Optionally, after determining the target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image, the method further includes: acquiring the target image captured by the line array camera; determining the first coordinates of the pixel points in the target image in the pixel coordinate system; and transforming the first coordinates according to the target transformation matrix to obtain the second coordinates of the pixel points in the laser coordinate system.
[0065] As an optional implementation scheme, for the pixel points on the product, the coordinates of the pixel coordinate system can be converted to the coordinates of the laser coordinate system in the following way:
[0066] Step S61: Assume that a point p on the product is scanned by a linear array camera and the first coordinate of the point p in the pixel coordinate system in the image is g(g 0 ,g 1 ).
[0067] Step S62: point g is transformed by the first transformation matrix to obtain point g h (g h0 ,g h1 ).
[0068] Step S63, point g h (g h0 ,g h1 ), according to the translation relationship between the calibration substrate and the laser, g h (g h0 ,g h1 ) After translation, we get g h ′(g h0 +Δx,g h1 +Δy), according to the rotation relationship between the calibration substrate and the laser, g h ′ is the laser coordinate p′(p 0 ,p 1), completing the conversion from pixel coordinates to laser coordinates.
[0069] p 0 =(g h0 +Δx)*cosθ-(g h1 +Δy)*sinθ
[0070] p 1 =(g h1 +Δy)*cosθ+(g h0 +Δx)-sinθ
[0071] This application uses a common servo motor motion mechanism and a universal circular calibration substrate to simplify the calibration process and lower the threshold for calibration; this application uses the actual application environment to complete the calibration of the linear array camera, which is fully in line with the actual application. This application can complete the calibration when the object is moving, which can meet the application in the scene of object movement. This application solves the problem of low calibration accuracy through the conversion method from the pixel coordinate system to the calibration substrate coordinate system. At the same time, it does not require a specific calibration target, and solves the problem that the positioning of the moving object and the calibration of the linear array camera are inconsistent with the actual use process.
[0072] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0073] In this embodiment, a calibration device for a linear array camera is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation in hardware, or a combination of software and hardware, is also possible and conceivable.
[0074] Fig. 9 is a structural block diagram of a calibration device for a line array camera according to an embodiment of the present invention. Fig. 9As shown, the device includes: a first acquisition module 92, which is used to acquire a first calibration image obtained by a linear array camera photographing a marker on a calibration substrate; a second acquisition module 94, which is used to acquire a second calibration image obtained by the linear array camera photographing a pattern engraved by a laser; and a determination module 96, which is used to determine a target transformation matrix for calibrating the linear array camera through the first calibration image and the second calibration image.
[0075] Optionally, the above-mentioned device is also used to determine a first transformation matrix between the pixel coordinate system of the first calibration image and the calibration substrate coordinate system; determine a second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system; and determine the target transformation matrix based on the first transformation matrix and the second transformation matrix.
[0076] Optionally, the above-mentioned device is also used to determine the first transformation matrix between the pixel coordinate system of the first calibration image and the calibration substrate coordinate system in the following manner: establishing the pixel coordinate system with the first vertex of the first calibration image as the coordinate origin; establishing the calibration substrate coordinate system with the first marker in the first calibration image as the coordinate origin; and calculating the first transformation matrix from the pixel coordinate system to the calibration substrate coordinate system by the least squares method.
[0077] Optionally, the above-mentioned device is also used to determine the second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system in the following manner: establish the laser coordinate system with the second marker in the second calibration image as the coordinate origin; determine the translation coordinates and rotation angle between the laser coordinate system and the calibration substrate coordinate system; determine the second transformation matrix based on the translation coordinates and the rotation angle.
[0078] Optionally, the above-mentioned device is also used to obtain a first calibration image by photographing the markers on the calibration substrate with the line array camera in the following manner: photographing the markers on the calibration substrate with the line array camera to obtain a first image; extracting a target area from the first image, wherein the target area includes at least two of the markers; and performing binarization processing and spot detection on the target area to obtain the first calibration image.
[0079] Optionally, the above-mentioned device is also used to obtain the second calibration image by photographing the pattern engraved by the laser with the linear array camera in the following manner: controlling the laser to engrave the pattern at the origin of the laser coordinate system, the first preset position of the horizontal axis and the second preset position of the vertical axis; using the linear array camera to photograph the pattern engraved by the laser to obtain the second calibration image.
[0080] Optionally, the above-mentioned device is also used to obtain a target image captured by the line array camera after determining the target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image; determine the first coordinates of the pixel points in the target image in the pixel coordinate system; and transform the first coordinates according to the target transformation matrix to obtain the second coordinates of the pixel points in the laser coordinate system.
[0081] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0082] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0083] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0084] S1, obtaining a first calibration image by photographing a marker on a calibration substrate with a linear array camera;
[0085] S2, obtaining a second calibration image by photographing the pattern carved by the laser with the linear array camera;
[0086] S3: Determine a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image.
[0087] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0088] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0089] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0090] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0091] S1, obtaining a first calibration image by photographing a marker on a calibration substrate with a linear array camera;
[0092] S2, obtaining a second calibration image by photographing the pattern carved by the laser with the linear array camera;
[0093] S3: Determine a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image.
[0094] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0095] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A calibration method for a linear array camera, characterized in that: include: A linear array camera is used to photograph a marker on a calibration substrate to obtain a first calibration image; The linear array camera is used to photograph the pattern carved by the laser to obtain a second calibration image; Determining a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image; Wherein, determining a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image includes: Determining a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system; Determining a second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system; The target transformation matrix is determined according to the first transformation matrix and the second transformation matrix.
2. The method according to claim 1, characterized in that Determining a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system includes: Establishing the pixel coordinate system with the first vertex of the first calibration image as the coordinate origin; Establishing the calibration substrate coordinate system with the first marker in the first calibration image as the coordinate origin; The first transformation matrix converted from the pixel coordinate system to the calibration substrate coordinate system is calculated by the least square method.
3. The method according to claim 1, characterized in that Determining a second transformation matrix between the laser coordinate system of the second calibration image and the calibration substrate coordinate system includes: Establishing the laser coordinate system with the second marker in the second calibration image as the coordinate origin; Determining the translation coordinates and rotation angle between the laser coordinate system and the calibration substrate coordinate system; The second transformation matrix is determined according to the translation coordinates and the rotation angle.
4. The method according to claim 1, characterized in that: The method of obtaining a first calibration image by photographing a marker on a calibration substrate by the line array camera includes: The marker on the calibration substrate is photographed by the line array camera to obtain a first image; Extracting a target area from the first image, wherein the target area includes at least two of the markers; The target area is subjected to binarization processing and spot detection to obtain the first calibration image.
5. The method according to claim 1, characterized in that The method of obtaining a second calibration image by photographing the pattern carved by the laser by the linear array camera includes: Controlling the laser to carve a pattern at the origin of the laser coordinate system, a first preset position of the horizontal axis, and a second preset position of the vertical axis; The pattern carved by the laser is photographed using a linear array camera to obtain the second calibration image.
6. The method according to any one of claims 1 to 5, characterized in that After determining a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image, the method further includes: Acquire a target image captured by the linear array camera; Determine a first coordinate of a pixel point in the target image in a pixel coordinate system; The first coordinate is transformed according to the target transformation matrix to obtain the second coordinate of the pixel point in the laser coordinate system.
7. A calibration device for a linear array camera, characterized in that: include: A first acquisition module is used to acquire a first calibration image by photographing a marker on a calibration substrate with a linear array camera; A second acquisition module is used to obtain a second calibration image by photographing the pattern carved by the laser by the linear array camera; A determination module, configured to determine a target transformation matrix for calibrating the line array camera through the first calibration image and the second calibration image; The device is also used to determine a first transformation matrix between a pixel coordinate system of the first calibration image and a calibration substrate coordinate system; determine a second transformation matrix between a laser coordinate system of the second calibration image and the calibration substrate coordinate system; and determine the target transformation matrix based on the first transformation matrix and the second transformation matrix.
8. A storage medium, characterized in that: The storage medium stores a computer program, wherein the program can be executed by a terminal device or a computer to execute the method described in any one of claims 1 to 6.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.
