Automatic light source waveband recommendation method and system for machine vision

By adopting the automatic recommendation method of light source bands in machine vision systems, using adversarial network and texture feature analysis, the light source bands are automatically adjusted, which solves the problems of low efficiency and limited adaptability in the selection of light source bands, and achieves more efficient and accurate defect detection.

CN119625241AActive Publication Date: 2025-03-14CHANGCHUN UNIV OF SCI & TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411730598.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-14
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

The existing machine vision system is less efficient when selecting light source bands, and has limited adaptability and versatility, which affects the accuracy of defect detection.

Method used

Through an automatic recommendation method for light source bands, using color industrial cameras and high-angle ring light sources, combined with adversarial network and texture feature analysis, the light source bands are automatically adjusted to optimize defect detection effects.

Benefits of technology

It improves the accuracy and efficiency of defect detection, reduces manual intervention and optimization time, and enhances the adaptability and versatility of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625241A_ABST
    Figure CN119625241A_ABST
Patent Text Reader

Abstract

The invention relates to a light source waveband automatic recommendation method and system for machine vision, and the method comprises the steps: adjusting the hue of a high-angle annular light source, and enabling a color industrial camera to collect a target object image after each adjustment; marking a target object image; segmenting the defect image; solving a sample average value of the texture feature vectors of the defect image; a color industrial camera collects a target object image under white light, an RGB image is generated through a generator in an adversarial network, and the average value of texture feature vectors of the RGB image is solved; and through a discriminator of the adversarial network, judging whether the two average values reach a mutual adversarial and Nash equilibrium state, if so, judging that the virtual light source generated by the generator is the optimal light source, and outputting an RGB value of the virtual light source as a recommended light source band under the corresponding defect category. According to the invention, the automatic selection of the light source is realized, the acquisition of maximized image information in defect detection can be better improved, and the accuracy degree of defect detection is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision, and in particular to a method and system for automatically recommending light source bands for machine vision. Background Art

[0002] In machine vision, the choice of light source is crucial, which directly affects the quality of the image and the performance of the system. Choosing the right light source band helps improve image quality and the accuracy of information extraction. Different light source bands will have different effects on the reflection, absorption and scattering of the target object. Therefore, in different application scenarios, it is necessary to select the appropriate light source band for specific tasks to achieve the best imaging effect. Traditional methods usually rely on experience and experiments to determine the best light source band, which is subjective and uncertain. Therefore, in order to overcome the problems of traditional light source band selection methods, automated methods can be used to recommend the best light source band. These automated methods can be based on machine learning, data-driven methods, or physical models and simulations.

[0003] Different industries have different requirements for light source color. In the field of medical imaging, for imaging technologies such as X-rays, CT scans, and MRI, the color requirements of the light source are usually not the primary consideration. However, in some cases, such as when used to display and interpret image results, a light source with natural color and consistent color temperature may be more helpful for doctors to make accurate diagnoses. At this time, a common method is to select a light source with a high color rendering index (CRI) to ensure that the image color is true and reliable. In the field of industrial inspection, the color of the light source is crucial for detecting defects, surface features, etc. of the target object. For example, in metal surface inspection, a blue light source with high contrast may be selected to highlight surface defects; while in food packaging inspection, a near-infrared light source may be selected to penetrate the packaging material to detect foreign matter.

[0004] Chinese invention patent CN112232399A discloses a method for detecting defects in automobile seats based on multi-feature fusion machine learning. The method extracts the color and texture features of multi-category automobile seat materials and trains a multi-feature fusion classifier to identify material category information; based on the classification results, defect detection is performed in combination with Blob analysis to determine whether there is damage or stains; the industrial robot receives the defect detection results, grabs the workpiece, and automatically sorts it to the designated areas of material category abnormality, damage, stains, and qualified products. The method is applicable to materials of different colors and materials, and does not require multi-template matching. The industrial robot can automatically sort them to the designated area according to the detection results. The method requires a lot of computing resources and time to train the machine learning model of multi-feature fusion, especially for detection tasks with high precision requirements, which may require the use of complex deep learning models. Moreover, when the production environment changes or new materials are introduced, the model may need to be retrained or adjusted, which increases the difficulty and cost of system maintenance. In addition, the method of the patent mainly focuses on the detection part after the defect detection method, but lacks the early defect collection process.

