Planar convex lens curvature radius detection method and system based on structured light reconstruction and sub-pixel fitting, and medium

By combining structured light reconstruction and subpixel fitting with a camera and projector, non-contact high-precision detection of the radius of curvature of plano-convex lenses was achieved, solving the problems of slow detection speed and low accuracy in traditional methods. This method is suitable for automatic detection on large-scale production lines.

CN121033013BActive Publication Date: 2026-03-24HANGZHOU HUICUI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-28
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing technologies for measuring the radius of curvature of plano-convex lenses suffer from problems such as slow detection speed, high risk of contact, low resolution, and severe optical distortion, making it difficult to achieve micron-level accuracy.

Method used

A method based on structured light reconstruction and subpixel fitting is adopted to achieve non-contact detection by using a camera and a projector. Gray code patterns are used for 3D reconstruction and edge feature extraction. The least squares method is combined to fit a spherical model and calculate the radius of curvature.

Benefits of technology

It achieves high-precision, low-cost, and easy-to-integrate plano-convex lens curvature radius detection, avoiding optical surface contamination or damage, and improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121033013B_ABST
    Figure CN121033013B_ABST
Patent Text Reader

Abstract

The application provides a kind of based on structure light reconstruction and subpixel fitting flat convex lens curvature radius detection method, system and medium, the method includes: based on camera acquisition multi-angle calibration plate image, camera parameter is calibrated;Based on the projector obtains encoding image, the projector parameter is calibrated;Based on the projection of projector after calibration Gray code pattern, based on the camera acquisition encoding image sequence after calibration, obtain three-dimensional point cloud data;Based on edge detection operator analysis three-dimensional point cloud data, extract the edge features of convex region, based on surface interpolation algorithm to the edge features of convex region subpixel fitting, obtain flat convex lens profile information;Construct spherical model, according to least square method to spherical model is fitted, based on the curvature radius result of convex region calculated by optimized spherical model, through the cooperation of camera and projector realizes non-contact detection, avoids optical surface pollution or damage, improves detection precision and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of optical element detection and industrial machine vision, in particular to a plano-convex lens curvature radius detection method, system and medium based on structured light reconstruction and sub-pixel fitting. BACKGROUND

[0002] Traditional plano-convex lens curvature radius measurement methods include contact interference measurement, Taylor circle method, profilometer scanning and the like, but have defects such as slow detection speed, great contact risk, high requirement for environment and the like. Although part of visual measurement systems realize non-contact detection, they are limited by resolution, optical distortion and rough fitting method, and it is difficult to achieve micron-level precision requirement. Therefore, there is an urgent need for a plano-convex lens curvature radius detection scheme with high precision, low cost and easy integration. SUMMARY

[0003] The purpose of the embodiment of the application is to provide a plano-convex lens curvature radius detection method, system and medium based on structured light reconstruction and sub-pixel fitting, which realizes non-contact detection through cooperation of a camera and a projector, avoids optical surface pollution or damage, and improves detection precision and efficiency.

[0004] The embodiment of the application also provides a plano-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting, which comprises the following steps:

[0005] Based on camera acquisition of multi-angle calibration plate images, multi-angle calibration plate images are analyzed according to a calibration algorithm, and camera parameters are calibrated;

[0006] Based on a projector, an encoded image is acquired, and projector parameters are calibrated based on the encoded image;

[0007] Based on the calibrated projector, a Gray code pattern is projected, based on the calibrated camera, an encoded image sequence is acquired, a corresponding projection coordinate of each pixel is decoded, three-dimensional reconstruction is performed on the projection coordinate, and three-dimensional point cloud data is obtained;

[0008] The three-dimensional point cloud data is pretreated, the three-dimensional point cloud data is analyzed based on an edge detection operator, edge features of a convex surface region are extracted, the edge features of the convex surface region are fitted based on a curved surface interpolation algorithm, and plano-convex lens contour information is obtained;

[0009] Based on the plano-convex lens contour information, a spherical surface model is constructed, the spherical surface model is fitted according to a least square method, an optimized spherical surface model is obtained, and the curvature radius result of the convex surface region is calculated based on the optimized spherical surface model.

[0010] Optionally, in the flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting, the camera is used to capture multi-angle calibration board images, and the camera parameters are calibrated according to a calibration algorithm, specifically including:

[0011] A checkerboard calibration board is selected, the camera position is set, and the camera is used to capture multi-angle checkerboard calibration board images;

[0012] Image features are extracted, and checkerboard corner features are screened out, and the checkerboard size is calculated based on the checkerboard corner features;

