Visual identification method and system for front side and back side of lens plastic part

By collecting video footage of lens plastic parts production, edge detection and optical flow methods are used to calculate distortion and grayscale consistency, and the matching weight of edge contours is calculated. This solves the distortion error problem in front and back recognition of lens plastic parts and achieves high-precision front and back recognition.

CN120912922AActive Publication Date: 2025-11-07YUYAO YAODA ELECTRONIC TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511430006.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-09
Publication Date
2025-11-07
Estimated Expiration
2045-10-09

Smart Images

  • Figure CN120912922A_ABST
    Figure CN120912922A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image processing, in particular to a lens plastic part front and back visual identification method and system, and the method comprises the steps: collecting a production video of a lens plastic part, and extracting a plurality of edge contours of a single lens plastic part from the production video; extracting an optical flow vector of each pixel point in the single edge contour by using an optical flow method so as to calculate the distortion degree and gray scale consistency of the single edge contour; calculating the matching weight of the single edge contour based on the gray scale consistency and distortion degree of the single edge contour, performing hu moment similarity weighting by using the matching weight of the single edge to obtain the adjusted hu moment similarity, setting the threshold value of the hu moment similarity, and completing the recognition of the front and back surfaces of the lens plastic part by using the threshold value of the hu moment similarity. Accuracy of front and back identification of the lens plastic part can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image processing. More particularly, it relates to a lens plastic piece front and back visual identification method and system. BACKGROUND

[0002] In the manufacturing process of electronic products such as smart phones, lens plastic parts are crucial to product quality. Lens plastic parts usually have front and back designs. To ensure accurate positioning and mounting operations, the front and back of the lens plastic part can be identified to ensure correct mounting of the lens plastic part.

[0003] In the prior art, when identifying the front and back of the lens plastic part, the front and back of the lens plastic part has a certain texture shape difference. Shape matching can be used to match the texture shape difference between the lens plastic part to be detected and the front lens plastic part, and the front and back of the lens plastic part can be identified according to the similarity matching result.

[0004] However, when using a camera to capture lens plastic part images, the lens plastic part is often small, and when the detection camera is too close to the lens plastic part, the lens plastic part is severely distorted, resulting in errors when using similarity matching to identify the front and back of the lens plastic part, resulting in missed detection and false detection. SUMMARY

[0005] To solve the above technical problems of missed detection and false detection of lens plastic part front and back identification due to lens plastic part distortion when calculating similarity, the present application provides solutions in the following aspects.

[0006] In a first aspect, the present application discloses a lens plastic piece front and back visual identification method, comprising: Collecting production video of lens plastic parts, extracting single-frame lens plastic part images from the production video, extracting single lens plastic part regions in the lens plastic part images, and extracting multiple edge contours of a single lens plastic part using an edge detection algorithm; Obtaining a single edge contour of the multiple edge contours of the single lens plastic part, extracting an optical flow vector of each pixel point in the single edge contour using an optical flow method, and calculating a distortion degree of the single edge contour; Obtaining a contour region of the single edge contour, calculating the gray consistency of the single edge contour using the gray difference of the contour region of the single edge contour and the contour region of all edge contours; The matching weight of the single edge contour is calculated based on the gray consistency and the distortion degree of the single edge contour, the hu moment similarity is weighted by using the matching weight of the single edge, the adjusted hu moment similarity is obtained, the hu moment similarity threshold is set, and the front and back surfaces of the lens plastic part are identified by using the hu moment similarity threshold.

[0007] Preferably, the extracting the plurality of edge contours of the single lens plastic part comprises: installing a camera at a fixed position above a lens plastic part production line, so that the camera has a vertical visual angle to the production line to capture an overhead view image of the lens plastic part on the production line; continuously capturing images of the lens plastic part to be detected by using the camera, so that a production video of the lens plastic part can be captured; obtaining an image of the lens plastic part to be detected corresponding to a current frame in the captured production video as a current frame image, performing gray processing on the current frame image by using a gray processing algorithm to obtain a gray processed image, and extracting a region of interest (ROI) of the single lens plastic part to be detected by using a pre-trained neural network; extracting edge lines of the ROI of the single lens plastic part to be detected by using a canny edge detection algorithm to obtain an edge detection result, pre-processing the edge detection result to connect broken edges, and taking a connected domain extraction result in the pre-processed connected domain extraction result as an edge contour, thereby obtaining the plurality of edge contours of the single lens plastic part.