[0005] Chinese invention patent CN105806849A discloses a system and method for detecting surface defects of automobile seats based on machine vision. The detection system includes a light source device, a single-chip numerical control device, an image acquisition device, an image processing and analysis platform, a database system and a hardware device. After the system acquires images, it judges whether the seat has defects by combining machine vision algorithms such as color recognition and template matching. The key to the defect detection vision solution of this patent is to perform multi-template matching on the detection image through the database system, calculate the similarity with each template in each search space in turn, determine the type of detection image, and then obtain the color and material characteristics of the detection image and compare them with the template data. Because the shapes, colors and other materials of automobile seats are rich, the method of establishing a template for each material and then performing multi-template matching on the material is too inefficient, so the method of this patent can only be used in scenes with fewer defect types or low efficiency requirements. At the same time, the initial cost of this method is high, the number of cameras required is too large, and the machine vision system requires a high initial investment. In terms of adaptability, different light sources and detection strategies may be required for seat surfaces of different materials, colors and textures, and the adaptability and versatility of the system may be limited. In terms of detection range, the system may have limited detection capabilities for some complex, hard-to-detect defects (such as very fine cracks or slight color differences). In addition, factors such as ambient light changes, vibration and dust may affect the stability of image acquisition and processing, thereby affecting the accuracy of the inspection results. Summary of the invention

[0006] In view of the problem that the existing machine vision system has low efficiency, limited adaptability and versatility in selecting light source bands, which affects the accuracy of defect detection, the present invention provides a method and system for automatically recommending light source bands for machine vision.

[0007] To solve the above problems, the present invention adopts the following technical solutions:

[0008] A method for automatically recommending light source bands for machine vision, the method comprising the following steps:

[0009] Step 1: Setting parameters for a color industrial camera, providing the color industrial camera with a high-angle ring light source under the lighting conditions of a dark room, transforming the light source control into an HSV mode, adjusting the hue of the high-angle ring light source according to a preset step length, and each time the hue is adjusted, the color industrial camera captures an image of the target object, and the saturation and brightness of each image remain unchanged;

[0010] Step 2: labeling all target object images captured by the color industrial camera according to defect categories;

[0011] Step 3: For each defect category, segment the marked defect part from the target image to obtain the corresponding defect image;

[0012] Step 4: Convert the defect image into a grayscale image, and calculate the grayscale co-occurrence matrix of the grayscale image. Use the grayscale co-occurrence matrix to estimate the texture features of the target image, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features. Construct a texture feature vector based on each texture feature, and obtain the sample average of the texture feature vector of the defect image, recorded as AVG_base;

[0013] Step 5: The color industrial camera collects the target image under white light, and inputs the target image under white light into the generator in the adversarial network to generate virtual light sources of different colors, assign the RGB colors of the virtual light sources of different colors to the target image under white light, generate RGB images under different virtual illuminations, and calculate the average value of the texture feature vector for each generated RGB image, recorded as AVG_check;

[0014] Step 6: Through the discriminator of the adversarial network, determine whether the sample average AVG_base obtained in step 4 and the average AVG_check obtained in step 5 reach a state of mutual confrontation and Nash equilibrium. If so, determine that the virtual light source generated by the generator is the optimal light source, output the RGB value of the virtual light source, and use the output RGB value as the recommended light source band under the corresponding defect category. The high-angle ring light source controls the brightness and mixing ratio of LEDs of different colors according to the recommended light source band.

[0015] A light source band automatic recommendation system for machine vision, the system comprising a sample placement table, a shading device, a color industrial camera, a high-angle ring light source, a digital constant voltage controller and an image processing platform, the sample placement table is used to place a target object, the shading device provides a dark room dark environment for the color industrial camera to collect an image of the target object, the high-angle ring light source provides lighting conditions for the color industrial camera to collect the target object image in the dark room dark environment, and the color industrial camera sends the collected target object image to the image processing platform, the digital constant voltage controller is connected to the high-angle ring light source and the image processing platform respectively, the digital constant voltage controller adjusts the brightness and mixing ratio of different color LEDs of the high-angle ring light source under the control of the image processing platform, and the image processing platform is configured to execute the steps of the light source band automatic recommendation method for machine vision as described above.