[0013] The image size is obtained, and the initial focal length parameter is calculated according to the image size and the checkerboard size;

[0014] The re-projection error of all feature points is calculated based on the image features;

[0015] The camera initial focal length parameter and the camera shooting angle are adjusted based on the re-projection error to calibrate the camera parameters.

[0016] Optionally, in the flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting, the projector is used to obtain a coded image, and the projector parameters are calibrated based on the coded image, specifically including:

[0017] The internal parameters and external parameters of the projector are obtained, the internal parameters include focal length, principal point coordinates and distortion coefficients, and the external parameters include the relative poses of the projector and the camera;

[0018] The mapping relationship between the projector pixels and the spatial three-dimensional coordinates is established,

[0019] Based on the projection of multiple frames of different Gray code patterns, each pixel point is assigned a unique code, and the calibrated camera is used to capture the coded image projected by the projector onto the calibration board;

[0020] The pixel three-dimensional coordinates are calculated based on the mapping relationship between the projector pixels and the spatial three-dimensional coordinates, the pixel three-dimensional coordinates are compared with the actual three-dimensional coordinates, and the coordinate deviation information is obtained;

[0021] The internal parameters and external parameters of the projector are dynamically adjusted based on the coordinate deviation information.

[0022] Optionally, in the flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting, the projection coordinates are three-dimensionally reconstructed, specifically including:

[0023] The projector projects the Gray code pattern with a set number onto the surface of the measured object to obtain each frame of Gray code image;

[0024] The binary image of each frame of the Gray code image is extracted, and the bright and dark stripes are extracted.

[0025] The binary value of each pixel is converted into a decimal index value in the order of frames, corresponding to the Gray code pattern number projected by the projector;

[0026] The corresponding projector pixel coordinates are obtained by Gray code and phase decoding for each camera pixel;

[0027] The mapping relationship between the spatial point and the pixel coordinates is established based on the calibration parameters of the camera and the projector, and the projection coordinates are obtained;

[0028] The corresponding pixel in the projector is found for each camera pixel, the three-dimensional coordinates are obtained, and the three-dimensional point cloud data is generated.

[0029] Optionally, in the flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting provided in the embodiments of the present application, the three-dimensional point cloud data is preprocessed, specifically including:

[0030] The three-dimensional point cloud data is obtained, and the data noise is removed by bilateral filtering;

[0031] The three-dimensional point cloud data after removing the data noise is subjected to point cloud angle registration, and the registered three-dimensional point cloud data is obtained;

[0032] The three-dimensional point cloud data is analyzed based on an edge detection operator, the data features are extracted, and the edge point cloud data of the convex region is screened out based on the data features;

[0033] The edge point cloud data of the convex region is fitted based on a B-spline interpolation algorithm, and a curved surface model is constructed;

[0034] The curvature extreme points or the normal vector mutation points are searched based on the curved surface model, the edge points are positioned to the sub-pixel level through a numerical optimization algorithm, and the flat-convex lens contour information is obtained.

[0035] Optionally, in the flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting provided in the embodiments of the present application, the curvature radius result of the convex region is calculated based on the optimized spherical surface model, specifically including:

[0036] The contour features are extracted based on the flat-convex lens contour information, the quadratic curve fitting is performed in the three-dimensional space based on the contour features, and the initial fitting parameters are obtained;

[0037] The initial spherical surface model is constructed based on the initial fitting parameters, and the initial model parameters are obtained;

[0038] The optimal fitting parameters are calculated according to the least square method, the initial model parameters are optimized according to the optimal fitting parameters, and the optimized spherical surface model is obtained;

[0039] Calculate the radius of curvature of the convex region based on the optimized spherical model.

[0040] In a second aspect, the embodiments of the present application provide a flat-convex lens radius of curvature detection system based on structured light reconstruction and sub-pixel fitting, which comprises a memory and a processor, the memory comprising a program of a flat-convex lens radius of curvature detection method based on structured light reconstruction and sub-pixel fitting, and the program of the flat-convex lens radius of curvature detection method based on structured light reconstruction and sub-pixel fitting, when executed by the processor, implements the following steps:

[0041] Based on the camera, a multi-angle calibration board image is acquired, and the multi-angle calibration board image is analyzed according to a calibration algorithm to calibrate the camera parameters;

[0042] Based on the projector, an encoded image is acquired, and the projector parameters are calibrated based on the encoded image;

