A visual inspection system for workpiece appearance defects based on image processing

Through image processing technology, the grayscale feature quantity and defectiveness of the pixels on the gear surface are obtained, the grayscale value is adjusted, and the threshold segmentation method is used to identify the defective area, which solves the problem in the existing technology that it is difficult to separate between teeth and tooth defects, and improves the efficiency The quality of the workpiece product.

CN118470016BActive Publication Date: 2024-10-01SUZHOU NUODAJIA AUTOMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410927698.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-01
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

It is difficult to accurately segment the defective areas between the teeth and on the teeth of the workpiece gear surface with the existing technology, resulting in a decrease in product qualification rate and overall quality.

Method used

Through image processing technology, the grayscale feature quantity of each pixel is obtained, the characteristic curve is drawn, the segments are divided, the defectiveness is calculated, the defective degree is obtained, the grayscale value is adjusted according to the defective degree, and the threshold segmentation method is used to identify the defective area.

Benefits of technology

It achieves precise segmentation of defective areas between teeth and on teeth, improves the pass rate and overall quality of workpiece products, and ensures the accuracy of pixel defect degrees.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118470016B_ABST
    Figure CN118470016B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and more specifically, to a visual inspection system for workpiece appearance defects based on image processing. The system includes collecting each frame of gear images, obtaining the grayscale feature quantity of each pixel point of each frame of gear images, and then obtaining each characteristic curve; dividing each characteristic curve into segments; obtaining the defectivity of each data of each segment of each characteristic curve, and then obtaining the defectivity of each pixel point of each frame of gear images; obtaining the adjacent pixel points of each pixel point of each frame of gear images, and then obtaining the representative value of the defectivity of each pixel point of each frame of gear images; obtaining the defectivity of each pixel point of each frame of gear images, and then adjusting the grayscale value of each pixel point of each frame of gear images to obtain each frame of enhanced images, segmenting each frame of enhanced images, and obtaining defect areas. The defect areas segmented by the present invention are more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more specifically, to a visual inspection system for workpiece appearance defects based on image processing. Background Art

[0002] The visual inspection system for workpiece appearance defects based on image processing plays a vital role in the field of industrial automation and quality control. Automatic defect detection can capture images of the workpiece surface through high-precision industrial cameras, and then identify and locate appearance defects such as cracks, bumps, stains, etc. on the workpiece surface. It can accurately measure and identify tiny defects, and timely discover quality problems in the production process to improve the accuracy and consistency of detection, reduce defective output, and improve production efficiency. Thereby improving the product qualification rate and overall quality.

[0003] The patent document with the authorization announcement number CN109544506B currently discloses a method and device for detecting appearance defects of workpieces, which obtains the grayscale value of each pixel point of the image corresponding to the workpiece from the workpiece detection image; determines the maximum grayscale value and the median grayscale value from the grayscale values ​​of each pixel point, wherein the median grayscale value is the grayscale value corresponding to the largest number of pixels with the same grayscale value; determines the grayscale value threshold corresponding to the defective pixel point based on the maximum grayscale value and the median grayscale value, and regards the pixel point whose grayscale value is less than the grayscale value threshold as the defective pixel point.

[0004] The above method determines the grayscale value threshold corresponding to the defective pixel point, and regards the pixel point with a grayscale value less than the grayscale value threshold as the defective pixel point. However, since the defects of the workpiece gear exist between the teeth and on the teeth, and there are differences in the grayscale values ​​between the teeth and the teeth, and due to the randomness of the defects, the grayscale value threshold corresponding to the defective pixel point cannot be determined, and thus the defective areas between the teeth and on the teeth cannot be accurately segmented, resulting in a decrease in the qualified rate and overall quality of the workpiece product. Summary of the invention

[0005] In order to accurately segment the defective areas between teeth and on teeth and improve the qualified rate and overall quality of workpiece products, the present invention proposes a visual inspection system for workpiece appearance defects based on image processing. The system includes the following modules:

[0006] An image acquisition module, used to acquire each frame of gear image;

[0007] A defect acquisition module is used to acquire the grayscale feature quantity of each pixel in each frame of the gear image; the grayscale feature quantity represents the local difference of the pixel;

[0008] The grayscale feature quantities of the pixels corresponding to the same position in each frame of the gear image are sorted in chronological order and a feature curve is drawn; based on the rotation period of the gear, the feature curve is divided into several segments and the defectivity of the pixels in any curve segment is calculated. for: ; In the formula, is the matching value between the lth segment and the pth segment of the jth characteristic curve, is the absolute value of the difference between the grayscale feature quantities of the vth data in the lth segment and the vth data in the pth segment of the jth characteristic curve; is the number of segments of the jth characteristic curve; represents the serial number of one of the segments of the j-th characteristic curve; the matching value represents the similarity between the two segments;

[0009] A defect degree acquisition module is used to acquire the defect degree of each pixel in each frame of the gear image, wherein the defect degree is positively correlated with the defectivity of the corresponding pixel;

[0010] The defect segmentation module is used to adjust the grayscale value of the pixel point based on the defect degree to obtain each frame of enhanced image; perform defect recognition on each frame of enhanced image to determine whether the workpiece has defects.

[0011] The beneficial effect is that the present invention innovatively proposes to obtain the defect degree of each pixel in the image, wherein the defect degree characterizes the possibility that the pixel is a defective pixel, and adjusts the grayscale value of the pixel according to the defect degree to obtain an enhanced image, so that the difference between the grayscale value of the defective pixel and the grayscale value of the non-defective pixel in the enhanced image is large, and finally the defective area is segmented according to the threshold segmentation method, which solves the problem of the difference in grayscale value between teeth and between teeth, so that the defective areas between teeth and on teeth can be accurately segmented, thereby improving the qualified rate and overall quality of the workpiece product, and the defect degree of the pixel is a result The defectivity of the pixel and the representative value of the defect degree are combined. The defectivity of the pixel is obtained based on the characteristic that the grayscale change of the same pixel in different gear images is fixed and periodic. The greater the defectivity of the pixel, the more likely the pixel is to be a defective pixel. Then, based on the characteristic that the defective pixel has a large defect in continuous frame images, the representative value of the defect degree of the pixel is obtained. Therefore, when the representative value of the defect degree of the pixel and the defectivity of the pixel are larger, the defect degree of the pixel is larger and it is more likely to be a defective pixel. Otherwise, it is more likely to be a non-defective pixel, which makes the defect degree of the pixel more accurate.

[0012] Preferably, the step of obtaining the grayscale feature value of each pixel in each frame of the gear image includes:

[0013] Take each pixel in each frame of the gear image as the central pixel, construct a window, and obtain the window of the central pixel; where the window size is ;

[0014] The product of the sum of the grayscale values ​​of all pixels in the window where the central pixel is located and the grayscale value of the central pixel is taken as the grayscale feature of the central pixel, thereby obtaining the grayscale feature of each pixel in each frame of the gear image.

[0015] The beneficial effect is that: the grayscale values ​​of each pixel and its surrounding pixels are known to be relatively similar, so the grayscale feature value of each pixel is obtained by combining the grayscale values ​​of each pixel and its surrounding pixels, which makes the grayscale feature of each pixel more accurate.

[0016] Preferably, the grayscale feature quantities of the pixels corresponding to the same position in each frame of the gear image are sorted in chronological order to draw a feature curve, including:

[0017] The time of collecting each frame of gear image is used as the horizontal coordinate, and the grayscale feature value of the pixel point corresponding to the same position in each frame of gear image is used as the vertical coordinate to obtain a two-dimensional coordinate system. The grayscale feature values ​​of the pixel points corresponding to the same position of all frame gear images are mapped to the two-dimensional coordinate system to obtain a characteristic curve.

[0018] Preferably, the rotation period of the gear is the ratio of the spacing between adjacent teeth of the gear to the rotation speed of the test bench.

[0019] The beneficial effect is that: it is known that the grayscale change of each pixel point in different gear images is fixed and periodic, so a characteristic curve is drawn according to the grayscale feature value of each pixel point in different gear images and the characteristic curve is divided into segments according to the rotation period of adjacent teeth, so as to facilitate the subsequent acquisition of the defectivity of each pixel point, that is, the possibility of a defective pixel point, by analyzing the similarity between the segments.

[0020] Preferably, the step of obtaining the defect degree of each pixel in each frame of the gear image includes:

[0021] Obtain the defect possibility of each pixel in each frame of gear image;

[0022] The product of the defect possibility and the defectivity of the corresponding pixel point is taken as the defect degree of the corresponding pixel point.

[0023] The beneficial effect is that the defectivity of each pixel and the representative value of the defectivity are combined to obtain the defectivity of each pixel, so that the result of the defectivity is more accurate.

[0024] Preferably, the step of obtaining the defect possibility of each pixel point of each frame of gear image includes:

[0025] Obtain the adjacent pixels of any pixel of each frame of the gear image, and use the average of the defectivity of the pixel and its adjacent pixels as the representative value of the defectivity of the pixel;

[0026] Taking any frame of gear image as the target frame image, obtain the sum of the mean of the defect degree representative values ​​of the pixel points in the first k frames of gear image corresponding to the target pixel point of the target frame image and the mean of the defect degree representative values ​​of the pixel points in the last k frames of gear image, and record it as the defect possibility of the target pixel point in the target frame image.

[0027] The beneficial effect is that: the larger the known defectivity of a pixel, the more likely it is to be a defective pixel, and defective pixels in continuous frame gear images have relatively large defects. Because the representative value of the defectivity of the pixel is obtained in combination with this feature, it is more accurate to measure whether the pixel is a defective pixel.

[0028] Preferably, the grayscale value of the pixel is adjusted based on the defect degree to obtain each frame of enhanced image, including:

[0029] The defect degree of each pixel point in each frame of the gear image is multiplied by the grayscale value of the corresponding pixel point as the updated grayscale value of each pixel point in each frame of the gear image to obtain each frame of the enhanced image.

[0030] The beneficial effect is that the grayscale value of the pixel is adjusted according to the defect degree, so that there is a large difference in the grayscale value between the defective pixel low point and the non-defective pixel point. Finally, the defect area segmented by the threshold segmentation method is more accurate, which improves the qualified rate and overall quality of the workpiece product.

[0031] Preferably, the defect recognition of each frame of enhanced image to determine whether the workpiece has defects includes:

[0032] Each frame of enhanced image is segmented using the Otsu threshold segmentation method to identify the defective area in each frame of enhanced image. If any frame of enhanced image and its adjacent frames of enhanced images have defective areas, the workpiece has defects.

[0033] The present invention has the following technical effects: the present invention obtains the defect degree of the pixel point according to the defectivity and the representative value of the defect degree of each pixel point in the original image, the defect degree represents the possibility that the pixel point is a defective pixel point, and adjusts the grayscale value of the pixel point according to the defect degree to obtain an enhanced image, so that the grayscale value of the defective pixel point in the enhanced image is significantly different from the grayscale value of the non-defective pixel point, and finally the defective area is segmented according to the threshold segmentation method, which solves the problem of the difference in grayscale value between the teeth and the teeth, so that the defective area between the teeth and on the teeth can be accurately segmented, thereby improving the qualified rate and overall quality of the workpiece product. Furthermore, the acquisition of the defectivity of the pixel point takes into account the characteristics that the grayscale change of the same pixel point in different gear images is fixed and periodic, and the defective pixel points in the continuous frame images have large defects, and obtains the representative value of the defect degree of the pixel point, so that the defect degree of the pixel point obtained according to the defectivity and the representative value of the defect degree is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0035] Figure 1 The system block diagram of a visual inspection system for workpiece appearance defects based on image processing according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0037] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.

[0038] The present invention provides a visual inspection system for workpiece appearance defects based on image processing. Figure 1As shown, a visual inspection system for workpiece appearance defects based on image processing includes modules 101 to 104, which are described in detail below.

[0039] The image acquisition module 101 acquires each frame of gear image.

[0040] Specifically, the gear is placed on the test bench, the test bench is rotated horizontally at a constant speed for one circle, and a high-definition camera is used to continuously shoot the gear with a shooting interval of 2 seconds per time to obtain an RGB image of each gear frame. In order to facilitate subsequent analysis, each gear image frame is grayscaled to obtain each gear grayscale image frame, and a semantic segmentation algorithm is used to perform semantic segmentation on each gear grayscale image frame to separate the gear area from the background area in each gear grayscale image frame, and the gear area in each gear grayscale image frame is recorded as each gear image frame. It should be noted that the semantic segmentation algorithm is a well-known technology and will not be described in detail in the embodiments of the present invention.

[0041] The defect acquisition module 102 obtains the grayscale feature of each pixel of each frame of the gear image according to the grayscale value of the pixel; obtains each characteristic curve according to the grayscale feature of each pixel of each frame of the gear image, and obtains the defect of each data of each segment of each characteristic curve according to the periodic change of each characteristic curve, thereby obtaining the defect of each pixel of each frame of the gear image.