[0008] Preferably, the distortion degree of the single edge contour comprises: obtaining the plurality of edge contours of the single lens plastic part to be detected; calculating the optical flow vector of each edge pixel point in all edge contours of the single lens plastic part to be detected in two continuous frames by using an optical flow method, obtaining the standard deviation value of the optical flow vector of all edge pixel points in the single edge contour in the single lens plastic part to be detected; obtaining the optical flow acceleration of each edge pixel point in the single edge contour in the horizontal and vertical directions, and calculating the average value of the optical flow acceleration of each edge pixel point in the single edge contour in the two directions; and obtaining the distortion degree of the single edge contour in the single lens plastic part to be detected based on the positive correlation between the standard deviation value and the average value of the optical flow acceleration.

[0009] Preferably, the gray scale consistency of the single edge profile comprises: obtaining the coordinates of each pixel point on the single edge profile in the ROI region of the single lens plastic part to be inspected, obtaining the gray scale value of each pixel point on the single edge profile at the corresponding coordinates in the gray scale image of each pixel point on the single edge profile, and calculating the average value of the corresponding gray scale values of all pixel points on the single edge profile; obtaining the gray scale values of each pixel point on the edge texture of the front surface of the standard lens plastic part, and calculating the average gray scale value of all pixel points on the edge texture of the front surface of the standard lens plastic part; calculating the ratio of the average value of the corresponding gray scale values of all pixel points on the single edge profile in the ROI region of the single lens plastic part to be inspected to the average gray scale value of all pixel points on the edge texture of the front surface of the standard lens plastic part; obtaining the variance value of the corresponding pixel gray scale values of the single edge profile in the ROI region of the single lens plastic part to be inspected; and based on the negative correlation between the variance value of the gray scale value and the ratio, obtaining the gray scale consistency of the single edge profile in the ROI region of the single lens plastic part to be inspected.

[0010] Preferably, the matching weight of the single edge profile comprises: obtaining the distortion degree of the single edge profile in the ROI region of the single lens plastic part to be inspected; obtaining the gray scale consistency of the single edge profile in the ROI region of the single lens plastic part to be inspected; based on the negative correlation between the distortion degree and the gray scale consistency of the single edge profile in the ROI region of the single lens plastic part to be inspected and normalized, obtaining the matching weight of the single edge profile in the ROI region of the single lens plastic part to be inspected.

[0011] Preferably, the front and back surface identification of the lens plastic part comprises: calculating the similarity between the lens plastic part to be inspected in the ROI region and the edge texture of the front surface of the standard lens plastic, adjusting the similarity by using the negative correlation value of the matching weight of the single edge profile in the ROI region of the single lens plastic part to be inspected, obtaining the similarity adjustment value of the lens plastic part to be inspected in the ROI region and the edge texture of the front surface of the standard lens plastic, and setting a similarity threshold value for the similarity adjustment value; marking the lens plastic part to be inspected as the front surface when the similarity adjustment value is less than or equal to the similarity threshold value, and vice versa, completing the front and back surface identification of the lens plastic part to be inspected.

[0012] Preferably, the pre-trained neural network comprises: the pre-trained neural network is an instance segmentation network, which includes a decoder and an encoder, and the data set is obtained by collecting the overhead image of the lens plastic part, marking the pixel points belonging to the lens plastic part in the overhead image of the lens plastic part as 1 and the background pixel points as 0 by manual labeling method, and obtaining the labeled data set.

[0013] In a second aspect, the present application further discloses a lens plastic part front and back visual identification system, comprising: a processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, the lens plastic part front and back visual identification method described above is realized.