[0043] Based on the calibrated projector, a Gray code pattern is projected, based on the calibrated camera, an encoded image sequence is acquired, the projection coordinates corresponding to each pixel are decoded, and three-dimensional reconstruction is performed on the projection coordinates to obtain three-dimensional point cloud data;

[0044] The three-dimensional point cloud data is preprocessed, the three-dimensional point cloud data is analyzed based on an edge detection operator, the edge features of the convex region are extracted, the edge features of the convex region are sub-pixel fitted based on a curved surface interpolation algorithm, and flat-convex lens contour information is obtained;

[0045] A spherical model is constructed based on the flat-convex lens contour information, the spherical model is fitted according to the least square method, an optimized spherical model is obtained, and the radius of curvature of the convex region is calculated based on the optimized spherical model.

[0046] Optionally, in the flat-convex lens radius of curvature detection system based on structured light reconstruction and sub-pixel fitting provided in the embodiments of the present application, based on the camera, a multi-angle calibration board image is acquired, and the multi-angle calibration board image is analyzed according to a calibration algorithm to calibrate the camera parameters, which specifically comprises:

[0047] A checkerboard calibration board is selected, the position of the camera is set, and multi-angle checkerboard calibration board images are acquired based on the camera;

[0048] Image features are extracted, checkerboard corner features are screened out, and the size of the checkerboard is calculated based on the checkerboard corner features;

[0049] The size of the image is acquired, and the initial focal length parameters are calculated according to the size of the image and the size of the checkerboard;

[0050] The re-projection error of all feature points is calculated based on the image features;

[0051] Adjust the initial focal length parameter and camera shooting angle of the camera based on the re-projection error to calibrate the camera parameters.

[0052] Optionally, in the flat-convex lens curvature radius detection system based on structured light reconstruction and sub-pixel fitting, the projector is used to acquire the coded image, and the projector parameters are calibrated based on the coded image, and the calibration specifically includes:

[0053] The internal parameters and external parameters of the projector are acquired, the internal parameters include focal length, principal point coordinates and distortion coefficients, and the external parameters include the relative poses of the projector and the camera;

[0054] The mapping relationship between the projector pixels and the spatial three-dimensional coordinates is established,

[0055] Multiple frames of different Gray code patterns are projected, each pixel point is assigned a unique code, and the calibrated camera is used to collect the coded image projected by the projector onto the calibration board;

[0056] The pixel three-dimensional coordinates are calculated based on the mapping relationship between the projector pixels and the spatial three-dimensional coordinates, the pixel three-dimensional coordinates are compared with the actual three-dimensional coordinates, and the coordinate deviation information is obtained;

[0057] The internal parameters and external parameters of the projector are dynamically adjusted based on the coordinate deviation information.

[0058] In a third aspect, the embodiments of the present application further provide a computer readable storage medium, the computer readable storage medium includes a flat-convex lens curvature radius detection method program based on structured light reconstruction and sub-pixel fitting, and the flat-convex lens curvature radius detection method program based on structured light reconstruction and sub-pixel fitting is executed by a processor to realize the steps of the flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting as described in any one of the above.

[0059] As can be seen from the above, the method, system and medium for detecting the curvature radius of a plano-convex lens based on structure light reconstruction and sub-pixel fitting provided in the embodiments of the present application, by acquiring multiple-angle calibration board images based on a camera, analyzing the multiple-angle calibration board images based on a calibration algorithm, and calibrating camera parameters; acquiring a coded image based on a projector, and calibrating projector parameters based on the coded image; projecting a Gray code pattern based on the calibrated projector, acquiring a coded image sequence based on the calibrated camera, decoding the projection coordinates corresponding to each pixel, and performing three-dimensional reconstruction on the projection coordinates to obtain three-dimensional point cloud data; preprocessing the three-dimensional point cloud data, analyzing the three-dimensional point cloud data based on an edge detection operator, extracting edge features of a convex region, performing sub-pixel fitting on the edge features of the convex region based on a curved surface interpolation algorithm, and obtaining plano-convex lens contour information; constructing a spherical surface model based on the plano-convex lens contour information, fitting the spherical surface model based on a least square method, obtaining an optimized spherical surface model, and calculating the curvature radius of the convex region based on the optimized spherical surface model, so that non-contact detection is realized through cooperation of the camera and the projector, optical surface pollution or damage is avoided, and detection accuracy and efficiency are improved. BRIEF DESCRIPTION OF DRAWINGS

[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0061] Figure 1 The flowchart of the method for detecting the curvature radius of a plano-convex lens based on structure light reconstruction and sub-pixel fitting provided in the embodiments of the present application is provided.

