A camera metal protection ring defect intelligent detection and classification system

By acquiring images from multiple light source angles and analyzing the changes in reflectivity and light and shadow morphology in connected areas, the problem of inaccurate detection caused by reflectivity in the defect detection of metal protective rings of cameras has been solved, achieving more accurate defect detection and classification.

CN121353236BActive Publication Date: 2026-06-09DONGGUAN ZELI PRECISION INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DONGGUAN ZELI PRECISION INTELLIGENT TECH CO LTD
Filing Date
2025-10-23
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, defect detection of camera metal protective rings ignores the high reflectivity of the material, resulting in excessive image reflection and making it impossible to accurately detect and classify defects.

Method used

Images are acquired from multiple light source angles. By obtaining the reflectivity and light and shadow morphology changes of connected regions, non-reflective images are filtered out. Based on the non-reflective images, shadow areas and illuminated areas are separated. The light and shadow morphology changes of illuminated areas are analyzed to perform defect detection and classification.

Benefits of technology

It improves the accuracy of defect detection and classification, enables a more comprehensive assessment of changes in light and shadow morphology in illuminated areas, and enhances the ability to detect defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121353236B_ABST
    Figure CN121353236B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of defect detection, in particular to a camera metal protection ring defect intelligent detection and classification system.The present application obtains the reflection intensity of multiple connected regions in the surface image according to the gray scale distribution of the pixel points in the surface image for any light source angle; screens out the non-reflection image according to the reflection intensity of the connected regions in the surface image of different light source angles; obtains the shadow area and the light area of the non-reflection image based on the gray scale distribution of the pixel points in the non-reflection image; obtains the light shadow form change degree of each light area in each non-reflection image according to the reflection intensity of each light area in each non-reflection image, and the position characteristics and the form characteristics of different shadow areas and light areas; and performs defect detection and classification on the metal protection ring.The present application accurately obtains the light shadow form change of the light area, and improves the accuracy of defect detection and classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect detection technology, specifically to an intelligent detection and classification system for defects in the metal protective ring of a camera. Background Technology

[0002] Camera metal protective rings are usually made of stainless steel or aluminum alloy by stamping. The stamping process is prone to defects such as burrs, chipping, scratches, dents, and deformation on the surface and contour of metal parts. Since stainless steel or aluminum alloy has high reflectivity when machine vision intelligent inspection and image acquisition, if the light source is not set properly, the image content can be lost due to reflection, resulting in inaccurate defect detection.

[0003] In existing technologies, fixed lighting is used when detecting surface defects of metal components in camera protective rings. This ignores the high reflectivity of the metal component material, resulting in excessively strong reflection in the acquired images, which fails to show the defects on the surface of the metal component, leading to poor defect detection and classification. Summary of the Invention

[0004] To address the problem of poor defect detection in existing methods that ignore the high reflectivity of materials, the present invention aims to provide an intelligent detection and classification system for defects in camera metal protective rings. The specific technical solution adopted is as follows:

[0005] This invention proposes an intelligent detection and classification system for defects in the metal protective ring of a camera, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps:

[0006] Acquire surface images of the camera's metal protective ring from multiple light source angles;

[0007] For any light source angle, multiple connected regions of the surface image are obtained based on the gray-level distribution of pixels in the surface image; the reflectance intensity of each connected region is obtained based on the gray-level distribution of different pixels in each connected region; and non-reflective images are selected based on the reflectance intensity of connected regions in the surface image at different light source angles.

[0008] Based on the grayscale distribution of pixels in the non-reflective image, the shadow area and the illuminated area of ​​the non-reflective image are obtained; based on the reflectivity of each illuminated area in each non-reflective image, as well as the positional and morphological characteristics of different shadow and illuminated areas, the degree of change in the light and shadow morphology of each illuminated area in each non-reflective image is obtained.

[0009] Based on the positional characteristics of different light-facing areas and the degree of change in light and shadow morphology in all non-reflective images, defects in metal protective rings are detected and classified.

[0010] Furthermore, the method for obtaining the connected region includes:

[0011] For any light source angle, obtain multiple edge lines of the surface image. If different edge lines intersect, take the corresponding intersection point as the edge segmentation point.

[0012] Based on the positional distribution of edge segmentation points on different surface images and the grayscale distribution of pixels, the segmentation effectiveness of each edge segmentation point is obtained;

[0013] If the segmentation validity of an edge segmentation point is greater than a preset valid threshold, the corresponding edge segmentation point is taken as a valid segmentation point; an edge with two valid segmentation points is taken as a valid edge, and the closed region formed by the valid edges is taken as a connected region.

[0014] Furthermore, the method for obtaining the segmentation validity includes:

[0015] For any edge segmentation point of a surface image, if there is an edge segmentation point at the same position on each surface image, the first effective coefficient of the edge segmentation point on each surface image is set to a positive integer 1.

[0016] Conversely, a second effective coefficient is obtained based on the gray-level range of pixels in the neighborhood of the edge segmentation point at the same position on each surface image, and the minimum positional distance between the edge segmentation point and the edge segmentation point on the surface image. The gray-level range is positively correlated with the second effective coefficient, and the minimum positional distance is negatively correlated with the second effective coefficient.

[0017] The mean of all first and second effective coefficients corresponding to the edge cutting points on different surface images is obtained and normalized to serve as the segmentation effectiveness of the edge cutting points.

[0018] Furthermore, the method for obtaining the reflectivity includes:

[0019] Obtain the average gray value of different pixels in each connected region as the overall gray value of the region;

[0020] The reflectance intensity of each connected region is obtained based on the grayscale difference between the grayscale values ​​of different pixels in each connected region and the overall grayscale value of the region, as well as the overall grayscale value of the region. Both the grayscale difference and the overall grayscale value of the region are positively correlated with the reflectance intensity.

[0021] Furthermore, the method for acquiring the non-reflective image includes:

[0022] The average reflectance of all connected regions on each surface image is obtained as the average reflectance of each surface image;

[0023] If the average reflectance of the surface image is less than or equal to the preset reflectance threshold, the corresponding surface image will be treated as a non-reflective image.

[0024] Furthermore, the method for obtaining the shadow region and the light-facing region includes:

[0025] For any non-reflective image, the pixels are clustered based on the gray-level distribution of the pixels in the image to obtain shadow point clusters, light-facing point clusters, and diffuse reflection point clusters;

[0026] Obtain the average gray level of all pixels in each cluster; designate the cluster with the lowest average gray level as the shadow cluster; and designate the cluster with the highest average gray level as the light-facing cluster.

[0027] The area formed by consecutive adjacent shadow points is taken as the shadow region; the area formed by consecutive adjacent ray points is taken as the ray region.

[0028] Furthermore, the method for obtaining the degree of change in light and shadow shape includes:

[0029] Based on the positional and morphological characteristics of different shadow and light regions, the morphological differences between different shadow regions are obtained;

[0030] For any non-reflective image, obtain the relative distance between the center points of each illuminated region and different shadow regions, and take the shadow region with the closest relative distance as the reference shadow region; obtain the ratio of the number of pixels between each illuminated region and the corresponding reference shadow region as the brightness-to-dark area ratio.

[0031] Based on the positional characteristics of the illuminated regions in different non-reflective images and the morphological differences of the corresponding reference shadow regions, the overall morphological difference of each illuminated region is obtained.

[0032] For any non-reflective image, the degree of change in the light and shadow morphology of each illuminated region is obtained based on the reflective intensity, the fluctuation of the light-dark area ratio, and the overall morphological difference of each illuminated region. The reflective intensity is negatively correlated with the degree of change in the light and shadow morphology, while the fluctuation of the light-dark area ratio and the overall morphological difference are both positively correlated with the degree of change in the light and shadow morphology.

[0033] Furthermore, the method for obtaining the morphological difference degree includes:

[0034] The fitted line is obtained by fitting the position coordinates of the pixels in each shadow region; the centers of different shadow regions are overlapped and the fitted lines are kept parallel to obtain the number of overlapping pixels with the same position between different shadow regions; the cumulative value of the number of pixels between different shadow regions is obtained.

[0035] The ratio of the number of pixels between each shadow region and its corresponding adjacent illuminated region is obtained as the shape coefficient of each shadow region.

[0036] Based on the first ratio of the number of overlaps and the cumulative value of the number of overlaps between different shadow regions, as well as the difference in morphological coefficients, the morphological difference between different shadow regions is obtained. The first ratio is negatively correlated with the morphological difference, while the difference in morphological coefficients is positively correlated with the morphological difference.

[0037] Furthermore, the method for obtaining the overall morphological difference includes:

[0038] For any two non-reflective images, obtain the relative distance between the center positions of the light-facing regions of the non-reflective images, and select the light-facing region corresponding to the smallest relative distance as the light-facing related region;

[0039] The morphological difference between each illuminated region and the corresponding reference shadow region of other illuminated regions on the corresponding non-illuminated image is obtained, as well as the sum of the morphological differences between each illuminated region and the corresponding reference shadow region of other illuminated related regions on other non-reflective images, which is used as the overall morphological difference.

[0040] Furthermore, the defect detection and classification of the metal protective ring includes:

[0041] The mean value of the change in light and shadow morphology of each illuminated region in all non-reflective images is obtained as the degree of defect of each illuminated region.

[0042] If the defect level of the light-facing region is greater than a preset first defect threshold but less than a preset second defect threshold, the corresponding light-facing region is designated as a first defect level region; if the defect level of the light-facing region is greater than or equal to the preset second defect threshold, the corresponding light-facing region is designated as a second defect level region; the preset second defect threshold is greater than the preset first defect threshold.

[0043] The present invention has the following beneficial effects:

[0044] This invention, for any light source angle, obtains multiple connected regions of a surface image based on the grayscale distribution of pixels, decomposing the complex whole image into local regions of different properties. Based on the grayscale distribution of different pixels in each connected region, the reflectivity of each connected region is obtained, quantifying the reflectivity characteristics of the region and helping to provide a basis for selecting reliable images. Based on the reflectivity of connected regions in surface images from different light source angles, non-reflective images are selected; considering that excessive reflection can obscure surface texture and details, images with weaker reflection are selected. Based on the grayscale distribution of pixels in the non-reflective images, the shadow and illuminated regions of the non-reflective images are obtained, achieving light and shadow separation. Based on the reflectivity of each illuminated region in each non-reflective image, as well as the positional and morphological characteristics of different shadow and illuminated regions, the degree of change in the light and shadow morphology of each illuminated region in each non-reflective image is obtained, providing a more comprehensive evaluation of the overall change of the illuminated region under different light sources. Defect detection and classification are performed on metal protective rings. This invention improves the accuracy of defect detection and classification by accurately obtaining the light and shadow morphological changes of the illuminated region. Attached Figure Description

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

[0046] Figure 1 This is a flowchart illustrating an implementation method of an intelligent detection and classification system for defects in a camera metal protective ring, provided in one embodiment of the present invention.

[0047] Figure 2 This is a flowchart of a segmentation validity acquisition method provided in one embodiment of the present invention;

[0048] Figure 3 This is a flowchart illustrating a method for obtaining the degree of change in light and shadow morphology according to an embodiment of the present invention. Detailed Implementation

[0049] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an intelligent detection and classification system for defects in a camera metal protective ring according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0051] The following description, in conjunction with the accompanying drawings, details the specific solution of the intelligent detection and classification system for defects in the metal protective ring of a camera provided by the present invention.

[0052] Please see Figure 1 The diagram illustrates a flowchart of an implementation method for an intelligent detection and classification system for defects in a camera metal protective ring, according to an embodiment of the present invention. The method specifically includes:

[0053] Step S1: Acquire surface images of the camera's metal protective ring from multiple light source angles.

[0054] In the embodiments of the present invention, considering that the metal protective ring of the camera is reflective, image content may be lost due to unreasonable light source settings, resulting in inaccurate defect detection. Therefore, the present invention performs defect analysis based on acquiring multiple images from a multi-angle ring light source and excluding the influence of high reflectivity and surface texture. First, the metal protective ring of the camera is illuminated from multiple angles, starting at 75° and gradually decreasing to 15° in 15° increments to ensure consistent shooting angles and obtain surface images of the metal protective ring of the camera from multiple light source angles.

[0055] It should be noted that, in order to improve image quality and facilitate subsequent processing, the acquired raw image is preprocessed. Specifically, the region of interest (ROI) is cropped based on the area around the protective circle to avoid background and other content increasing the computational load. Gaussian filtering is applied to the image to reduce noise, and the background and metal parts are separated by image threshold segmentation based on the highest angle of the ring light source to ensure clear image contours and minimal interference from the metal parts. The specific methods are well known to those skilled in the art and will not be elaborated here.

[0056] Step S2: For any angle, obtain multiple connected regions of the surface image based on the grayscale distribution of pixels in the surface image; obtain the reflectivity of each connected region based on the grayscale distribution of different pixels in each connected region; and filter out non-reflective images based on the reflectivity of connected regions in the surface image at different angles.

[0057] Because the metal protective ring is made of reflective material, the higher the angle of the ring light source, the stronger the reflection on the surface of the metal component tends to be, affecting the loss of almost all surface details. As the angle of the light source decreases, the surface reflection weakens. When the differences in reflection from different surfaces of the actual metal component constitute different areas, the distinct outlines of these areas are displayed in multiple images. Therefore, by analyzing the grayscale distribution of pixels, the brightness changes of each pixel can be reflected. For any given angle, multiple connected regions of the surface image are obtained based on the grayscale distribution of pixels in the surface image.

[0058] Preferably, in one embodiment of the present invention, the method for obtaining the connected region includes:

[0059] For any light source angle, obtain multiple edge lines of the surface image. If different edge lines intersect, take the corresponding intersection point as the edge segmentation point.

[0060] It should be noted that the specific edge detection algorithm is a well-known technique in the field of science and will not be elaborated here.

[0061] Based on the positional distribution of edge segmentation points on different surface images and the grayscale distribution of pixels, the segmentation effectiveness of each edge segmentation point is obtained;

[0062] Preferably, in one embodiment of the present invention, the method for obtaining segmentation validity is described in [reference needed]. Figure 2 It illustrates a flowchart of a method for obtaining segmentation validity, including:

[0063] Step S201: For any edge segmentation point of a surface image, if there is an edge segmentation point at the same position on each surface image, set the first effective coefficient of the edge segmentation point on each surface image to a positive integer 1.

[0064] Considering that if different surfaces of an actual metal part reflect light to form different regions, the regions will show obvious edge contours in multiple images, while edges caused by other reasons are not universal, the more edge segmentation points exist at the same location in different images, the more helpful it is for subsequent processing and the greater the segmentation effectiveness.

[0065] Step S202: Conversely, based on the grayscale range of pixels in the neighborhood of the edge segmentation point at the same position on each surface image, and the minimum positional distance between the edge segmentation point and the edge segmentation point on the surface image, a second effective coefficient is obtained. The grayscale range is positively correlated with the second effective coefficient, and the minimum positional distance is negatively correlated with the second effective coefficient.

[0066] It should be noted that, in the embodiments of the present invention, the positional distance between the dividing points is obtained by Euclidean distance or Manhattan distance calculation methods. The specific means are well known to those skilled in the art and will not be described in detail here.

[0067] In one embodiment of the present invention, if there is no edge cutting point at the same location, the difference between the maximum and minimum gray values ​​of pixels in the neighborhood of the corresponding edge cutting point on each surface image is calculated, i.e., the gray range value; the first sum of the positive integer 1 and the minimum position distance is obtained, and the ratio of the gray range value to the first sum is obtained as the second effective coefficient; therefore, based on the above basic mathematical operations, the correlation between the gray range value, the minimum position distance, and the second effective coefficient is constructed, i.e., the larger the gray range value, the greater the difference in brightness around the cutting point; the smaller the minimum position distance, the greater the prevalence of cutting points at the same location in other images, and the greater the effectiveness of edge cutting point segmentation.

[0068] Step S203: Obtain the mean value between all first and second effective coefficients corresponding to the edge cutting points on different surface images, and normalize it as the segmentation effectiveness of the edge cutting points.

[0069] It should be noted that in some embodiments of the present invention, a linear normalization method or normalization function, such as the logistic mapping function, is used for normalization processing. The specific methods used are well-known to those skilled in the art and will not be elaborated upon here.

[0070] If the segmentation validity of an edge segmentation point is greater than a preset valid threshold, the corresponding edge segmentation point is taken as a valid segmentation point; an edge with two valid segmentation points is taken as a valid edge, and the closed region formed by the valid edges is taken as a connected region.

[0071] It should be noted that, in one embodiment of the present invention, the size of the preset effective threshold is set to 0.5; in other embodiments of the present invention, the size of the preset effective threshold may be set according to specific circumstances, and will not be limited or elaborated here.

[0072] The reflectivity reflects the image texture information of the metal protective ring and its ability to reflect light. The greater the reflectivity, the more serious the loss of details. Textures and burr defects are affected by the reflection and are not visible in the image. The overall brightness will be higher and the gray value will be larger. Therefore, the reflectivity of each connected region is obtained based on the gray value distribution of different pixels in each connected region.

[0073] Preferably, in one embodiment of the present invention, the method for obtaining reflective intensity includes:

[0074] Obtain the average gray value of different pixels in each connected region as the overall gray value of the region;

[0075] The reflectance intensity of each connected region is obtained based on the grayscale difference between the grayscale values ​​of different pixels in each connected region and the overall grayscale value of the region, as well as the overall grayscale value of the region. Both the grayscale difference and the overall grayscale value of the region are positively correlated with the reflectance intensity.

[0076] It should be noted that the grayscale difference between each pixel and the overall grayscale value of the region is significant. The greater the grayscale difference, the further it deviates from the basic grayscale level, the more uneven the grayscale distribution, and the greater the reflective intensity. The larger the overall grayscale value of the region, the greater the reflective intensity, as the average of the overall grayscale value of the region reflects the overall grayscale level of the connected region. Therefore, both the grayscale difference and the overall grayscale value of the region are positively correlated with the reflective intensity.

[0077] In one embodiment of the present invention, the sum of grayscale differences between the grayscale values ​​of all pixels in each connected region and the overall grayscale value of the region is obtained. The product between the sum of the differences and the overall grayscale value of the region is calculated and normalized and mapped as the reflectance intensity of each connected region. Therefore, based on the above basic mathematical operations, a correlation relationship between grayscale difference, overall grayscale value of the region and reflectance intensity is constructed, that is, the greater the grayscale difference, the greater the overall grayscale value of the region, and the greater the reflectance intensity of the region.

[0078] The weaker the reflectivity of a metal part's surface, the clearer the details of surface defects can be, which is more conducive to defect analysis. Based on the reflectivity of connected regions in surface images from different angles, non-reflective images can be selected.

[0079] Preferably, in one embodiment of the present invention, the method for acquiring a non-reflective image includes:

[0080] The average reflectance of all connected regions on each surface image is obtained as the average reflectance of each surface image;

[0081] If the average reflectance of the surface image is less than or equal to the preset reflectance threshold, the corresponding surface image will be treated as a non-reflective image.

[0082] It should be noted that, in one embodiment of the present invention, the preset reflectivity threshold is set to 0.7; in other embodiments of the present invention, the preset reflectivity threshold can be set according to specific circumstances, and will not be limited or elaborated here.

[0083] Therefore, obtaining non-reflective images and excluding images with excessive reflection helps avoid image matching bias and is beneficial for analyzing the texture details of the image surface.

[0084] Step S3: Based on the grayscale distribution of pixels in the non-reflective image, obtain the shadow area and the illuminated area of ​​the non-reflective image; according to the reflectivity of each illuminated area in each non-reflective image, as well as the positional and morphological characteristics of different shadow and illuminated areas, obtain the degree of change in the light and shadow morphology of each illuminated area in each non-reflective image.

[0085] When the surface of a metal part has weak reflection, a low-angle ring light source will illuminate the defects on the surface of the metal part and create shadows; the gray-scale distribution reflects the amount of light received by the pixel, the area with more light has a larger gray-scale value, and the area with less light has a smaller gray-scale value; based on the gray-scale distribution of pixels in a non-reflective image, the shadow area and the illuminated area of ​​the non-reflective image are obtained.

[0086] Preferably, in one embodiment of the present invention, the method for obtaining the shadow area and the light-facing area includes:

[0087] For any non-reflective image, the pixels are clustered based on the gray-level distribution of the pixels in the image to obtain shadow point clusters, light-facing point clusters, and diffuse reflection point clusters;

[0088] Obtain the average gray level of all pixels in each cluster; designate the cluster with the lowest average gray level as the shadow cluster; and designate the cluster with the highest average gray level as the light-facing cluster.

[0089] The area formed by consecutive adjacent shadow points is taken as the shadow region; the area formed by consecutive adjacent ray points is taken as the ray region.

[0090] It should be noted that, in the embodiments of the present invention, the pixels can be clustered by the K-means clustering algorithm, and pixels with similar gray levels can be grouped into one class. Considering that in addition to the light-facing points directly illuminated by the light source and other shadow points, there are also intermediate brightness points illuminated by diffuse reflection, K is set to 3 for clustering to obtain 3 corresponding clusters. The specific means are well known to those skilled in the art and will not be described in detail here.

[0091] Since the illuminated surface is determined by the shape of the structure itself when the angle of the ring light changes, the center of the illuminated surface remains basically unchanged, thus analyzing the changes of the illuminated part in different images; therefore, based on the reflectivity of each illuminated area in each non-reflective image, as well as the positional and morphological characteristics of different shadow and illuminated areas, the degree of change of light and shadow morphology of each illuminated area in each non-reflective image is obtained.

[0092] Preferably, in one embodiment of the present invention, the method for obtaining the degree of change in light and shadow shape is described in [reference needed]. Figure 3 It shows a flowchart of a method for obtaining the degree of change in light and shadow morphology, including:

[0093] Step S301: Based on the positional and morphological characteristics of different shadow areas and light-facing areas, obtain the morphological differences between different shadow areas.

[0094] Preferably, in one embodiment of the present invention, the method for obtaining the morphological difference degree includes:

[0095] The fitted line is obtained by fitting the position coordinates of the pixels in each shadow region; the centers of different shadow regions are overlapped and the fitted lines are kept parallel to obtain the number of overlapping pixels with the same position between different shadow regions; the cumulative value of the number of pixels between different shadow regions is obtained.

[0096] The ratio of the number of pixels between each shadow region and its corresponding adjacent illuminated region is obtained as the shape coefficient of each shadow region.

[0097] Based on the first ratio of the number of overlaps and the cumulative value of the number of overlaps between different shadow regions, as well as the difference in morphological coefficients, the morphological difference between different shadow regions is obtained. The first ratio is negatively correlated with the morphological difference, while the difference in morphological coefficients is positively correlated with the morphological difference.