[0014] The present application has the following advantages: The problem that the traditional shape matching algorithm based on hu moments may fail due to angle changes is solved, and multiple detection is realized once; the optical flow vector of the edge points contained in a single independent contour is calculated, the distortion degree of a single independent contour is calculated, and the influence of the contour with high distortion degree on the matching result is avoided; the gray level and texture consistency features of the pixel points in a single contour are established, the response capability to the front edge texture of the standard lens plastic part is improved, the weight of different contours in the ROI region of a single lens plastic part is calculated, the hu moment similarity calculation of different contours is weighted, the accuracy of shape matching using hu moments is improved, and the misjudgment probability of the front and back of the lens plastic part is reduced. BRIEF DESCRIPTION OF DRAWINGS

[0015] Figure 1 is a method flowchart of steps S1-S4 in the lens plastic part front and back visual identification method of the embodiment of the present application.

[0016] Figure 2 is a structural block diagram of the lens plastic part front and back visual identification system of the embodiment of the present application. DETAILED DESCRIPTION

[0017] 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 part of the embodiments of the present application, rather than all the embodiments of the present application.

[0018] Referring to Figure 1 A lens plastic part front and back visual identification method comprises steps S1-S4, and specifically as follows: S1: Collecting a production video of a lens plastic part, extracting a single-frame lens plastic part image from the production video, extracting a single lens plastic part region in the lens plastic part image, and extracting multiple edge contours of a single lens plastic part by using an edge detection algorithm.

[0019] A camera is installed at a fixed position above a lens plastic part production line, and the camera visual angle is perpendicular to the production line, so as to collect a top view image of the lens plastic part on the production line.

[0020] The camera continuously collects images of the lens plastic part to be detected, and a production video of the lens plastic part to be detected can be collected, wherein the production video is composed of images of the lens plastic part to be detected at continuous time points, and an image at a time point in the production video is an image of the lens plastic part to be detected collected in the production line at the time point.

[0021] An image of the lens plastic part to be detected corresponding to a frame at a current time in the collected production video is obtained as a current frame image, the current frame image is analyzed, the current frame image is first grayed by using a graying algorithm to obtain a grayed image, and a single lens plastic part ROI region is extracted from the current frame image after graying by using a pre-trained neural network.

[0022] Since it is impossible to ensure that only one lens plastic part is in the camera collection field of view during production video collection by using the camera, the neural network needs to be used to extract a single lens plastic part to be detected, wherein the neural network is not directly used to identify the front and back of the single lens plastic part to be detected, because the front and back of the single lens plastic part to be detected are less different, the neural network has less learnable distinguishing features, and it is difficult to obtain a high-precision neural network identification model.

[0023] During production video collection, each frame of the image of the lens plastic part to be detected contains not only the lens plastic part but also more background content, and the lens plastic part and the background have great differences, so the pre-trained neural network can be used to extract a single lens plastic part, which is conducive to improving the accuracy of subsequent identification of the front and back of the single lens plastic part.

[0024] The pre-trained neural network is an instance segmentation network, includes a decoder and an encoder, a data set is collected by using a top view image of the lens plastic part, pixel points belonging to the lens plastic part in the top view image of the lens plastic part are marked as 1 by using an artificial marking method, background pixel points are marked as 0, a marked data set is obtained, and an existing instance segmentation network model is used to train the marked data, wherein the existing instance segmentation network model can use a Mask R-CNN network, and the training process of the Mask R-CNN network is a known content, which will not be described herein again, and the trained neural network is used as the pre-trained neural network to extract a single lens plastic part to be detected in each frame of the image of the lens plastic part to be detected.

[0025] The grayed current frame image of the lens plastic part to be detected is input into the pre-trained neural network to obtain a mask image of each lens plastic part to be detected in the grayed current frame image of the lens plastic part to be detected, and the mask image of each lens plastic part to be detected is multiplied by the grayed current frame image of the lens plastic part to be detected to obtain an ROI region of a single lens plastic part to be detected.

[0026] To obtain the ROI region of the i-th lens plastic part to be inspected, since the front and back recognition is achieved by utilizing the difference in texture between the front and back of the current lens plastic part to be inspected and the front of the standard front lens plastic part, the edge line of the ROI region of the i-th lens plastic part to be inspected is extracted using the Canny edge detection algorithm to obtain the edge detection result. In the edge detection result, the edge pixels that make up the edge line are pixels with a gray value of 255, and the gray value of the pixels that are not on the edge line is 0. Therefore, the edge detection result is a binary image.

[0027] The edge detection results contain multiple disconnected edge contours, each corresponding to a different shape. If the global hu moment is calculated directly, it will confuse the features of all shapes. Therefore, it is necessary to separate the independent edges first and then match them one by one.

[0028] The edge detection results are preprocessed to connect the broken edges. The preprocessing process is as follows: For the first... The edge detection results of the ROI region of the plastic lens to be inspected are obtained by using the image closing operation method. The edge detection results after closing operation are then obtained by using the connected component analysis method. In the connected component extraction results, each connected component extraction result is an edge line, which is considered as an edge contour. Thus, multiple edge contours of a single plastic lens are obtained. The connected component analysis and image closing operation methods are known techniques and will not be described in detail in this solution.

[0029] S2: Obtain a single edge contour from multiple edge contours of a single lens plastic part, and use optical flow method to extract the optical flow vector of each pixel in the single edge contour in order to calculate the degree of distortion of the single edge contour. Get the The connected component extraction results of the ROI region of the plastic part of the lens to be inspected are obtained. Multiple edge contours of the ROI area of ​​the plastic part of the lens to be inspected.

[0030] Get the The ROI area of ​​the plastic component to be inspected is the first The first edge contour The logarithm of the hu moments is .

[0031] When using Hu moments to calculate similarity and match the edge of the plastic lens under test with the front edge of the standard plastic lens under test, image distortion of the plastic lens under test is caused by the field of view of the acquisition camera, which will affect the similarity calculation results of Hu moments.

[0032] Since the actual size of the plastic part of the lens under inspection is constant, the pixel changes between two consecutive image frames should be consistent. However, due to the distortion of the plastic part of the lens under inspection captured by the camera, the pixels that should change consistently may change inconsistently. Therefore, the overall change of different edge contours can be used to measure the distortion of the plastic part of the lens under inspection, and this can be used to correct the similarity calculation when using Hu moments, thereby improving the accuracy of front and back identification of the plastic part of the lens under inspection.

[0033] In the first of two consecutive frames In the ROI region of the plastic part to be inspected, the sparse optical flow method is used to calculate the... The optical flow vector of each edge pixel in the ROI region of the plastic part of the lens to be inspected is used. The sparse optical flow method is a well-known technique and will not be described in detail in this solution.

[0034] Among them, the The first ROI region of the plastic part to be inspected On the edge contour of the first The optical flow vector of each edge pixel is .

[0035] No. The first ROI region of the plastic part to be inspected The degree of distortion of each edge contour : In the formula, For the first The first ROI region of the plastic part to be inspected Each edge contour contains the standard deviation of the optical flow vectors of all edge pixels. A larger value indicates that the interval between two consecutive frames is... The higher the difference in optical flow vectors of edge pixels within an edge contour, the higher the degree of distortion.

[0036] For the first Each edge contour contains the number of edge pixels. and They are edge pixels. The horizontal and vertical components of the optical flow vector. and They are edge pixels. Optical flow acceleration in the horizontal and vertical directions.

[0037] Optical flow vectors are the motion vectors of pixels in an image between two consecutive frames, reflecting the intensity of local deformation of an object. When distortion occurs, the difference in the motion rate of pixels in different regions increases, such as the near end moving quickly and the far end moving slowly. Therefore, the degree of distortion of different shapes in the ROI region of a single plastic part of a lens under inspection is different.

[0038] S3: Obtain the contour region of a single edge contour, and calculate the gray-level consistency of the single edge contour by utilizing the gray-level difference between the contour region of the single edge contour and the contour regions of all edge contours. After obtaining the ROI region of a single lens plastic part to be inspected, since the problem features represented by different edge contours on the lens plastic part to be inspected are inconsistent, if the edge texture on the lens plastic part to be inspected is consistent with the edge texture on the front of the standard lens plastic part, then when using Hu moments for similarity calculation, it should have a higher approximation, and vice versa.