[0062] Figure 2 The camera calibration flowchart of the method for detecting the curvature radius of a plano-convex lens based on structure light reconstruction and sub-pixel fitting provided in the embodiments of the present application is provided.

[0063] Figure 3 The three-dimensional point cloud reconstruction process schematic diagram of the method for detecting the curvature radius of a plano-convex lens based on structure light reconstruction and sub-pixel fitting provided in the embodiments of the present application is provided.

[0064] Figure 4 The system diagram of the system for detecting the curvature radius of a plano-convex lens based on structure light reconstruction and sub-pixel fitting provided in the embodiments of the present application is provided.

[0065] Figure 5 The structure light coding schematic diagram of the system for detecting the curvature radius of a plano-convex lens based on structure light reconstruction and sub-pixel fitting provided in the embodiments of the present application is provided.

[0066] Figure 6 A curvature radius fitting error distribution diagram of a flat-convex lens curvature radius detection system based on structured light reconstruction and sub-pixel fitting is provided for an embodiment of the present application. DETAILED DESCRIPTION

[0067] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0068] It should be noted that similar reference numbers and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", and the like are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.

[0069] Please refer to Figure 1 , Figure 1 is a flowchart of a flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting in some embodiments of the present application. The flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting is used in a terminal device. The flat-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting includes the following steps:

[0070] S101, based on a camera, acquiring a multi-angle calibration board image, analyzing the multi-angle calibration board image according to a calibration algorithm, and calibrating camera parameters;

[0071] S102, based on a projector, acquiring a coded image, and calibrating projector parameters based on the coded image;

[0072] S103, based on the calibrated projector, projecting a Gray code pattern, based on the calibrated camera, acquiring a coded image sequence, decoding the projection coordinates corresponding to each pixel, and performing three-dimensional reconstruction on the projection coordinates to obtain three-dimensional point cloud data;

[0073] S104, preprocessing the three-dimensional point cloud data, analyzing the three-dimensional point cloud data based on an edge detection operator, extracting edge features of the convex surface region, performing sub-pixel fitting on the edge features of the convex surface region based on a curved surface interpolation algorithm, and obtaining flat-convex lens contour information;

[0074] S105, constructing a spherical surface model based on the flat lens profile information, fitting the spherical surface model according to a least square method to obtain an optimized spherical surface model, and calculating a curvature radius result of the convex region based on the optimized spherical surface model.

[0075] It should be noted that the curvature radius of the plano-convex lens is detected quickly, stably and non-contactly by the high-precision structured light three-dimensional reconstruction, sub-pixel profile extraction and spherical surface fitting method based on robust estimation, and the detection precision and efficiency are greatly improved, and the method is suitable for automatic detection requirements of large-scale production lines.

[0076] Please refer to Figure 2 , Figure 2 is a camera calibration flowchart of a plano-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting in some embodiments of the present application. According to the embodiment of the present application, a plurality of angle calibration board images are acquired based on a camera, the plurality of angle calibration board images are analyzed according to a calibration algorithm, and the camera parameters are calibrated, specifically including:

[0077] S201, selecting a checkerboard calibration board, setting a camera position, and acquiring a plurality of angle checkerboard calibration board images based on the camera;

[0078] S202, extracting image features, screening out checkerboard corner point features, and calculating a checkerboard size based on the checkerboard corner point features;

[0079] S203, acquiring an image size, and calculating an initial focal length parameter according to the image size and the checkerboard size;

[0080] S204, calculating the re-projection error of all feature points based on the image features;

[0081] S205, adjusting the initial focal length parameter of the camera and the camera shooting angle based on the re-projection error to calibrate the camera parameters.

[0082] It should be noted that the plurality of angle calibration board images are acquired, and the Zhang Zhengyou calibration method is used to calculate the camera intrinsic matrix K, distortion coefficient (k1, k2, p1, p2) ).

[0083] Through 20-30 groups of checkerboard images with different angles, the focal length, principal point coordinates and other parameters are solved.

[0084] A standard plane (such as a ceramic plate) is projected, a phase-height mapping relationship is established, and the error is controlled within 0.5%.

[0085] According to the embodiment of the present application, an encoding image is acquired based on a projector, and the projector parameters are calibrated based on the encoding image, specifically including:

[0086] Obtaining internal parameters and external parameters of the projector, the internal parameters including focal length, principal point coordinates and distortion coefficients, and the external parameters including relative poses of the projector and the camera;

[0087] Establishing a mapping relationship between pixels of the projector and spatial three-dimensional coordinates,

