Part defect detection method and system
By fusing the three-axis angular velocity detected by high-frequency and low-frequency angular velocity, a spatial point expansion function is constructed to restore the blurred image and extract the defect area, which solves the problem of low efficiency of traditional detection and improves the efficiency and accuracy of part defect detection.
Patent Information
- Application Number
- CN202411353950.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-10-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional parts defect detection methods rely on manual spot inspection, which is difficult to meet the needs of large-scale quality inspection. Moreover, the chatter of the image acquisition device causes a decrease in imaging quality and affects the efficiency of defect detection.
A high-frequency angular velocity detection device and a low-frequency angular velocity detection device are used to measure the three-axis angular velocity, and a spatial point expansion function is constructed through data fusion to restore the blurred image, perform threshold segmentation and edge detection, and extract the appearance features of the defective area.
It improves the efficiency of part defect detection, solves the problem of low detection efficiency caused by the vibration of the image acquisition device, and achieves more accurate and faster defect detection.
Smart Images

Figure CN118864313A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular, relates to a method and system for detecting defects in parts. Background Art
[0002] In the industrial manufacturing process, part defect detection can help identify the appearance defects of various industrial products to ensure product quality. Traditional part defect detection methods usually rely on manual sampling, which is difficult to meet large-scale quality inspection needs.
[0003] In recent years, with the continuous advancement of technologies such as industrial imaging, vision-based industrial parts defect detection technology has made significant progress and has become an effective product appearance quality inspection solution.
[0004] In actual usage scenarios, vision-based part defect detection faces the problem of camera jitter. Broadband jitter will lead to a decline in image quality and affect the efficiency of defect detection. Summary of the invention
[0005] The present invention provides a method for detecting defects in parts, which solves the technical problem in the prior art that vibration of an image acquisition device leads to low efficiency in detecting defects in parts.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions to achieve them.
[0007] A method for detecting defects in parts, comprising: Acquire the three-axis high-frequency angular velocity of the image acquisition device within the exposure time period measured by the high-frequency angular velocity detection device; acquire the three-axis low-frequency angular velocity of the image acquisition device within the exposure time period measured by the low-frequency angular velocity detection device; fuse the acquired three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain the fused three-axis angular velocity; Construct a spatial point expansion function based on the fused three-axis angular velocity; Restoring the blurred image acquired by the image acquisition device within the exposure time period using the spatial point expansion function to obtain a restored image; Performing threshold segmentation on the restored image to obtain a defect area; Edge detection and morphological operations are performed on the defect area to extract the appearance features of the defect area.
[0008] In some embodiments of the present application, constructing a spatial point expansion function according to the fused three-axis angular velocity specifically includes: Generating a three-axis angular displacement of a blurred image according to the fused three-axis angular velocity; For each pixel of the blurred image, the following steps are performed to obtain the spatial point spread function corresponding to each pixel: Generate an image displacement of a pixel according to the three-axis angular displacement; Discretizing the image displacement to obtain image displacement trajectory coordinates; According to the coordinates of the image motion trajectory, the spatial point spread function of the pixel is generated.
[0009] In some embodiments of the present application, a total variation regularization algorithm is used to restore a blurred image according to a spatial point spread function to obtain a restored image.
[0010] In some embodiments of the present application, the method of restoring the blurred image using the total variation regularization algorithm according to the spatial point spread function to obtain the restored image specifically includes: The spatial point spread functions of all pixels of the blurred image are constructed into a point spread function matrix; Divide the blurred image into blocks according to a point spread function matrix to obtain corresponding matrix sub-blocks and blurred image sub-blocks; According to the matrix sub-blocks, the corresponding blurred image sub-blocks are restored using the total variation regularization algorithm to obtain restored image sub-blocks; The restored image sub-blocks are stitched together to obtain a complete restored image.
[0011] In some embodiments of the present application, the step of splicing the obtained restored image sub-blocks together to obtain a complete restored image specifically includes: Extend the boundary between adjacent restored image sub-block A and restored image sub-block B outward by a set width L, so that the width of the overlapping area of the two restored image sub-blocks is 2L; The pixel value of the jth pixel in the overlapping area for: ; Where j=1,2,3,…,2L; represents the pixel value of the restored image sub-block A corresponding to the j-th pixel in the overlapping area; Represents the pixel value of the restored image sub-block B corresponding to the j-th pixel point in the overlapping area.
[0012] In some embodiments of the present application, performing threshold segmentation on the restored image to obtain the defect area specifically includes: Calculating the grayscale mean μ and standard deviation δ of the restored image; Calculate image threshold = μ + 3δ; Extracting pixel coordinates of the restored image whose grayscale value is greater than the image threshold; Marking the row coordinates and column coordinates of the smallest rectangle containing the pixel coordinates in the restored image; The rectangular area is cut out to obtain the defect area.
[0013] In some embodiments of the present application, edge detection and morphological operations are performed on the defect area to extract the appearance features of the defect area, specifically including: Performing edge detection on the defective area to obtain the edge of the defective area; A morphological opening operation is performed on the edge of the defect area to obtain the appearance characteristics of the defect area.
[0014] In some embodiments of the present application, the part defect detection method further includes the following steps: The appearance features of the defect area are displayed in the restored image.
[0015] In some embodiments of the present application, the part defect detection method further includes the following steps: The shape features and location information of the defective area are stored in a table and image tags are added.
[0016] A parts defect detection system, comprising: An image acquisition device, which is used to acquire a blurred image during an exposure period; A high-frequency angular velocity detection device, which is used to measure the three-axis high-frequency angular velocity of the image acquisition device during the exposure period; A low-frequency angular velocity detection device, which is used to measure the three-axis low-frequency angular velocity of the image acquisition device during the exposure period; A data fusion module, which is used to fuse the three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain a fused three-axis angular velocity; Image processing module, which is used to: Construct a spatial point expansion function based on the fused three-axis angular velocity; Restoring the blurred image acquired by the image acquisition device within the exposure time period using the spatial point expansion function to obtain a restored image; Performing threshold segmentation on the restored image to obtain a defect area; Edge detection and morphological operations are performed on the defect area to extract the appearance features of the defect area.
[0017] Compared with the prior art, the advantages and positive effects of the present invention are as follows: the part defect detection method and system of the present invention obtain the three-axis high-frequency angular velocity of the image acquisition device measured by the high-frequency angular velocity detection device within the exposure time period; obtain the three-axis low-frequency angular velocity of the image acquisition device measured by the low-frequency angular velocity detection device within the exposure time period; fuse the obtained three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain the fused three-axis angular velocity; construct a spatial point expansion function according to the fused three-axis angular velocity; use the spatial point expansion function to restore the blurred image collected by the image acquisition device within the exposure time period to obtain a restored image; perform threshold segmentation on the restored image to obtain the defect area; perform edge detection and morphological operations on the defect area to extract the appearance characteristics of the defect area; the part defect detection method and system of the present invention solve the technical problem of low efficiency of part defect detection caused by vibration of the image acquisition device in the prior art, and improve the efficiency of defect detection.
[0018] After reading the specific embodiments of the present invention in conjunction with the accompanying drawings, other features and advantages of the present invention will become more clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a structural block diagram of an embodiment of the parts defect detection system proposed by the present invention; Figure 2 It is a schematic diagram of the connection between the three-axis vibration measurement device and the robotic arm; Figure 3 It is a schematic diagram of the structure of the three-axis flutter measurement device; Figure 4 is a flow chart of an embodiment of the method for detecting part defects proposed by the present invention; Figure 5 is a flow chart of an embodiment of a process for constructing a spatial point expansion function; Figure 6 is a flow chart of an embodiment of a blurred image restoration process; Figure 7 is a flow chart of an embodiment of performing threshold segmentation on a restored image; Figure 8 is a flow chart of an embodiment of performing edge detection and morphological operations on defect areas; Fig. 9 is a blurred image acquired by the image acquisition device during the exposure period; Fig.10 is the restored image; Fig.11 is a schematic diagram of the smallest rectangle marked in the restored image; Fig.12 is a schematic diagram of the defect area; Fig.13It is a schematic diagram of the edge of the defect area; Fig.14 It is a schematic diagram of the appearance characteristics of the defect area; Fig.15 It is a schematic diagram of the shape features and position information of the defective area in the restored image.
[0020] Figure numerals: 10, robotic arm; 20, three-axis vibration measurement device; 21, side panel. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0022] In view of the technical problem that the efficiency of part defect detection is low due to the vibration of the image acquisition device, the present invention proposes a part defect detection method and system to improve the efficiency of part defect detection. The part defect detection system and method of the present invention are described in detail below in conjunction with the accompanying drawings and embodiments.
[0023] The part defect detection system of this embodiment includes an image acquisition device, a high-frequency angular velocity detection device, a low-frequency angular velocity detection device, a data fusion module, an image processing module, etc. Figure 1 shown.
[0024] An image acquisition device is used to acquire a blurred image within an exposure time period.
[0025] A high-frequency angular velocity detection device is used to measure the three-axis high-frequency angular velocity of an image acquisition device within an exposure time period.
[0026] A low-frequency angular velocity detection device is used to measure the three-axis low-frequency angular velocity of an image acquisition device within an exposure time period.
[0027] The data fusion module is used to fuse the three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain the fused three-axis angular velocity.
[0028] An image processing module is used to perform the following steps: (1) Constructing a spatial point expansion function based on the fused three-axis angular velocity; (2) Restoring the blurred image acquired by the image acquisition device during the exposure period using a spatial point expansion function to obtain a restored image; (3) Perform threshold segmentation on the restored image to obtain the defect area; (4) Perform edge detection and morphological operations on the defect area to extract the shape features of the defect area.
[0029] An image acquisition device (such as a camera), which is mounted on the robot arm 10, is used to acquire a blurred image of the part during an exposure period.
[0030] The high-frequency angular velocity detection device is installed on the robot arm 10. The high-frequency angular velocity detection device includes three MHD angular velocity sensors. The three MHD angular velocity sensors respectively measure the X-axis high-frequency angular velocity, the Y-axis high-frequency angular velocity, and the Z-axis high-frequency angular velocity of the image acquisition device during the exposure period.
[0031] The low-frequency angular velocity detection device is installed on the mechanical arm 10. The low-frequency angular velocity detection device includes three MEMS gyroscopes. The three MEMS gyroscopes respectively measure the X-axis low-frequency angular velocity, the Y-axis low-frequency angular velocity, and the Z-axis low-frequency angular velocity of the image acquisition device during the exposure period.
[0032] The high-frequency angular velocity detection device and the low-frequency angular velocity detection device constitute a three-axis vibration measurement device 20. The three-axis vibration measurement device 20 is installed on the robot arm 10. Figure 2 As shown, it is used to collect triaxial vibration information. The output signal of the triaxial vibration measurement device 20 is collected by a data acquisition card and transmitted to the data fusion module.
[0033] Assume that the center position of the side panel 21 of the square housing of the three-axis vibration measurement device 20 is taken as the origin of the coordinate system, the length direction of the side panel 21 is taken as the X-axis, and the width direction of the side panel 21 is taken as the Y-axis, and a spatial rectangular coordinate system is established, see Figure 3 When the three-axis vibration measurement device 20 is mounted on the robot arm 10, the length direction of the robot arm 10 is parallel to the X-axis.
[0034] In some embodiments of the present application, an adaptive sequential Kalman filter algorithm is used to perform data fusion, so that the data fusion has higher fusion accuracy.
[0035] The data fusion module uses the adaptive sequential Kalman filter algorithm to fuse the X-axis high-frequency angular velocity and the X-axis low-frequency angular velocity to obtain the fused X-axis angular velocity w x (t).
[0036] The data fusion module uses the adaptive sequential Kalman filter algorithm to fuse the Y-axis high-frequency angular velocity and the Y-axis low-frequency angular velocity to obtain the fused Y-axis angular velocity w Y (t).
[0037] The data fusion module uses the adaptive sequential Kalman filter algorithm to fuse the high-frequency angular velocity of the Z axis with the low-frequency angular velocity of the Z axis to obtain the fused Z-axis angular velocity w Z (t).
[0038] The image processing module can be deployed in the host computer, and the data fusion module can be deployed in the processing unit.
[0039] First, the three-axis vibration measurement device 20 is fixedly connected to the robot arm 10, and the output ends of the six sensors in the three-axis vibration measurement device are connected to the data acquisition end of the processing unit; the processing unit is integrated with a data fusion module; the signal trigger end of the image acquisition device is connected to the digital signal output end of the processing unit. After the detection system is enabled, the host computer is used to control the processing unit to output a pulse signal, and the data fusion algorithm integrated in the processing unit is used to fuse the three-axis angular vibration information to obtain the vibration measurement information within the exposure time period (the fused three-axis angular velocity), and the camera is controlled to trigger imaging to obtain a blurred image under the influence of the vibration, and the host computer is used to read the fused three-axis angular velocity and blurred image within the camera exposure time. The host computer is integrated with an image processing module.
[0040] The part defect detection system of this embodiment executes the following part defect detection method.
[0041] The part defect detection method of this embodiment mainly includes the following steps: Figure 4 shown.
[0042] Step S1: obtaining the three-axis high-frequency angular velocity of the image acquisition device within the exposure time period measured by the high-frequency angular velocity detection device; obtaining the three-axis low-frequency angular velocity of the image acquisition device within the exposure time period measured by the low-frequency angular velocity detection device; fusing the obtained three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain the fused three-axis angular velocity.
[0043] Step S2: construct a spatial point expansion function based on the fused three-axis angular velocity.
[0044] In some embodiments of the present application, step S2 specifically includes the following steps: Figure 5 shown.
[0045] Step S2-1: According to the fused three-axis angular velocity w x (t), w Y (t), w Z (t), the three-axis angular displacement of the generated blurred image , , .
[0046] In this step, the three-axis angular displacement within the exposure time period is calculated using the three-axis angular velocity.
[0047] Assuming that the exposure time is t, the exposure duration is T, and the exposure time period is t~t+T, the three-axis angular velocity signal w in the exposure time period is x (t), wY (t), w Z (t) is numerically integrated to obtain the angular displacement of the camera along the X axis during the exposure period. , the angular displacement along the Y axis , the angular displacement along the Z axis .
[0048] .
[0049] .
[0050] .
[0051] Where: , , They are the X-axis, Y-axis, and Z-axis angular positions of the camera before exposure.
[0052] Step S2-2: For each pixel of the blurred image, execute the following steps S2-2-1 to S2-2-3 to obtain the spatial point spread function corresponding to each pixel.
[0053] Step S2-2-1: Generate the image displacement of the pixel according to the three-axis angular displacement.
[0054] In this step, the image displacement within the exposure time is calculated using the three-axis angular displacement.
[0055] According to the imaging principle, the angular vibration of the Y-axis and Z-axis has a more significant impact on the image quality than the X-axis. Therefore, only the image shift Y(t) in the Y-axis direction and the image shift Z(t) in the Z-axis direction are generated below.
[0056] According to the imaging relationship, it can be concluded that the camera The image shift Y(t) generated by vibration is Image shift Z(t) caused by vibration.
[0057] .
[0058] .
[0059] Where f is the focal length of the camera.
[0060] It is the angle between the pixel M(a,b) in the blurred image and the optical axis of the camera in the Y-axis direction.
[0061] It is the angle between the pixel M(a,b) in the blurred image and the optical axis of the camera and the Z-axis direction.
[0062] a, b represent the horizontal and vertical coordinates of pixel M respectively.
[0063] Step S2-2-2: Discretize the image displacement to obtain the image displacement trajectory coordinates.
[0064] Considering the discreteness of digital images and the discrete information collected by the data acquisition card, the image displacement and Discretize and set the sampling interval to The total number of sampling points during the exposure period is , then: ;
[0065] .
[0066] in, express The image movement trajectory coordinates at time.
[0067] express The Y-axis direction image shift trajectory coordinates at the moment.
[0068] express The coordinates of the image shift trajectory in the Z-axis direction at the moment.
[0069] Step S2-2-3: Generate the spatial point spread function of the pixel according to the image motion trajectory coordinates.
[0070] This step constructs a spatial point spread function based on statistical laws.
[0071] (1) Divide the image motion trajectory coordinates by the size of a single pixel and round them off to get the image motion trajectory coordinates in the pixel coordinate system.
[0072] Assume that the size (length × width) of a single pixel in the imaging system is p y ×p z , the image motion trajectory coordinates along the Y-axis and Z-axis directions , Divide by the size of a single pixel and round off. Using the above relationship, the image motion trajectory coordinates are converted to the pixel coordinate system, and we can get: .
[0073] In the formula, Represents the image motion trajectory coordinates in the pixel coordinate system.
[0074] (2) By counting the number of sampling intervals on each pixel, the light energy distribution on the image point trajectory can be obtained. After normalization, the light energy weight of each pixel can be obtained. The weights of all pixels on the moving trajectory constitute the spatial point spread function.
[0075] First calculate the image motion coordinates of each sampling point , and then count the number of sampling intervals on each pixel.
[0076] By designing the above steps S2-1 to S2-2, the spatial point spread function corresponding to each pixel can be accurately and quickly calculated.
[0077] The angle is explained below , The calculation method of .
[0078] Assume that a pixel point (pixel) corresponding to the position of the part in the blurred image is recorded as point M(a, b), where a and b represent the horizontal and vertical coordinates of the image pixel point respectively. The center pixel point of the image is the geometric center of the image matrix, recorded as point N(width / 2, height / 2). Where width and height represent the width and height of the image size respectively. Calculate the distance between the image pixel point M where the part is located and the image center pixel point N on the Y axis and Z axis and , by and Half the image size, i.e. the number of pixel matrix columns / 2 and number of lines / 2, the proportional coefficients of the imaging system on the Z axis and Y axis are calculated to be k1 and k2.
[0079]
[0080] Using the known Y-axis angle between the optical axis and the camera to the imaging center of the part The Z-axis angle between the optical axis and the camera to the imaging center of the part , combined with the proportional coefficients k1 and k2 calculated above, perform proportional operations respectively.
[0081]
[0082] It is the angle between the optical axis in the Y-axis direction and the imaging center of the camera to the part.
[0083] It is the angle between the optical axis in the Z direction and the imaging center of the camera to the part.
[0084] Thus, the angle between the actual position corresponding to the upper boundary of the image and the camera and the optical axis is obtained. The angle between the actual position corresponding to the right edge of the image and the camera and the optical axis Then, the least squares linear interpolation method is used to fit the part position corresponding to any point M(a, b) in the image to the angle between the camera and the optical axis. and .
[0085]
[0086] Based on the above angle information, repeat steps S2-2-1 to S2-2-3 to respectively calculate the vibration information corresponding to each point of the image, construct different spatial point spread functions for each point of the image, and obtain the spatial point spread function array H.
[0087]
[0088] Step S3: using the spatial point expansion function to restore the blurred image acquired by the image acquisition device during the exposure period to obtain a restored image.
[0089] In some embodiments of the present application, a total variation regularization algorithm is used to restore a blurred image according to a spatial point spread function to obtain a restored image.
[0090] The total variation regularization algorithm is used to smooth and denoise the image to restore the image with good restoration effect.
[0091] In some embodiments of the present application, according to the spatial point spread function, the blurred image is restored using the total variation regularization algorithm to obtain a restored image; specifically, the following steps are included, see Figure 6 shown.
[0092] Step S3-1: constructing a point spread function matrix from the spatial point spread functions of all pixels of the blurred image.
[0093] Step S3-2: Divide the blurred image into blocks according to the point spread function matrix to obtain corresponding matrix sub-blocks and blurred image sub-blocks.
[0094] Each pixel M(a,b) corresponds to a spatial point spread function and the row and column coordinates of the point spread function matrix. The blurred image is divided into blocks according to the coordinates corresponding to the point spread function matrix to obtain the corresponding matrix sub-blocks and blurred image sub-blocks.
[0095] Step S3-3: According to the matrix sub-block, the corresponding blurred image sub-block is restored using the total variation regularization algorithm to obtain a restored image sub-block.
[0096] The total variation regularization algorithm is used to achieve image restoration, and the restoration rule is shown in the following formula.
[0097] .
[0098] Where: represents the objective function; the left side of the plus sign is the fidelity term, is the fidelity term coefficient; the right side of the plus sign is the regularization term, is the regularization term coefficient, which is used to control the weight ratio between the fidelity term and the regularization term.
[0099] Representation calculation Norm.
[0100] Represents the restored image sub-block.
[0101] and Represent the restored image sub-blocks The horizontal and vertical gradients.
[0102] Represents a blurred image sub-block.
[0103] Represents a blurred image sub-block The corresponding matrix sub-block.
[0104] Let the objective function Solve the minimum to get the restored image sub-block .
[0105] Step S3-4: stitching together the restored image sub-blocks to obtain a complete restored image.
[0106] All the restored image sub-blocks are spliced together according to their positional relationship before segmentation to obtain a complete restored image.
[0107] The blurred image captured by the image acquisition device is as follows: Fig. 9 As shown; According to the spatial point spread function, the total variation regularization algorithm is used to restore the blurred image, and the restored image is as follows Fig.10 shown.
[0108] By designing steps S3-1 to S3-4, the point spread function matrix and the blurred image are first divided into blocks to obtain matrix sub-blocks and blurred image sub-blocks, and then the total variation regularization algorithm is used to restore each blurred image sub-block to obtain a restored image sub-block. Finally, the restored image sub-blocks are spliced together to obtain a complete restored image. Through this restoration process, a restored image with good restoration effect can be obtained accurately and quickly.
[0109] In some embodiments of the present application, a pixel of a blurred image is a blurred image sub-block, a spatial point spread function of a point spread function matrix is a matrix sub-block, and a pixel of a restored image is a restored image sub-block.
[0110] In some embodiments of the present application, the restored image sub-blocks are spliced together to obtain a complete restored image, which specifically includes the following steps.
[0111] (1) The boundary between adjacent restored image sub-block A and restored image sub-block B is extended outward by a set width L, so that the two adjacent restored image sub-blocks have an overlapping area, and the width of the overlapping area is 2L.
[0112] (2) The image pixels in the overlapping area are calculated according to different weights, and the weight coefficient is recursively calculated according to 1 / 2L, that is, the weight of the j-th element is (2L-j+1) / 2L and (j-1) / 2L, respectively (j=1,2,3,…2L).
[0113] The pixel value of the jth pixel in the overlapping area for: .
[0114] Among them, j=1,2,3,…,2L.
[0115] Represents the pixel value of the restored image sub-block A corresponding to the j-th pixel point in the overlapping area.
[0116] Represents the pixel value of the restored image sub-block B corresponding to the j-th pixel point in the overlapping area.
[0117] express The weight coefficient of .
[0118] express The weight coefficient of .
[0119] The boundaries of two adjacent restored image sub-blocks are extended outward to form an overlapping area, and the weight value of each pixel in the overlapping area is calculated to improve the clarity of the joint of the two adjacent restored image sub-blocks.
[0120] (3) For the non-overlapping area, the pixel value of each pixel is the pixel value of the corresponding restored image sub-block A or restored image sub-block B.
[0121] (4) After stitching together the restored image sub-blocks, a complete restored image is obtained.
[0122] In another embodiment of the present application, after calculating the spatial point spread function corresponding to each pixel of the blurred image, the total variation regularization algorithm is used to restore each pixel of the blurred image according to the corresponding spatial point spread function to obtain each pixel of the restored image, thereby obtaining the restored image. Using this method, each pixel of the blurred image is directly restored, which is simple and fast.
[0123] Step S4: Perform threshold segmentation on the restored image to obtain the defect area.
[0124] Set μ+3δ as the image threshold to segment the restored image and locate the defect area.
[0125] This step specifically includes the following steps, see Figure 7 shown.
[0126] Step S4-1: Calculate the grayscale mean μ and standard deviation δ of the restored image.
[0127] The calculation formula is as follows: ; δ = 1 n h ⋅ m l ∑ x = 1 n h ∑ y = 1 m l [ u ( x , y ) − μ ] 2 ;
[0128] In the formula, and represents the number of rows and columns of the restored image matrix, and u(x,y) is the grayscale value of the pixel at the position (x,y) of the restored image.
[0129] Step S4-2: Calculate the image threshold = μ + 3δ.
[0130] Step S4-3: extracting pixel coordinates in the restored image whose grayscale values are greater than the image threshold.
[0131] Step S4-4: Mark the row and column coordinates of the smallest rectangle containing these pixel coordinates in the restored image, see Fig.11 shown.
[0132] Step S4-5: Cut out the rectangular area to obtain the defect area, see Fig.12 shown.
[0133] By designing steps S4-1 to S4-5, the image threshold is calculated, the pixel coordinates of the restored image whose grayscale value is greater than the image threshold are extracted, and the row coordinates and column coordinates of the minimum rectangular area containing the extracted pixel coordinates are marked in the restored image, and the restored image is cropped to obtain a local image of the defect area. Through the above steps, the defect area can be quickly and accurately located.
[0134] Step S5: Perform edge detection and morphological operations on the defect area to extract the appearance features of the defect area.
[0135] This step extracts the shape features of the defective area of the part based on edge detection methods and morphological operations.
[0136] This step specifically includes the following steps, see Figure 8 shown.
[0137] Step S5-1: Perform edge detection on the defect area to obtain the edge of the defect area.
[0138] Perform canny operator edge detection on the defect area to obtain the edge of the defect area, such as Fig.13 shown.
[0139] Step S5-2: Perform morphological opening operation on the edge of the defect area to obtain the shape features of the defect area, see Fig.14 shown.
[0140] According to the distance between the edges of the defect area, a structural element with the same size as the distance between the edges of the defect area is generated for morphological operation. First, the edges of the defect area are opened using the structural element, then the line features are connected, and finally the defect area is filled to obtain the shape features of the defect area.
[0141] By designing steps S5-1 to S5-2, the edge of the defect area is first obtained, and then a morphological opening operation is performed on the edge of the defect area to obtain the shape characteristics of the defect area. The method is simple and easy to implement.
[0142] The part defect detection method and system of the present embodiment obtain the three-axis high-frequency angular velocity of the image acquisition device within the exposure time period measured by the high-frequency angular velocity detection device; obtain the three-axis low-frequency angular velocity of the image acquisition device within the exposure time period measured by the low-frequency angular velocity detection device; fuse the obtained three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain the fused three-axis angular velocity; construct a spatial point expansion function according to the fused three-axis angular velocity; use the spatial point expansion function to restore the blurred image collected by the image acquisition device within the exposure time period to obtain a restored image; perform threshold segmentation on the restored image to obtain the defect area; perform edge detection and morphological operations on the defect area to extract the appearance characteristics of the defect area; the part defect detection method and system of the present embodiment solve the technical problem of low efficiency of part defect detection caused by vibration of the image acquisition device in the prior art, and improve the efficiency of defect detection.
[0143] In some embodiments of the present application, in order to facilitate the repair personnel to quickly know the appearance features of the defective area, after the appearance features of the defective area are obtained, the appearance features of the defective area are displayed in the restored image.
[0144] The extracted shape features and position information (coordinates) of the defect area are displayed in the restored image to facilitate the restoration personnel to quickly locate it, such as Fig.15 shown.
[0145] The appearance characteristics and location information of the defective area can help maintenance personnel quickly repair the defects.
[0146] In some embodiments of the present application, in order to improve detection efficiency, the appearance characteristics and location information of the defective area are stored in a table, and image tags are added.
[0147] The position information and appearance features of the defective area of the part in the restored image are stored in an Excel table, and image tags are automatically added to help repair personnel quickly repair part defects and improve detection efficiency.
[0148] The part defect detection method of this embodiment first obtains the blurred image and the fused three-axis angular velocity; then constructs a spatial point expansion function based on the fused three-axis angular velocity, and restores the image using the spatial point expansion function; finally, the defect area is located and the coordinates of the defect area are extracted.
[0149] In order to solve the problem of low efficiency of industrial part defect detection caused by chatter, this application proposes a part defect detection method and system based on multi-source chatter information fusion of magnetohydrodynamic (MHD) angular velocity sensor and MEMS gyroscope. MHD angular velocity sensor is used to measure high-frequency chatter, MEMS gyroscope is used to measure low-frequency chatter, and adaptive sequential Kalman filter algorithm is used to achieve signal fusion of high-frequency chatter and low-frequency chatter, and obtain chatter measurement information in the full frequency band of 0.1Hz to 1000 Hz (three-axis angular velocity after fusion). Based on this, a spatial point spread function is constructed, and the total variation (TV) regularization algorithm is used to restore the blurred image. The threshold segmentation algorithm is used to locate part defects, and the defect shape features of the part are extracted based on the edge detection method and morphological operation. The part defect detection method of this application can improve the efficiency of the vision-based part defect detection method and improve the degree of automation of industrial systems.
[0150] The part defect detection method and system of this embodiment physically integrates the MHD angular velocity sensor and the MEMS gyroscope, and uses three MHD angular velocity sensors and three MEMS gyroscopes to form a three-axis vibration measurement device; the three-axis vibration measurement device is fixed to the robotic arm, and the adaptive sequential Kalman filter algorithm is used to perform signal fusion on the MHD angular velocity sensors and MEMS gyroscopes on the three measurement axes, respectively, to achieve broadband (0.1Hz~1000 Hz) high-precision measurement of three-axis vibration information. The processing unit is used to collect the output data of the six sensors in real time, and real-time data fusion is performed. The host computer outputs pulse signals to control the camera to trigger imaging, and the blurred image taken is transmitted to the host computer.
[0151] The pulse signal output by the host computer is used to accurately locate the fusion output data of the MHD angular velocity sensor and the MEMS gyroscope during the exposure time. The fusion output data is integrated to obtain the angular displacement information of the camera during the exposure time. The image motion model is obtained by combining the geometric relationship of the imaging system. Based on this, a spatial point spread function based on the flutter fusion information is constructed, and the total variation (TV) regularization algorithm is used to restore the blurred image. The restored image is thresholded to locate the defect area, and the defect area is rectangularly selected, and the coordinate value is output. The canny operator is used to detect the defect edge of the rectangular image (defect area) selected, and the shape characteristics of the defect are further obtained by morphological operations.
[0152] The part defect detection method and system of the present application utilizes the fusion measurement of MHD angular velocity sensors and MEMS gyroscopes to achieve wide-band measurement of camera jitter. MHD angular velocity sensors have the advantages of small size and impact resistance, but they cannot measure low-frequency jitter information below 2 Hz. The present application uses low-frequency MEMS gyroscopes and MHD angular velocity sensors for data fusion to achieve measurement of wide-band jitter data in a vision-based defect detection system. A spatial point spread function is constructed based on the jitter fusion information to achieve restoration of blurred images under the influence of wide-band jitter. The present application utilizes edge detection and morphological methods to extract the shape and position information of part defects, which can help maintenance personnel quickly repair defects and improve the efficiency of defect detection.
[0153] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for a person skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to replace some of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions claimed to be protected by the present invention.
Claims
1. A method for detecting defects in parts, Features: include: Acquire the three-axis high-frequency angular velocity of the image acquisition device within the exposure time period measured by the high-frequency angular velocity detection device; Acquire the three-axis low-frequency angular velocity of the image acquisition device within the exposure time period measured by the low-frequency angular velocity detection device; fuse the acquired three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain the fused three-axis angular velocity; Construct a spatial point expansion function based on the fused three-axis angular velocity; Restoring the blurred image acquired by the image acquisition device within the exposure time period using the spatial point expansion function to obtain a restored image; Performing threshold segmentation on the restored image to obtain a defect area; Edge detection and morphological operations are performed on the defect area to extract the appearance features of the defect area.
2. The method according to claim 1, Features: The step of constructing a spatial point expansion function according to the fused three-axis angular velocity specifically includes: Generating a three-axis angular displacement of a blurred image according to the fused three-axis angular velocity; For each pixel of the blurred image, the following steps are performed to obtain the spatial point spread function corresponding to each pixel: Generate an image displacement of a pixel according to the three-axis angular displacement; Discretizing the image displacement to obtain image displacement trajectory coordinates; According to the coordinates of the image motion trajectory, the spatial point spread function of the pixel is generated.
3. The method according to claim 1, Features: According to the spatial point spread function, the blurred image is restored using the total variation regularization algorithm to obtain the restored image.
4. The method according to claim 3, Features: The method of restoring the blurred image using a total variation regularization algorithm according to the spatial point spread function to obtain a restored image specifically includes: The spatial point spread functions of all pixels of the blurred image are constructed into a point spread function matrix; Divide the blurred image into blocks according to a point spread function matrix to obtain corresponding matrix sub-blocks and blurred image sub-blocks; According to the matrix sub-blocks, the corresponding blurred image sub-blocks are restored using the total variation regularization algorithm to obtain restored image sub-blocks; The restored image sub-blocks are stitched together to obtain a complete restored image.
5. The method according to claim 4, Features: The step of stitching together the restored image sub-blocks to obtain a complete restored image specifically includes: Extend the boundary between adjacent restored image sub-block A and restored image sub-block B outward by a set width L, so that the width of the overlapping area of the two restored image sub-blocks is 2L; The pixel value of the jth pixel in the overlapping area for: ; Where, j=1,2,3,…,2L; represents the pixel value of the restored image sub-block A corresponding to the j-th pixel in the overlapping area; Represents the pixel value of the restored image sub-block B corresponding to the j-th pixel point in the overlapping area.
6. The method according to claim 1, Features: The threshold segmentation of the restored image to obtain the defect area specifically includes: Calculating the grayscale mean μ and standard deviation δ of the restored image; Calculate image threshold = μ + 3δ; Extracting pixel coordinates in the restored image whose grayscale value is greater than the image threshold; Marking the row coordinates and column coordinates of the smallest rectangle containing the pixel coordinates in the restored image; The rectangular area is cut out to obtain the defect area.
7. The method according to claim 1, Features: The edge detection and morphological operation are performed on the defect area to extract the appearance features of the defect area, specifically including: Performing edge detection on the defective area to obtain the edge of the defective area; A morphological opening operation is performed on the edge of the defect area to obtain the appearance characteristics of the defect area.
8. The method according to claim 1, Features: The part defect detection method also includes the following steps: The appearance features of the defect area are displayed in the restored image.
9. The method according to claim 8, Features: The part defect detection method also includes the following steps: The shape features and location information of the defective area are stored in a table and image tags are added.
10. A parts defect detection system, Features: include: An image acquisition device, which is used to acquire a blurred image during an exposure period; A high-frequency angular velocity detection device, which is used to measure the three-axis high-frequency angular velocity of the image acquisition device during the exposure period; A low-frequency angular velocity detection device, which is used to measure the three-axis low-frequency angular velocity of the image acquisition device during the exposure period; A data fusion module, which is used to fuse the three-axis high-frequency angular velocity with the three-axis low-frequency angular velocity to obtain a fused three-axis angular velocity; Image processing module, which is used to: Construct a spatial point expansion function based on the fused three-axis angular velocity; Restoring the blurred image acquired by the image acquisition device within the exposure time period using the spatial point expansion function to obtain a restored image; Performing threshold segmentation on the restored image to obtain a defect area; Edge detection and morphological operations are performed on the defect area to extract the appearance features of the defect area.
Citation Information
Patent Citations
Combined measurement method based on MHD (magneto hydrodynamics) angular velocity sensor and high-precision gyroscope
CN106840155A
Microscopic image restoration method based on multi-view-field segmentation
CN111062895A
Glass detection method and device, electronic equipment and computer readable storage medium
CN114693673A
Image restoration method, system and device based on MHD angular velocity sensor
CN115330641A
Remote sensing blurred image restoration method and system
CN117495713A
