A method for accurately measuring the position of a light spot based on image processing

By employing dual geometric correction of distortion and perspective transformation, the measurement error problems caused by camera distortion and perspective effects are solved, achieving high-precision and efficient spot position measurement, which is suitable for industrial inspection and optical measurement fields.

CN122281733APending Publication Date: 2026-06-26BEIJING INST OF ENVIRONMENTAL FEATURES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610499154.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-15
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies suffer from measurement errors caused by camera distortion and perspective effects, lack end-to-end automated processes, and are cumbersome to operate and prone to introducing human error.

Method used

By employing dual geometric correction of distortion and perspective transformation, the camera is calibrated using a checkerboard calibration board, establishing a mapping relationship between pixels and physical coordinates, and detecting the coordinates of the center pixel of the light spot.

Benefits of technology

It achieves high-precision measurement at the sub-pixel level, and parameters can be processed in batches after one calibration, avoiding manual intervention. It is applicable to different cameras and shooting angles, improving measurement efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122281733A_ABST
    Figure CN122281733A_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology, and particularly to a method for accurately measuring the position of a light spot based on image processing. The method includes: using a checkerboard calibration plate to calibrate and correct the distortion of a camera; acquiring image data with the calibrated camera, establishing a pixel-to-physical coordinate mapping relationship by corresponding the four corner feature points of the target area in the image data with the physical coordinate points of the target area; performing perspective transformation on the acquired image according to the mapping relationship to obtain a front view without perspective distortion; detecting the brightest light spot in the transformed front view and determining the center pixel coordinates of the light spot. This invention can solve the measurement error problems caused by optical distortion, perspective effects, and inconsistencies in the process in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for accurately measuring the position of a light spot based on image processing. Background Technology

[0002] Image-based spot localization technology is widely used in fields such as industrial inspection and optical measurement. However, existing technologies often suffer from the following problems: 1. Camera distortion affects accuracy: Ordinary camera lenses have radial and tangential distortion, which leads to geometric distortion at the edges of the image and directly affects the accuracy of coordinate measurement.

[0003] 2. Perspective projection introduces errors: When the shooting angle is not perpendicular, the perspective effect will distort the shape of the object, and traditional methods are difficult to map the image coordinates to the real physical coordinate system.

[0004] 3. Fragmented process: Existing solutions are mostly for a single step (such as only calibration or only transformation), lacking an end-to-end automated process from the original image to the final physical coordinates, which is cumbersome and prone to human error. Summary of the Invention

[0005] This invention provides a method, apparatus, electronic device, and storage medium for accurate measurement of spot position based on image processing, which can solve the measurement error problems caused by optical distortion, perspective effect, and process inconsistency in the prior art.

[0006] In a first aspect, embodiments of the present invention provide a method for accurately measuring the position of a light spot based on image processing, comprising: The camera distortion was calibrated and corrected using a checkerboard calibration plate. The calibrated camera acquires image data, making the four corner feature points of the target area in the image data correspond to the physical coordinate points of the target area, and establishing a mapping relationship from pixels to physical coordinates; The acquired image is subjected to perspective transformation based on the mapping relationship to obtain a front view without perspective distortion; The brightest spot is detected in the transformed front view, and the center pixel coordinates of the spot are determined.

[0007] Optionally, the distortion calibration and correction of the camera using a checkerboard calibration plate includes: Multiple images were taken from different angles using a checkerboard calibration board; Extract the coordinates of the interior corner points of the captured image; A world coordinate system is generated based on the corner coordinates of the checkerboard calibration board. The corner coordinates generated in the world coordinate system are compared with the extracted corner coordinates to obtain the camera intrinsic parameter matrix and distortion coefficients.

[0008] Optionally, the camera intrinsic parameter matrix and distortion coefficients can be calculated using the estimateCameraParameters function; The inner corner points are extracted using a corner detection algorithm, which includes detectCheckerboardPoints.

[0009] Optionally, after the calibrated camera acquires image data, before establishing a pixel-to-physical coordinate mapping relationship by corresponding the four corner feature points of the target area in the image data with the physical coordinate points of the target area, the method further includes: Draw a rectangular region on the first corrected image and save the cropping parameters; The cropping parameters are applied to all images to preserve the target area to be tested, thereby reducing redundant data and improving processing efficiency.

[0010] Optionally, establishing a pixel-to-physical coordinate mapping relationship by corresponding the four corner feature points of the target region in the image data with the physical coordinate points of the target region includes: Extract the feature points at the four corners of the image; The four feature points are sorted and mapped to the physical coordinates of the target area to be measured. Calculate the homography matrix to establish the mapping relationship between image pixels and physical coordinates.

[0011] Optionally, the four corner feature points of the image are extracted by a spot detection algorithm, which includes top-hat transformation and extended maximum detection; The homography matrix is ​​calculated using the fitgeotrans function.

