CN114219758A - Defect detection method, system, electronic device and computer readable storage medium - Google Patents

Defect detection method, system, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN114219758A
CN114219758A CN202111315995.7A CN202111315995A CN114219758A CN 114219758 A CN114219758 A CN 114219758A CN 202111315995 A CN202111315995 A CN 202111315995A CN 114219758 A CN114219758 A CN 114219758A
Authority
CN
China
Prior art keywords
image
defect
area
region
detected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111315995.7A
Other languages
Chinese (zh)
Inventor
蔡旗
潘华东
殷俊
高美
李中振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202111315995.7A priority Critical patent/CN114219758A/en
Publication of CN114219758A publication Critical patent/CN114219758A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • G06T3/4038Scaling the whole image or part thereof for image mosaicing, i.e. plane images composed of plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/68Analysis of geometric attributes of symmetry

Abstract

The application discloses a defect detection method, a system, an electronic device and a computer readable storage medium, wherein the defect detection method comprises the following steps: acquiring an image group containing a surface to be detected; the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image group comprises a surface to be measured; and performing defect detection on the surface to be detected on the first image and the second image in the image group to obtain a defect pre-detection area corresponding to the surface to be detected. According to the scheme, the accuracy of defect detection can be improved.

Description

Defect detection method, system, electronic device and computer readable storage medium
Technical Field
The present application relates to the field of machine vision technologies, and in particular, to a defect detection method, system, electronic device, and computer-readable storage medium.
Background
In the production process of products, due to the influence of multiple aspects such as environment, equipment and the like, the defects such as scratches and dirt can be generated on the surfaces of the products, the defects on the surfaces of the products seriously affect the quality of the products, the accuracy rate of a manual visual inspection mode in the prior art is low, the efficiency of an intelligent model for analyzing image data is high, but the image data is usually acquired by a camera device at a fixed position and is influenced by a complex environment, and the accuracy rate of defect detection based on the image data of a single view field is also low. In view of the above, how to improve the accuracy of defect detection is an urgent problem to be solved.
Disclosure of Invention
The technical problem mainly solved by the application is to provide a defect detection method, a defect detection system, an electronic device and a computer-readable storage medium, which can improve the accuracy of defect detection.
In order to solve the above technical problem, a first aspect of the present application provides a defect detection method, including: acquiring an image group containing a surface to be detected; the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image group comprises the surface to be detected; and carrying out defect detection on the surface to be detected on the first image and the second image in the image group to obtain a defect pre-detection area corresponding to the surface to be detected.
In order to solve the above technical problem, a second aspect of the present application provides a defect detecting system, including: the device comprises a light source, a camera device and a processor, wherein the light source is used for polishing partial area of a surface to be measured; the camera device is used for collecting the image of the side surface to be detected when the light source irradiates part of the area of the side surface to be detected; a processor is coupled to the camera device for receiving the image captured by the camera device and executing the method of the first aspect.
To solve the above technical problem, a third aspect of the present application provides an electronic device, including: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor calls the program data to execute the method of the first aspect or the second aspect.
In order to solve the above technical problem, a fourth aspect of the present application provides a computer-readable storage medium having stored thereon program data, which when executed by a processor, implements the method of the first aspect or the second aspect.
In the scheme, an image group containing a surface to be detected is obtained, wherein the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the same group comprises the surface to be detected, that is, the obtained first image and the obtained second image in the same group both comprise the high-brightness region and the low-brightness region, and the region formed by splicing the high-brightness regions of the first image and the second image in the same group is larger than or equal to the region corresponding to the surface to be detected, so that the probability that the imaging of a defect part is not clear due to strong reflection of the surface to be detected under a strong illumination condition is reduced, the defect detection of the surface to be detected is carried out on the first image and the second image in the image group to obtain a defect pre-detection region corresponding to the surface to be detected, and further obtain a more accurate defect result from the defect pre-detection region, the accuracy of defect detection is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
FIG. 1 is a schematic flow chart diagram illustrating one embodiment of a defect detection method of the present application;
FIG. 2 is a schematic view of an application scenario of an embodiment of the present application in which a first image and a second image correspond to each other;
FIG. 3 is a schematic flow chart diagram illustrating another embodiment of a defect detection method of the present application;
FIG. 4 is a schematic structural diagram of an embodiment corresponding to the detection module of the present application;
FIG. 5 is a schematic diagram of a defect detection system according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of an embodiment of an electronic device of the present application;
FIG. 7 is a schematic structural diagram of an embodiment of a computer-readable storage medium according to the present application.
Detailed Description
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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, the term "plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a schematic flow chart of an embodiment of a defect detection method according to the present application, the method including:
s101: the method comprises the steps of obtaining an image group containing a surface to be detected, wherein the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image group comprises the surface to be detected.
Specifically, the surface to be measured is polished from different angles at different times by the light source, so that an image group corresponding to the surface to be measured and acquired by the camera device is obtained, and the image group comprises a first image and a second image. The light sources are arranged in groups, each group comprises two light sources and is symmetrically arranged on two sides of the surface to be measured, when the light sources are used for polishing, the light sources arranged in the same group respectively polish partial areas on the surface to be measured, and the camera device collects image data when the light sources are used for polishing. The surface to be measured is one of the surfaces of the object to be measured.
Further, referring to fig. 2, fig. 2 is a schematic view of an application scenario of an embodiment corresponding to a first image and a second image in the present application, where an image acquired when a first light source in the same group is illuminated is defined as a first image as shown in fig. 2 a, and an image acquired when a second light source in the same group is illuminated is defined as a second image as shown in fig. 2B, where a high-luminance area is an area formed on image data after an area of a surface to be measured is exposed by the area illuminated by the light source, and a low-luminance area is an area other than the high-luminance area on the image data.
Furthermore, the area spliced by the high-brightness area of the first image and the high-brightness area of the second image in the image group comprises the surface to be detected, namely, the image spliced by the high-brightness area of the first image and the high-brightness area of the second image in the image group completely comprises the images with the same size corresponding to the surface to be detected, therefore, the light source corresponding to the image group polishes partial area of the surface to be detected when polishing is performed, and the polished area of the light source in the same group completely covers the surface to be detected, so that the probability that the imaging of the defect position is not clear due to strong reflection of the surface to be detected under the strong illumination condition is reduced.
In an application scene, a camera device is installed opposite to a surface to be measured of an object to be measured, even numbers of light sources are distributed according to groups, two light sources in each group are symmetrically arranged on two sides of the object to be measured and form a preset angle (such as 30 degrees, 45 degrees or 60 degrees) with the object to be measured, the light sources are sequentially lightened to polish the surface to be measured, meanwhile, the camera device collects image data corresponding to the surface to be measured at different moments in sequence when the light sources are lightened, and the image data are divided into image groups according to the grouping mode of the light sources.
S102: and performing defect detection on the surface to be detected on the first image and the second image in the image group to obtain a defect pre-detection area corresponding to the surface to be detected.
Specifically, a detection algorithm or a detection module is used for detecting the defects of the to-be-detected surface of the first image and the second image in the image group, so that a defect pre-detection area corresponding to the to-be-detected surface is obtained. The defect pre-detection area is a detection frame including defects on the surface to be detected.
In an application mode, the defect detection of the surface to be detected is carried out on a first image and a second image in a pair of image groups by using a detection model, and the training process of the detection model comprises the following steps: the method comprises the steps of obtaining a first image and a second image, preprocessing the first image and the second image, marking the positions of defects on the images to obtain training image data, inputting the training image data into a detection model to output predicted image data, and optimizing parameters of the detection model based on the position deviation of a defect pre-detection area calibrated on the predicted image data and the training image data until a convergence condition is met to obtain the trained detection model.
In a specific application scenario, the detection model is a double-current convolution network model and comprises a first image channel corresponding to a first image and a second image channel corresponding to a second image, after the trained detection model is obtained, the first image corresponding to the surface to be detected is input into the first image channel, and the second image is input into the second image channel, so that a defect pre-detection area corresponding to the surface to be detected and output by the detection model is obtained.
Further, quantitative analysis is carried out on the defects in the defect pre-detection area, and a defect detection result corresponding to the defects is obtained, wherein the defects include but are not limited to scratches and attachments on the surface of the object to be detected and areas where the surface of the object to be detected does not meet the quality requirement.
In an application scenario, the object to be detected is a camera device, the surface to be detected is a lens of the camera device, the defect is an attachment on the camera lens, and after a defect pre-detection area corresponding to the surface to be detected is obtained, quantitative analysis is performed on the defect pre-detection area, so that the actual length and the actual area of the defect, namely the attachment, are obtained.
In the scheme, an image group containing a surface to be detected is obtained, wherein the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the same group comprises the surface to be detected, that is, the obtained first image and the obtained second image in the same group both comprise the high-brightness region and the low-brightness region, and the region formed by splicing the high-brightness regions of the first image and the second image in the same group is larger than or equal to the region corresponding to the surface to be detected, so that the probability that the imaging of a defect part is not clear due to strong reflection of the surface to be detected under a strong illumination condition is reduced, the defect detection of the surface to be detected is carried out on the first image and the second image in the image group to obtain a defect pre-detection region corresponding to the surface to be detected, and further obtain a more accurate defect result from the defect pre-detection region, the accuracy of defect detection is improved.
Referring to fig. 3, fig. 3 is a schematic flow chart of another embodiment of the defect detection method of the present application, including:
s301: the method comprises the steps of obtaining an image group containing a surface to be detected, wherein the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image group comprises the surface to be detected.
Specifically, the first image and the second image are collected at different times based on different angles of light, the first image and the second image include a first central axis, a region on one side of the first central axis is a high-brightness region, and a region on the other side of the first central axis is a low-brightness region. When a light source irradiates a surface to be detected, a high-brightness area corresponds to a partially-collected graph irradiated by the light source on one side of a central axis, a low-brightness area corresponds to a partially-collected image not irradiated by the light source on the other side of the central axis, for a first image and a second image of the same group, the positions irradiated by the central axis as a boundary light source are opposite when the high-brightness area and the low-brightness area are irradiated twice, so that the first image and the second image acquired by a camera device are exposed at different moments, a splicing area of the high-brightness area of the first image and the high-brightness area of the second image in the same group comprises the surface to be detected, the first image comprises a bright field image corresponding to the high-brightness area and a dark field image corresponding to the low-brightness area, the second image also comprises a bright field image corresponding to the high-brightness area and a dark field image corresponding to the low-brightness area, and therefore the detection caused by the fact that defect characteristic information contained in the single bright field image or dark field image is accurate is reduced The probability of error detection improves the accuracy of defect detection.
S302: and respectively inputting the first image and the second image in the image group into the detection model to obtain fusion characteristics corresponding to the image group, and determining a defect pre-detection area corresponding to the surface to be detected based on the fusion characteristics.
Specifically, the fusion feature is obtained based on a first feature of the first image and a second feature of the second image, and the detection model is obtained by training based on a plurality of historical image groups. The historical image group comprises a first image and a second image.
Further, the detection model at least comprises a first image channel and a second image channel, the detection model is obtained through pre-training based on multiple groups of first images and second images, and the trained detection model is used for calibrating a defect pre-detection area corresponding to the surface to be detected.
In an application manner, please refer to fig. 4, where fig. 4 is a schematic structural diagram of an embodiment corresponding to the detection module of the present application, and a training process corresponding to the detection module includes: the method comprises the steps of obtaining a first image and a second image, carrying out data cleaning and data enhancement on image data, establishing an image data sample set, marking the position of a defect on the image data sample set, inputting the first image into a first image channel, inputting the second image into a second image channel, inputting output characteristics of the two channels into a fusion module, then fusing the characteristics, calibrating a defect pre-detection area on the image data in a pre-detection frame positioning module based on the fusion characteristics, and continuously training an optimization model result by adopting a gradient descent strategy and an Adam optimization function until a convergence condition is met to obtain a trained detection model. By training the dual-channel detection model, the trained detection model can fuse the characteristics of the first image and the second image, and a more accurate defect pre-detection area is obtained based on the fused characteristics.
In an application scene, obtaining an image group, and inputting a first image and a second image in the image group into a detection model respectively to obtain fusion characteristics corresponding to the image group, wherein the steps comprise: performing feature extraction on a first image in the image group based on a first image channel to obtain a first feature; performing feature extraction on a second image in the image group based on a second image channel to obtain a second feature; and fusing the first feature and the second feature to obtain fused features corresponding to the image group.
Specifically, a first image in the same group is input into a first image channel of the detection model, a second image in the same group is input into a second image channel of the detection model, and a first feature corresponding to the first image and a second feature corresponding to the second image are obtained, so that features corresponding to two images with opposite high-brightness areas corresponding to the same surface to be detected are fused, and the fused features are obtained to fully express feature information of the surface to be detected.
In a specific application scene, inputting a first image in the same group into a first image channel and inputting a second image into a second image channel, fusing the first image passing through the first image channel and the second image passing through the second image channel to obtain a fused image and corresponding fusion characteristics on the fused image, and calibrating a defect pre-detection area on a surface to be detected on the fused image based on the fusion characteristics. It can be understood that when a plurality of defects are included on the surface to be detected, a corresponding number of defect pre-inspection areas are calibrated.
In another application scenario, the image group includes a plurality of images, the first image and the second image in the image group are respectively input into the detection model to obtain the fusion features corresponding to the image group, and the defect pre-detection region corresponding to the surface to be detected is determined based on the fusion features, including: respectively inputting a first image and a second image of each image group in the plurality of image groups into a detection model to obtain fusion characteristics corresponding to each image group, and determining a defect pre-detector region corresponding to a surface to be detected based on each obtained fusion characteristic; and determining the area obtained by merging the obtained defect pre-detection areas as the defect pre-detection area corresponding to the surface to be detected.
Specifically, the first image and the second image in each image group are used for acquiring the fusion feature corresponding to each image group based on the mode in the last application scene, the defect pre-detection area corresponding to each image group is calibrated on the fusion feature corresponding to each image group, and then the defect pre-detection areas corresponding to each image group are merged to obtain a more accurate and complete defect pre-detection area corresponding to the surface to be detected, so that the probability of inaccurate detection result caused by the unclear imaging of the defect position in a single image group is reduced.
S303: and expanding the boundary of the defect pre-detection area to obtain a defect quantitative area.
Specifically, the boundary of the defect pre-inspection area is expanded based on the pixel coordinates of the defect pre-inspection area, and an expanded defect quantitative area is obtained.
In an application mode, the defect pre-detection area is corresponding to a rectangular frame, pixel coordinates corresponding to the boundary of the defect pre-detection area are obtained, and preset pixel coordinate values are added on the basis of the pixel coordinates corresponding to the boundary of the defect pre-detection area, so that the boundary of the defect pre-detection area is expanded, an expanded defect quantitative area is obtained, and the edges of the defects are all included in the defect quantitative area. The preset pixel coordinate value may be any one of 5 to 10 pixel coordinate units.
S304: and performing threshold segmentation on the defect quantitative area to obtain a defect positioning area in the defect quantitative area.
Specifically, the defect quantitative region is subjected to adaptive threshold segmentation to obtain a pixel-level positioning mark corresponding to the defect, and the pixel-level positioning mark is the defect positioning region. The adaptive threshold segmentation algorithm includes, but is not limited to, a maximum inter-class variance method and a binarization algorithm.
In an application mode, performing threshold segmentation on the defect quantitative region, and separating a defect positioning region and a background region outside the defect positioning region from the defect quantitative region; and distinguishing the defect positioning area from the background area, and only reserving pixels of the defect positioning area.
Specifically, a defect quantitative region is segmented by using an adaptive threshold segmentation algorithm, a defect positioning region corresponding to the defect and a background region outside the defect positioning region are segmented from the defect quantitative region, the defect positioning region and the background region are distinguished, and only pixels of the defect positioning region are reserved, so that the accuracy of quantitative analysis on the defect positioning pixels is improved.
In a specific application scene, the maximum inter-class variance method is utilized to carry out threshold segmentation on the defect quantitative region to obtain a defect positioning region and a background region, and pixels of the background region are eliminated so as to only reserve the pixels of the defect positioning region.
S305: and determining the defect area and the defect length corresponding to the defect positioning area from the defect positioning area.
Specifically, pixels in the defect positioning region are mapped to the actual size, so that the defect area and the defect length corresponding to the defect positioning region are obtained, and quantitative analysis of the defect positioning region is realized.
In an application mode, acquiring a first number of pixels in a defect positioning area, and mapping the first number to an actual size to determine a defect area corresponding to the defect positioning area; and performing skeleton extraction on the defect positioning area to obtain a defect skeleton arranged by single pixels, obtaining a second number of pixels in the defect skeleton, and mapping the second number to an actual size to determine the defect length corresponding to the defect positioning area.
Specifically, the first number of pixels in the defect localization area is counted to obtain the number of pixels in the defect localization area, and the size of the pixels is mapped to the actual size to obtain the defect area corresponding to the defect localization area.
Further, firstly, performing skeleton extraction on the defect positioning area to obtain a defect skeleton, changing the defect positioning area into a skeleton with single-pixel arrangement by adopting a skeleton extraction method, namely arranging pixels in a short side of the defect positioning area in a single pixel manner to obtain a long side of the defect positioning area, counting a second number of the pixels in the defect skeleton, mapping the size of the pixels to an actual size to obtain a defect length corresponding to the defect positioning area, and realizing the quantification of the defect positioning area by mapping the pixels to the actual size, thereby simply and accurately obtaining an actual parameter corresponding to the defect positioning area.
Optionally, in response to the defect area and/or the defect length exceeding the corresponding threshold, outputting a defect positioning area and an alarm signal corresponding to the surface to be detected, or in response to the defect area and the defect length not exceeding the corresponding threshold, outputting a qualified signal corresponding to the surface to be detected.
In an application scene, a K3M algorithm is used for extracting defect frameworks corresponding to long edges in a defect positioning area, a second number of pixels corresponding to the defect frameworks is further obtained, and then the lengths of the pixels with the second number are mapped to the actual size, so that actual parameters of the defects are obtained.
In this example, the obtained first image and the second image in the same group both include a high-brightness region and a low-brightness region, so that the probability that the imaging of the defect is unclear due to strong reflection of the surface to be detected under a strong illumination condition is reduced, at least one group of the first image and the second image including the high-brightness region and the low-brightness region is input into a detection model to obtain a defect pre-detection region corresponding to the surface to be detected, the boundary of the defect pre-detection region is expanded to obtain a defect quantitative region to improve the detection precision, the defect quantitative region is subjected to threshold segmentation to obtain a defect positioning region, a defect framework is obtained in the defect positioning region through framework extraction, the number of pixels in the defect framework and the number of all pixels in the defect positioning region are counted and are respectively mapped to actual dimensions to obtain the defect length and the defect area.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of a defect detection system 50 according to the present application, including: the device comprises a light source 500, a camera 502 and a processor 504, wherein the light source 500 is used for shining light to a partial area of the surface to be measured. The camera 502 is used for collecting an image of the side surface when the light source 500 irradiates a partial region of the surface to be measured. The processor 504 is coupled to the camera 502 for receiving the image captured by the camera 502 and executing the method of any of the above embodiments.
Specifically, the light sources 500 are arranged in groups, the number of the light sources 500 in each group is even, the light sources 500 in each group polish partial regions of the surface to be measured at different times, the image pickup device 502 shoots the surface to be measured when the light sources are correspondingly polished, time-sharing exposure of the surface to be measured is realized, the first image and the second image respectively comprise a high-brightness region and a low-brightness region on the first image and the second image corresponding to the same group, and the region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image group comprises the surface to be measured. The processor 504 is coupled to the camera 502 and, after receiving at least one set of the first image and the second image including the surface to be measured, performs the method described in any of the above embodiments.
In the scheme, the light source 500 irradiates light to a partial area of the surface to be detected, the camera device 502 shoots image data when the light source 500 irradiates light to the partial area of the surface to be detected, the processor 504 acquires a first image and a second image containing the surface to be detected from the camera device 502, the first image and the second image are arranged according to groups, wherein the first image and the second image respectively comprise a high-brightness area and a low-brightness area, the area formed by splicing the high-brightness area of the first image and the high-brightness area of the second image in the image group comprises the surface to be detected, that is, the first image and the second image in the same group comprise the high-brightness area and the low-brightness area, so that the probability that the defect position is not clear due to strong reflection of the surface to be detected under the condition of strong illumination is reduced, at least one group of the first image and the second image comprising the high-brightness area and the low-brightness area is input into the detection model, and obtaining a defect pre-inspection area corresponding to the surface to be detected, further obtaining a more accurate defect result from the defect pre-inspection area, and improving the accuracy of defect detection.
Optionally, the even number of light sources 500 are arranged in groups, each group includes two light sources 500 and is symmetrically arranged on both sides of the surface to be detected, and the defect detecting system 50 further includes a controller (not shown) for controlling the light sources 500 in all the groups to sequentially light up and polish partial areas of the surface to be detected, and controlling the camera device 502 to sequentially collect image data of the surface to be detected during the light up. The image data is divided into image groups according to the grouping mode of the light source 500, each image group comprises a first image and a second image, each of the first image and the second image comprises a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image groups comprises a surface to be measured.
In an application scene, an even number of light sources 500 are arranged according to groups, each group comprises two light sources 500, the two light sources 500 in each group are symmetrically arranged on the central axis of the plane where the surface to be detected is located, a controller sends a control command to the light sources 500 and the camera device 502 to enable the light sources 500 in all the groups to be sequentially lightened to polish partial areas on the surface to be detected, the camera device 502 is controlled to sequentially collect image data of the surface to be detected during lightening, images collected by the camera device 502 during respective lightening of the two light sources 500 in the same group are respectively a first image and a second image, the first image and the second image are collected by the camera device 502 after exposure of the photosensitive surface at different moments, one group of image data comprises a high-brightness area and a low-brightness area, and the high-brightness area in one group of image data covers the whole surface to be detected, so that the surface to be detected generates strong reflection to cause defects on the premise that the whole surface to be detected can be obtained under the condition of low-intensity illumination, and the defect position is generated on the premise that the whole surface to be detected can be detected Probability of imaging ambiguity.
Optionally, the center of the light sensing surface on the camera device 502 is directly opposite to the center of the surface to be measured, two connecting lines are respectively corresponding between the centers of the two light sources 500 in each group and the center of the surface to be measured, and an included angle between the two connecting lines corresponding to each group and the plane where the surface to be measured is located is equal. Wherein, the camera 502 is arranged right above the photosensitive surface, the center of the photosensitive surface is over against the center of the surface to be measured so as to be convenient for taking the central area of the image data of the surface to be measured, two connecting lines are respectively corresponding between the centers of the two light sources 500 in each group and the center of the surface to be measured, the included angles between the two connecting lines and the plane of the surface to be measured are equal, so that the light sources 500 in the same group are in a symmetrical state, so that the first image and the second image collected in the same group comprise a first central axis, the area on one side of the first central axis is a high-brightness area, the area on the other side of the first central axis is a low-brightness area, the image data is divided into at least one set of a first image and a second image in a grouping manner of the light source 500, the first image and the second image each include a high luminance region and a low luminance region, and a region formed by the high-brightness region of the first image and the high-brightness region of the second image in the same group is superposed with the surface to be measured.
In a specific application scenario, the image capturing Device 502 is a Charge Coupled Device (CCD) camera, the image capturing Device 502 faces the surface to be detected, two sets of two light sources 500 are provided in each set, the light sources 500 in each set sequentially illuminate the surface to be detected, the image capturing Device 502 collects image data to obtain two sets of first and second images, wherein the first and second images include a first central axis, the first central axis of the first image in one set is perpendicular to the first central axis of the first image in the other set, so as to obtain the first and second images of high and low brightness regions at different angles, and the processor 504 analyzes the image data to obtain a more accurate defect detection result.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of an electronic device 60 of the present application, the electronic device 60 includes a memory 601 and a processor 602 coupled to each other, wherein the memory 601 stores program data (not shown), and the processor 602 invokes the program data to implement the defect detection method in any of the embodiments described above, and for a description of relevant contents, reference is made to the detailed description of the embodiment of the method described above, which is not repeated herein.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of a computer-readable storage medium 70 of the present application, the computer-readable storage medium 70 stores program data 700, and the program data 700 is executed by a processor to implement the defect detection method in any of the above embodiments, and the description of the related contents refers to the detailed description of the above method embodiments, which is not repeated herein.
It should be noted that, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (13)