[0016] The beneficial effects of the present invention are:

[0017] The present invention provides a method and system for automatically recommending light source bands for machine vision. The method and system automatically select the light source, that is, automatically select the spectral range of the light source used to collect images. This spectral range improves the display degree of defects, can better improve the acquisition of image information in defect detection, and reduce manual intervention and optimization time. The present invention adapts to the environment and conditions under different light sources, and after calculating the texture difference value and color difference value of the defect part, recommends an optimal light source to shoot the target object sample, thereby greatly improving the accuracy of defect detection of the target object sample, which is very valuable for realizing an intelligent and adaptive machine vision system.

[0018] At the same time, the present invention photographs the target sample in a dark box environment, thus avoiding the interference of stray light and also preventing secondary defects due to environmental factors, thereby improving the accuracy of the experimental results and the reliability of the experiment.

[0019] The present invention combines the previous image acquisition part with the subsequent image processing algorithm to provide a method and system for automatically recommending light source bands. The whole process is relatively complete, which greatly improves the efficiency of target object defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A flowchart of a method for automatically recommending light source wavelength bands according to one embodiment of the present invention;

[0021] Figure 2 A schematic diagram of the structure of an automatic light source band recommendation system according to another embodiment of the present invention;

[0022] Figure 3 is a schematic structural diagram of a shading device;

[0023] Figure 4 The experimental images collected.

[0024] Explanation of the accompanying drawings: 1. Sample placement table; 2. Shading device; 2-1. Industrial aluminum profile frame; 2-2. Black flocked light-absorbing cloth; 2-3. Acrylic plate; 2-4. Black optical light-absorbing paper; 3. Color industrial camera; 4. High-angle ring light source; 5. Digital constant voltage controller; 6. Image processing platform; 7. Camera holder. DETAILED DESCRIPTION

[0025] In order to make the purpose and technical solution of the present invention clearer, the technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0026] In one embodiment, if Figure 1 As shown, this embodiment provides a method for automatically recommending light source bands for machine vision, and the method specifically includes the following steps 1 to 6.

[0027] Step 1: Set parameters for the color industrial camera 3. The high-angle ring light source 4 provides the color industrial camera 3 with lighting conditions in a dark room, and the light source model used by the color industrial camera 3 for data acquisition is the HSV model, that is, the high-angle ring light source 4 transforms the light source control into the HSV mode. The HSV light source divides the hue into a circle from 0° to 360°, representing the color change from red, yellow, green, cyan, blue to purple. Next, adjust the hue of the high-angle ring light source 4 according to the preset step length, and when the light source color changes according to the HSV light source, each time the hue is adjusted, the color industrial camera 3 is driven to collect an image of the target object with the same defect. In this process, the saturation and brightness of each image taken by the color industrial camera 3 remain unchanged. The target images of different defects collected by the color industrial camera 3 are stored in a specified folder. In this embodiment, the value of the preset step length can be selected according to actual needs, and is not limited here. For example, the value range of the preset step length is 5 degrees to 10 degrees.

[0028] Step 2: Use the target detection and labeling tool LabelImg to label all target object images captured by the color industrial camera 3 according to the defect category. For example, for several typical indicators of seat detection: pinholes, scratches, stains, foreign objects, and wrinkles, the five defect categories are labeled as Pinholes, scratches, stains, foreign objects, and wrinkles respectively.

[0029] Step 3: For each defect category, segment the marked defective part from the target object image to obtain the corresponding defective image. In the XML file, Xmin, Ymin, Xmax, and Ymax are usually used to define a bounding box. Xmin represents the x-coordinate of the upper left corner of the bounding box, indicating the leftmost position of the bounding box in the image, and is used to mark the position of the target object in the image; Ymin represents the y-coordinate of the upper left corner of the bounding box, indicating the uppermost position of the bounding box in the image; Xmax represents the x-coordinate of the lower right corner of the bounding box, indicating the rightmost position of the bounding box in the image; Ymax represents the y-coordinate of the lower right corner of the bounding box, indicating the lowermost position of the bounding box in the image. Through the four values ​​of Xmin, Ymin, Xmax, and Ymax, a rectangular area can be uniquely determined to represent the range of the target object in the image. Within this range, the marked defective part is segmented from the sample image to obtain a defective image, denoted as I. n , n=1,2,…N, where N is the total number of target object images captured by the color industrial camera 3 under this defect category.

[0030] Step 4: Due to the defective image I n It is a color HSV image, so this step needs to first transform the defect image I n Convert to grayscale image, calculate the gray-level co-occurrence matrix (GLCM) of the converted grayscale image, and then use the calculated gray-level co-occurrence matrix to estimate various texture features of the corresponding target image, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features. By calculating Contrast, Dissimilarity, Homogeneity, Energy, and Correlation, these features work together to fully describe the characteristics of image texture, including its roughness, uniformity, repeatability, and directionality. Multiple texture features are fused into a texture feature vector, recorded as (Contrast, Dissimilarity, Homogeneity, Energy, Ccorrelation). By calculating the average value F of all features in the texture feature vector (Contrast, Dissimilarity, Homogeneity, Energy, Ccorrelation), the sample average value of the texture feature vector is obtained, recorded as AVG_base, and the form of AVG_base is (F, red, green, blue).

[0031] Step 5: The color industrial camera 3 also separately collects one target object image under white light and one under total darkness, and inputs the target object image under white light into the generator in the adversarial network. Through the generator in the adversarial network, virtual light sources of different colors are generated, and the R, G, and B colors of the virtual light sources of different colors are assigned to the target object image under white light. Under the virtual light source and virtual illumination, each target object image under white light generates an RGB image under different virtual illumination. The average value of the texture feature vector of each generated RGB image is calculated and recorded as AVG_check.

[0032] Similar to obtaining the sample average AVG_base of the texture feature vector, in step 5, after generating the RGB image, first convert the RGB image into a grayscale image, and calculate the grayscale co-occurrence matrix of the grayscale image, and then use the grayscale co-occurrence matrix to estimate various texture features of the corresponding RGB image, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features. A texture feature vector is constructed based on each texture feature, and then the average value of the texture feature vector of the RGB image is obtained by calculating the average value of all features in the texture feature vector, which is recorded as AVG_check, and the form of AVG_check is the same as that of AVG_base.

[0033] Step 6: Use the adversarial network to select the optimal light source. In this step, the discriminator of the adversarial network is used to determine whether the sample average AVG_base obtained in step 4 and the average AVG_check obtained in step 5 have reached a state of mutual confrontation and Nash equilibrium to evaluate whether the optimal light source is selected. When the loss function of the network is in a constant state, it means that the sample average AVG_base and the average AVG_check have reached a state of mutual confrontation and Nash equilibrium. At this time, the virtual light source generated by the generator is determined to be the optimal light source, and the RGB value of the virtual light source is output. The output RGB value is used as the recommended light source band. The high-angle ring light source 4 controls the brightness and mixing ratio of LEDs of different colors according to the recommended light source band. If the loss function of the network is not in a constant state, an optimal RGB value that has been generated is output.

[0034] The light source band automatic recommendation method proposed in this embodiment selects the processing process and algorithm of the appropriate light source, combines the extracted multiple features, and calculates the average value AVG_check of the texture feature vector of the generated RGB image and the average value AVG_base of the texture feature vector sample of the defect image through weighting or fusion methods, and then uses machine learning or deep learning models, through the mutual confrontation between adversarial networks, Nash equilibrium, and finally outputs the RGB light source value suitable for defect detection, thereby obtaining a light source band for machine vision, improving the efficiency and accuracy of defect detection. Through a large amount of experimental data, the model is trained to learn which light source band can provide the best detection effect under different feature conditions, and the final output RGB value is also corresponding to the defect category.

[0035] In another embodiment, Figure 2 As shown, this embodiment provides an automatic light source band recommendation system for machine vision, which mainly includes a sample placement table 1, a shading device 2, a color industrial camera 3, a high-angle ring light source 4, a digital constant voltage controller 5 and an image processing platform 6.

[0036] The sample placement table 1 is used to place a target object or sample with defects, and is arranged opposite to the color industrial camera 3 .

[0037] The sample placement table 1 is placed inside the shading device 2, and the shading device 2 is used to provide the required dark room environment for the color industrial camera 3 to collect the image of the target object to avoid the interference of natural light.

[0038] The color industrial camera 3 is used to collect the image of the captured target object and transmit the target object image to the image processing platform 6. The color industrial camera 3 is nested and fixed with the high-angle ring light source 4 just above the target object, and collects image data of the target object on the sample placement table 1 just below.

[0039] The high-angle ring light source 4 is used to provide lighting conditions in a dark room environment for the color industrial camera 3 to capture the target object image. It can provide clear and uniform lighting conditions, which is helpful for detecting and identifying defects on the surface of the material.

[0040] The digital constant voltage controller 5 is connected to the high-angle ring light source 4 and the image processing platform 6 respectively. The digital constant voltage controller 5 is used to adjust and control the light source color of the high-angle ring light source 4, collect, transmit and store data, and perform related control operations. The digital constant voltage controller 5 is connected to the high-angle ring light source 4, and can adjust the brightness and mixing ratio of different color LEDs of the high-angle ring light source 4 according to the different background colors of the defective samples and the different colors of the defects, so as to achieve the contrast of features such as pinholes, scratches, stains, foreign matter, wrinkles, etc. on the surface of the sample, so that the color industrial camera 3 can better obtain clear defect features.

[0041] The high-angle ring light source 4 is a multi-color light source system, which is composed of multiple LEDs (Light Emitting Diodes) and can provide light output in multiple colors. It usually includes three LEDs, red (R), green (G) and blue (B), to achieve a wide range of color selection and mixing. The brightness and color intensity of each LED color can be independently adjusted to achieve the desired color effect. Under the control of the image processing platform 6, the digital constant voltage controller 5 is able to control and adjust the brightness and mixing ratio of LEDs of different colors, so that a variety of colors and color temperatures can be produced. The high-angle ring light source 4 is an HSV model, which divides the color tone into a circle from 0° to 360°, representing the color change from red, yellow, green, cyan, blue to purple.

[0042] like Figure 3 As shown, the shading device 2 includes an industrial aluminum profile frame 2-1, a black flocked light-absorbing cloth 2-2, an acrylic plate 2-3, and a black optical light-absorbing paper 2-4. A plurality of acrylic plates 2-3 are sealed with the industrial aluminum profile frame 2-1 by hot melt adhesive, and then the black optical light-absorbing paper 2-4 is pasted on both sides of each acrylic plate 2-3 to create a completely dark environment and completely block interference from external natural light sources. The remaining side of the industrial aluminum profile frame 2-1 is used as an inlet and outlet for taking and placing samples. This inlet is sealed with a black flocked light-absorbing cloth 2-2, and finally a cavity for accommodating the sample placement table 1 and the high-angle annular light source 4 is formed. The shading device 2 in this embodiment can solve the problem of effective image acquisition and processing in a lightless environment, and realizes efficient and reliable image acquisition and processing in a lightless environment.

[0043] The color industrial camera 3 and the high-angle ring light source 4 are nested perpendicular to the sample placement table 1. The color industrial camera 3 is fixed on the acrylic plate 2-3 on the top of the shading device 2 through the camera holder 7. When the color of the high-angle ring light source 4 begins to change, the color industrial camera 3 takes a picture of the target object every time the color of the light source changes, and then stores the captured image in the image processing platform 6.

[0044] Furthermore, the system of this embodiment also includes an expansion dock, and the image processing platform 6 is connected to the color industrial camera 3 via the expansion dock to expand the number of peripheral interfaces.

[0045] After the image processing platform 6 receives the target image captured by the color industrial camera 3, the image processing platform 6 is configured to execute the steps of the automatic light source band recommendation method for machine vision described in the above embodiment. The specific steps are as follows:

[0046] Step 1: The image processing platform 6 sets the parameters of the color industrial camera 3 through the camera driver, and adjusts the hue of the high-angle ring light source 4 according to the preset step length through the digital constant voltage controller 5. When the color of the light source changes according to the HSV light source, the image processing platform 6 drives the color industrial camera 3 to take pictures every time the adjustment changes, and collects an image of the target object with the same defect. In this process, the saturation and brightness of each image taken by the color industrial camera 3 remain unchanged; and the target object images collected by the color industrial camera are stored in a specified folder; in this embodiment, the value range of the preset step length can be 5 degrees to 10 degrees;

[0047] Step 2: The image processing platform 6 uses the target detection and annotation tool LabelImg to annotate all target images captured by the color industrial camera 3 according to defect categories. For example, for several typical indicators of seat inspection: pinholes, scratches, stains, foreign objects, and wrinkles, the five defect categories are annotated as Pinholes, scratches, stains, foreign objects, and wrinkles respectively;

[0048] Step 3: For each defect category, segment the marked defect part from the target object image to obtain the corresponding defect image; in the XML file, Xmin, Ymin, Xmax, and Ymax are usually used to define a bounding box. Xmin represents the x-coordinate of the upper left corner of the bounding box, indicating the leftmost position of the bounding box in the image, and is used to mark the position of the target object in the image; Ymin represents the y-coordinate of the upper left corner of the bounding box, indicating the uppermost position of the bounding box in the image; Xmax represents the x-coordinate of the lower right corner of the bounding box, indicating the rightmost position of the bounding box in the image; Ymax represents the y-coordinate of the lower right corner of the bounding box, indicating the lowermost position of the bounding box in the image. Through the four values ​​of Xmin, Ymin, Xmax, and Ymax, a rectangular area can be uniquely determined to represent the range of the target object in the image. Within this range, the marked defect part is segmented from the sample image to obtain a defect image, denoted as I. n , n=1,2,…N, where N is the total number of target object images captured by the color industrial camera 3 under this defect category;

[0049] Step 4: Due to the defective image I n It is a color HSV image, so this step needs to first transform the defect image I nConvert to a grayscale image, and calculate the Gray-Level Co-occurrence Matrix (GLCM) of the converted grayscale image, and then use the calculated GLCM to estimate various texture features of the corresponding target image, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features; by calculating Contrast, Dissimilarity, Homogeneity, Energy, and Correlation, these features work together to fully describe the characteristics of the image texture, including its roughness, uniformity, repeatability, and directionality; fuse multiple texture features into a texture feature vector, recorded as (Contrast, Dissimilarity, Homogeneity, Energy, Ccorrelation), and calculate the average value F of all features in the texture feature vector (Contrast, Dissimilarity, Homogeneity, Energy, Ccorrelation) to obtain the sample average value of the texture feature vector, recorded as AVG_base, and the form of AVG_base is (F, red, green, blue);

[0050] Step 5: The color industrial camera 3 also separately collects one target image under white light and one under completely dark conditions, and only selects the target image under white light. The target image under white light is input into the generator in the adversarial network. The generator in the adversarial network generates virtual light sources of different colors, and the R, G, and B colors of the virtual light sources of different colors are assigned to the target image under white light. Under the virtual light source and virtual illumination, each target image under white light generates an RGB image under different virtual illumination. The average value of the texture feature vector of each generated RGB image is calculated and recorded as AVG_check;

[0051] Similar to obtaining the sample average AVG_base of the texture feature vector, in step 5, after generating the RGB image, first convert the RGB image into a grayscale image, calculate the grayscale co-occurrence matrix of the grayscale image, and then use the grayscale co-occurrence matrix to estimate the texture features of the corresponding RGB image, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features. A texture feature vector is constructed based on each texture feature, and then the average value of the texture feature vector of the RGB image is obtained by calculating the average value of all features in the texture feature vector, which is recorded as AVG_check, and the form of AVG_check is the same as that of AVG_base;

[0052] Step 6: Use the adversarial network to select the optimal light source. In this step, the discriminator of the adversarial network is used to determine whether the sample average AVG_base obtained in step 4 and the average AVG_check obtained in step 5 have reached a state of mutual confrontation and Nash equilibrium to evaluate whether the optimal light source is selected. When the loss function of the network is in a constant state, it means that the sample average AVG_base and the average AVG_check have reached a state of mutual confrontation and Nash equilibrium. At this time, the virtual light source generated by the generator is the optimal light source, and the RGB value of the virtual light source is output, and the output RGB value is used as the recommended light source band under the corresponding defect category. The image processing platform 6 outputs the optimal RGB value, that is, the recommended light source band to the digital constant voltage controller 5. The digital constant voltage controller 5 controls the high-angle ring light source 4 to control the brightness and mixing ratio of different color LEDs according to the recommended light source band to achieve the optimal light source selection. If the loss function is not in a constant state, an optimal RGB value that has been generated is output.

[0053] The following is combined with specific experimental data to illustrate the technical effect of the present invention. With 10 degrees as a step, the hue of the high-angle ring light source 4 is adjusted from 0 to 360 degrees, and the color industrial camera 3 is used to collect 36 color images. In addition, the color industrial camera 3 separately takes one image of the target object in white light and in a completely dark environment. A total of 38 images are collected at one time for one sample. Figure 4 As shown, the sample average value AVG_base (texture, red, green, blue) of the obtained texture feature vector is (2, 14, 12, 16), and the average value AVG_check (texture, red, green, blue) of the texture feature vector recommended by the simulated light source is (3, 15, 17, 14), so the recommended calculated value is the color channel of (3, 15, 17, 14), that is, the most recommended color value is R=255, G=0, B=42, and this color value is transmitted to the digital constant voltage controller 5, so as to select this light source value to shoot similar samples in the future.

[0054] The present invention can improve detection accuracy and reliability and enhance adaptability. Different detection tasks and detected objects perform differently under different light source bands. By automatically recommending suitable light source bands, the contrast and clarity of the image can be maximized, and the details can be enhanced, thereby improving the accuracy and reliability of detection. By selecting the most suitable light source band, false detections and missed detections caused by inappropriate lighting can be significantly reduced, thereby ensuring the accuracy of the detection results.

[0055] In addition, the present invention improves the efficiency and automation of the machine vision system, reduces the reliance on manual experience, and improves the automation of the machine vision system by automatically recommending the light source band through the system, thereby reducing the requirements for the professional knowledge of the operator. The light source band automatic recommendation system can dynamically adjust the light source band according to the real-time detection environment and the characteristics of the object being detected, thereby improving the detection efficiency and flexibility.

[0056] The present invention can adapt to a variety of objects and scenes, and can automatically recommend light source bands, so that the machine vision system is suitable for detecting objects of different colors, materials and surfaces, thereby enhancing the versatility and adaptability of the machine vision system. According to environmental changes, the light source band can be automatically adjusted according to changes in ambient light, thereby ensuring that stable detection effects can be obtained under different environmental conditions. Reduce trial and error costs. Traditional methods require a lot of trials and adjustments to determine the optimal light source band. The automatic recommendation method reduces these trial and error processes and reduces the waste of time and resources. By optimizing the light source band, the success rate and efficiency of detection are improved, and the rework and defective rate caused by detection errors are reduced, thereby indirectly reducing production costs.