[0012] Optionally, determining the center pixel coordinates of the spot includes: After eliminating interference from the four corner areas, the coordinates of the center pixel of the light spot are accurately located using the weighted centroid method. Based on the pixel-physical scale relationship, the pixel coordinates of the light spot are converted into physical coordinates, and the Euclidean distance from the spot to the center of the image is calculated.

[0013] Secondly, embodiments of the present invention also provide a device for accurately measuring the position of a light spot based on image processing, used to implement the method described in any one of the above methods, the device comprising: The correction unit is used to perform distortion calibration and correction on the camera using a checkerboard calibration plate. The mapping unit is used to correct the image data acquired by the camera, so that the four corner feature points of the target area in the image data correspond to the physical coordinate points of the target area, and establish a mapping relationship from pixels to physical coordinates. A perspective unit is used to perform perspective transformation on the acquired image according to the mapping relationship to obtain a front view without perspective distortion; The spot measurement unit detects the brightest spot in the transformed front view and determines the center pixel coordinates of the spot.

[0014] Thirdly, embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the method described in any embodiment of this specification.

[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the methods described in any embodiment of this specification.

[0016] Compared with the prior art, the present invention has at least the following beneficial effects: High precision: Through dual geometric correction of distortion and perspective transformation, measurement errors are controlled at the sub-pixel level (average reprojection error <0.5 pixels). End-to-end automation: Once parameters are calibrated, batch processing can be performed, avoiding manual intervention and significantly improving efficiency (actual testing showed that it only takes 1 minute to process 100 images).

[0017] High adaptability: Suitable for different cameras, lenses, and shooting angles, with wide applicability in fields such as industrial inspection and optical measurement. Highly adaptable to various environments. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart provided in an embodiment of the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0021] The following describes the specific implementation of the above concept.

[0022] The core of this invention lies in constructing a complete processing pipeline, the overall process of which is as follows: Figure 1 As shown, it includes the following steps: 1. Camera distortion calibration and correction Multiple images were captured from different angles using a checkerboard calibration board, and the coordinates of the inner corner points were extracted using a corner detection algorithm (such as detectCheckerboardPoints).

[0023] A world coordinate system (unit: millimeters) is generated based on corner coordinates, and the camera intrinsic parameter matrix (focal length, principal point) and distortion coefficients (radial, tangential) are calculated using the estimateCameraParameters function.

[0024] The undistortImage function is applied to correct distortion in all subsequent images to eliminate the effects of lens distortion.

[0025] 2. Image cropping and ROI localization: Interactively draw a rectangular region of interest (ROI) on the first corrected image and save the cropping parameters (position, width and height).

[0026] The cropping parameters are applied in batches to all images, preserving the target area to be tested (such as a 390mm×390mm board), reducing redundant data and improving processing efficiency.

[0027] 3. Calculation of perspective transformation matrix: In the cropped image, the four corner feature points are extracted using spot detection algorithms (such as top-hat transformation and extended maximum detection).

[0028] Interactively select and sort four feature points (clockwise) to correspond to the target physical coordinates [0,0; 390,0;390,390; 0,390] ​​(unit: millimeters).

[0029] The homography matrix is ​​calculated using the fitgeotrans function, establishing the mapping relationship between image pixels and physical coordinates.

[0030] 4. Batch perspective transformation and spot distance measurement: The above matrix is ​​used to perform perspective transformation (imwarp) on all cropped images to generate a front view without perspective distortion.

[0031] The brightest spot is detected in the transformed image, and interference from the four corner regions is eliminated. The center pixel coordinates of the spot are accurately located using the weighted centroid method.

[0032] Based on the pixel-physical scale relationship (e.g., 390mm corresponds to N pixels), the pixel coordinates of the light spot are converted into physical coordinates, and the Euclidean distance from it to the center of the image is calculated.

[0033] This invention provides a device for accurately measuring the position of a light spot based on image processing. The device can be implemented in software, hardware, or a combination of both. From a hardware perspective, a hardware architecture diagram of the electronic device housing the image processing-based accurate light spot position measurement device provided in this invention embodiment includes, in addition to the processor, memory, network interface, and non-volatile memory, other hardware such as a forwarding chip responsible for processing packets. Taking software implementation as an example, as a logical device, it is formed by the CPU of the electronic device reading the corresponding computer program from the non-volatile memory into memory and running it. The image processing-based accurate light spot position measurement device provided in this embodiment includes: The correction unit is used to perform distortion calibration and correction on the camera using a checkerboard calibration plate. The mapping unit is used to correct the image data acquired by the camera, so that the four corner feature points of the target area in the image data correspond to the physical coordinate points of the target area, and establish a mapping relationship from pixels to physical coordinates. A perspective unit is used to perform perspective transformation on the acquired image according to the mapping relationship to obtain a front view without perspective distortion; The spot measurement unit detects the brightest spot in the transformed front view and determines the center pixel coordinates of the spot.

[0034] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on an image processing-based device for precise measurement of spot position. In other embodiments of the present invention, an image processing-based device for precise measurement of spot position may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0035] The information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the method embodiment of the present invention, and the specific details can be found in the description of the method embodiment of the present invention, and will not be repeated here.

[0036] This invention also provides an electronic device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements a method for accurately measuring the position of a light spot based on image processing, according to any embodiment of this invention.

[0037] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program causes the processor to perform a method for accurately measuring the position of a light spot based on image processing, according to any embodiment of this invention.

[0038] Specifically, a system or apparatus equipped with a storage medium may be provided, on which software program code implementing the functions of any of the embodiments described above is stored, and the computer (or CPU or MPU) of the system or apparatus may read and execute the program code stored in the storage medium.

[0039] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.

[0040] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.

[0041] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0042] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion module connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion module execute some and all of the actual operations, thereby realizing the function of any of the above embodiments.

[0043] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0044] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.

[0045] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications 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 the present invention.

Claims

1. A method for accurately measuring the position of a light spot based on image processing, characterized in that, include: The camera distortion was calibrated and corrected using a checkerboard calibration plate. The calibrated camera acquires image data, making the four corner feature points of the target area in the image data correspond to the physical coordinate points of the target area, and establishing a mapping relationship from pixels to physical coordinates; The acquired image is subjected to perspective transformation based on the mapping relationship to obtain a front view without perspective distortion; The brightest spot is detected in the transformed front view, and the center pixel coordinates of the spot are determined.

2. The method for accurately measuring the position of a light spot based on image processing according to claim 1, characterized in that, The method of using a checkerboard calibration plate to calibrate and correct camera distortion includes: Multiple images were taken from different angles using a checkerboard calibration board; Extract the coordinates of the interior corner points of the captured image; A world coordinate system is generated based on the corner coordinates of the checkerboard calibration board. The corner coordinates generated in the world coordinate system are compared with the extracted corner coordinates to obtain the camera intrinsic parameter matrix and distortion coefficients.

3. The method for accurately measuring the position of a light spot based on image processing according to claim 2, characterized in that, The estimateCameraParameters function is used to calculate the camera intrinsic parameter matrix and distortion coefficients. The inner corner points are extracted using a corner detection algorithm, which includes detectCheckerboardPoints.

4. The method for accurately measuring the position of a light spot based on image processing according to claim 1, characterized in that, After the calibrated camera acquires image data, before establishing the pixel-to-physical coordinate mapping relationship by corresponding the four corner feature points of the target area in the image data with the physical coordinate points of the target area, the following steps are also included: Draw a rectangular region on the first corrected image and save the cropping parameters; The cropping parameters are applied to all images to preserve the target area to be tested, thereby reducing redundant data and improving processing efficiency.

5. The method for accurately measuring the position of a light spot based on image processing according to claim 1, characterized in that, The step of establishing a mapping relationship from pixels to physical coordinates by associating the four corner feature points of the target area in the image data with the physical coordinate points of the target area includes: Extract the feature points at the four corners of the image; The four feature points are sorted and mapped to the physical coordinates of the target area to be measured. Calculate the homography matrix to establish the mapping relationship between image pixels and physical coordinates.

6. The method for accurately measuring the position of a light spot based on image processing according to claim 5, characterized in that, The four corner feature points of the image are extracted by a spot detection algorithm, which includes top-hat transformation and extended maximum detection. The homography matrix is ​​calculated using the fitgeotrans function.

7. The method for accurately measuring the position of a light spot based on image processing according to claim 1, characterized in that, The determination of the center pixel coordinates of the spot includes: After eliminating interference from the four corner areas, the coordinates of the center pixel of the light spot are accurately located using the weighted centroid method. Based on the pixel-physical scale relationship, the pixel coordinates of the light spot are converted into physical coordinates, and the Euclidean distance from the spot to the center of the image is calculated.

8. A device for precise measurement of spot position based on image processing, characterized in that, The apparatus for implementing the method as described in any one of claims 1-7 comprises: The correction unit is used to perform distortion calibration and correction on the camera using a checkerboard calibration plate. The mapping unit is used to correct the image data acquired by the camera, so that the four corner feature points of the target area in the image data correspond to the physical coordinate points of the target area, and establish a mapping relationship from pixels to physical coordinates. A perspective unit is used to perform perspective transformation on the acquired image according to the mapping relationship to obtain a front view without perspective distortion; The spot measurement unit detects the brightest spot in the transformed front view and determines the center pixel coordinates of the spot.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor, when executing the computer program, implements the method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-7.