[0098] It should be noted that, in the embodiments of the present invention, the position coordinates of the pixels in each shadow region can be fitted with a straight line using the least squares method or a polynomial fitting method. The specific means are well known to those skilled in the art and will not be described in detail here. The first ratio reflects the morphological similarity between different shadow regions. The larger the first ratio, the more overlap there is, the more similar the shapes of the shadow regions are, and the smaller the morphological difference is. The difference represents the absolute value of the calculated difference. The smaller the difference in the morphological coefficient, the closer the shapes of the shadow regions are, and the smaller the morphological difference is. Therefore, the first ratio is negatively correlated with the morphological difference, and the difference in the morphological coefficient is positively correlated with the morphological difference.

[0099] In one embodiment of the present invention, the difference between the positive integer 1 and the first ratio is obtained as the morphological difference coefficient; the product of the difference in morphological coefficients between different shadow regions and the morphological difference coefficients is obtained as the morphological difference degree between different shadow regions; therefore, based on the above basic mathematical operations, a correlation relationship is constructed between the first ratio, the difference in morphological coefficients and the morphological difference degree, that is, the larger the first ratio, the smaller the morphological difference coefficient, the greater the difference in morphological coefficients, and the greater the morphological difference degree.

[0100] Step S302: For any non-reflective image, obtain the relative distance between the center points of each illuminated area and different shadow areas, and take the shadow area with the closest relative distance as the reference shadow area; obtain the ratio of the number of pixels between each illuminated area and the corresponding reference shadow area as the light-dark area ratio.

[0101] Considering that the weaker the reflectivity of the metal part surface, the clearer the surface defect details can be displayed, the defect is illuminated by the light source and casts a shadow on its back side, and the range of the shadow area reflected by the projection when a defect occurs is larger than that of the normal area in different non-reflective images, therefore, the shadow area corresponding to the closest distance to each illuminated area is analyzed to evaluate the correlation between the light and dark areas in each image.

[0102] Step S303: Based on the positional characteristics of the illuminated areas on different non-reflective images and the morphological differences of the corresponding reference shadow areas of different illuminated areas, obtain the overall morphological difference of each illuminated area.

[0103] Preferably, in one embodiment of the present invention, the method for obtaining the overall morphological difference includes:

[0104] Considering that when the angle of the ring light source changes, the illuminated bright surface is determined by the shape of the structure itself, and the center of the bright surface remains basically unchanged, the closer the center positions are on different images, the more they represent the area illuminated by the same structure; therefore, for any two non-reflective images, obtain the relative distance between the center positions of the illuminated areas between the non-reflective images, and select the illuminated area corresponding to the smallest relative distance as the illuminated related area.

[0105] The morphological differences between illuminated regions in different dimensions are analyzed to obtain the morphological difference degree between each illuminated region and the corresponding reference shadow region of other illuminated regions on the corresponding non-illuminated image, as well as the cumulative value between the morphological difference degree between each illuminated region and the corresponding reference shadow region of other illuminated related regions on the non-reflective image, which is used as the overall morphological difference degree.

[0106] Step S304: For any non-reflective image, based on the reflective intensity, the fluctuation of the light-dark area ratio, and the overall shape difference of each illuminated area, obtain the light and shadow shape change degree of each illuminated area. The reflective intensity is negatively correlated with the light and shadow shape change degree, while the fluctuation of the light-dark area ratio and the overall shape difference are positively correlated with the light and shadow shape change degree.

[0107] It should be noted that, in the embodiments provided by the present invention, the degree of fluctuation can be reflected by calculating the variance or standard deviation of the light-dark area ratio. The larger the variance, the greater the degree of fluctuation. The specific means are well known to those skilled in the art and will not be described in detail here.

[0108] It should be noted that the greater the reflective intensity of the illuminated area, the lower the reliability of the analysis of the illuminated part. When the angle of the light source is different, the shape of the shadow of the defect changes even more. Therefore, the degree of fluctuation in the ratio of light and dark areas reflects the changes in the light and dark areas under different light source angles. The greater the fluctuation, the more inconsistent the ratio of light and dark areas corresponding to the illuminated area, and the greater the change in the shape of light and shadow. The greater the difference in the shape of the shadow areas corresponding to the illuminated areas, the more inconsistent the shapes of the illuminated areas, the greater the overall difference in shape, and the greater the change in the shape of light and shadow. Therefore, reflective intensity is negatively correlated with the change in the shape of light and shadow, while the degree of fluctuation in the ratio of light and dark areas and the overall difference in shape are both positively correlated with the change in the shape of light and shadow.