[0039] Since the edge texture of the plastic part of the lens under test is not obvious, in order to further amplify the difference in edge texture between the front and back of the plastic part of the lens under test, the difference between a single edge contour and the edge texture of the front of the standard lens plastic part is obtained, so as to achieve the purpose of amplifying the difference in edge texture between the front and back of the plastic part of the lens under test.

[0040] Get the The first ROI region of the plastic part to be inspected The coordinates of each pixel on the edge contour are obtained. The coordinates of each pixel on the edge contour are in the th... Calculate the grayscale value at the corresponding coordinates of each pixel on the edge contour in the grayscale image, and calculate the i-th... The mean gray value of all pixels on the edge contour .

[0041] Similarly, obtain the grayscale value of each pixel on the edge texture of the front side of the standard lens plastic part, and calculate the average grayscale value of all pixels on the edge texture of the front side of the standard lens plastic part. The edge texture of the front side of the standard lens plastic part is obtained through the edge detection result acquisition step in step S1 above.

[0042] In obtaining the Within the ROI area of ​​the plastic component to be inspected, the first... Variance of pixel grayscale values ​​corresponding to edge contours This reflects the uniformity of the grayscale distribution of pixels within the contour.

[0043] Get the first The first ROI region of the plastic part to be inspected Grayscale consistency of each edge contour : In the formula, For the first Within the ROI area of ​​the plastic component to be inspected, the first... The mean gray value of all pixels on the edge contour The average grayscale value of all pixels on the edge texture of the front side of the standard lens plastic part The closer the ratio is to 1, the stronger it indicates that the first... The pixels inside the edge contour are more likely to belong to the front edge texture of the plastic part of the lens under inspection.

[0044] Among them, since it belongs to the edge pixel, the first... Within the ROI area of ​​the plastic component to be inspected, the first... The mean gray value of all pixels on the edge contour It will not be 0.

[0045] For the first The variance of the grayscale value of the pixel corresponding to the j-th edge contour within the ROI region of the lens plastic part under inspection reflects the uniformity of the grayscale distribution of the pixels. The pixel color and texture on the surface of the lens plastic part are relatively uniform, therefore... The smaller the value, the more likely it is that the first... The pixels with a defined edge contour are more likely to belong to the surface area of ​​the plastic part of the lens under inspection, and the less interference they receive. Indicates An exponential function with base 0.

[0046] That is, the first Within the ROI area of ​​the plastic component to be inspected, the first... The consistency index of pixels within the edge contour can distinguish whether these pixels belong to the front area of ​​the plastic part under inspection, and weight the matching of different shapes. The larger the value, the more it indicates the first Each edge contour is more important in the matching process, and its weight should be increased.

[0047] Calculate the first by combining the degree of distortion and the consistency index. Within the ROI area of ​​the plastic component to be inspected, the first... The weight of each edge contour in the matching process In the formula, For the first The total number of edge contours within the ROI area of ​​each plastic part of the lens to be inspected.

[0048] To account for the degree of distortion, and to avoid the contours with a high degree of distortion having a significant impact on the matching results, their matching weight should be appropriately reduced.

[0049] As a consistency index, to avoid the background region contour from interfering with the matching process and results, the contour with higher consistency is assigned a higher weight.

[0050] S4: Based on the grayscale consistency and distortion degree of a single edge contour, calculate the matching weight of the single edge contour, use the matching weight of the single edge to perform hu moment similarity weighting, obtain the adjusted hu moment similarity, set the hu moment similarity value threshold, and use the hu moment similarity value threshold to complete the front and back recognition of the lens plastic parts.

[0051] Using steps S2 and S3, the result is calculated based on the first... Within the ROI area of ​​the plastic component to be inspected, the first... After considering the grayscale consistency and distortion degree of each edge contour, the similarity calculation formula for the Hu moments is weighted to obtain the first... The new similarity value between the ROI region of the plastic part to be inspected and the front face of the plastic part of the standard lens is used as a similarity adjustment value. .

[0052] In the formula, 7 represents the number of hu matrices, which are 7 invariant moments derived from the image moments. This will not be elaborated further in existing techniques.