1. A method of defect detection, the method comprising:
acquiring an image group containing a surface to be detected; the image group comprises a first image and a second image, the first image and the second image respectively comprise a high-brightness region and a low-brightness region, and a region formed by splicing the high-brightness region of the first image and the high-brightness region of the second image in the image group comprises the surface to be detected;
and carrying out defect detection on the surface to be detected on the first image and the second image in the image group to obtain a defect pre-detection area corresponding to the surface to be detected.
2. The defect detection method of claim 1, wherein the first image and the second image are collected at different times based on different angles of illumination, the first image and the second image include a first central axis, a region on one side of the first central axis is a high brightness region, and a region on the other side of the first central axis is a low brightness region.
3. The defect detection method according to claim 1, wherein the step of performing defect detection on the surface to be detected on the first image and the second image in the image group to obtain a defect pre-detection region corresponding to the surface to be detected comprises:
inputting the first image and the second image in the image group into a detection model respectively to obtain fusion features corresponding to the image group, and determining a defect pre-detection area corresponding to the surface to be detected based on the fusion features; the fusion features are obtained based on first features of the first image and second features of the second image, and the detection model is obtained by training based on a plurality of historical image groups.
4. The defect detection method of claim 3, wherein the detection model at least comprises a first image channel and a second image channel, and the step of inputting the first image and the second image in the image group into the detection model respectively to obtain the fused features corresponding to the image group comprises:
performing feature extraction on the first image in the image group based on the first image channel to obtain a first feature; and
performing feature extraction on the second image in the image group based on the second image channel to obtain a second feature;
and fusing the first characteristic and the second characteristic to obtain fused characteristics corresponding to the image group.
5. The defect detection method according to claim 3, wherein the image group comprises a plurality of images, and the step of inputting the first image and the second image in the image group into a detection model respectively to obtain a fusion feature corresponding to the image group and determining the defect pre-inspection region corresponding to the surface to be inspected based on the fusion feature comprises:
inputting the first image and the second image of each image group in the plurality of image groups into a detection model respectively to obtain fusion characteristics corresponding to each image group, and determining a defect pre-detector region corresponding to a surface to be detected based on each obtained fusion characteristic;
and determining the area obtained by merging the obtained defect pre-detection areas as the defect pre-detection area corresponding to the surface to be detected.
6. The method according to claim 1, wherein after the step of detecting the defect of the surface to be detected in the first image and the second image in the image group to obtain the defect pre-inspection area corresponding to the surface to be detected, the method further comprises:
expanding the boundary of the defect pre-detection area to obtain a defect quantitative area;
performing threshold segmentation on the defect quantitative region to obtain a defect positioning region in the defect quantitative region;
and determining the defect area and the defect length corresponding to the defect positioning area from the defect positioning area.
7. The method of claim 6, wherein the step of performing threshold segmentation on the quantitative defect region to obtain a localized defect region in the quantitative defect region comprises:
performing threshold segmentation on the defect quantitative region, and separating the defect positioning region and a background region outside the defect positioning region from the defect quantitative region;
and distinguishing the defect positioning area from the background area, and only reserving pixels of the defect positioning area.
8. The method according to claim 7, wherein the step of determining the defect area and the defect length corresponding to the defect localization area from the defect localization area comprises:
acquiring a first number of pixels in the defect positioning area, and mapping the first number to an actual size to determine a defect area corresponding to the defect positioning area; and performing skeleton extraction on the defect positioning area to obtain a defect skeleton arranged by a single pixel, obtaining a second number of pixels in the defect skeleton, and mapping the second number to an actual size to determine the defect length corresponding to the defect positioning area.
9. A defect detection system, comprising:
the light source is used for polishing a partial area of the surface to be measured;
the camera device is used for collecting the image of the side surface to be detected when the light source irradiates part of the area of the side surface to be detected;
a processor coupled to the camera for receiving images captured by the camera and performing the method of any of claims 1-8.
10. The system of claim 9, wherein an even number of the light sources are arranged in groups, each group including two light sources and being symmetrically arranged on two sides of the surface to be detected, the system further comprising:
the controller is used for controlling the light sources in all the groups to be sequentially lightened to polish partial areas of the surface to be detected, and controlling the camera device to sequentially acquire image data of the surface to be detected during polishing; the image data is divided into image groups according to the grouping mode of the light sources, each image group comprises a first image and a second image, each image comprises a high-brightness area and a low-brightness area, and the area formed by splicing the high-brightness area of the first image and the high-brightness area of the second image in the image groups comprises the surface to be measured.
11. The defect detection system of claim 10, wherein the center of the light sensing surface on the image capturing device is opposite to the center of the surface to be detected, two connecting lines are respectively arranged between the centers of the two light sources in each group and the center of the surface to be detected, and an included angle between each corresponding two connecting lines in each group and the plane of the surface to be detected is equal.
12. An electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program data that the processor calls to perform the method of any of claims 1-8.
13. A computer-readable storage medium, on which program data are stored, which program data, when being executed by a processor, carry out the method of any one of claims 1-8.
CN202111315995.7A 2021-11-08 2021-11-08 Defect detection method, system, electronic device and computer readable storage medium Pending CN114219758A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111315995.7A CN114219758A (en) 2021-11-08 2021-11-08 Defect detection method, system, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111315995.7A CN114219758A (en) 2021-11-08 2021-11-08 Defect detection method, system, electronic device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114219758A true CN114219758A (en) 2022-03-22