[0042] It should be noted that it is known that the defects of the workpiece gear exist between the teeth and on the teeth and there are differences in the grayscale values ​​between the teeth and the teeth, that is, the grayscale difference between non-defective pixels is large, and there is a grayscale intersection between non-defective pixels and defective pixels. The defective pixels cannot be distinguished from the non-defective pixels using the grayscale value, that is, the traditional Otsu threshold segmentation method cannot accurately segment the defects between the teeth and on the teeth at the same time. Therefore, it is necessary to increase the grayscale difference between the non-defective pixels and the defective pixels, and enhance each frame of the gear image to achieve accurate segmentation of the defective area.

[0043] It should be further explained that in the process of grayscale enhancement, it is necessary to distinguish between defective pixels and non-defective pixels. Since the light source is fixed and each tooth gap and tooth of the gear are the same when shooting the gear image, the fluctuation of the grayscale change of the same pixel point in each frame of the gear image is fixed and periodic. Since the grayscale value of the pixel point in the gear image is similar to the grayscale value of the surrounding pixels, the grayscale feature value of each pixel point in each frame of the gear image is obtained according to the grayscale value of the pixel point in the gear image and the grayscale value of the surrounding pixels (the grayscale feature value of the pixel point represents the grayscale change of the pixel point). Then, according to the grayscale feature value of the same pixel point in each frame of the gear image, the characteristic curve of the pixel point is drawn. Since the time period for rotating a tooth to the position of its adjacent tooth when the gear rotates on the test table is a cycle, the characteristic curve of the pixel point is divided into segments according to the cycle. Finally, the defective pixels and non-defective pixels are distinguished by analyzing the similarity between the segments.

[0044] In the embodiment of the present invention, the preset window size , taking each pixel of each frame of the gear image as the central pixel, construct The window size is set to obtain the window of each pixel point of each frame of the gear image. In the embodiment of the present invention, the preset window size In other embodiments, implementers can preset the window size according to the specific implementation method. The value of .

[0045] Get the grayscale feature value of the jth pixel of the i-th frame gear image:

[0046] ;

[0047] In the formula, Represents the grayscale feature value of the jth pixel of the i-th frame gear image; Represents the gray value of the jth pixel of the i-th frame gear image; The gray value of the vth pixel in the window representing the jth pixel of the gear image in the i-th frame; The number of pixels in the window representing the jth pixel of the gear image in the i-th frame.

[0048] In an embodiment of the present invention, the grayscale feature value of the j-th pixel point of each frame of the gear image is obtained, and the acquisition time of each frame of the gear image is used as the horizontal coordinate, and the grayscale feature value of the j-th pixel point of each frame of the gear image is used as the vertical coordinate to obtain a two-dimensional coordinate system. The j-th pixel point of all frames of gear images is mapped to the two-dimensional coordinate system to obtain the j-th characteristic curve; similarly, each characteristic curve is obtained.

[0049] It should be noted that a gear is composed of a plurality of teeth. Therefore, in an embodiment of the present invention, the rotation speed of the test bench and the spacing between adjacent teeth of the gear are obtained, and the ratio of the spacing between adjacent teeth of the gear to the rotation speed of the test bench is used as the rotation period of the gear; each characteristic curve is divided into segments according to the rotation period of the gear to obtain a plurality of segments of each characteristic curve.

[0050] It should be noted that it is known that each characteristic curve is divided into segments according to the rotation period of adjacent teeth. The less similar any segment of any characteristic curve is to each other segment, the more likely the data in this segment of the characteristic curve is to be abnormal. And when there is a large difference between the grayscale feature value of any data in this segment of the characteristic curve and that of each other segment, the more likely the data in this segment of the characteristic curve is to be abnormal. Therefore, according to the periodicity of each characteristic curve, the imperfection of each data in each segment of each characteristic curve is obtained.

[0051] In an embodiment of the present invention, a DTW matching algorithm is used to obtain a matching value between the lth segment of the jth characteristic curve and the pth segment of the jth characteristic curve excluding the lth segment, which is recorded as a matching value between the lth segment of the jth characteristic curve and the pth segment of the jth characteristic curve excluding the lth segment.

[0052] Get the imperfection of the vth data of the lth segment of the jth characteristic curve:

[0053] ;