[0053] For the first Within the ROI area of ​​the plastic component to be inspected, the first... The logarithmic distance between the moment of the edge contour and the moment of the texture shape on the front of the standard lens plastic, taken as the Euclidean distance, is used to reflect the similarity.

[0054] For the first Within the ROI area of ​​the plastic component to be inspected, the first... Each edge contour has a matching weight; a larger weight indicates that the edge contour is more important in the matching process. The smaller the value, the higher the similarity between the edge texture of the plastic part of the lens under test and that of the standard lens plastic. Therefore, an exponential function is used. right Perform negative correlation mapping.

[0055] Calculation yields the first The similarity adjustment value between the edge texture of the lens plastic part under test and the standard lens plastic in the ROI area of ​​the lens plastic part under test. , The smaller the value is, the more similar the front of the lens plastic part is to the front of the standard lens plastic, and the higher the similarity of the front of the lens plastic part to the front of the standard lens plastic is. The value is set as a threshold value of 0.6, and the threshold value is a hyperparameter and is selected according to actual conditions.

[0056] The lens plastic part to be detected whose similarity adjustment value is less than or equal to 0.6 is marked as a front, and the rest is marked as a back, and the front and back identification of the lens plastic part to be detected is completed.

[0057] The application further provides a lens plastic part front and back visual identification system. As shown in the system, the system comprises a processor and a memory, the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a lens plastic part front and back visual identification method according to the application is realized. The system further comprises a communication bus and a communication interface and other components familiar to those skilled in the art, the settings and functions of which are known in the art, and thus will not be described here. Figure 2

[0058] It should be pointed out that for those skilled in the art, without departing from the concept of the application, several modifications and improvements can be made, which all belong to the protection scope of the application. Therefore, the protection scope of the application patent should be subject to the appended claims.​

Claims

1. A lens plastic part front and back surface visual identification method, characterized in that, The application relates to a lens plastic part production video acquisition method. The method comprises the following steps: acquiring a production video of a lens plastic part, extracting a single-frame lens plastic part image from the production video, extracting a single lens plastic part region in the lens plastic part image, and extracting multiple edge contours of a single lens plastic part by using an edge detection algorithm. An individual edge contour is obtained from the multiple edge contours of the single lens plastic part, and an optical flow vector of each pixel point in the individual edge contour is extracted by using an optical flow method to calculate a distortion degree of the individual edge contour. The contour region of the individual edge contour is obtained, and the gray consistency of the individual edge contour is calculated by using the gray difference between the contour region of the individual edge contour and the contour regions of all edge contours. Based on the gray consistency and the distortion degree of the individual edge contour, a matching weight of the individual edge contour is calculated, the hu moment similarity is weighted by using the matching weight of the individual edge, an adjusted hu moment similarity is obtained, a hu moment similarity value threshold is set, and the front and back surfaces of the lens plastic part are identified by using the hu moment similarity value threshold.

2. The lens plastic piece front and back surface visual identification method according to claim 1, characterized in that, The method comprises the following steps: A camera is installed at a fixed position above a lens plastic part production line, and the camera is arranged to have a vertical visual angle with respect to the production line to acquire an overhead view image of the lens plastic part on the production line. The camera continuously acquires images of the lens plastic part to be detected to obtain a production video of the lens plastic part. A current frame image of the lens plastic part to be detected corresponding to a current time in the production video is acquired as a current frame image, the current frame image is grayed by using a graying algorithm to obtain a grayed image, and a single lens plastic part ROI region is extracted from the current frame image by using a pre-trained neural network. An edge line of the single lens plastic part ROI region is extracted by using a canny edge detection algorithm to obtain an edge detection result, the edge detection result is pretreated to connect the broken edges, one connected domain extraction result in the pretreated connected domain extraction result is an edge line, and the edge line is taken as an edge contour, and then, multiple edge contours of the single lens plastic part are obtained.