[0109] In one embodiment of the present invention, the difference between the positive integer 1 and the reflectance intensity is obtained as the first difference; the product of the first difference, the overall morphological difference, and the fluctuation of the light-dark area ratio is obtained and normalized and mapped as the light and shadow morphological change degree of each illuminated area; therefore, based on the above basic mathematical operations, the correlation between the reflectance intensity, the fluctuation of the light-dark area ratio, the overall morphological difference, and the light and shadow morphological change degree is constructed, that is, the smaller the reflectance intensity, the more helpful it is to analyze the features on the image; the greater the fluctuation of the light-dark area ratio, the greater the overall morphological difference, and the greater the light and shadow morphological change degree.

[0110] Step S4: Based on the positional characteristics of different light-facing areas and the degree of change in light and shadow morphology in all non-reflective images, perform defect detection and classification on the metal protective ring.

[0111] The degree of change in the shape of light and shadow in the illuminated area reflects the change in illumination. The greater the degree of change in the shape of light and shadow, the greater the change in illumination, the more affected by burrs, and the more beneficial it is for defect detection and classification.

[0112] Preferably, in one embodiment of the present invention, defect detection and classification of the metal protective ring includes:

[0113] The mean value of the change in light and shadow morphology of each illuminated region in all non-reflective images is obtained as the degree of defect of each illuminated region.

[0114] If the defect level of the light-facing region is greater than a preset first defect threshold but less than a preset second defect threshold, the corresponding light-facing region is designated as a first defect level region; if the defect level of the light-facing region is greater than or equal to a preset second defect threshold, the corresponding light-facing region is designated as a second defect level region; the preset second defect threshold is greater than the preset first defect threshold.

[0115] It should be noted that the greater the degree of defect, the more likely the defect is to occur in the light-facing area, and the greater the severity of the defect. Therefore, the preset second defect threshold is greater than the preset first defect threshold, and the defect degree of the second defect level is greater than that of the first defect level. In one embodiment of the present invention, the preset first defect threshold is 0.45 and the preset second defect threshold is 0.65. In other embodiments of the present invention, the size of the defect threshold can be set according to specific circumstances, and will not be limited or elaborated here.

[0116] Based on this, the light-facing areas at different locations are analyzed to determine whether defects have occurred at the location of the metal protective ring, and the defects are classified into different levels to improve the accuracy of defect detection and classification.

[0117] In summary, this invention obtains multiple connected regions of a surface image based on the grayscale distribution of pixels in the surface image for any given light source angle; obtains the reflectivity of each connected region based on the grayscale distribution of different pixels in each connected region; filters out non-reflective images based on the reflectivity of connected regions in surface images from different light source angles; obtains the shadow and illuminated regions of the non-reflective images based on the grayscale distribution of pixels in the non-reflective images; and obtains the light and shadow morphology variation degree of each illuminated region in each non-reflective image based on the reflectivity of each illuminated region, as well as the positional and morphological characteristics of different shadow and illuminated regions; and performs defect detection and classification on metal protective rings. This invention improves the accuracy of defect detection and classification by accurately obtaining the light and shadow morphology variation of illuminated regions.

[0118] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0119] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A smart detection and classification system for defects in the metal protective ring of a camera, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it performs the following steps: Acquire surface images of the camera's metal protective ring from multiple light source angles; For any light source angle, multiple connected regions of the surface image are obtained based on the gray-level distribution of pixels in the surface image; the reflectance intensity of each connected region is obtained based on the gray-level distribution of different pixels in each connected region; and non-reflective images are selected based on the reflectance intensity of connected regions in the surface image at different light source angles. Based on the grayscale distribution of pixels in the non-reflective image, the shadow area and the illuminated area of ​​the non-reflective image are obtained; based on the reflectivity of each illuminated area in each non-reflective image, as well as the positional and morphological characteristics of different shadow and illuminated areas, the degree of change in the light and shadow morphology of each illuminated area in each non-reflective image is obtained. Based on the positional characteristics of different light-facing areas and the degree of change in light and shadow morphology in all non-reflective images, defects in the metal protective ring are detected and classified. The method for obtaining the degree of change in light and shadow shape includes: Based on the positional and morphological characteristics of different shadow and light regions, the morphological differences between different shadow regions are obtained; For any non-reflective image, obtain the relative distance between the center points of each illuminated region and different shadow regions, and take the shadow region with the closest relative distance as the reference shadow region; obtain the ratio of the number of pixels between each illuminated region and the corresponding reference shadow region as the brightness-to-dark area ratio. Based on the positional characteristics of the illuminated regions in different non-reflective images and the morphological differences of the corresponding reference shadow regions, the overall morphological difference of each illuminated region is obtained. For any non-reflective image, the degree of change in the light and shadow morphology of each illuminated region is obtained based on the reflective intensity, the fluctuation of the light-dark area ratio, and the overall morphological difference of each illuminated region. The reflective intensity is negatively correlated with the degree of change in the light and shadow morphology, while the fluctuation of the light-dark area ratio and the overall morphological difference are both positively correlated with the degree of change in the light and shadow morphology.

2. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 1, characterized in that, The method for obtaining the connected region includes: For any light source angle, obtain multiple edge lines of the surface image. If different edge lines intersect, take the corresponding intersection point as the edge segmentation point. Based on the positional distribution of edge segmentation points on different surface images and the grayscale distribution of pixels, the segmentation effectiveness of each edge segmentation point is obtained; If the segmentation validity of an edge segmentation point is greater than a preset valid threshold, the corresponding edge segmentation point is taken as a valid segmentation point; an edge with two valid segmentation points is taken as a valid edge, and the closed region formed by the valid edges is taken as a connected region.

3. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 2, characterized in that, The method for obtaining segmentation validity includes: For any edge segmentation point of a surface image, if there is an edge segmentation point at the same position on each surface image, the first effective coefficient of the edge segmentation point on each surface image is set to a positive integer 1. Conversely, a second effective coefficient is obtained based on the gray-level range of pixels in the neighborhood of the edge segmentation point at the same position on each surface image, and the minimum positional distance between the edge segmentation point and the edge segmentation point on the surface image. The gray-level range is positively correlated with the second effective coefficient, and the minimum positional distance is negatively correlated with the second effective coefficient. The mean of all first and second effective coefficients corresponding to the edge segmentation points on different surface images is obtained and normalized to serve as the segmentation effectiveness of the edge segmentation points.

4. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 1, characterized in that, The method for obtaining the reflectivity includes: Obtain the average gray value of different pixels in each connected region as the overall gray value of the region; The reflectance intensity of each connected region is obtained based on the grayscale difference between the grayscale values ​​of different pixels in each connected region and the overall grayscale value of the region, as well as the overall grayscale value of the region. Both the grayscale difference and the overall grayscale value of the region are positively correlated with the reflectance intensity.

5. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 1, characterized in that, The method for acquiring the non-reflective image includes: The average reflectance of all connected regions on each surface image is obtained as the average reflectance of each surface image; If the average reflectance of the surface image is less than or equal to the preset reflectance threshold, the corresponding surface image will be treated as a non-reflective image.

6. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 1, characterized in that, The method for obtaining the shadow area and the illuminated area includes: For any non-reflective image, the pixels are clustered based on the gray-level distribution of the pixels in the image to obtain shadow point clusters, light-facing point clusters, and diffuse reflection point clusters; Obtain the average gray level of all pixels in each cluster; designate the cluster with the lowest average gray level as the shadow cluster; and designate the cluster with the highest average gray level as the light cluster. The area formed by consecutive adjacent shadow points is taken as the shadow region; the area formed by consecutive adjacent ray points is taken as the ray region.

7. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 1, characterized in that, The method for obtaining the morphological difference includes: The fitted line is obtained by fitting the position coordinates of the pixels in each shadow region; the centers of different shadow regions are overlapped and the fitted lines are kept parallel to obtain the number of overlapping pixels with the same position between different shadow regions; the cumulative value of the number of pixels between different shadow regions is obtained. The ratio of the number of pixels between each shadow region and its corresponding adjacent illuminated region is obtained as the shape coefficient of each shadow region. Based on the first ratio of the number of overlaps and the cumulative value of the number of overlaps between different shadow regions, as well as the difference in morphological coefficients, the morphological difference between different shadow regions is obtained. The first ratio is negatively correlated with the morphological difference, while the difference in morphological coefficients is positively correlated with the morphological difference.

8. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 1, characterized in that, The method for obtaining the overall morphological difference includes: For any two non-reflective images, obtain the relative distance between the center positions of the light-facing regions of the non-reflective images, and select the light-facing region corresponding to the smallest relative distance as the light-facing related region; The morphological difference between each illuminated region and the corresponding reference shadow region of other illuminated regions on the corresponding non-reflective image is obtained, as well as the sum of the morphological differences between each illuminated region and the corresponding reference shadow region of other illuminated related regions on the non-reflective image, which is used as the overall morphological difference.

9. The intelligent detection and classification system for defects in the metal protective ring of a camera according to claim 8, characterized in that, The defect detection and classification of the metal protective ring includes: The mean value of the change in light and shadow morphology of each illuminated region in all non-reflective images is obtained as the degree of defect of each illuminated region. If the defect level of the light-facing region is greater than a preset first defect threshold but less than a preset second defect threshold, the corresponding light-facing region is designated as a first defect level region; if the defect level of the light-facing region is greater than or equal to the preset second defect threshold, the corresponding light-facing region is designated as a second defect level region; the preset second defect threshold is greater than the preset first defect threshold.