[0054] In the formula, Represents the imperfection of the vth data of the lth segment of the jth characteristic curve; Represents the matching value between the lth segment of the jth characteristic curve and the pth segment of the jth characteristic curve excluding the lth segment. The larger the value, the less similar the lth segment of the jth characteristic curve is to the pth segment of the jth characteristic curve excluding the lth segment. At this time, the defect of the vth data of the lth segment of the jth characteristic curve is relatively large. The absolute value of the difference between the grayscale feature quantity of the vth data of the lth segment of the jth characteristic curve and the vth data of the pth segment excluding the lth segment, the larger the value, the greater the defect of the vth data of the lth segment of the jth characteristic curve; represents the number of segments of the jth characteristic curve; The larger the value of , the greater the defect of the vth data in the lth segment of the jth characteristic curve.

[0055] It should be noted that it is known that each data in each characteristic curve corresponds to each pixel point of each frame image, so the defectivity of each pixel point of each frame gear image is obtained according to the defectivity of each data in each segment of each characteristic curve.

[0056] The defect degree acquisition module 103 acquires the defect degree of each pixel point of each frame of the gear image according to the defectivity of each pixel point of each frame of the gear image.

[0057] It should be noted that the gear image is obtained by placing the gear on the test bench and rotating it horizontally. Therefore, when a defect appears on any frame of the gear image, defects will also appear at the corresponding positions of the multiple frames of gear images following the frame of the gear image. Therefore, the greater the defect of any pixel point in any frame of the gear image, and the greater the defect of the pixel point in the adjacent frame image of the gear image and the adjacent pixel points of the pixel point, it means that the defect degree of the pixel point in the frame of the gear image is large.

[0058] Specifically, the adjacent pixel points of each pixel point of each frame of the gear image are obtained: the number of adjacent pixel points m is preset, and m pixel points on the right side and m pixel points on the left side of each pixel point of each frame of the gear image are obtained as the adjacent pixel points of each pixel point of each frame of the gear image; it should be noted that if the number of pixel points on the right side or left side of any pixel point of any frame image does not meet m, a 0-padding operation is performed on it. In an embodiment of the present invention, the preset number of adjacent pixel points m=7. In other embodiments, the implementer may preset the value of the number of adjacent pixel points m according to the specific implementation method.

[0059] The average of the defectivity of each pixel point of each frame of the gear image and the adjacent pixel points of each pixel point is recorded as the defectivity representative value of each pixel point of each frame of the gear image.

[0060] Get the defect degree of each pixel in each frame of gear image:

[0061]

[0062] In the formula, Represents the defect degree of the jth pixel of the i-th frame gear image; Represents the defectivity of the jth pixel of the i-th gear image. The larger its value is, the higher the defectivity of the jth pixel of the i-th gear image is. The defect degree representative value of the j-th pixel of the gear image in the iz-th frame; represents the defect degree representative value of the jth pixel point of the gear image of the i+zth frame; k represents the number of preset gear images. In the embodiment of the present invention, the number of preset gear images k=5. In other embodiments, the implementer may preset the number of gear images according to the specific implementation situation; The larger the value of , the greater the defectivity of the j-th pixel point of the adjacent frame image of the i-th frame gear image and the adjacent pixel points of the j-th pixel point. Therefore, the greater the defectivity of the j-th pixel point of the i-th frame gear image.

[0063] The defective area segmentation module 104 adjusts the grayscale value of the pixel points based on the defect degree of the pixel points of each frame of the gear image to obtain each frame of enhanced image; performs defect recognition on each frame of enhanced image, and determines whether the workpiece has defects.

[0064] It should be noted that it is known that when the defect degree of any pixel point in any frame of gear image is large, it means that the pixel point may be a pixel point in the defective area. At this time, the grayscale value of the pixel point needs to be increased. When the defect degree of any pixel point in any frame of gear image is small, it means that the pixel point may be a pixel point in the non-defective area. At this time, the grayscale value of the pixel point needs to be reduced to highlight the defective area. When there is a defective area in any frame of gear image, and there are also defective areas in the previous few frames of gear images or the next few frames of gear images of the frame of gear image, there is a defect on the workpiece.

[0065] In an embodiment of the present invention, the number of images is preset to be b, and the defect degree of each pixel point of each frame of the gear image is multiplied by the grayscale value, which is used as the updated grayscale value of each pixel point of each frame of the gear image to obtain each frame of enhanced image. The Otsu threshold segmentation method is used to segment each frame of enhanced image, and the defect area in each frame of enhanced image is identified. If there is a defect area in any frame of enhanced image and the previous b frames of enhanced image or the next b frames of enhanced image, then there is a defect in the workpiece. In an embodiment of the present invention, the number of images is preset to be 4. In other embodiments, the implementer may preset the value of the number of images b according to the specific implementation method.

[0066] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.

[0067] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A visual inspection system for workpiece appearance defects based on image processing, characterized in that: Includes the following modules: An image acquisition module, used to acquire each frame of gear image; A defect acquisition module is used to acquire the grayscale feature quantity of each pixel in each frame of the gear image; the grayscale feature quantity represents the local difference of the pixel; The grayscale feature quantities of the pixel points corresponding to the same position in each frame of the gear image are sorted in chronological order, and a feature curve is drawn; Based on the rotation period of the gear, the characteristic curve is divided into several segments, and the defect of the pixel point in any curve segment is calculated. for: ; In the formula, is the matching value between the lth segment and the pth segment of the jth characteristic curve, is the absolute value of the difference between the grayscale feature quantities of the vth data in the lth segment and the vth data in the pth segment of the jth characteristic curve; is the number of segments of the jth characteristic curve; represents the serial number of one of the segments of the j-th characteristic curve; The matching value represents the similarity between the two segments; The defect degree acquisition module is used to acquire the defect degree of each pixel in each frame of the gear image, including: acquiring the defect possibility of each pixel in each frame of the gear image; multiplying the defect possibility by the defectivity of the corresponding pixel as the defect degree of the corresponding pixel; the defect degree is positively correlated with the defectivity of the corresponding pixel; The method of obtaining the defect possibility of each pixel point of each frame of gear image comprises: obtaining the adjacent pixel points of any pixel point of each frame of gear image, and taking the average of the defectiveness of the pixel point and its adjacent pixel points as the defective degree representative value of the pixel point; taking any frame of gear image as the target frame image, obtaining the sum of the average of the defective degree representative values ​​of the pixel points in the first k frames of gear image corresponding to the target pixel point of the target frame image and the average of the defective degree representative values ​​of the pixel points in the last k frames of gear image, and recording it as the defect possibility of the target pixel point in the target frame image; The defect segmentation module is used to adjust the grayscale value of the pixel point based on the defect degree to obtain each frame of enhanced image; perform defect recognition on each frame of enhanced image to determine whether the workpiece has defects.

2. The visual inspection system for workpiece appearance defects based on image processing according to claim 1 is characterized in that: The step of obtaining the grayscale feature value of each pixel in each frame of the gear image includes: Take each pixel in each frame of the gear image as the central pixel, construct a window, and obtain the window of the central pixel; where the window size is ; The product of the sum of the grayscale values ​​of all pixels in the window where the central pixel is located and the grayscale value of the central pixel is taken as the grayscale feature of the central pixel, thereby obtaining the grayscale feature of each pixel in each frame of the gear image.

3. The visual inspection system for workpiece appearance defects based on image processing according to claim 1, characterized in that: The grayscale feature quantities of the pixels corresponding to the same position in each frame of the gear image are sorted in chronological order. Plot characteristic curves, including: The time of collecting each frame of gear image is used as the horizontal coordinate, and the grayscale feature value of the pixel point corresponding to the same position in each frame of gear image is used as the vertical coordinate to obtain a two-dimensional coordinate system. The grayscale feature values ​​of the pixel points corresponding to the same position of all frame gear images are mapped to the two-dimensional coordinate system to obtain a characteristic curve.

4. The visual inspection system for workpiece appearance defects based on image processing according to claim 1 is characterized in that: The rotation period of the gear is the ratio of the spacing between adjacent teeth of the gear to the rotation speed of the test bench.

5. The visual inspection system for workpiece appearance defects based on image processing according to claim 1 is characterized in that: The step of adjusting the grayscale value of the pixel based on the defect degree to obtain each frame of enhanced image includes: The defect degree of each pixel point in each frame of the gear image is multiplied by the grayscale value of the corresponding pixel point as the updated grayscale value of each pixel point in each frame of the gear image to obtain each frame of the enhanced image.

6. The visual inspection system for workpiece appearance defects based on image processing according to claim 1, characterized in that: The defect recognition of each frame of enhanced image to determine whether the workpiece has defects includes: Each frame of enhanced image is segmented using the Otsu threshold segmentation method to identify the defective area in each frame of enhanced image. If any frame of enhanced image and its adjacent frames of enhanced images have defective areas, the workpiece has defects.