3. The lens plastic piece front and back surface visual identification method according to claim 1, characterized in that, The method comprises the following steps: Multiple edge contours of the single lens plastic part ROI region are obtained. An optical flow vector of each edge pixel point in all edge contours of the single lens plastic part ROI region in two continuous frames is calculated by using an optical flow method, a standard deviation value of the optical flow vector of each edge pixel point in the single edge contour of the single lens plastic part ROI region is obtained. The optical flow acceleration of each edge pixel point in the single edge contour of the single lens plastic part ROI region in horizontal and vertical directions is obtained, and the average value of the optical flow acceleration of each edge pixel point in the single edge contour of the single lens plastic part ROI region in the two directions is calculated. Based on the positive correlation between the standard deviation value and the average value of the optical flow acceleration, the distortion degree of the single edge contour of the single lens plastic part ROI region is obtained.

4. The lens plastic piece front and back surface visual identification method according to claim 1, characterized in that, The method comprises the following steps: Obtaining the coordinates of each pixel point on the single edge contour in the ROI region of the single lens plastic part to be inspected, obtaining the gray value of each pixel point on the single edge contour in the gray image corresponding to the coordinates of each pixel point on the single edge contour, and calculating the average value of the gray values corresponding to all pixel points on the single edge contour; Obtaining the gray value of each pixel point on the edge texture of the front surface of the standard lens plastic part, and calculating the average value of the gray values of all pixel points on the edge texture of the front surface of the standard lens plastic part; Calculating the ratio of the average value of the gray values corresponding to all pixel points on the single edge contour in the ROI region of the single lens plastic part to be inspected to the average value of the gray values of all pixel points on the edge texture of the front surface of the standard lens plastic part; Obtaining the variance value of the gray values of the pixel points corresponding to the single edge contour in the ROI region of the single lens plastic part to be inspected; Based on the negative correlation between the variance value of the gray values and the ratio, the gray consistency of the single edge contour in the ROI region of the single lens plastic part to be inspected is obtained.

5. The lens plastic piece front and back surface visual identification method according to claim 1, characterized in that, The matching weight of the single edge contour includes: Obtaining the distortion degree of the single edge contour in the ROI region of the single lens plastic part to be inspected; Obtaining the gray consistency of the single edge contour in the ROI region of the single lens plastic part to be inspected; Based on the negative correlation between the distortion degree and the gray consistency of the single edge contour in the ROI region of the single lens plastic part to be inspected and normalization, the matching weight of the single edge contour in the ROI region of the single lens plastic part to be inspected is obtained.

6. The lens plastic piece front and back surface visual identification method according to claim 1, characterized in that, The front and back surface identification of the lens plastic part includes: The similarity between the lens plastic part to be inspected in the ROI region and the edge texture of the front surface of the standard lens plastic part is calculated, the negative correlation value of the matching weight of the single edge contour in the ROI region of the single lens plastic part to be inspected is used to adjust the similarity, and the similarity adjustment value of the lens plastic part to be inspected in the ROI region and the edge texture of the front surface of the standard lens plastic part is obtained. The similarity threshold is set for the similarity adjustment value; The lens plastic part to be inspected is marked as the front surface when the similarity is less than or equal to the similarity threshold, and vice versa, and the front and back surface identification of the lens plastic part to be inspected is completed.

7. The lens plastic piece front and back surface visual identification method according to claim 2, characterized in that, The pre-trained neural network includes: the pre-trained neural network is an instance segmentation network, which includes a decoder and an encoder. The data set is obtained by collecting the overhead image of the lens plastic part, and the pixel points belonging to the lens plastic part in the overhead image of the lens plastic part are marked as 1 by manual marking method, and the background pixel points are marked as 0 to obtain the labeled data set.

8. A lens plastic piece front and back visual identification system, characterized in that, It includes: A processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, a lens plastic part front and back surface visual identification method according to claims 1-7 is realized.

Citation Information

Patent Citations

  • Objective evaluation method for image quality

    CN106023208A

  • A video jitter removing method based on a fusion motion model

    CN109729263A

  • Video noise reduction method and device, electronic equipment and computer readable medium

    CN111833269A

  • Variable distortion correction for panoramic images

    US20240020801A1

  • Medical image registration method, computer apparatus and storage medium

    US20250078293A1