Family

ID=80696665

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111315995.7A Pending CN114219758A (en) 2021-11-08 2021-11-08 Defect detection method, system, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114219758A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115100102A (en) * 2022-05-10 2022-09-23 厦门微亚智能科技有限公司 Coated lens defect detection method, device and equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115100102A (en) * 2022-05-10 2022-09-23 厦门微亚智能科技有限公司 Coated lens defect detection method, device and equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN108683907A (en) Optics module picture element flaw detection method, device and equipment
CN107895362B (en) Machine vision method for detecting quality of miniature wiring terminal
CN105812790B (en) Method for evaluating verticality between photosensitive surface and optical axis of image sensor and optical test card
CN112200790B (en) Cloth defect detection method, device and medium
CN111862097A (en) Data enhancement method and device for micro defect detection rate
CN114280075A (en) Online visual inspection system and method for surface defects of pipe parts
CN110706224A (en) Optical element weak scratch detection method, system and device based on dark field image
CN112634203A (en) Image detection method, electronic device and computer-readable storage medium
CN112595496A (en) Method, device and equipment for detecting defects of near-eye display equipment and storage medium
CN116026843A (en) Battery appearance defect detection method, device and detection system
CN116071315A (en) Product visual defect detection method and system based on machine vision
CN114993614A (en) AR head-mounted equipment testing equipment and testing method thereof
CN114612418A (en) Method, device and system for detecting surface defects of mouse shell and electronic equipment
CN114219758A (en) Defect detection method, system, electronic device and computer readable storage medium
CN113781393A (en) Screen defect detection method, device, equipment and storage medium
CN113189005A (en) Portable surface defect integrated detection device and surface defect automatic detection method
CN111563869B (en) Stain test method for quality inspection of camera module
CN116256366A (en) Chip defect detection method, detection system and storage medium
CN115205288B (en) Industrial defect detection method and device
CN110148141A (en) A kind of silk-screen optical filter small pieces detection method of counting and equipment
CN116091506A (en) Machine vision defect quality inspection method based on YOLOV5
CN104112266B (en) Image edge blurring detecting method and device
CN111524102B (en) Screen dirt detection method and device of liquid crystal display
JP2007285868A (en) Luminance gradient detection method, flaw detection method, luminance gradient detector and flaw detector
CN111062887B (en) Image definition judging method based on improved Retinex algorithm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination