Glass size measurement method based on multiple line scanning cameras, medium and electronic equipment
By performing perspective transformation and free transformation in the multi-line scanning camera measurement system, the accuracy problem caused by inconsistent installation angles of each camera is solved, and high-precision glass size measurement is achieved.
Patent Information
- Application Number
- CN202510245380.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2045-03-04
AI Technical Summary
When multi-line scan cameras measure glass with large area, the installation angles of each line scan camera cannot be completely unified, resulting in inconsistent pixel sizes and affecting measurement accuracy.
Through calibration steps and mapping steps, perspective transformation and free transformation, the multi-line scanning camera calibration images and measurement images are corrected to achieve unified scale and high-precision stitching of the camera grid.
The accuracy and pixel size consistency of multi-line scanning cameras when measuring glass is improved, and high-precision cross-camera distance measurement is achieved.
Smart Images

Figure CN119756185A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to glass size measurement, in particular to a glass size measurement method, medium and electronic equipment based on a multi-line scanning camera. Background Art
[0002] At present, for large-area glass, machine vision technology can be used to achieve dimensional measurement. This method involves using multiple line scan cameras to stitch images and measure distance across cameras. However, its disadvantage is that the measurement accuracy is not high enough. Summary of the invention
[0003] The applicant found that the reason why the accuracy of measuring a large area of glass using a multi-line scan camera is not high enough is that the installation angles of the line scan cameras are slightly different and cannot be completely unified, resulting in inconsistent pixel sizes between cameras, which in turn affects the measurement accuracy.
[0004] The technical problem to be solved by the present invention is that the installation angles of various line scan cameras cannot be completely unified, which affects the measurement accuracy, and provides a glass size measurement method, medium and electronic equipment based on multiple line scan cameras.
[0005] In order to achieve the above-mentioned purpose, the present invention provides a technical solution: a glass size measurement method based on multi-line scan camera image stitching, comprising: a calibration step S1 and a mapping step S2.
[0006] The calibration step S1 includes: step S11, acquiring a multi-line scan camera calibration image; step S12, establishing a cross-camera coordinate system for the multi-line scan camera; step S13, determining the compensation reference of the measured glass in the mapping step; step S14, performing a perspective transformation on the multi-line scan camera calibration image, with the purpose of correcting the camera grid of the cross-camera coordinate system to the same scale as much as possible, thereby realizing pre-correction of the multi-line scan camera calibration image; step S15, performing a free transformation on the multi-line scan camera calibration image after the perspective transformation, with the purpose of correcting the camera grid of the cross-camera coordinate system to the same scale, thereby realizing correction of the multi-line scan camera calibration image; and step S16, splicing the multi-line scan camera calibration image after the free transformation, and the calibration is completed.
[0007] The mapping step S2 includes: step S21, acquiring a multi-line scan camera measurement image and calibration parameters determined based on the calibration step S1; step S22, performing deviation compensation on the multi-line scan camera measurement image; step S23, performing perspective transformation on the multi-line scan camera measurement image; step S24, performing free transformation on the multi-line scan camera measurement image after the perspective transformation; step S25, splicing the multi-line scan camera measurement image after the free transformation; and step S26, determining the size of the measured glass based on the spliced multi-line scan camera measurement image.
[0008] As a preferred solution of the glass size measurement method, in step S11, the multi-line scan camera calibration image includes a calibration plate and the measured glass, and the calibration plate completely covers the measured glass; in step S21, the multi-line scan camera measurement image includes the measured glass.
[0009] As a preferred solution of the glass size measurement method, step S13, determines the coordinates of the midpoint of the edge straight line of the measured glass in the cross-camera coordinate system; step S22, calculates the difference between the midpoint of the edge straight line of the measured glass in the multi-line scan camera measurement image and the multi-line scan camera calibration image, and translates the multi-line scan camera measurement image by the difference to compensate for the deviation.
[0010] As a preferred solution of the glass size measurement method, in step S15, the size of the camera grid is recalculated according to the corner point distribution resulting from the perspective transformation, the target corner point position is calculated according to the number of rows and columns of the corner point grid of each line scan camera calibration image and the position of the first corner point, and then the transformation relationship of the FFD free transformation is calculated according to the source data points and the target data points.
[0011] As a preferred solution of the glass size measurement method, in step S16, the rigid transformation relationship between adjacent phases is calculated using the camera grid in the common field of view of adjacent line scan cameras, and image stitching is completed according to the rigid transformation matrix.
[0012] As a preferred solution of the glass size measurement method, the calibration step S1 is performed only once.
[0013] As a preferred solution of the glass size measurement method, the mapping step S2 is repeatedly performed to batch measure the sizes of different measured glasses.
[0014] Another technical solution provided by the present invention is a computer-readable storage medium having a computer program stored thereon, which implements the steps of the glass size measurement method when executed by a processor.
[0015] Another technical solution provided by the present invention is: an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is communicatively connected to the memory, and is characterized in that the steps of the glass size measurement method are executed when the computer program is called.
[0016] Compared with the prior art, the beneficial effects of the present invention are at least that: through perspective transformation and free transformation, correction of multi-line scan camera calibration images and multi-line scan camera measurement images is achieved, and the problem of inaccurate ranging in the motion direction of the multi-line scan camera and difficulty in making the pixel size in the motion direction consistent due to the splicing of the multi-line scan camera is solved, so that the multi-line scan camera can complete high-precision image stitching with uniform pixel size, thereby completing high-precision cross-camera ranging of the multi-line scan camera.
[0017] In addition to the technical problems solved by the present invention, the technical features that constitute the technical solution, and the beneficial effects brought about by the technical features of the technical solution described above, other technical problems that can be solved by the present invention, other technical features included in the technical solution, and the beneficial effects brought about by these technical features will be further described in detail in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of the glass size measuring method of the present invention.
[0019] Figure 2 It is a flow chart of the calibration step S1 of the glass size measurement method of the present invention.
[0020] Figure 3 It is a flow chart of the mapping step S2 of the glass size measurement method of the present invention.
[0021] Figure 4 It is a structural schematic diagram of the electronic device of the present invention. DETAILED DESCRIPTION
[0022] The present invention is further described in detail below by means of specific embodiments in combination with the accompanying drawings. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0023] See also Figures 1 to 3 This embodiment provides a glass size measurement method based on multi-line scan camera image stitching. The glass size measurement method includes: a calibration step S1 and a mapping step S2.
[0024] The calibration step S1 is performed only once, after the position of the multi-line scan camera is fixed, while the mapping step S2 can be performed repeatedly, with the purpose of batch measuring the dimensions of different measured glasses.
[0025] The calibration step S1 comprises: Step S11, obtaining a calibration image of a multi-line scan camera. The calibration image of the multi-line scan camera includes a calibration plate and a glass to be measured. The calibration plate completely covers the glass to be measured. In a specific implementation, the calibration image of the multi-line scan camera is composed of a plurality of calibration images taken by the multi-line scan camera. The calibration plate can be a chessboard calibration plate. The length and width of the calibration plate are respectively greater than the length and width of the glass to be measured. Preferably, the line scan camera uses a 4k line scan camera.
[0026] Step S12, establishing a cross-camera coordinate system for the multi-line scan camera according to the corner position of the calibration plate in the multi-line scan camera calibration image, wherein the X-axis of the cross-camera coordinate system is perpendicular to the conveying direction of the measured glass, and the Y-axis of the cross-camera coordinate system is parallel to the conveying direction of the measured glass.
[0027] Step S13, determine the coordinates of the midpoint of the edge straight line of the measured glass in the cross-camera coordinate system, recorded as OffsetY. The edge straight line is parallel to the conveying direction of the measured glass. The purpose is to determine the compensation reference of the measured glass in the Y-axis direction in the mapping step. Since the timing of each trigger shooting of the multi-line scan camera is inconsistent, that is, there may be a large deviation in each group of pictures in the Y-axis direction, deviation compensation is required. It should be noted that since the equipment for transporting the measured glass has a centering mechanism, there is generally no deviation in each group of pictures in the X-axis direction, and no deviation compensation is required.
[0028] Step S14, perspective transformation is performed on the multi-line scan camera calibration image, the purpose of which is to correct the camera grid of the cross-camera coordinate system to the same scale as much as possible, so as to achieve pre-correction of the multi-line scan camera calibration image. When the camera installation angle of the multi-line scan camera is too inclined, if free transformation is directly used for correction, the result is that the deformation is too large to complete the task. The pre-correction in step S14 can solve the above problem well.
[0029] Step S15, the multi-line scan camera calibration image after perspective transformation is freely transformed, the purpose is to correct the camera grid of the cross-camera coordinate system to the same scale, and realize the correction of the multi-line scan camera calibration image: according to the corner point distribution of the perspective transformation result, the size of the camera grid is recalculated. According to the number of rows and columns of the corner point grid of each line scan camera calibration image and the position of the first corner point, the target corner point position is calculated, and then the transformation relationship of the FFD free transformation is calculated according to the source data point and the target data point.
[0030] Step S16, stitching the freely transformed multi-line scan camera calibration images: using the camera grids in the common field of view of adjacent line scan cameras, calculate the rigid transformation relationship between adjacent phases, and complete image stitching and calibration according to the rigid transformation matrix.
[0031] The mapping step S2 comprises: Step S21, obtaining a multi-line scan camera measurement image and calibration parameters determined based on the calibration step S1. The multi-line scan camera measurement image only includes the measured glass, and does not include the calibration plate.
[0032] Step S22, calculate the difference between the midpoint of the edge straight line of the measured glass in the multi-line scan camera measurement image and the multi-line scan camera calibration image, recorded as OffsetDiffY. The multi-line scan camera measurement image is translated by OffsetDiffY to perform deviation compensation in the Y-axis direction.
[0033] Step S23, performing perspective transformation on the image measured by the multi-line scan camera.
[0034] Step S24, performing free transformation on the multi-line scan camera measurement image after perspective transformation.
[0035] Step S25, stitching the multi-line scan camera measurement images after free transformation.
[0036] Step S26, determining the size of the measured glass based on the spliced multi-line scan camera measurement images.
[0037] Through perspective transformation and free transformation, the calibration image and measurement image of the multi-line scan camera can be corrected, and the problems of inaccurate distance measurement in the motion direction of the multi-line scan camera and difficulty in making the pixel size in the motion direction consistent due to the stitching of the multi-line scan camera can be solved. The multi-line scan camera can complete high-precision image stitching with uniform pixel size, thereby completing high-precision cross-camera distance measurement of the multi-line scan camera.
[0038] This embodiment further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, all or part of the steps of the glass size measurement method in the above solution are implemented.
[0039] It will be understood by a person skilled in the art that all or part of the steps in the method for implementing the above-mentioned embodiment can be completed by a program instruction processor, and the program can be stored in a computer-readable storage medium, and the storage medium can be a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above-mentioned storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.
[0040] See also Figure 4 This embodiment also provides an electronic device. The electronic device includes a memory 101 and a processor 102. The memory 101 stores a computer program. The processor 102 is connected to the memory 101 for communication, and executes all or part of the steps of the glass size measurement method in the above scheme when the computer program is called.
[0041] In some possible implementations, the memory 101 may include various media that can store program codes, such as ROM, RAM, magnetic disk, U disk, memory card or optical disk. Specifically, the memory 101 may include a computer system readable medium in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. The memory 101 may include at least one program product, which has a group (e.g., at least one) of program modules, which are configured to perform the functions of various embodiments of the present invention. The processor 102 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0042] The above only expresses the implementation mode of the present invention, and its description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.
Claims
1. A glass size measurement method based on multi-line scan camera image stitching, characterized in that: include: Calibration step S1 and mapping step S2; The calibration step S1 includes: step S11, acquiring a multi-line scan camera calibration image; step S12, establishing a cross-camera coordinate system for the multi-line scan camera; step S13, determining a compensation reference of the measured glass in the mapping step; step S14, performing a perspective transformation on the multi-line scan camera calibration image; step S15, performing a free transformation on the multi-line scan camera calibration image after the perspective transformation; and step S16, splicing the multi-line scan camera calibration image after the free transformation, and the calibration is completed; The mapping step S2 includes: step S21, acquiring a multi-line scan camera measurement image and calibration parameters determined based on the calibration step S1; step S22, performing deviation compensation on the multi-line scan camera measurement image; step S23, performing perspective transformation on the multi-line scan camera measurement image; step S24, performing free transformation on the multi-line scan camera measurement image after the perspective transformation; step S25, splicing the multi-line scan camera measurement image after the free transformation; and step S26, determining the size of the measured glass based on the spliced multi-line scan camera measurement image.
2. The glass size measuring method according to claim 1, characterized in that: In step S11, the multi-line scan camera calibration image includes a calibration plate and the glass to be measured, and the calibration plate completely covers the glass to be measured; in step S21, the multi-line scan camera measurement image includes the glass to be measured.
3. The glass size measuring method according to claim 1, characterized in that: Step S13, determining the coordinates of the midpoint of the edge straight line of the glass to be measured in the cross-camera coordinate system; Step S22, calculating the difference between the midpoint of the edge straight line of the glass to be measured in the multi-line scan camera measurement image and the multi-line scan camera calibration image, and translating the multi-line scan camera measurement image by the difference to compensate for the deviation.
4. The glass size measuring method according to claim 1, characterized in that: In step S15, the size of the camera grid is recalculated according to the corner point distribution obtained by the perspective transformation, the target corner point position is calculated according to the number of rows and columns of the corner point grid of each line scan camera calibration image and the position of the first corner point, and then the transformation relationship of the FFD free transformation is calculated according to the source data points and the target data points.
5. The glass size measuring method according to claim 1, characterized in that: In step S16, the rigid transformation relationship between adjacent phases is calculated using the camera grid in the common field of view of the adjacent line scan cameras, and the image stitching is completed according to the rigid transformation matrix.
6. The glass size measuring method according to claim 1, characterized in that: The calibration step S1 is performed only once.
7. The glass size measuring method according to claim 1, characterized in that: The mapping step S2 is repeatedly performed to batch measure the sizes of different measured glasses.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the glass size measurement method according to any one of claims 1 to 5 are implemented.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is communicatively connected to the memory, wherein: When the computer program is called, the steps of the glass size measuring method according to any one of claims 1 to 5 are executed.
Citation Information
Patent Citations
A vision-based lane detection method
CN109190483A
Calibration method and device for vehicle-mounted camera and terminal
CN110555885A
Calibration method of line scanning camera
CN114494464A
Image splicing method and device for jointly shooting large-size display through line scanning camera
CN115222596A
Line scan camera calibration method, computing device and storage medium
CN115496812A