[0057] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0058] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for automatically recommending light source bands for machine vision, characterized in that: The following steps are involved: Step 1: Setting parameters for a color industrial camera (3), providing a high-angle ring light source (4) in a dark room lighting condition for the color industrial camera (3), converting the light source control into an HSV mode, adjusting the hue of the high-angle ring light source (4) according to a preset step length, and each time the hue is adjusted, the color industrial camera (3) captures an image of the target object, and the saturation and brightness of each image remain unchanged; Step 2: labeling all target object images captured by the color industrial camera (3) according to defect categories; Step 3: For each defect category, segment the marked defect part from the target image to obtain the corresponding defect image; Step 4: Convert the defect image into a grayscale image, and calculate the grayscale co-occurrence matrix of the grayscale image. Use the grayscale co-occurrence matrix to estimate the texture features of the target image, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features. Construct a texture feature vector based on each texture feature, and obtain the sample average of the texture feature vector of the defect image, recorded as AVG_base. Step 5: The color industrial camera (3) captures an image of the target object under white light, and inputs the image of the target object under white light into the generator in the adversarial network to generate virtual light sources of different colors, assign the RGB colors of the virtual light sources of different colors to the image of the target object under white light, and generate RGB images under different virtual lightings. For each generated RGB image, the average value of the texture feature vector is calculated, which is recorded as AVG_check; Step 6: Through the discriminator of the adversarial network, it is determined whether the sample average value AVG_base obtained in step 4 and the average value AVG_check obtained in step 5 reach a mutually confrontational and Nash equilibrium state. If so, it is determined that the virtual light source generated by the generator is the optimal light source, and the RGB value of the virtual light source is output. The output RGB value is used as the recommended light source band under the corresponding defect category. The high-angle ring light source (4) controls the brightness and mixing ratio of LEDs of different colors according to the recommended light source band.

2. The method for automatically recommending light source bands for machine vision according to claim 1, characterized in that: In step 5, after generating RGB images under different virtual illuminations, the RGB images are converted into grayscale images, and the grayscale co-occurrence matrix of the grayscale images is calculated. The grayscale co-occurrence matrix is ​​used to estimate various texture features of the RGB images, including contrast features, heterogeneity features, homogeneity features, energy features, and correlation features. A texture feature vector is constructed based on each texture feature.

3. The method for automatically recommending light source bands for machine vision according to claim 1, characterized in that: The target object image captured by the color industrial camera (3) is stored in a designated folder.

4. The method for automatically recommending light source bands for machine vision according to claim 1, characterized in that: The preset step length ranges from 5 degrees to 10 degrees.

5. An automatic light source band recommendation system for machine vision, characterized in that: The invention comprises a sample placement table (1), a shading device (2), a color industrial camera (3), a high-angle ring light source (4), a digital constant voltage controller (5) and an image processing platform (6), wherein the sample placement table (1) is used to place a target object, the shading device (2) provides a dark room dark environment for the color industrial camera (3) to collect an image of the target object, the high-angle ring light source (4) provides lighting conditions for the color industrial camera (3) to collect an image of the target object in a dark room dark environment, and the color industrial camera (3) sends the collected image of the target object to the image processing platform (6), the digital constant voltage controller (5) is connected to the high-angle ring light source (4) and the image processing platform (6) respectively, and the digital constant voltage controller (5) adjusts the brightness and mixing ratio of different color LEDs of the high-angle ring light source (4) under the control of the image processing platform (6), and the image processing platform (6) is configured to execute the steps of the automatic light source band recommendation method for machine vision as described in any one of claims 1 to 5.

6. The automatic light source band recommendation system for machine vision according to claim 5, characterized in that: The shading device (2) comprises an industrial aluminum profile frame (2-1), one side of the industrial aluminum profile frame (2-1) is sealed by a black flocked light-absorbing cloth (2-2) as an inlet and outlet, and the other side is sealed by an acrylic plate (2-3) to form a cavity for accommodating the sample placement table (1) and the high-angle annular light source (4), and both sides of each acrylic plate (2-3) are covered with black optical light-absorbing paper (2-4).

7. The automatic light source band recommendation system for machine vision according to claim 6, characterized in that: The color industrial camera (3) is fixed on the acrylic plate (2-3) via a camera fixer (7), and the color industrial camera (3) is nested and fixed with the high-angle annular light source (4).

8. The automatic light source band recommendation system for machine vision according to claim 5, characterized in that: It also includes an expansion dock, and the image processing platform (6) is connected to the color industrial camera (3) via the expansion dock.

Citation Information

Patent Citations

  • Automobile seat surface defect detection system based on machine vision as well as detection method

    CN105806849A

  • Automobile seat defect detection method based on multi-feature fusion machine learning

    CN112232399A

  • Image defect detection model training method and device, image defect detection model testing method and device and storage medium

    CN110796637A

  • Co-prime modulation-based silicon-based dual-polarization Fourier transform spectrum detection method

    CN114878477A

  • Computer-implemented recommendation system and visualization for interior design

    WO2023174562A1