[0088] Projecting different Gray code patterns based on multiple frames, assigning a unique code to each pixel point, and collecting the coded image projected by the projector onto the calibration board using the calibrated camera;

[0089] Calculating the three-dimensional coordinates of the pixels based on the mapping relationship between the pixels of the projector and the spatial three-dimensional coordinates, comparing the three-dimensional coordinates of the pixels with the actual three-dimensional coordinates, and obtaining coordinate deviation information;

[0090] Based on the coordinate deviation information, dynamically adjusting the internal parameters and external parameters of the projector.

[0091] It should be noted that the projector is regarded as a reverse camera for coding calibration to obtain the intrinsic parameters and the extrinsic matrix relative to the camera Optimizing the system extrinsic parameters using the plane constraint relationship to reduce error accumulation.

[0092] Please refer to Figure 3 , Figure 3 is a three-dimensional point cloud reconstruction process schematic diagram of a planar convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting in some embodiments of the present application. According to the embodiment of the present application, the projection coordinates are reconstructed in three dimensions, specifically including:

[0093] The projector projects the set number of Gray code patterns onto the surface of the measured object to obtain each frame of Gray code image;

[0094] Binaryzation is performed on each frame of Gray code image to extract bright and dark stripes;

[0095] The binary values of each pixel are converted into decimal index values in the order of frames to correspond to the Gray code pattern number projected by the projector;

[0096] The corresponding projector pixel coordinates are obtained for each camera pixel through Gray code and phase decoding;

[0097] The mapping relationship between the spatial points and the pixel coordinates is established based on the calibration parameters of the camera and the projector to obtain the projection coordinates;

[0098] The corresponding pixel in the projector is found for each camera pixel to obtain the three-dimensional coordinates and generate three-dimensional point cloud data.

[0099] It should be noted that the projection Gray code (Gray Code) and phase shift encoding pattern (phase step ) to realize the spatial unique corresponding encoding mapping.

[0100] Acquire the sequence of encoding map by camera , decode the corresponding projection coordinates of each pixel, and calculate the three-dimensional coordinates in the physical space .

[0101] The three-dimensional reconstruction algorithm is based on the principle of binocular triangulation:

[0102] ,

[0103] P is a three-dimensional point coordinate in space;

[0104] wherein is a pixel homogeneous coordinate, is a depth, is an inverse matrix of an internal parameter.

[0105] According to the embodiment of the present application, the three-dimensional point cloud data is preprocessed, specifically including:

[0106] Obtain the three-dimensional point cloud data, and remove data noise by bilateral filtering;

[0107] The three-dimensional point cloud data after removing data noise is subjected to point cloud angle registration to obtain registered three-dimensional point cloud data;

[0108] Based on the edge detection operator, the three-dimensional point cloud data is analyzed, the data features are extracted, and the edge point cloud data of the convex region is screened out based on the data features;

[0109] The edge point cloud data of the convex region is fitted based on the B-spline interpolation algorithm to construct a curved surface model;

[0110] Based on the curved surface model, the curvature extreme point or the normal vector mutation point is searched, the edge point is positioned to a sub-pixel level through a numerical optimization algorithm, and the flat convex lens contour information is obtained.

[0111] It should be noted that the point cloud preprocessing specifically includes:

[0112] Point cloud filtering: bilateral filtering is used to remove noise and retain clear contour.

[0113] Point cloud registration: if multi-view reconstruction is required, the ICP (Iterative Closest Point) algorithm is applied to accurately register different view point clouds. A multi-scale Gaussian filter is used to enhance edge features, and then an improved Canny algorithm is applied to obtain an initial edge.

[0114] Sub-pixel positioning is realized by local paraboloid interpolation, and the formula is as follows:

[0115] The gray scale gradient direction is , the gray value is , and the edge position satisfies:

[0116] .

[0117] According to the embodiment of the application, the curvature radius of the convex region is calculated based on the optimized spherical model, and specifically includes:

[0118] Based on the profile information of the plano-convex lens, profile features are extracted, and based on the profile features, quadratic curve fitting is performed in the three-dimensional space to obtain initial fitting parameters;

[0119] Based on the initial fitting parameters, an initial spherical model is constructed to obtain initial model parameters;

[0120] According to the least square method, optimal fitting parameters are calculated, and the initial model parameters are optimized according to the optimal fitting parameters to obtain an optimized spherical model;

[0121] Based on the optimized spherical model, the curvature radius of the convex region is calculated.

[0122] It should be noted that the spherical model is constructed as follows:

[0123] ,

