Defect recognition method of transparent objects to be inspected based on image segmentation
By performing contrast enhancement and sample variance threshold segmentation on images of transparent objects to be inspected, combined with local adaptive threshold segmentation, the problem of distinguishing internal foreign matter and surface foreign matter is solved, achieving accurate defect identification of transparent objects to be inspected, and improving detection efficiency. accuracy and efficiency.
Patent Information
- Application Number
- CN202110909232.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-09
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-08-09
AI Technical Summary
During the detection process of transparent objects to be inspected, it is difficult to distinguish between internal foreign matter and surface foreign matter, leading to erroneous identification. It is difficult for the existing technology to effectively identify bright spots, halos and ghosts in optical imaging, affecting the accuracy of defect identification.
Using an image segmentation-based method, potential defect images are obtained through contrast enhancement processing and sample variance threshold segmentation, and local adaptive threshold segmentation is performed to remove potential reflections and accurately identify defect types.
Effectively distinguish potential defects and potential reflections, reduce image boundary interference, improve the accuracy of defect type identification, and avoid misidentifying good products as defective products or missing inspections.
Smart Images

Figure CN113592841B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of machine vision detection, and in particular to a method for identifying defects of transparent objects to be detected based on image segmentation. Background Art
[0002] In assembly line production, transparent or translucent objects such as glass need to be quality inspected. During the inspection process, there are two main types of defects that need to be distinguished: internal foreign matter and surface foreign matter. If a product has internal foreign matter, it will be classified as a defective product and cannot be put on the market. However, in daily production, it is unavoidable that surface foreign matter such as dust and other impurities will adhere to the surface of the product. If internal foreign matter cannot be distinguished from surface foreign matter, surface foreign matter may be mistaken for internal foreign matter, resulting in good products being mistakenly identified as defective products; or internal foreign matter may be mistaken for surface foreign matter, resulting in missed inspections.
[0003] During product inspection, transparent objects have the special properties of "transparency" and "reflection", which results in the optical imaging of defective transparent objects showing different types of "bright spots". Moreover, under the illumination of light sources, halos and shadows may be generated in certain local locations, making it difficult for defect recognition solutions based on computer vision to effectively identify defects.
[0004] Therefore, before performing defect identification on a transparent object to be inspected, it is necessary to effectively segment the bright spot images representing different types, so that the defect type can be accurately identified based on the segmented images later. Summary of the invention
[0005] In order to overcome the problems existing in the related art, the present application provides a method for defect identification of transparent objects to be inspected based on image segmentation, which can effectively segment bright spot images representing different types, and then accurately identify the defect type based on the segmented images.
[0006] The present application provides a method for identifying defects of a transparent object to be inspected based on image segmentation, comprising:
[0007] Acquire a first processed image, where the first processed image is a photographed image of the transparent object to be tested;
[0008] Performing contrast enhancement processing and sample variance threshold segmentation on the first processed image to obtain a second processed image, where the second processed image is an image corresponding to the potential defect;
[0009] Performing region segmentation according to the bright spot image of the first processed image to obtain segmentation position information and a region segmentation image;
[0010] Performing local adaptive threshold segmentation on the region segmented image to obtain a third processed image, wherein the third processed image is an image corresponding to the potential defect and the potential reflection;
[0011] Determine whether there is a local potential defect image at the corresponding image position of the second processed image according to the segmentation position information corresponding to the third processed image; if there is a local potential defect image, remove the image information of the potential defect in the third processed image according to the local potential defect image to obtain an image to be identified that only reflects the potential reflection;
[0012] Defect types of the transparent object to be inspected are identified according to the second processed image and the image to be identified.
[0013] In one embodiment, before performing contrast enhancement processing and sample variance threshold segmentation on the first processed image, the process includes:
[0014] Gaussian filtering is performed on the first processed image to obtain a first processed image after noise reduction.
[0015] In one implementation, the contrast enhancement process is a gamma contrast enhancement process; and the sample variance threshold segmentation is a var-threshold threshold segmentation.
[0016] In one embodiment, performing region segmentation according to the bright spot image of the first processed image to obtain segmentation position information and a region segmentation image includes:
[0017] S1, obtaining a bright spot image in the first processed image;
[0018] S2, taking the center point of the current bright spot image as the center, setting a region segmentation frame in the first processed image to obtain a region segmentation image corresponding to the current bright spot image;
[0019] S3, determining whether there are bright spot images in the first processed image that have not yet been segmented; if so, executing step S1; if not, executing step S4;
[0020] S4. Segment the image according to the regions of all the bright spot images in the first processed image, and determine segmentation position information corresponding to each bright spot image.
[0021] In one implementation, the size of the region segmentation frame is determined according to the following formula, including:
[0022]
[0023] Among them, R is the radius of the largest inscribed circle in the region segmentation frame, L is the height of potential surface foreign matter, is the light source angle between the irradiation light source and the horizontal plane where the transparent object to be inspected is located, is the refraction angle of the irradiation light source on the transparent object to be tested, and h is the thickness of the transparent object to be tested.
[0024] In one embodiment, Determined according to the following formula, including:
[0025]
[0026] Wherein, n is the refractive index of the transparent object to be tested.
[0027] In one embodiment, the step of identifying the defect type of the transparent object to be inspected according to the second processed image and the image to be identified includes:
[0028] Analyzing the correlation between the image to be identified and the bright spot image in the local potential defect image, the local potential defect image includes the first bright spot image and / or the second bright spot image, and the image to be identified includes the third bright spot image, wherein the grayscale value of the third bright spot image is smaller than the first bright spot image or the second bright spot image;
[0029] If the third bright spot image is a reflection of one of the bright spot images of the local potential defect image, then determining that the one of the bright spot images is the first bright spot image, and determining that the defect at the position corresponding to the first bright spot image is a surface foreign body;
[0030] It is determined that the remaining bright spot images in the local potential defect image except the first bright spot image are second bright spot images, and it is determined that the defect at a position corresponding to the second bright spot image is an internal foreign body.
[0031] In one embodiment, the analyzing the correlation between the image to be identified and the bright spot image in the local potential defect image includes:
[0032] Determine whether the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line; the reflection imaging boundary line is the symmetry axis of the surface foreign matter imaging and the surface foreign matter reflection imaging under the illumination of the light source;
[0033] If not, it is determined that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
[0034] In one embodiment, determining whether the third bright spot image and the bright spot image of the local potential defect image are distributed behind both sides of the reflection imaging boundary line includes:
[0035] If the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line, determining whether the third bright spot image is smaller than the bright spot image of the local potential defect image;
[0036] If not, it is determined that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
[0037] In one embodiment, after determining whether the third bright spot image is smaller than the bright spot image of the local potential defect image, the method further comprises:
[0038] If the third bright spot image is smaller than the bright spot image of the local potential defect image, determining whether the image integrity of the third bright spot image meets the integrity threshold;
[0039] If yes, determining that the bright spot image of the local potential defect image currently being compared is the first bright spot image;
[0040] If not, it is determined that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
[0041] The technical solution provided by this application includes the following beneficial effects:
[0042] In the scheme of the embodiment of the present application, the original image (i.e., the first processed image) is processed by two branches respectively. The first branch is to perform contrast enhancement processing on the original image, sharpen the edge contours of various bright spot images (corresponding to potential defects and potential reflections, respectively) in the original image, and then perform sample variance threshold segmentation. Since the bright spots corresponding to potential defects and potential reflections are different in brightness, the processing of this scheme can effectively distinguish the two (and then segment out independent potential defect images) and remove interference from image boundaries, making the segmentation more accurate; the second branch is to perform local adaptive threshold segmentation on the original image to obtain a third processed image as the potential defect and the potential corresponding image, and then subtract the images obtained by the two branches accordingly, so that an accurate image to be analyzed that only reflects the potential reflection can be obtained, so that accurate defect type identification can be performed based on the image to be analyzed later.
[0043] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and other objects, features and advantages of the present application will become more apparent through a more detailed description of exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.
[0045] Figure 1It is a flow chart of a method for identifying defects of a transparent object to be inspected based on image segmentation according to an embodiment of the present application;
[0046] Figure 2 is a schematic diagram of a lighting system shown in an embodiment of the present application;
[0047] Figure 3 It is a logical schematic diagram of potential defect segmentation shown in an embodiment of the present application;
[0048] Figure 4 is a logical schematic diagram of potential reflection segmentation shown in an embodiment of the present application;
[0049] Figure 5 is a schematic diagram of the process of segmenting a region of interest shown in an embodiment of the present application;
[0050] Figure 6 is a schematic diagram of the principle of setting the size of the region segmentation frame shown in an embodiment of the present application;
[0051] Figure 7 is a schematic diagram of setting the size of the region segmentation frame shown in an embodiment of the present application;
[0052] Figure 8 It is another flow chart of a method for identifying defects of a transparent object to be inspected based on image segmentation shown in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The preferred embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0054] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0055] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0056] During product inspection, transparent objects have the special properties of "transparency" and "reflection", which results in the optical imaging of defective transparent objects showing different types of "bright spots". Moreover, under the illumination of light sources, halos and shadows may be generated in certain local locations, making it difficult for defect recognition solutions based on computer vision to effectively identify defects.
[0057] In view of the above problems, an embodiment of the present application provides a method for identifying defects of transparent objects to be inspected based on image segmentation, which can effectively segment bright spot images representing different types, and then accurately identify the defect type based on the segmented images.
[0058] Embodiment 1
[0059] The embodiment of the present application shows the process of a method for identifying defects in a transparent object to be inspected based on image segmentation. Figure 1 , the embodiment of the transparent object defect recognition method based on image segmentation in the embodiment of the present application includes:
[0060] 101. Acquire a first processed image, where the first processed image is a photographed image of a transparent object to be inspected;
[0061] Specifically, the first processed image can be a direct image obtained by an industrial camera after photographing a transparent object to be inspected (such as glass); it can also be an image obtained by extracting the detection area from the captured image through a region of interest (ROI) (in actual applications, it may not be necessary to inspect the entire piece of glass, so a local detection area can be extracted from the captured image first).
[0062] In actual applications, a transparent object to be inspected is placed in an illumination system, and an industrial camera is used to photograph the transparent object under the illumination of a line scanning light source, thereby obtaining a first processed image. Through the illumination of the line scanning light source in the illumination system, if there are foreign objects on the surface of the transparent object to be inspected (mainly dust), a bright spot image corresponding to the reflection will appear in the first processed image (darker than the bright spot image corresponding to the internal foreign objects). In the embodiment of the present application, the illumination system creates a distinguishing condition for distinguishing whether the foreign objects are on the surface or inside.
[0063] Industrial camera: An industrial camera is a key component in a machine vision system. Its most essential function is to convert optical signals into ordered electrical signals.
[0064] Line scanning light source: also known as linear light source, is a point-shaped light source that can emit continuous visible light. If its light propagates linearly in only one direction in space, then this light point is called a line light source. This definition is only in an ideal state. In reality, for example, car high beams, searchlights, laser pens, etc. have some scattering to the surroundings, but they can all be regarded as line light sources.
[0065] For example, please refer to Figure 2 The transparent object to be inspected is a glass screen, and the type of foreign matter is dust. Figure 2 A line scanning light source is used to illuminate the glass, and an industrial camera is used to photograph the glass to obtain a glass image. The color of the line scanning light source and the brand of the industrial camera are not limited.
[0066] The distance L1 between the line scanning light source and the glass is in the range of 60 mm to 80 mm, and is set to 70 mm in this embodiment. The incident angle γ of the line scanning light source is in the range of 15° to 30°, and is set to 20° in this embodiment.
[0067] The distance between the line scanning light source and the glass is a straight-line distance, and the incident angle of the line scanning light source is an angle between the irradiated light of the line scanning light source and the normal line of the glass.
[0068] The distance L2 between the industrial camera and the glass is in the range of 360 mm to 400 mm, and is set to 380 mm in this embodiment. The shooting angle δ between the camera and the normal line of the glass is in the range of 0° to 45°, and is set to 25° in this embodiment.
[0069] Among them, the distance between the industrial camera and the glass is the straight-line distance, and the shooting angle between the camera and the normal of the glass is the angle between the extension line of the camera lens irradiation direction and the normal of the glass.
[0070] Placing the transparent object to be inspected in the lighting system can illuminate the dust and foreign matter to produce a reflected image. The lighting system parameters are set within the preset range to better play the effect of the lighting system and enable the camera to have a clearer and more efficient shooting effect. The preset lighting system parameters provide parameter support for the inspection personnel to set the subsequent area segmentation frame.
[0071] 102. Perform contrast enhancement processing and sample variance threshold segmentation on the first processed image to obtain a second processed image, where the second processed image is an image corresponding to the potential defect;
[0072] In the embodiment of the present application, contrast enhancement processing is performed on the first processed image to sharpen the image details of the bright spot image in the first processed image, so that the bright spot image corresponding to the surface foreign matter (i.e., the first bright spot image), the bright spot image corresponding to the internal foreign matter (i.e., the second bright spot image), and the bright spot image corresponding to the reflection of the surface foreign matter (i.e., the third bright spot image) can all be clearly displayed. Exemplarily, the contrast enhancement processing is gamma contrast enhancement processing.
[0073] In the embodiment of the present application, after the contrast enhancement processing, sample variance threshold segmentation is further performed. Since "the bright spot image corresponding to the reflection is darker than the bright spot image corresponding to the internal foreign matter", the grayscale value of the third bright spot image will be obviously one level lower. The sample variance threshold segmentation can accurately remove the image part corresponding to the potential reflection in the overlapping bright spot images (there is an intersection between the first bright spot image and the third bright spot image, or there is an intersection between the second bright spot image and the third bright spot image).
[0074] Exemplarily, the sample variance threshold segmentation is var-threshold threshold segmentation. Compared with the local adaptive threshold segmentation (calculating the mean value in the domain minus the set deviation value), the var sample variance threshold segmentation is to calculate the standard variance in the domain multiplied by the standard deviation factor, and then compare it with the set threshold. Since the value of the pixel points at the edge of the image after calculating the standard variance is relatively large, the var sample variance threshold segmentation can remove the interference of the image edge.
[0075] For example, the logic diagram of step 102 can be referred to Figure 3 It can be understood that the ellipse and the square are only used to distinguish the bright spot image corresponding to the defect and the bright spot image corresponding to the reflection, and do not represent the shape structure of the bright spot image itself; in practical applications, the bright spot image can be an irregular shape.
[0076] Optionally, in order to avoid enhancing some image noise points during the subsequent contrast enhancement process, Gaussian filtering may be performed on the first processed image before step 102 to obtain a first processed image after noise reduction to eliminate interference from image noise points.
[0077] 103. Performing region segmentation according to the bright spot image of the first processed image to obtain segmentation position information and a region segmentation image;
[0078] In an embodiment of the present application, each bright spot image in the first processed image is used as a reference to perform region of interest segmentation, and the entire first processed image is divided into N bright spot image corresponding region segmentation images, where N is the number of bright spot images extracted from the first processed image.
[0079] The segmentation position information is position and size information corresponding to the N segmented images.
[0080] The specific implementation of the region of interest segmentation in the embodiment of the present application can be referred to in Example 2, and will not be repeated here.
[0081] It is understandable that there is no strict order between step 102 and step 103, and the execution of step 103 does not depend on the output structure of step 102, that is, step 102 and step 103 can be executed in parallel.
[0082] 104. Perform local adaptive threshold segmentation on the region segmented image to obtain a third processed image, where the third processed image is an image corresponding to the potential defect and the potential reflection;
[0083] In the embodiment of the present application, all bright spot images (including the first bright spot image, the second bright spot image and the third bright spot image, i.e., images corresponding to potential defects and potential reflections) in the regional segmented image can be extracted through local adaptive threshold segmentation to form a third processed image.
[0084] In practical applications, since the region segmentation image extracted by the region of interest segmentation performed in step 103 covers a certain range, the bright spot images near the reference bright spot image or the bright spot images overlapping with the reference bright spot image may be extracted. At this time, it is temporarily unclear whether these bright spot images are the first bright spot images, the second bright spot images or the third bright spot images.
[0085] 105. Determine whether there is a local potential defect image at a corresponding image position of the second processed image according to the segmentation position information corresponding to the third processed image; if there is a local potential defect image, remove the image information of the potential defect in the third processed image according to the local potential defect image to obtain an image to be identified that only reflects the potential reflection;
[0086] In the embodiment of the present application, since the third processed image is a local image based on the region segmentation image for bright spot extraction, and the second processed image is a large image based on the first processed image that only reflects the potential defects, it is necessary to analyze the local position of the second processed image according to the segmentation position information corresponding to the third processed image. If there is a local potential defect image, the image information of the potential defect in the third processed image is removed according to the local potential defect image to obtain an image to be identified that only reflects the potential reflection. For example, you can refer to Figure 4 , wherein the complete reflection image (ie, the image to be identified) can be obtained by using the "defect itself" in the local potential defect image. In practical applications, the image to be identified may include more than one third bright spot image.
[0087] The corresponding image position is the segmentation position information corresponding to the image to be identified in the first processed image.
[0088] 106. Identify the defect type of the transparent object to be inspected according to the second processed image and the image to be identified.
[0089] In step 106, the third bright spot images of the image to be identified may be acquired one by one, and the third bright spot images currently acquired may be compared and analyzed one by one with the local potential defect images (wherein there may be more than one bright spot images) at the corresponding positions in the second processed image, to determine the association between the image to be identified and the bright spot images in the local potential defect images; if the third bright spot image is a reflection of one of the bright spot images in the local potential defect images, then the one of the bright spot images is determined to be the first bright spot image, and the defect at the corresponding position of the first bright spot image is determined to be a surface foreign body; the remaining bright spot images in the local potential defect image except the first bright spot image are determined to be second bright spot images, and the defect at the corresponding position of the second bright spot image is determined to be an internal foreign body.
[0090] Until each third bright spot image in the image to be identified is compared with each bright spot image in the local potential defect image, the current analysis and identification step is completed.
[0091] It is understandable that before analysis and identification, it is only known that the local potential defect image includes the first bright spot image and / or the second bright spot image, but it is unclear which bright spot image is the first bright spot image and which bright spot image is the second bright spot image.
[0092] In practical applications, due to the complex optical imaging environment of the transparent object to be tested, halos and ghost images may be generated, and these halos and ghost images may overlap with the bright spot image, which may increase the area of the bright spot image or interfere with the edge of the bright spot image, causing deviations when comparing the correlation between the bright spot image in the image to be identified and the local potential defect image.
[0093] The embodiment of the present application performs two branches of processing on the original image (i.e., the first processed image). The first branch performs contrast enhancement processing on the original image to sharpen the edge contours of various bright spot images (corresponding to potential defects and potential reflections, respectively) in the original image, and then performs sample variance threshold segmentation. Since the bright spots corresponding to potential defects and potential reflections are different in brightness, the processing of this scheme can effectively distinguish the two (and then segment out independent potential defect images) and remove interference from image boundaries, making the segmentation more accurate; the second branch performs local adaptive threshold segmentation on the original image to obtain a third processed image as the potential defect and the potential corresponding image, and then subtracts the images obtained by the two branches accordingly, so that an accurate image to be analyzed that only reflects the potential reflection can be obtained, which can effectively eliminate the interference of halos and ghost images, so that accurate defect type identification can be performed based on the image to be analyzed later.
[0094] Embodiment 2
[0095] See also Figure 5 The following embodiments describe specific implementations of the region of interest segmentation, including:
[0096] 201. Obtain a bright spot image in the first processed image;
[0097] In the embodiment of the present application, the bright spot images in the first processed image may be traversed in sequence until all the bright spot images have completed the region of interest segmentation.
[0098] 202. Taking the center point of the current bright spot image as the center, set a region segmentation frame in the first processed image to obtain a region segmentation image corresponding to the current bright spot image;
[0099] For example, in the embodiment of the present application, the transparent object to be inspected is a glass screen, and the foreign matter type is dust. Figure 6 The size of the region segmentation frame is calculated according to the optical principle of the light and shadow imaging formed by the line scanning light source irradiating the glass. The region segmentation frame is a rectangular region (in a preferred embodiment, the rectangle of the region segmentation frame is a square), and the radius of the largest inscribed circle in the rectangular region is R. Figure 6 Note that the value of R is the distance between the dust's own imaging point relative to the line scanning light source and the farthest imaging point of the reflection. Figure 7 , where T is the center point of the bright spot image, Figure 7 This is a schematic diagram of setting the region segmentation frame based on the radius of the maximum inscribed circle.
[0100] The size of the region segmentation box is determined according to the following formula, including:
[0101]
[0102] Where R is the radius of the largest inscribed circle in the region segmentation frame,
[0103] L is the potential surface foreign matter height (dust particles in the present embodiment, which can be 0.4 mm),
[0104] is the light source angle between the irradiation light source and the horizontal plane where the transparent object to be inspected is located, and in this embodiment, the value is 70 . Determine the incident angle as =20°.
[0105] The refraction angle of the irradiation light source on the transparent object to be tested can be calculated as For 13
[0106] h is the thickness of the transparent object to be inspected, which is 0.9 mm in this embodiment.
[0107] In the above formula Determined according to the following formula, including:
[0108]
[0109] Wherein, n is the refractive index of the transparent object to be inspected. Depending on the transparent object to be inspected, its refractive index may be different. In this embodiment, the transparent object to be inspected is a glass screen, and the refractive index is 1.5.
[0110] 203. Determine whether there is any bright spot image in the first processed image that has not been segmented;
[0111] If yes, the process returns to step 201 ; if no, the process proceeds to step 204 .
[0112] 204. Segment the image according to the regions of all the bright spot images in the first processed image, and determine segmentation position information corresponding to each bright spot image.
[0113] In the embodiment of the present application, since the radius R of the maximum inscribed circle is the farthest distance of the potential reflection image corresponding to the reference bright spot image. That is, the potential reflection images of all reference bright spot images are included in the segmented region segmentation image, and the image in the frame can be analyzed and processed centrally by setting the region segmentation frame, and the image area irrelevant to the reference bright spot image in the transparent object to be inspected image as the reference can be excluded, thereby reducing the workload and improving the detection efficiency. In addition, the region segmentation image intercepted by the region segmentation frame can cover the potential reflection image of the reference bright spot image as much as possible, thereby improving the accuracy of subsequent analysis.
[0114] Embodiment three.
[0115] Please participate Figure 8 The following embodiment describes a specific implementation method of analyzing the association relationship between the image to be identified and the bright spot image in the local potential defect image, including:
[0116] 301. Determine whether the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line;
[0117] You can refer to Figure 5 The reflection imaging dividing line is the symmetry axis of the surface foreign body imaging and the surface foreign body reflection imaging under the illumination of the light source.
[0118] If yes, execute step 302.
[0119] If not, step 305 is executed to determine that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
[0120] In practical applications, the surface foreign matter imaging and the surface foreign matter reflection imaging are definitely on both sides of the reflection imaging dividing line, and are not images distributed on both sides of the reflection imaging dividing line. The correlation between the two is definitely not the relationship between the surface foreign matter and the surface foreign matter reflection.
[0121] 302. Determine whether the third bright spot image is smaller than the bright spot image of the local potential defect image;
[0122] If the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line, determining whether the third bright spot image is smaller than the bright spot image of the local potential defect image;
[0123] If yes, execute step 303.
[0124] If not, step 305 is executed to determine that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
[0125] In practical applications, according to the characteristics of light, the area of the surface foreign matter image is definitely larger than the area of the surface foreign matter reflection image. Therefore, if the area of the third bright spot image is greater than or equal to the bright spot image in the defect image, the correlation between the two is definitely not the relationship between the surface foreign matter and the surface foreign matter reflection.
[0126] 303. Determine whether the image integrity of the third bright spot image meets the integrity threshold;
[0127] If the third bright spot image is smaller than the bright spot image of the local potential defect image, determining whether the image integrity of the third bright spot image meets the integrity threshold;
[0128] If yes, step 304 is executed to determine that the bright spot image of the local potential defect image currently being compared is the first bright spot image.
[0129] If not, step 305 is executed to determine that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
[0130] In practical applications, the boundary of the region segmentation frame may be within the image range of some bright spot images. Since the size of the region segmentation frame can include the farthest reflected image (i.e., the third bright spot image), the boundary of the region segmentation frame cannot segment the third bright spot image corresponding to the reference bright spot image. On the contrary, if the boundary of the region segmentation frame is within the image range of a certain bright spot image, the bright spot image cannot be the third bright spot image corresponding to the reference bright spot image (the reflection of the reference bright spot image).
[0131] To judge the image integrity of the third bright spot image, the shape of the bright spot image of the local potential defect image can be compared to judge whether the third bright spot image is proportional to the shape of the bright spot image of the local potential defect image. If the shape is incomplete or missing, the image integrity is insufficient. The specific method can be: 1. The shortest distance between the central pixel point of the third bright spot image and the edge of the regional segmentation frame is less than a threshold (the threshold can be set according to actual conditions). 2. The pixel point on the third bright spot image is adjacent to the pixel point on the edge of the regional segmentation frame. If at least one of the above criteria is met, it is considered that the third bright spot image is adjacent to the edge of the bright block regional image.
[0132] 304. Determine the bright spot image of the local potential defect image currently being compared as the first bright spot image;
[0133] 305. Determine the bright spot image of the local potential defect image currently being compared as the second bright spot image.
[0134] In the embodiment of the present application, the correlation between the third bright spot image and the bright spot image of the local potential defect image is analyzed from multiple angles and aspects, and combined with the accurate segmentation results of the potential reflection image and the potential defect image in Example 1, the accuracy of similar foreign matter detection results is greatly improved, avoiding mistaking surface foreign matter for internal foreign matter, resulting in good products being mistakenly identified as defective products; or mistaking internal foreign matter for surface foreign matter, resulting in missed detection.
[0135] The scheme of the present application has been described in detail above with reference to the accompanying drawings. In the above embodiments, the descriptions of the various embodiments have their own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art should also be aware that the actions and systems involved in the specification are not necessarily required for the present application. In addition, it can be understood that the steps in the method of the embodiment of the present application can be adjusted in order, merged and deleted according to actual needs, and the modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0136] In addition, the method according to the present application may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing some or all of the steps in the above method of the present application.
[0137] Alternatively, the present application can also be implemented as a non-temporary machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) on which executable code (or computer program, or computer instruction code) is stored. When the executable code (or computer program, or computer instruction code) is executed by a processor of an electronic device (or electronic device, server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present application.
[0138] Those skilled in the art will further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the application herein may be implemented as electronic hardware, computer software, or combinations of both.
[0139] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system and method according to multiple embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a part of a module, a program segment or a code, and the part of the module, the program segment or the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or the flow chart, and the combination of the square boxes in the block diagram and / or the flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0140] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for identifying defects in transparent objects to be inspected based on image segmentation, characterized in that: include: Acquire a first processed image, where the first processed image is a photographed image of the transparent object to be tested; Performing contrast enhancement processing and sample variance threshold segmentation on the first processed image to obtain a second processed image, where the second processed image is an image corresponding to the potential defect; Performing region segmentation according to the bright spot image of the first processed image to obtain segmentation position information and a region segmentation image; Performing local adaptive threshold segmentation on the region segmented image to obtain a third processed image, wherein the third processed image is an image corresponding to the potential defect and the potential reflection; Determine whether there is a local potential defect image at the corresponding image position of the second processed image according to the segmentation position information corresponding to the third processed image; if there is a local potential defect image, remove the image information of the potential defect in the third processed image according to the local potential defect image to obtain an image to be identified that only reflects the potential reflection; Identifying the defect type of the transparent object to be inspected according to the second processed image and the image to be identified, wherein identifying the defect type of the transparent object to be inspected according to the second processed image and the image to be identified includes: Analyzing the correlation between the image to be identified and the bright spot image in the local potential defect image, the local potential defect image includes the first bright spot image and / or the second bright spot image, and the image to be identified includes the third bright spot image, wherein the grayscale value of the third bright spot image is smaller than the first bright spot image or the second bright spot image; If the third bright spot image is a reflection of one of the bright spot images of the local potential defect image, then determining that the one of the bright spot images is the first bright spot image, and determining that the defect at the position corresponding to the first bright spot image is a surface foreign body; It is determined that the remaining bright spot images in the local potential defect image except the first bright spot image are second bright spot images, and it is determined that the defect at a position corresponding to the second bright spot image is an internal foreign body.
2. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 1, characterized in that: Before performing contrast enhancement processing and sample variance threshold segmentation on the first processed image, the method includes: Gaussian filtering is performed on the first processed image to obtain a first processed image after noise reduction.
3. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 1, characterized in that: The contrast enhancement processing is a gamma contrast enhancement processing; The sample variance threshold segmentation is var-threshold threshold segmentation.
4. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 1, characterized in that: The performing region segmentation according to the bright spot image of the first processed image to obtain segmentation position information and a region segmentation image includes: S1, obtaining a bright spot image in the first processed image; S2, taking the center point of the current bright spot image as the center, setting a region segmentation frame in the first processed image to obtain a region segmentation image corresponding to the current bright spot image; S3, determining whether there are any bright spot images in the first processed image that have not been segmented; if so, executing step S1; if not, executing step S4; S4. Segment the image according to the regions of all the bright spot images in the first processed image, and determine segmentation position information corresponding to each bright spot image.
5. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 4, characterized in that: The size of the region segmentation frame is determined according to the following formula, including: R=L÷tanα+tanβ×h×2 Among them, R is the radius of the largest inscribed circle in the area segmentation frame, L is the potential surface foreign body height, α is the light source angle between the irradiation light source and the horizontal plane where the transparent object to be inspected is located, β is the refraction angle of the irradiation light source on the transparent object to be inspected, and h is the thickness of the transparent object to be inspected.
6. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 5, characterized in that: β is determined according to the following formula, including: β=sin -1 (sin(90°-α)÷n) Wherein, n is the refractive index of the transparent object to be tested.
7. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 1, characterized in that: The analyzing the correlation between the image to be identified and the bright spot image in the local potential defect image includes: Determine whether the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line; the reflection imaging boundary line is the symmetry axis of the surface foreign matter imaging and the surface foreign matter reflection imaging under the illumination of the light source; If not, it is determined that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
8. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 7, characterized in that: The step of determining whether the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line comprises: If the third bright spot image and the bright spot image of the local potential defect image are distributed on both sides of the reflection imaging boundary line, determining whether the third bright spot image is smaller than the bright spot image of the local potential defect image; If not, it is determined that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
9. The method for identifying defects of transparent objects to be inspected based on image segmentation according to claim 8, characterized in that: After determining whether the third bright spot image is smaller than the bright spot image of the local potential defect image, the method includes: If the third bright spot image is smaller than the bright spot image of the local potential defect image, determining whether the image integrity of the third bright spot image meets the requirement; If yes, determining that the bright spot image of the local potential defect image currently being compared is the first bright spot image; If not, it is determined that the bright spot image of the local potential defect image currently being compared is the second bright spot image.
Citation Information
Patent Citations
Method and system for distinguishing surface foreign matter and internal foreign matter of glass
CN110208269A
Method and device for discriminating flaw of glass plate
JP2010249552A