[0124] , , The coordinates of the center of the fitted sphere in the three-dimensional space are represented by x, y, and z respectively;

[0125] x, y, z: three-dimensional coordinates of a point in the point cloud;

[0126] R: the radius of the sphere, i.e. the curvature radius.

[0127] The formula is expanded as follows:

[0128] ,

[0129] Let:

[0130] ,

[0131] ,

[0132] ,

[0133] ,

[0134] ,

[0135] , , : 3D coordinates of the fitted sphere center.

[0136] Linearized construction matrix and vector b:

[0137] ,

[0138] N: indicates that there are N 3D points in total involved in the sphere fitting.

[0139] Each row represents the coordinates of a 3D point and a constant 1 for fitting the bias term D.

[0140] Solve by least square method:

[0141] ,

[0142] where A, B, C are intermediate variables in the fitting, which are used to calculate the sphere center coordinates, and D represents the constant term related to the sphere center and radius; b represents the N x 1 constant term vector (negative sum of squares);

[0143] Restore the sphere center and the radius of curvature:

[0144] ,

[0145] .

[0146] In order to improve the robustness, the RANSAC method is introduced to iteratively remove outlier points and fit the final model.

[0147] The radius of curvature and the surface type error are output:

[0148] Calculate the standard residual deviation (Residual Standard Deviation) to evaluate the fitting accuracy:

[0149] ,

[0150] : the i-th point in the point cloud,

[0151] : the fitted sphere center,

[0152] : the fitted sphere radius,

[0153] : the distance from the point to the sphere center,

[0154] : the standard deviation, used to measure the fitting error, ​

[0155] where is the radius of each point to the center of the fitted sphere.

[0156] Output a detection report, including the radius of curvature , root mean square error (RMS), fitting confidence.

[0157] As Figures 4-6 shown in the second aspect, the embodiments of the application provide a flat-convex lens curvature radius detection system based on structured light reconstruction and sub-pixel fitting, which comprises a processor, a memory and at least one program, the program is stored in the memory and is configured to be executed by the processor, and the program comprises instructions for executing any of the above flat-convex lens curvature radius detection methods based on structured light reconstruction and sub-pixel fitting.

[0158] The third aspect of the application provides a computer-readable storage medium, which comprises a flat-convex lens curvature radius detection method program based on structured light reconstruction and sub-pixel fitting, and the flat-convex lens curvature radius detection method program based on structured light reconstruction and sub-pixel fitting is executed by a processor to realize the steps of any of the above flat-convex lens curvature radius detection methods based on structured light reconstruction and sub-pixel fitting.

[0159] The application discloses a flat-convex lens curvature radius detection method, system and medium based on structured light reconstruction and sub-pixel fitting, which comprises the following steps: acquiring multiple-angle calibration board images based on a camera, analyzing the multiple-angle calibration board images based on a calibration algorithm, and calibrating camera parameters; acquiring a coded image based on a projector, calibrating projector parameters based on the coded image; projecting a Gray code pattern based on the calibrated projector, acquiring a coded image sequence based on the calibrated camera, decoding the projection coordinates corresponding to each pixel, and performing three-dimensional reconstruction on the projection coordinates to obtain three-dimensional point cloud data; preprocessing the three-dimensional point cloud data, analyzing the three-dimensional point cloud data based on an edge detection operator, extracting edge features of a convex region, performing sub-pixel fitting on the edge features of the convex region based on a curved surface interpolation algorithm, and obtaining flat-convex lens contour information; constructing a spherical surface model based on the flat-convex lens contour information, fitting the spherical surface model based on a least square method, obtaining an optimized spherical surface model, calculating the curvature radius of the convex region based on the optimized spherical surface model, and realizing non-contact detection through cooperation of the camera and the projector, thereby avoiding optical surface pollution or damage and improving detection precision and efficiency.

[0160] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other manners. The above described device embodiments are merely exemplary. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling, or direct coupling or communication connection between the components can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0161] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units; they can be located in one place or distributed on multiple network units; and part or all of the units can be selected as needed to achieve the purposes of the embodiments.

[0162] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; and the integrated unit can be implemented in the form of hardware or hardware plus software functional units.

[0163] Those of ordinary skill in the art can understand that all or part of the steps of the above-described method embodiments can be completed by a program instructing related hardware, and the aforementioned program can be stored in a readable storage medium, and when the program is executed, the steps of the method embodiments are executed; and the aforementioned storage medium includes mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic discs or optical discs, and various media that can store program codes.

[0164] Alternatively, the integrated units of the present application, if implemented in the form of software functional modules and sold or used as independent products, can also be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present application. The aforementioned storage medium includes mobile storage devices, ROMs, RAMs, magnetic discs or optical discs, and various media that can store program codes.

Claims

1. A method for detecting the radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting, characterized in that, The application relates to a method for calibrating a camera and a projector, and a device thereof. The method comprises the following steps: a camera is used to capture multi-angle calibration board images, and a calibration algorithm is used to analyze the multi-angle calibration board images and calibrate camera parameters; a projector is used to obtain a coded image, and the coded image is used to calibrate projector parameters; a calibrated projector is used to project a Gray code pattern, a calibrated camera is used to capture a coded image sequence, the corresponding projection coordinates of each pixel are decoded, three-dimensional reconstruction is performed on the projection coordinates, and three-dimensional point cloud data is obtained; the three-dimensional point cloud data is pretreated, an edge detection operator is used to analyze the three-dimensional point cloud data, edge features of a convex region are extracted, a surface interpolation algorithm is used to perform sub-pixel fitting on the edge features of the convex region, and flat convex lens contour information is obtained, wherein the pretreatment of the three-dimensional point cloud data specifically comprises the following steps: three-dimensional point cloud data is obtained, data noise is removed through bilateral filtering; the three-dimensional point cloud data after the removal of data noise is subjected to point cloud angle registration, and registered three-dimensional point cloud data is obtained; an edge detection operator is used to analyze the three-dimensional point cloud data, data features are extracted, and edge point cloud data of a convex region is screened out based on the data features; a B-spline interpolation algorithm is used to fit the edge point cloud data of the convex region, and a curved surface model is constructed; a curvature extreme point or a normal vector mutation point is searched based on the curved surface model, a numerical optimization algorithm is used to position the edge points to a sub-pixel level, and flat convex lens contour information is obtained; 2. The method according to claim 1, wherein the method is a method for detecting a radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting, characterized in that, a spherical surface model is constructed based on the flat convex lens contour information, the spherical surface model is fitted according to a least square method, an optimized spherical surface model is obtained, and the curvature radius of the convex region is calculated based on the optimized spherical surface model. The camera is used to capture multi-angle calibration board images, and a calibration algorithm is used to analyze the multi-angle calibration board images and calibrate camera parameters, specifically comprising the following steps: a checkerboard calibration board is selected, a camera position is set, and a camera is used to capture multi-angle checkerboard calibration board images; image features are extracted, and checkerboard corner point features are screened out; the size of the image is obtained, and the initial focal length parameter is calculated according to the size of the image and the size of the checkerboard; the re-projection error of all feature points is calculated based on the image features; 3. The method for detecting the radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting according to claim 2, characterized in that, the initial focal length parameter and the camera shooting angle of the camera are adjusted based on the re-projection error, and the camera parameters are calibrated. The projector is used to obtain a coded image, and the coded image is used to calibrate projector parameters, specifically comprising the following steps: the internal parameters and external parameters of the projector are obtained, the internal parameters include focal length, principal point coordinates and distortion coefficients, and the external parameters include the relative poses of the projector and the camera; a mapping relationship between the pixels of the projector and the three-dimensional coordinates in space is established, different Gray code patterns are projected based on multiple frames, each pixel point is assigned a unique code, and a calibrated camera is used to capture the coded image projected by the projector onto a calibration board; the three-dimensional coordinates of the pixels are calculated based on the mapping relationship between the pixels of the projector and the three-dimensional coordinates in space, the three-dimensional coordinates of the pixels are compared with actual three-dimensional coordinates, and coordinate deviation information is obtained; 4. The method of claim 3, wherein the method is a method of detecting a radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting, characterized in that, the internal parameters and external parameters of the projector are dynamically adjusted based on the coordinate deviation information. The projection coordinates are subjected to three-dimensional reconstruction, specifically comprising the following steps: the projector projects a Gray code pattern with a set number onto the surface of a measured object, and each frame of Gray code image is obtained; The binary value of each pixel is converted into a decimal index value in sequence of frames, corresponding to the number of the Gray code pattern projected by the projector; The corresponding projector pixel coordinates of each camera pixel are obtained through Gray code and phase decoding; The mapping relationship between the space point and the pixel coordinates is established based on the calibration parameters of the camera and the projector, and the projection coordinates are obtained; The corresponding pixel in the projector is found for each camera pixel, and the three-dimensional coordinates are obtained, and the three-dimensional point cloud data is generated. Based on the optimized spherical model, the curvature radius of the convex region is calculated, specifically including:

5. The method for detecting the radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting according to claim 4, characterized in that, Based on the profile feature extraction of the plano-convex lens profile information, a quadratic curve fitting is performed in the three-dimensional space based on the profile feature, and initial fitting parameters are obtained; An initial spherical model is constructed based on the initial fitting parameters, and initial model parameters are obtained; The optimal fitting parameters are calculated according to the least square method, and the initial model parameters are optimized according to the optimal fitting parameters, and the optimized spherical model is obtained; Based on the optimized spherical model, the curvature radius of the convex region is calculated. The system comprises a memory and a processor, the memory comprising a program of a plano-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting, the program of the plano-convex lens curvature radius detection method based on structured light reconstruction and sub-pixel fitting being implemented by the processor to realize the following steps:

6. A plano-convex lens curvature radius detection system based on structured light reconstruction and sub-pixel fitting, characterized in that, Based on the camera, a multi-angle calibration board image is acquired, and the camera parameters are calibrated according to the calibration algorithm based on the analysis of the multi-angle calibration board image; Based on the projector, an encoded image is obtained, and the projector parameters are calibrated based on the encoded image; Based on the calibrated projector, a Gray code pattern is projected, and based on the calibrated camera, an encoded image sequence is acquired, the corresponding projection coordinates of each pixel are decoded, and three-dimensional reconstruction is performed on the projection coordinates to obtain three-dimensional point cloud data; The three-dimensional point cloud data is preprocessed, the three-dimensional point cloud data is analyzed based on an edge detection operator, the edge features of the convex region are extracted, the edge features of the convex region are fitted to a sub-pixel level based on a surface interpolation algorithm, and plano-convex lens profile information is obtained, wherein the preprocessing of the three-dimensional point cloud data comprises: acquiring three-dimensional point cloud data, and removing data noise by bilateral filtering; the three-dimensional point cloud data after removing data noise is subjected to point cloud angle registration to obtain registered three-dimensional point cloud data; the three-dimensional point cloud data is analyzed based on an edge detection operator, and data features are extracted, and the edge point cloud data of the convex region is selected based on the data features; the edge point cloud data of the convex region is fitted based on a B-spline interpolation algorithm, and a surface model is constructed; the curvature extreme points or normal vector mutation points are searched based on the surface model, and the edge points are positioned to a sub-pixel level through a numerical optimization algorithm, and the plano-convex lens profile information is obtained; Based on the plano-convex lens profile information, a spherical model is constructed, the spherical model is fitted according to the least square method, an optimized spherical model is obtained, and the curvature radius of the convex region is calculated based on the optimized spherical model. Based on the camera, a multi-angle calibration board image is acquired, and the camera parameters are calibrated according to the calibration algorithm based on the analysis of the multi-angle calibration board image, specifically including:

7. The system for detecting the radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting according to claim 6, wherein, ​ Select a chessboard calibration plate, set the camera position, and capture multiple-angle chessboard calibration plate images based on the camera; Extract image features, filter out chessboard corner features, and calculate the size of the chessboard based on the chessboard corner features; Obtain the image size and calculate the initial focal length parameter based on the image size and the chessboard size; Calculate the re-projection error of all feature points based on image features; Adjust the camera's initial focal length parameter and camera shooting angle based on the re-projection error to calibrate the camera parameters.

8. The system for detecting the radius of curvature of a plano-convex lens based on structured light reconstruction and sub-pixel fitting according to claim 7, wherein, Based on the projector, obtain the encoded image, and calibrate the projector parameters based on the encoded image, specifically including: Obtain the internal and external parameters of the projector, including focal length, principal point coordinates, and distortion coefficients, and the external parameters include the relative pose of the projector and the camera; Establish the mapping relationship between the projector pixels and the spatial three-dimensional coordinates, Project multiple frames of different Gray code patterns, assign a unique code to each pixel point, and use the calibrated camera to capture the encoded image projected by the projector onto the calibration plate; Based on the mapping relationship between the projector pixels and the spatial three-dimensional coordinates, calculate the pixel three-dimensional coordinates, compare the pixel three-dimensional coordinates with the actual three-dimensional coordinates, and obtain the coordinate deviation information; Based on the coordinate deviation information, dynamically adjust the internal and external parameters of the projector.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium includes a program for detecting the curvature radius of a plano-convex lens based on structured light reconstruction and sub-pixel fitting, and when the program is executed by a processor, the steps of the method for detecting the curvature radius of a plano-convex lens based on structured light reconstruction and sub-pixel fitting as claimed in any one of claims 1 to 5 are implemented.