A visual inspection device and method for the processing quality of flow channel plates

CN122736990APending Publication Date: 2026-09-11SICHUAN LONGQING PRECISION MACHINERY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610840334.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-11
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

这些方法对流道板在图像中的位置偏移和角度旋转高度敏感,实际生产中每次摆放或被检工件自身的加工尺寸波动都会导致图像产生整体或局部的位姿变化,直接比对会产生大量伪缺陷

Benefits of technology

通过采集流道板表面的原始图像并生成流道板灰度图像,对所述流道板灰度图像执行阈值分割操作提取出流道区域二值图,根据流道区域二值图定位每个流道单元的轮廓边界生成流道单元轮廓集合,对所述流道单元轮廓集合中的每个轮廓进行形态学闭运算填充轮廓内部孔洞获得完整流道单元区域图,从所述完整流道单元区域图中提取每个流道单元的几何中心坐标和主轴方向角生成流道单元位姿参数集,将所述流道单元位姿参数集与预设的标准流道模板进行仿射配准获得每个流道单元的仿射变换矩阵,根据所述仿射变换矩阵将每个流道单元的图像区域映射至标准坐标空间生成对齐后的流道单元图像集,该过程能够针对每个流道单元独立计算其相对于标准模板的空间变换关系,有效消除实际检测中工件摆放角度偏差、位置偏移以及各流道单元个体加工误差造成的位姿不一致,使得每个流道单元的图像与标准模板在几何空间上达到精确重合。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122736990A_ABST
    Figure CN122736990A_ABST
Patent Text Reader

Abstract

This invention discloses a visual inspection device and method for flow channel plate processing quality, belonging to the field of visual inspection technology for flow channel plate processing quality. The method acquires the original image of the flow channel plate surface and generates a grayscale image. Threshold segmentation is performed to extract the binary image of the flow channel region. The contour boundary of each flow channel unit is located to generate a contour set. Morphological closing operations are performed on each contour to obtain a complete flow channel unit region image. The geometric center coordinates and principal axis direction angle of each flow channel unit are extracted to generate a pose parameter set. The pose parameter set is affine registered with a standard flow channel template to obtain an affine transformation matrix. Based on the affine transformation matrix, the image region of each flow channel unit is mapped to the standard coordinate space to generate an aligned flow channel unit image set. The defect type is determined based on the area and aspect ratio of each connected component, and the quality inspection result is output. This method can eliminate the interference of individual pose differences of flow channel units on the detection, achieving pixel-level defect discrimination.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of visual inspection technology for flow channel plate processing quality, specifically a visual inspection device and method for flow channel plate processing quality. Background Technology

[0002] The flow channel plate is a key component in a fluid control system used for distributing and collecting fluids, and its surface is covered with multiple precision flow channel units. After the flow channel plate is manufactured, the machining quality of the flow channel units needs to be inspected to determine whether there are defects such as missing material, burrs, blockages, or deformation. Currently, quality judgment mainly relies on manual visual inspection or machine vision comparison methods based on fixed templates.

[0003] Manual visual inspection suffers from low efficiency, high subjectivity, and a high rate of missed defects after prolonged operation, making it difficult to meet the full inspection requirements of mass production. Existing machine vision inspection methods typically acquire images of the flow channel plate and then directly compare them with a standard template in overall grayscale, or use simple edge extraction to find defects. These methods are highly sensitive to the positional offset and angular rotation of the flow channel plate in the image. In actual production, each placement or fluctuation in the processing dimensions of the inspected workpiece will cause overall or local pose changes in the image, resulting in a large number of false defects when directly compared. At the same time, the surface of the flow channel unit has differences in processing texture and reflection. Simple grayscale thresholding can easily misjudge texture interference as damage or mask real defects. Current technology lacks an inspection method that can eliminate individual pose differences of flow channel units and perform precise discrimination of defect areas. Summary of the Invention

[0004] This invention aims to solve at least one of the technical problems existing in the prior art; Therefore, this invention proposes a visual inspection method for the processing quality of flow channel plates, comprising: Acquire the original image of the flow channel plate surface, generate a grayscale image of the flow channel plate, perform threshold segmentation on the grayscale image of the flow channel plate, and extract the binary image of the flow channel region; Based on the binary map of the flow channel region, locate the contour boundary of each flow channel unit and generate a set of flow channel unit contours; A morphological closing operation is performed on each contour in the set of flow channel unit contours to fill the internal holes of the contour, thereby obtaining a complete flow channel unit region map. The geometric center coordinates and principal axis direction angle of each flow channel unit are extracted from the complete flow channel unit region map to generate a set of flow channel unit pose parameters. The pose parameter set of the flow channel unit is affinely registered with a preset standard flow channel template to obtain the affine transformation matrix of each flow channel unit. The image region of each flow channel unit is mapped to the standard coordinate space according to the affine transformation matrix to generate an aligned flow channel unit image set. For each image in the aligned flow channel unit image set, calculate the pixel-by-pixel grayscale difference between the image and the standard template image, and generate a grayscale difference distribution map. For pixels in the grayscale difference distribution map that exceed a preset grayscale difference threshold, connected component marking is performed to generate a defective connected component set; Based on the area and aspect ratio of each connected component in the defect connected component set, the defect type corresponding to the connected component is determined, and the flow channel plate quality inspection result is output.

[0005] Further, the steps of acquiring the original image of the flow channel plate surface and generating a grayscale image of the flow channel plate specifically include: Control the ring light source to illuminate the surface of the flow channel plate at a preset angle, triggering the industrial camera to capture the original color image of the flow channel plate surface; Extract the red channel component, green channel component, and blue channel component from the original color image; The red channel component, green channel component, and blue channel component are fused and calculated according to a weighted summation rule, wherein the sum of the weight coefficients of the red channel component, green channel component, and blue channel component in the weighted summation rule is an integer of one. The result of the fusion calculation is used as the gray value of each pixel location to generate a grayscale image of the flow channel plate.

[0006] Further, the step of performing threshold segmentation on the grayscale image of the flow channel plate to extract the binary image of the flow channel region specifically includes: Statistically analyze the grayscale value distribution of all pixels in the grayscale image of the flow channel plate, and generate a grayscale histogram; The peak and trough positions are identified in the grayscale histogram, and the grayscale value corresponding to the trough position is used as the segmentation threshold. Traverse each pixel in the grayscale image of the flow channel plate and compare the grayscale value of that pixel with the segmentation threshold. When the grayscale value of a pixel is greater than or equal to the segmentation threshold, the pixel is assigned the value of a foreground pixel; when the grayscale value of a pixel is less than the segmentation threshold, the pixel is assigned the value of a background pixel. The assignment results of all pixels are combined into a binary map of the flow channel region.

[0007] Further, the step of locating the contour boundary of each flow channel unit and generating a set of flow channel unit contours based on the binary map of the flow channel region specifically includes: An eight-connected neighborhood scan is performed on the binary map of the flow channel region, traversing each pixel row by row starting from the top left pixel; When it is detected that the pixel value of the current pixel is a foreground pixel value and the pixel is not marked, the region growing algorithm is executed with the pixel as the seed point, and all foreground pixels that are 8-connected to the seed point are included in the same connected region. Record the minimum row coordinates, maximum row coordinates, minimum column coordinates, and maximum column coordinates of the same connected region to form the boundary rectangle of the connected region; Based on the boundary rectangle, the peripheral pixel sequence of the connected region is extracted using an edge tracking algorithm. This peripheral pixel sequence is then used as the flow channel unit contour corresponding to the connected region and stored in the flow channel unit contour set.

[0008] Further, the step of performing morphological closing operations on each contour in the set of flow channel unit contours to fill the internal holes of the contours and obtain a complete flow channel unit region map specifically includes: Take out a flow channel unit contour to be processed from the set of flow channel unit contours, and construct an internal region binary map of the contour with the flow channel unit contour as the boundary. The pixels inside the contour boundary in the internal region binary map are assigned as foreground pixel values, and the pixels outside the contour boundary are assigned as background pixel values. Construct a circular structural element, the radius of which is determined according to the standard width of the flow channel unit; Perform an expansion operation on the internal region binary image and the circular structural element to obtain an expanded region binary image; The expanded region binary map and the circular structural element are subjected to an erosion operation to obtain an eroded region binary map. The eroded region binary map is used as the complete flow channel unit region map of the flow channel unit. Traverse all flow channel unit outlines and merge the complete flow channel unit region map corresponding to each flow channel unit according to spatial location to obtain the complete flow channel unit region map.

[0009] Further, the step of extracting the geometric center coordinates and principal axis direction angle of each flow channel unit from the complete flow channel unit region diagram to generate the flow channel unit pose parameter set specifically includes: Locate a flow channel unit region to be processed from the complete flow channel unit region map, and calculate the sum of the row coordinates and the sum of the column coordinates of all pixels in the flow channel unit region; The total number of pixels within the flow channel unit region is used as the area normalization factor. The sum of the row coordinates and the sum of the column coordinates are divided by the area normalization factor to obtain the geometric center row coordinates and geometric center column coordinates of the flow channel unit region, which are then combined to form the geometric center coordinates. Calculate the covariance matrix of each pixel within the flow channel unit region relative to the geometric center coordinates, and solve for the eigenvector corresponding to the largest eigenvalue of the covariance matrix; The orientation angle of the feature vector is used as the principal axis orientation angle of the flow channel unit region. The geometric center coordinates and the principal axis orientation angle are associated and stored as a flow channel unit pose parameter record. After traversing all flow channel unit regions, a flow channel unit pose parameter set is generated.

[0010] Further, the step of performing affine registration between the pose parameter set of the flow channel unit and a preset standard flow channel template to obtain the affine transformation matrix of each flow channel unit specifically includes: Take out a flow channel unit pose parameter record to be registered from the flow channel unit pose parameter set. Based on the geometric center coordinates and principal axis direction angle in the record, construct the source point set of the flow channel unit. The source point set contains the coordinates of multiple feature points in the region of the flow channel unit. Extract the target point set corresponding to the flow channel unit from the preset standard flow channel template. The target point set contains the coordinates of multiple feature points with the same relative position within the standard flow channel unit area. The rigid body transformation parameters from the source point set to the target point set are calculated using the least squares fitting algorithm. The rigid body transformation parameters include rotation angle, translation row offset value, and translation column offset value. The rotation angle, the row offset value of the translation amount, and the column offset value of the translation amount are combined into a three-row, three-column affine transformation matrix, and this affine transformation matrix is ​​used as the affine transformation matrix of the flow channel unit.

[0011] Further, the step of mapping the image region of each flow channel unit to the standard coordinate space according to the affine transformation matrix to generate an aligned flow channel unit image set specifically includes: For a flow channel unit to be transformed, obtain the affine transformation matrix corresponding to the flow channel unit and the image region of the flow channel unit in the original image; Traverse each source pixel in the image region, obtain the original row coordinates and original column coordinates of the source pixel, and combine the original row coordinates and original column coordinates into a two-dimensional column vector. Perform matrix multiplication on the affine transformation matrix and the two-dimensional column vector to obtain the transformed row coordinates and column coordinates, which are used as the position coordinates of the target pixel. A bilinear interpolation algorithm is used to calculate the gray value of the target pixel based on the gray value of the source pixel. The gray values ​​of all target pixels are arranged according to the target position coordinates to generate the image after the flow channel unit is aligned. After traversing all flow channel units, the image set of the aligned flow channel units is obtained.

[0012] Further, for each image in the aligned flow channel unit image set, the step of calculating the pixel-by-pixel grayscale difference between the image and the standard template image to generate a grayscale difference distribution map specifically includes: Take out an aligned image to be detected from the aligned flow channel unit image set, and at the same time obtain a standard template image corresponding to the aligned image. The standard template image has the same row and column size as the aligned image. Locate the starting pixel position in the aligned image, and traverse all pixel positions in row-major order starting from the starting pixel position; At each pixel location, the gray value of the aligned image at that pixel location is subtracted from the gray value of the standard template image at that pixel location to obtain the gray value difference at that pixel location. The grayscale difference is compared with zero. When the grayscale difference is negative, the grayscale difference is assigned to zero. When the grayscale difference is positive, the original value is kept. The processed grayscale difference is used as the grayscale difference distribution value of the pixel position. After traversing all pixel positions, a grayscale difference distribution map is generated.

[0013] Further, the step of marking connected components for pixels in the grayscale difference distribution map that exceed a preset grayscale difference threshold to generate a set of defective connected components specifically includes: Traverse each pixel in the grayscale difference distribution map, compare the grayscale difference distribution value of the pixel with the preset grayscale difference threshold, and mark the pixel as a candidate defect pixel when the grayscale difference distribution value is greater than or equal to the preset grayscale difference threshold. A four-connected neighborhood scanning algorithm is used to perform connected component marking on all candidate defect pixels. Starting from the first candidate defect pixel, the candidate defect pixel is assigned the current connected component number. The neighboring pixels that are four-connected to the candidate defect pixel are scanned recursively, and the neighboring pixels that meet the conditions of the candidate defect pixel are assigned the same current connected component number. When the recursive scan cannot be expanded, the current connected component number is incremented by one, and the scan continues to the next unmarked candidate defect pixel until all candidate defect pixels are assigned connected component numbers. Count the number of pixels and the range of pixel positions corresponding to each connected component number, and take the set of pixels corresponding to each connected component number as a defective connected component. The set of all defective connected components constitutes the defective connected component set.

[0014] A visual inspection device for flow channel plate processing quality is provided, comprising a roller conveyor and a visual inspection component disposed above and below the roller conveyor. The visual inspection component includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of visual inspection of flow channel plate processing quality as described above.

[0015] Compared with the prior art, the beneficial effects of the present invention are: By acquiring the original image of the flow channel plate surface and generating a grayscale image of the flow channel plate, a threshold segmentation operation is performed on the grayscale image of the flow channel plate to extract the binary image of the flow channel region. Based on the binary image of the flow channel region, the contour boundary of each flow channel unit is located to generate a set of flow channel unit contours. Morphological closing operation is performed on each contour in the set of flow channel unit contours to fill the internal holes of the contour to obtain a complete flow channel unit region image. The geometric center coordinates and principal axis direction angle of each flow channel unit are extracted from the complete flow channel unit region image to generate a set of flow channel unit pose parameters. The set of flow channel unit pose parameters is affine registered with a preset standard flow channel template to obtain the affine transformation matrix of each flow channel unit. Based on the affine transformation matrix, the image region of each flow channel unit is mapped to the standard coordinate space to generate an aligned set of flow channel unit images. This process can independently calculate the spatial transformation relationship of each flow channel unit relative to the standard template, effectively eliminating the inconsistency in pose caused by workpiece placement angle deviation, position offset, and individual processing errors of each flow channel unit in actual inspection, so that the image of each flow channel unit and the standard template are accurately coincident in geometric space.

[0016] For each image in the aligned flow channel unit image set, the pixel-by-pixel grayscale difference between the image and the standard template image is calculated to generate a grayscale difference distribution map. Pixels in the grayscale difference distribution map that exceed a preset grayscale difference threshold are marked with connected components to generate a defect connected component set. Based on the area and aspect ratio of each connected component in the defect connected component set, the defect type corresponding to the connected component is determined, and the flow channel plate quality inspection result is output. This process further performs pixel-level subtraction operations at the grayscale level on the basis of geometric registration, which can separate grayscale abnormal areas caused by actual structural defects, excess materials, or surface damage from normal texture backgrounds. By performing connected component aggregation on pixels exceeding the threshold and classification based on area and aspect ratio, continuous abnormal pixel blocks are divided into independent defect entities, and different defect categories with different causes are distinguished according to geometric features. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the steps of a visual inspection method for the processing quality of a flow channel plate according to the present invention. Figure 2 Schematic diagram of grayscale and binarization principle of flow channel plate image; Figure 3 This is a grayscale difference distribution diagram of the flow channel unit; Figure 4 The component distribution diagram of the covariance matrix for the characteristics of the flow channel unit; Figure 5 This is a structural diagram of a visual inspection device for flow channel plate processing quality according to the present invention; Among them, 1-vision inspection component; 2-roller conveyor device; 3-flow channel plate. Detailed Implementation

[0018] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] See appendix Figure 1 This invention provides a visual inspection method for the processing quality of flow channel plates, the method comprising: The process involves acquiring an original image of the flow channel plate surface to generate a grayscale image of the flow channel plate. A threshold segmentation operation is then performed on the grayscale image to extract a binary image of the flow channel region. Based on this binary image, the contour boundary of each flow channel unit is located, generating a set of flow channel unit contours. Morphological closing operations are performed on each contour in the set to fill internal holes, resulting in a complete flow channel unit region image. The geometric center coordinates and principal axis direction angles of each flow channel unit are extracted from this complete region image to generate a set of flow channel unit pose parameters. Finally, this set of pose parameters is affined with a preset standard flow channel template. Registration is performed to obtain the affine transformation matrix of each flow channel unit. Based on the affine transformation matrix, the image region of each flow channel unit is mapped to the standard coordinate space to generate an aligned flow channel unit image set. For each image in the aligned flow channel unit image set, the pixel-by-pixel grayscale difference between the image and the standard template image is calculated to generate a grayscale difference distribution map. Pixels in the grayscale difference distribution map that exceed a preset grayscale difference threshold are marked as connected components to generate a defect connected component set. Based on the area and aspect ratio of each connected component in the defect connected component set, the defect type corresponding to the connected component is determined, and the flow channel plate quality inspection result is output.

[0020] Example 1 See appendix Figure 2A ring light source is controlled to illuminate the surface of the flow channel plate at a preset angle, triggering an industrial camera to acquire the original color image of the flow channel plate surface. Red, green, and blue channel components are extracted from the original color image. These components are then fused according to a weighted summation rule, where the sum of the weight coefficients for the red, green, and blue channels is an integer. The fusion result is used as the grayscale value for each pixel location to generate a grayscale image of the flow channel plate. The resulting image is then statistically analyzed. The grayscale distribution of all pixels in the grayscale image of the flow channel plate is described, and a grayscale histogram is generated. Peak and trough positions are identified in the grayscale histogram. The grayscale value corresponding to the trough position is used as a segmentation threshold. Each pixel in the grayscale image of the flow channel plate is traversed, and the grayscale value of the pixel is compared with the segmentation threshold. When the grayscale value of the pixel is greater than or equal to the segmentation threshold, the pixel is assigned as a foreground pixel value. When the grayscale value of the pixel is less than the segmentation threshold, the pixel is assigned as a background pixel value. The assignment results of all pixels are combined into a binary image of the flow channel region.

[0021] In practical implementation, a molded flow channel plate is used as the detection object. The surface of the flow channel plate contains multiple parallel rectangular cross-sectional flow channel units. A ring light source is controlled to illuminate the surface of the flow channel plate at a 45-degree angle, triggering an industrial camera to acquire the original color image of the flow channel plate surface. Red, green, and blue channel components are extracted from the original color image. These components are then fused according to a weighted summation rule. In this rule, the weight coefficient for the red channel component is 0.299, the weight coefficient for the green channel component is 0.587, and the weight coefficient for the blue channel component is 0.114. The sum of these three weight coefficients is an integer of one. The result of the fusion calculation is used as the grayscale value for each pixel location, generating a grayscale image of the flow channel plate. The above coefficient settings are based on the brightness calculation formula for converting a color image to a grayscale image in the BT.601 standard formulated by the Radiocommunication Sector of the International Telecommunication Union. In this standard, the luminance component is obtained by weighting the red, green and blue channels with different weights. The green channel has the largest weight because the human visual system is most sensitive to green wavelengths of light. The red channel has the second largest weight, and the blue channel has the smallest weight because the human eye is least sensitive to blue wavelengths of light.

[0022] In some embodiments, the grayscale value distribution of all pixels in the grayscale image of the flow channel plate is statistically analyzed to generate a grayscale histogram. The horizontal axis of the grayscale histogram is the grayscale level from 0 to 255, and the vertical axis is the number of pixels corresponding to each grayscale level. Peak positions and trough positions are identified in the grayscale histogram. The peak positions correspond to the grayscale concentration range of the background area of ​​the flow channel plate, and the trough positions correspond to the grayscale transition range between the flow channel area and the background area of ​​the flow channel plate. The grayscale value corresponding to the trough position is used as the segmentation threshold.

[0023] Optionally, each pixel in the grayscale image of the flow channel plate is traversed, and the grayscale value of the pixel is compared with the segmentation threshold. When the grayscale value of the pixel is greater than or equal to the segmentation threshold, the pixel is assigned a foreground pixel value of 255. When the grayscale value of the pixel is less than the segmentation threshold, the pixel is assigned a background pixel value of 0. The assignment results of all pixels are combined into a binary image of the flow channel region. The connected regions formed by the foreground pixel values ​​of 255 in the binary image of the flow channel region correspond to the flow channel unit positions on the flow channel plate.

[0024] It is understood that in the weighted summation rule, the sum of the weighting coefficients of the red channel component, the green channel component, and the blue channel component is an integer of one. The specific calculation formula is as follows: in, Indicates coordinates as The grayscale value of the pixel, Indicates coordinates as The red channel component value of the pixel, This represents the weighting coefficient of the red channel component. (Use different fonts when representing the green channel component in the formula to avoid confusion; in actual implementation, use comments to distinguish them.) This represents the green channel component value. This represents the weighting coefficient of the green channel component. This represents the blue channel component value. This represents the weighting coefficient of the blue channel component.

[0025] In some embodiments, when there are multiple valley positions in the grayscale histogram, the grayscale value corresponding to the valley position located between the largest peak and the second largest peak is selected as the segmentation threshold.

[0026] Optionally, the pixels with a foreground pixel value of 255 constitute the foreground mask of the flow channel region, and the pixels with a background pixel value of 0 constitute the background mask.

[0027] It can be understood that, after using the gray value corresponding to the valley position as the segmentation threshold, all pixels in the grayscale image of the flow channel plate with gray values ​​greater than or equal to the segmentation threshold are determined as flow channel region pixels, and all pixels with gray values ​​less than the segmentation threshold are determined as non-flow channel region pixels.

[0028] Example 2 An eight-connected neighborhood scan is performed on the binary image of the flow channel region. Starting from the top left pixel, each pixel is traversed row by row. When the pixel value of the current pixel is detected as a foreground pixel value and the pixel is not marked, a region growing algorithm is performed with the pixel as the seed point. All foreground pixels that are eight-connected to the seed point are grouped into the same connected region. The minimum row coordinate, maximum row coordinate, minimum column coordinate, and maximum column coordinate of the same connected region are recorded to form the boundary rectangle of the connected region. Based on the boundary rectangle, an edge tracking algorithm is used to extract the sequence of peripheral pixels of the connected region. The sequence of peripheral pixels is used as the flow channel unit contour corresponding to the connected region and stored in the flow channel unit contour set.

[0029] In a specific implementation, taking a flow channel plate containing eight parallel flow channel units as an example, the binary image of the flow channel region obtained after performing threshold segmentation is processed. The size of the binary image of the flow channel region is 2048 pixels × 2048 pixels. The pixels with a foreground pixel value of 255 constitute the connected region of the flow channel unit, and the pixels with a background pixel value of 0 constitute the non-flow channel region. An eight-connected neighborhood scan is performed on the binary image of the flow channel region. The neighborhood directions of the eight-connected neighborhood scan include eight directions: up, down, left, right, upper left, upper right, lower left, and lower right. Starting from the upper left corner pixel of the binary image of the flow channel region, each pixel is traversed row by row. The traversal order is to scan row by row from left to right, and after completing a row, move to the leftmost end of the next row to continue scanning.

[0030] In some embodiments, when the pixel value of the current pixel is detected to be foreground pixel value 255 and the current pixel is not marked, a region growing algorithm is executed with the current pixel as the seed point. The region growing algorithm will group all foreground pixel values ​​255 that are eight-connected with the seed point into the same connected region. During the region growing process, each time a new pixel is grown, the pixel is used as a new seed point to continue to expand in eight neighborhood directions until no new eight-connected foreground pixel can be added. All pixels that are grouped into the same connected region constitute a complete flow channel unit connected region.

[0031] Optionally, the minimum row coordinates, maximum row coordinates, minimum column coordinates, and maximum column coordinates of the same connected region are recorded to form the boundary rectangle of the connected region. The coordinates of the upper left corner of the boundary rectangle are (minimum row coordinate, minimum column coordinate), and the coordinates of the lower right corner are (maximum row coordinate, maximum column coordinate). The height of the boundary rectangle is the maximum row coordinate minus the minimum row coordinate plus one, and the width of the boundary rectangle is the maximum column coordinate minus the minimum column coordinate plus one.

[0032] It can be understood that the offsets of the eight directions relative to the coordinates of the current pixel in an 8-connected neighborhood scan can be represented as the following set: in, The set of offset vectors represents the eight-connected neighborhood. The first component of each ordered pair in the set represents the row coordinate offset, and the second component represents the column coordinate offset. The offset value is -1, 0, or 1. The coordinates of the eight-connected neighborhood pixels of the current pixel are obtained by adding each ordered pair in the offset vector set to the row coordinate and column coordinate of the current pixel, respectively.

[0033] In some embodiments, based on the boundary rectangle, an edge tracking algorithm is used to extract the sequence of peripheral pixels of the connected region. The edge tracking algorithm starts from the minimum row coordinates and minimum column coordinates of the connected region within the boundary rectangle, scans the contour boundary of the connected region in a clockwise direction, records the row coordinates and column coordinates of each boundary pixel in sequence, arranges all the scanned boundary pixels in the scanning order into a sequence of peripheral pixels, and uses this sequence of peripheral pixels as the contour of the flow channel unit corresponding to the connected region.

[0034] Optionally, after extracting the peripheral pixel sequence of a connected region, the peripheral pixel sequence is stored in the flow channel unit contour set. The remaining unmarked pixels in the binary image of the flow channel region are traversed, and the eight-connected neighborhood scan and region growing operations are repeated until all foreground pixels with a pixel value of 255 in the binary image of the flow channel region are marked and the contour extraction is completed.

[0035] It is understood that the set of flow channel unit contours contains multiple flow channel unit contours. Each flow channel unit contour consists of a series of boundary pixel coordinates arranged in a clockwise direction. The row and column coordinates of each boundary pixel are integers. Two adjacent boundary pixels in the flow channel unit contour are 8-connected in the binary image of the flow channel region.

[0036] Example 3 One flow channel unit contour to be processed is selected from the set of flow channel unit contours. Using this contour as the boundary, an internal region binary map is constructed. Pixels within the contour boundary in the internal region binary map are assigned foreground pixel values, and pixels outside the contour boundary are assigned background pixel values. A circular structural element is constructed, the radius of which is determined according to the standard width of the flow channel unit. An expansion operation is performed between the internal region binary map and the circular structural element to obtain an expanded region binary map. An erosion operation is then performed between the expanded region binary map and the circular structural element to obtain an eroded region binary map. This eroded region binary map is used as the complete flow channel unit region map for that flow channel unit. All flow channel unit contours are traversed, and the complete flow channel unit region maps corresponding to each flow channel unit are merged according to their spatial position to obtain the complete flow channel unit region map. From the complete flow channel unit region map, locate a flow channel unit region to be processed, calculate the sum of row coordinates and column coordinates of all pixels in the flow channel unit region, use the total number of pixels in the flow channel unit region as the area normalization factor, divide the sum of row coordinates and column coordinates by the area normalization factor to obtain the geometric center row coordinates and geometric center column coordinates of the flow channel unit region, combine them to form the geometric center coordinates, calculate the covariance matrix of each pixel in the flow channel unit region relative to the geometric center coordinates, solve for the eigenvector corresponding to the largest eigenvalue of the covariance matrix, use the direction angle of the eigenvector as the principal axis direction angle of the flow channel unit region, associate and store the geometric center coordinates and the principal axis direction angle as a flow channel unit pose parameter record, and generate a flow channel unit pose parameter set after traversing all flow channel unit regions.

[0037] In a specific implementation, taking the set of flow channel unit contours extracted from a flow channel plate as an example, the set of flow channel unit contours contains eight flow channel unit contours. Each flow channel unit contour consists of a series of eight-connected boundary pixel coordinates. A flow channel unit contour to be processed is taken out from the set of flow channel unit contours. Using the flow channel unit contour to be processed as the boundary, a binary map of the internal region of the flow channel unit contour to be processed is constructed. The pixels inside the contour boundary in the binary map of the internal region are assigned a foreground pixel value of 255, and the pixels outside the contour boundary are assigned a background pixel value of 0. A circular structural element is constructed. The radius of the circular structural element is determined according to the standard width of the flow channel unit. The standard width of the flow channel unit is 50 pixels, so the radius of the circular structural element is set to 25 pixels. The value of all pixels inside the circular structural element is 1, and the value of all pixels outside is 0.

[0038] In some embodiments, a dilation operation is performed on the internal region binary image and the circular structuring element to obtain a dilated region binary image. The dilation operation involves traversing every pixel in the internal region binary image through the center of the circular structuring element. When there is a foreground pixel value of 255 within the area covered by the circular structuring element, the pixel at the center of the corresponding circular structuring element in the dilated image is assigned the foreground pixel value of 255. Then, an erosion operation is performed on the dilated region binary image and the circular structuring element to obtain an eroded region binary image. The erosion operation involves traversing every pixel in the dilated region binary image through the center of the circular structuring element. When all pixels within the area covered by the circular structuring element are foreground pixel values ​​of 255, the pixel at the center of the corresponding circular structuring element in the eroded image is assigned the foreground pixel value of 255; otherwise, it is assigned the background pixel value of 0. The eroded region binary image is then used as the complete flow channel unit region image corresponding to the flow channel unit outline to be processed.

[0039] Optionally, all flow channel unit contours are traversed, and the steps of constructing an internal region binary image, constructing a circular structural element, performing dilation operation, and performing erosion operation are performed on each flow channel unit contour. The complete flow channel unit region images corresponding to each flow channel unit are merged according to spatial position to obtain a complete flow channel unit region image. The complete flow channel unit region image is a binary image with the same size as the original flow channel plate grayscale image, wherein the interior of each flow channel unit region is filled with a foreground pixel value of 255, and the gaps between flow channel unit regions and the background region are filled with a background pixel value of 0.

[0040] In a specific implementation, a flow channel unit region to be processed is located from the complete flow channel unit region map. The sum of the row coordinates and the sum of the column coordinates of all pixels within the flow channel unit region to be processed are calculated. Assuming that the flow channel unit region to be processed contains K pixels, and the row coordinate of the i-th pixel is... Column coordinates are Then the sum of the row coordinates is The sum of the column coordinates is Using the total number of pixels K within the flow channel unit region to be processed as an area normalization factor, the sum of the row coordinates and the sum of the column coordinates are divided by the area normalization factor to obtain the geometric center row coordinates and geometric center column coordinates of the flow channel unit region to be processed. These are then combined to form the geometric center coordinates, where the geometric center row coordinates are... The column coordinates of the geometric center are .

[0041] In some embodiments, the covariance matrix of each pixel within the flow channel unit region to be processed relative to the coordinates of the geometric center is calculated. The covariance matrix is ​​a 2×2 matrix, and its elements are calculated using the following formula: in, This represents the row coordinate of the i-th pixel within the flow channel unit region to be processed. This represents the column coordinate of the i-th pixel within the flow channel unit region to be processed. Represents the row coordinates of the geometric center. Represents the column coordinates of the geometric center. This represents the total number of pixels within the flow channel unit region to be processed. The top-left element of the matrix is ​​the variance of the row coordinates, the bottom-right element is the variance of the column coordinates, and the bottom-left and top-right elements are the covariances of the row and column coordinates. (Appendix) Figure 4 This paper demonstrates the statistical correlation between different feature components during the feature extraction process of the flow channel unit. By statistically calculating the coordinate distribution of a large number of pixels within the flow channel unit region, a covariance matrix of a multi-dimensional feature space is constructed. The magnitude of each component in the covariance matrix is ​​mapped to an intensity value for visualization, generating a covariance matrix component distribution map. The diagonal components in the covariance matrix component distribution map show the distribution variance of the flow channel unit in the row and column coordinate directions, while the off-diagonal components show the distribution covariance between the row and column coordinate directions. The brightness distribution in the covariance matrix component distribution map reflects the morphological characteristics of the pixel cloud within the flow channel unit, and the component values ​​reflect the original data distribution state required to calculate the principal axis direction angle of the flow channel unit. The covariance matrix component distribution map embodies the mathematical mapping relationship in the generation process of the flow channel unit pose parameter record and demonstrates the geometric structural characteristics of the flow channel unit in the image coordinate system.

[0042] Optionally, the eigenvector corresponding to the largest eigenvalue of the covariance matrix is ​​solved. The eigenvector is a two-dimensional column vector. The direction angle of the eigenvector is used as the principal axis direction angle of the flow channel unit region to be processed. The principal axis direction angle is obtained by calculating the arctangent of the ratio of the second component to the first component of the eigenvector. The geometric center coordinates and the principal axis direction angle are associated and stored as a flow channel unit pose parameter record. The flow channel unit pose parameter record contains three values: geometric center row coordinates, geometric center column coordinates, and principal axis direction angle.

[0043] It is understood that after traversing all flow channel unit regions, a flow channel unit pose parameter set is generated. The flow channel unit pose parameter set contains multiple flow channel unit pose parameter records equal to the number of flow channel units. Each record corresponds to the spatial position and orientation of a flow channel unit in the complete flow channel unit region map.

[0044] Example 4 A flow channel unit pose parameter record to be registered is retrieved from the flow channel unit pose parameter set. Based on the geometric center coordinates and principal axis direction angle in the record, a source point set for the flow channel unit is constructed. The source point set contains the coordinates of multiple feature points within the flow channel unit region. A target point set corresponding to the flow channel unit is extracted from a preset standard flow channel template. The target point set contains the coordinates of multiple feature points at the same relative position within the standard flow channel unit region. The least squares fitting algorithm is used to calculate the rigid body transformation parameters from the source point set to the target point set. The rigid body transformation parameters include rotation angle, translation row offset, and translation column offset. The rotation angle, translation row offset, and translation column offset are combined into a 3x3 affine transformation matrix. This affine transformation matrix is ​​used as the flow channel unit. For a given flow channel unit to be transformed, the affine transformation matrix is ​​obtained, along with the image region of the flow channel unit in the original image. Each source pixel in the image region is traversed to obtain its original row and column coordinates. These coordinates are then combined to form a two-dimensional column vector. A matrix multiplication operation is performed between the affine transformation matrix and the two-dimensional column vector to obtain the transformed row and column coordinates, which serve as the position coordinates of the target pixel. A bilinear interpolation algorithm is used to calculate the grayscale value at the target pixel's location based on the grayscale values ​​of the source pixels. The grayscale values ​​of all target pixels are arranged according to their target position coordinates to generate the aligned image of the flow channel unit. After traversing all flow channel units, the aligned flow channel unit image set is obtained.

[0045] In a specific implementation, taking a flow channel plate containing eight flow channel units as an example, a flow channel unit pose parameter record to be registered is retrieved from the flow channel unit pose parameter set. This record contains three values: geometric center row coordinates, geometric center column coordinates, and principal axis direction angle. Based on the geometric center coordinates and principal axis direction angle in the record, a source point set for the flow channel unit corresponding to the pose parameter record to be registered is constructed. This source point set contains the coordinates of multiple feature points within the flow channel unit region corresponding to the pose parameter record to be registered. The selected points are the four corner points of the boundary rectangle of the flow channel unit region and the geometric center point of the flow channel unit region, totaling five feature points. The target point set corresponding to the flow channel unit to be registered is extracted from the preset standard flow channel template. The target point set contains the coordinates of multiple feature points with the same relative position within the standard flow channel unit region. The standard flow channel template pre-stores the coordinate values ​​of five feature points of each standard flow channel unit region. The five feature points include the four corner points of the boundary rectangle of the standard flow channel unit region and the geometric center point of the standard flow channel unit region.

[0046] In some embodiments, a least squares fitting algorithm is used to calculate the rigid body transformation parameters from the source point set to the target point set. These rigid body transformation parameters include rotation angle, row offset of translation, and column offset of translation. The goal of the least squares fitting algorithm is to minimize the sum of squared Euclidean distances between each feature point in the source point set and its corresponding feature point in the target point set after transformation. The rotation angle is denoted as θ, the row offset of translation is denoted as Δr, and the column offset of translation is denoted as Δc. The rotation angle, row offset of translation, and column offset of translation are combined into a 3x3 affine transformation matrix. The affine transformation matrix has the following form: Where θ represents the rotation angle, Δr represents the translation row offset value, and Δc represents the translation column offset value. The element in the first row and first column of the matrix is ​​the cosine value of θ, the element in the first row and second column is the negative and positive sine values ​​of θ, the element in the first row and third column is the translation column offset value, the element in the second row and first column is the sine value of θ, the element in the second row and second column is the cosine value of θ, the element in the second row and third column is the translation row offset value, the elements in the third row and first column and the third row and second column are both 0, and the element in the third row and third column is 1. The affine transformation matrix is ​​used as the pose parameter of the flow channel unit to be registered to record the affine transformation matrix of the corresponding flow channel unit.

[0047] Optionally, for a flow channel unit to be transformed, the affine transformation matrix corresponding to the flow channel unit to be transformed and the image region of the flow channel unit to be transformed in the original image are obtained. The image region is defined by the flow channel unit outline of the flow channel unit to be transformed and contains all the pixels of the flow channel unit. Each source pixel in the image region is traversed to obtain the original row coordinates and original column coordinates of the source pixel. The original row coordinates and original column coordinates are combined to form a two-dimensional column vector. The first component of the two-dimensional column vector is the original row coordinate, and the second component is the original column coordinate. The affine transformation matrix and the two-dimensional column vector are multiplied to obtain the transformed row coordinates and transformed column coordinates, which are used as the position coordinates of the target pixel. In the matrix multiplication operation, the first two rows of the affine transformation matrix, the two-dimensional column vector, and the translation part are all involved in the calculation. The result is a two-dimensional vector. The first component of the two-dimensional vector is the transformed row coordinate, and the second component is the transformed column coordinate.

[0048] In some embodiments, a bilinear interpolation algorithm is used to calculate the gray value at the target pixel location based on the gray value of the source pixel. The bilinear interpolation algorithm performs linear interpolation between the four nearest neighbor integer pixels around the target coordinate location. First, two linear interpolations are performed in the row direction, and then one linear interpolation is performed in the column direction to obtain the gray value at the target pixel location. The gray values ​​of all target pixels are arranged according to the target position coordinates to generate the image after the flow channel unit to be transformed is aligned. In the aligned image, each pixel corresponds to an integer pixel position in the standard coordinate space. For the case where the target position coordinates are not integers, the gray value is obtained by bilinear interpolation. For the case where the target position coordinates exceed the boundary of the standard coordinate space, the background gray value 0 is directly assigned.

[0049] It can be understood that after traversing all flow channel units, an aligned flow channel unit image set is obtained. The aligned flow channel unit image set contains multiple aligned images equal to the number of flow channel units. Each aligned image has the same row and column dimensions, which are consistent with the dimensions of the standard flow channel unit region in the standard flow channel template.

[0050] Optionally, when the number of feature points in the source point set is greater than 2, the rigid body transformation parameters calculated by the least squares fitting algorithm minimize the root mean square error between the source point set and the target point set.

[0051] It can be understood that the coordinates of the four nearest neighbor integer pixels involved in the gray value calculation formula at the target pixel position in the bilinear interpolation algorithm are obtained by rounding down and up the target pixel position coordinates respectively.

[0052] Example 5 Take an aligned image to be detected from the aligned flow channel unit image set, and simultaneously obtain a standard template image corresponding to the aligned image. The standard template image has the same row and column dimensions as the aligned image. Locate the starting pixel position in the aligned image. Starting from the starting pixel position, traverse all pixel positions in row-major order. At each pixel position, subtract the gray value of the standard template image from the gray value of the aligned image at that pixel position to obtain the gray value difference. Compare the gray value difference with zero. If the gray value difference is negative, assign it to zero; if the gray value difference is positive, keep the original value. Use the processed gray value difference as the gray value difference distribution value of that pixel position. After traversing all pixel positions, generate a gray value difference distribution map. Traverse each pixel in the gray value difference distribution map and compare the gray value difference distribution value of that pixel with a preset gray value. A threshold difference is compared, and when the grayscale difference distribution value is greater than or equal to the preset grayscale difference threshold, the pixel is marked as a candidate defect pixel. A four-connected neighborhood scanning algorithm is used to perform connected component marking on all candidate defect pixels. Starting from the first candidate defect pixel, the candidate defect pixel is assigned a current connected component number. The neighboring pixels that are four-connected to the candidate defect pixel are scanned recursively. The neighboring pixels that meet the conditions of the candidate defect pixel are assigned the same current connected component number. When the recursive scan cannot be expanded, the current connected component number is incremented by one, and the next unmarked candidate defect pixel is scanned until all candidate defect pixels are assigned a connected component number. The number of pixels and the range of pixel positions corresponding to each connected component number are counted. The set of pixels corresponding to each connected component number is a defect connected component. The set of all defect connected components constitutes the defect connected component set.

[0053] In a specific implementation, taking a flow channel plate containing eight flow channel units as an example, after completing affine registration and alignment operations, an aligned flow channel unit image set is obtained. The aligned flow channel unit image set contains eight aligned images, each with a size of 200 pixels × 500 pixels. An aligned image to be detected is taken from the aligned flow channel unit image set, and a standard template image corresponding to the aligned image to be detected is obtained. The standard template image has the same row and column size as the aligned image to be detected. The standard template image has 200 rows and 500 columns. The standard template image is pre-stored in the system and represents the standard grayscale distribution of defect-free flow channel units.

[0054] In some embodiments, the starting pixel position in the alignment image to be detected is located, where the starting pixel position is row 1, column 1. Starting from the starting pixel position, all pixel positions are traversed in row-major order. The row-major order is as follows: first, the row number is fixed, and all column numbers are traversed. After completing a row, the row number is incremented by one, and then the traversal starts from column 1 again, until the 200th row and 500th column are traversed. At each pixel position, the gray value of the alignment image to be detected at that pixel position is subtracted from the gray value of the standard template image at that pixel position to obtain the gray value difference at that pixel position. Assuming the gray value of the alignment image to be detected at pixel position (i,j) is... The grayscale value of the standard template image at pixel position (i,j) is Then the grayscale difference .

[0055] Optionally, the grayscale difference is compared with zero. When the grayscale difference is negative, it is assigned the value of zero; when the grayscale difference is positive, it is kept as the original value. The processed grayscale difference is used as the grayscale difference distribution value of the pixel position. The processing can be expressed as the following formula: in, Indicates coordinates as The grayscale difference distribution value at the pixel location, This indicates taking the maximum value between the value inside the parentheses and zero. This indicates that the aligned image to be detected in the aligned channel unit image set is located at coordinates... The grayscale value at the pixel location. This indicates that the standard template image corresponding to the aligned image to be detected is located at coordinates... The grayscale value at the pixel location. The value of is an integer from 1 to 200. The value range is from 1 to 500.

[0056] It is understood that after traversing all pixel positions, a grayscale difference distribution map is generated. This grayscale difference distribution map has the same row and column dimensions as the alignment image to be detected. The grayscale difference distribution value at each pixel position in the grayscale difference distribution map is a non-negative number; the larger the value, the greater the positive grayscale deviation of the alignment image to be detected relative to the standard template image at that position. (Appendix) Figure 4This diagram reflects the spatial distribution of grayscale differences between the aligned flow channel unit image and the standard template image. It calculates the difference between the grayscale value of each pixel in the aligned flow channel unit image and the grayscale value of the same pixel in the standard template image, retaining all positive differences to obtain a two-dimensional matrix. Each element in this matrix is ​​used as the grayscale difference distribution value at its corresponding coordinate position, forming a grayscale difference distribution map. During the generation of the grayscale difference distribution map, the aligned flow channel unit image and the standard template image have the same row and column dimensions. The value of each coordinate point in the grayscale difference distribution map represents the intensity of the positive grayscale deviation at the corresponding position on the flow channel unit surface. High-brightness pixels in the grayscale difference distribution map represent areas on the flow channel unit surface with grayscale differences relative to the standard template image, while low-brightness pixels represent areas on the flow channel unit surface with consistent grayscale relative to the standard template image. The grayscale difference distribution map transforms the texture information in the original image into single-channel intensity information reflecting processing deviations, and serves as reference information for marking candidate defect pixels.

[0057] In specific implementation, each pixel in the grayscale difference distribution map is traversed, and the grayscale difference distribution value of the pixel is compared with a preset grayscale difference threshold, which is set to 30. When the grayscale difference distribution value is greater than or equal to the preset grayscale difference threshold of 30, the pixel is marked as a candidate defect pixel. When the grayscale difference distribution value is less than 30, it is not marked. A four-connected neighborhood scanning algorithm is used to perform connected component marking on all candidate defect pixels. The neighborhood direction of the four-connected neighborhood scanning algorithm includes four directions: up, down, left, and right. Starting from the first candidate defect pixel, the first candidate defect pixel is assigned the current connected component number 1. The neighboring pixels that are four-connected to the first candidate defect pixel are scanned recursively. During the recursive scanning process, for each candidate defect pixel, its adjacent pixels in the four directions of up, down, left, and right are checked in turn to see if they are candidate defect pixels and have not been assigned a connected component number. The neighboring pixels that meet the conditions of candidate defect pixels are assigned the same current connected component number 1.

[0058] In some embodiments, when the recursive scan cannot be extended, that is, when all four-connected candidate defect pixels corresponding to the current connected component number 1 have been marked, the current connected component number is incremented by one to become 2, and the next unmarked candidate defect pixel is scanned. The next unmarked candidate defect pixel is assigned the current connected component number 2, and the recursive scan is performed again. The above process is repeated until all candidate defect pixels are assigned connected component numbers. The number of pixels and the pixel position range corresponding to each connected component number are counted. The number of pixels is the total number of candidate defect pixels belonging to the connected component. The pixel position range includes the minimum row coordinate, maximum row coordinate, minimum column coordinate, and maximum column coordinate of all pixels in the connected component. The set of pixels corresponding to each connected component number is taken as a defect connected component. The set of all defect connected components constitutes the defect connected component set.

[0059] Optionally, in the four-connected neighborhood scanning algorithm, the four neighborhood directions of each candidate defect pixel are scanned in a fixed order of up, down, left, and right.

[0060] It can be understood that each defect connected region in the defect connected region set corresponds to a connected candidate defect pixel region in the gray-scale difference distribution map, and the candidate defect pixel region reflects the position range of the flow channel unit surface with positive gray-scale deviation relative to the standard template.

[0061] In specific implementation, based on the area and aspect ratio of each connected component in the defective connected component set, the defect type corresponding to the connected component is determined, and the flow channel plate quality inspection result is output. The area is the number of pixels in the connected component, and the aspect ratio is the ratio of the height to the width of the bounding rectangle of the connected component. Connected components with an area greater than 50 pixels and an aspect ratio less than 3 are identified as pitting defects, connected components with an area greater than 200 pixels and an aspect ratio greater than 5 are identified as scratch defects, and connected components with an area between 10 and 50 pixels and an aspect ratio between 0.8 and 1.2 are identified as impurity defects. The final output flow channel plate quality inspection result includes the position coordinates and defect type of each defective connected component.

[0062] This embodiment provides a visual inspection device for the processing quality of flow channel plates. The device includes a roller conveyor 2 and a visual inspection component 1 disposed above the roller conveyor 2. The device conveys the flow channel plate 3 to the area below the visual inspection component 1 via the roller conveyor 2, and the visual inspection component 1 performs quality inspection on the flow channel plate. The visual inspection component 1 includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the aforementioned steps of visual inspection of flow channel plate processing quality.

[0063] The above embodiments are only used to illustrate the technical methods of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of the present invention without departing from the spirit and scope of the technical methods of the present invention.

Claims

1. A visual inspection method for the processing quality of flow channel plates, characterized in that, include: Acquire the original image of the flow channel plate surface, generate a grayscale image of the flow channel plate, perform threshold segmentation on the grayscale image of the flow channel plate, and extract the binary image of the flow channel region; Based on the binary map of the flow channel region, locate the contour boundary of each flow channel unit and generate a set of flow channel unit contours; A morphological closing operation is performed on each contour in the set of flow channel unit contours to fill the internal holes of the contour, thereby obtaining a complete flow channel unit region map. The geometric center coordinates and principal axis direction angle of each flow channel unit are extracted from the complete flow channel unit region map to generate a set of flow channel unit pose parameters. The pose parameter set of the flow channel unit is affine registered with a preset standard flow channel template to obtain the affine transformation matrix of each flow channel unit. The image region of each flow channel unit is mapped to the standard coordinate space according to the affine transformation matrix to generate an aligned flow channel unit image set. For each image in the aligned flow channel unit image set, calculate the pixel-by-pixel grayscale difference between the image and the standard template image, and generate a grayscale difference distribution map. For pixels in the grayscale difference distribution map that exceed a preset grayscale difference threshold, connected component marking is performed to generate a defective connected component set; Based on the area and aspect ratio of each connected component in the defect connected component set, the defect type corresponding to the connected component is determined, and the flow channel plate quality inspection result is output.

2. The visual inspection method for the processing quality of flow channel plates according to claim 1, characterized in that, The steps for acquiring the original image of the flow channel plate surface and generating a grayscale image of the flow channel plate specifically include: Control the ring light source to illuminate the surface of the flow channel plate at a preset angle, triggering the industrial camera to capture the original color image of the flow channel plate surface; Extract the red channel component, green channel component, and blue channel component from the original color image; The red channel component, green channel component, and blue channel component are fused and calculated according to a weighted summation rule, wherein the sum of the weight coefficients of the red channel component, green channel component, and blue channel component in the weighted summation rule is an integer of one. The result of the fusion calculation is used as the gray value of each pixel location to generate a grayscale image of the flow channel plate.

3. The visual inspection method for the processing quality of flow channel plates according to claim 2, characterized in that, The steps of performing threshold segmentation on the grayscale image of the flow channel plate to extract the binary image of the flow channel region specifically include: Statistically analyze the grayscale value distribution of all pixels in the grayscale image of the flow channel plate, and generate a grayscale histogram; The peak and trough positions are identified in the grayscale histogram, and the grayscale value corresponding to the trough position is used as the segmentation threshold. Traverse each pixel in the grayscale image of the flow channel plate and compare the grayscale value of that pixel with the segmentation threshold. When the grayscale value of a pixel is greater than or equal to the segmentation threshold, the pixel is assigned the value of a foreground pixel; when the grayscale value of a pixel is less than the segmentation threshold, the pixel is assigned the value of a background pixel. The assignment results of all pixels are combined into a binary map of the flow channel region.

4. The visual inspection method for the processing quality of flow channel plates according to claim 3, characterized in that, The steps of locating the contour boundary of each flow channel unit and generating a set of flow channel unit contours based on the binary map of the flow channel region specifically include: An eight-connected neighborhood scan is performed on the binary map of the flow channel region, traversing each pixel row by row starting from the top left pixel; When it is detected that the pixel value of the current pixel is a foreground pixel value and the pixel is not marked, the region growing algorithm is executed with the pixel as the seed point, and all foreground pixels that are 8-connected to the seed point are included in the same connected region. Record the minimum row coordinates, maximum row coordinates, minimum column coordinates, and maximum column coordinates of the same connected region to form the boundary rectangle of the connected region; Based on the boundary rectangle, the peripheral pixel sequence of the connected region is extracted using an edge tracking algorithm. This peripheral pixel sequence is then used as the flow channel unit contour corresponding to the connected region and stored in the flow channel unit contour set.

5. The visual inspection method for the processing quality of flow channel plates according to claim 4, characterized in that, The steps of performing morphological closing operations on each contour in the set of flow channel unit contours to fill the internal holes of the contours and obtain a complete flow channel unit region map specifically include: Take out a flow channel unit contour to be processed from the set of flow channel unit contours, and construct an internal region binary map of the contour with the flow channel unit contour as the boundary. The pixels inside the contour boundary in the internal region binary map are assigned as foreground pixel values, and the pixels outside the contour boundary are assigned as background pixel values. Construct a circular structural element, the radius of which is determined according to the standard width of the flow channel unit; Perform an expansion operation on the internal region binary image and the circular structural element to obtain an expanded region binary image; The expanded region binary map and the circular structural element are subjected to an erosion operation to obtain an eroded region binary map. The eroded region binary map is used as the complete flow channel unit region map of the flow channel unit. Traverse all flow channel unit outlines and merge the complete flow channel unit region map corresponding to each flow channel unit according to spatial location to obtain the complete flow channel unit region map.

6. The visual inspection method for the processing quality of a flow channel plate according to claim 5, characterized in that, The steps of extracting the geometric center coordinates and principal axis orientation angles of each flow channel unit from the complete flow channel unit region diagram to generate the flow channel unit pose parameter set specifically include: Locate a flow channel unit region to be processed from the complete flow channel unit region map, and calculate the sum of the row coordinates and the sum of the column coordinates of all pixels in the flow channel unit region; The total number of pixels within the flow channel unit region is used as the area normalization factor. The sum of the row coordinates and the sum of the column coordinates are divided by the area normalization factor to obtain the geometric center row coordinates and geometric center column coordinates of the flow channel unit region, which are then combined to form the geometric center coordinates. Calculate the covariance matrix of each pixel within the flow channel unit region relative to the geometric center coordinates, and solve for the eigenvector corresponding to the largest eigenvalue of the covariance matrix; The orientation angle of the feature vector is used as the principal axis orientation angle of the flow channel unit region. The geometric center coordinates and the principal axis orientation angle are associated and stored as a flow channel unit pose parameter record. After traversing all flow channel unit regions, a flow channel unit pose parameter set is generated.

7. The visual inspection method for the processing quality of a flow channel plate according to claim 6, characterized in that, The step of performing affine registration between the pose parameter set of the flow channel unit and a preset standard flow channel template to obtain the affine transformation matrix of each flow channel unit specifically includes: Take out a flow channel unit pose parameter record to be registered from the flow channel unit pose parameter set. Based on the geometric center coordinates and principal axis direction angle in the record, construct the source point set of the flow channel unit. The source point set contains the coordinates of multiple feature points in the region of the flow channel unit. Extract the target point set corresponding to the flow channel unit from the preset standard flow channel template. The target point set contains the coordinates of multiple feature points with the same relative position within the standard flow channel unit area. The rigid body transformation parameters from the source point set to the target point set are calculated using the least squares fitting algorithm. The rigid body transformation parameters include rotation angle, translation row offset value, and translation column offset value. The rotation angle, the row offset value of the translation amount, and the column offset value of the translation amount are combined into a three-row, three-column affine transformation matrix, and this affine transformation matrix is ​​used as the affine transformation matrix of the flow channel unit.

8. The visual inspection method for the processing quality of a flow channel plate according to claim 7, characterized in that, The step of mapping the image region of each flow channel unit to the standard coordinate space according to the affine transformation matrix to generate an aligned flow channel unit image set specifically includes: For a flow channel unit to be transformed, obtain the affine transformation matrix corresponding to the flow channel unit and the image region of the flow channel unit in the original image; Traverse each source pixel in the image region, obtain the original row coordinates and original column coordinates of the source pixel, and combine the original row coordinates and original column coordinates into a two-dimensional column vector. Perform matrix multiplication on the affine transformation matrix and the two-dimensional column vector to obtain the transformed row coordinates and column coordinates, which are used as the position coordinates of the target pixel. A bilinear interpolation algorithm is used to calculate the gray value of the target pixel based on the gray value of the source pixel. The gray values ​​of all target pixels are arranged according to the target position coordinates to generate the image after the flow channel unit is aligned. After traversing all flow channel units, the image set of the aligned flow channel units is obtained.

9. The visual inspection method for the processing quality of a flow channel plate according to claim 8, characterized in that, For each image in the aligned flow channel unit image set, the step of calculating the pixel-by-pixel grayscale difference between the image and the standard template image, and generating a grayscale difference distribution map, specifically includes: Take out an aligned image to be detected from the aligned flow channel unit image set, and at the same time obtain a standard template image corresponding to the aligned image. The standard template image has the same row and column size as the aligned image. Locate the starting pixel position in the aligned image, and traverse all pixel positions in row-major order starting from the starting pixel position; At each pixel location, the gray value of the aligned image at that pixel location is subtracted from the gray value of the standard template image at that pixel location to obtain the gray value difference at that pixel location. The grayscale difference is compared with zero. When the grayscale difference is negative, the grayscale difference is assigned to zero. When the grayscale difference is positive, the original value is kept. The processed grayscale difference is used as the grayscale difference distribution value of the pixel position. After traversing all pixel positions, a grayscale difference distribution map is generated. The step of marking connected components of pixels in the grayscale difference distribution map that exceed a preset grayscale difference threshold to generate a set of defective connected components specifically includes: Traverse each pixel in the grayscale difference distribution map, compare the grayscale difference distribution value of the pixel with the preset grayscale difference threshold, and mark the pixel as a candidate defect pixel when the grayscale difference distribution value is greater than or equal to the preset grayscale difference threshold. A four-connected neighborhood scanning algorithm is used to perform connected component marking on all candidate defect pixels. Starting from the first candidate defect pixel, the candidate defect pixel is assigned the current connected component number. The neighboring pixels that are four-connected to the candidate defect pixel are scanned recursively, and the neighboring pixels that meet the conditions of the candidate defect pixel are assigned the same current connected component number. When the recursive scan cannot be expanded, the current connected component number is incremented by one, and the next unmarked candidate defect pixel is scanned until all candidate defect pixels are assigned connected component numbers. Count the number of pixels and the range of pixel positions corresponding to each connected component number, and take the set of pixels corresponding to each connected component number as a defective connected component. The set of all defective connected components constitutes the defective connected component set.

10. A visual inspection device for the processing quality of flow channel plates, characterized in that, The device includes a roller conveyor and a vision inspection component disposed above and below the roller conveyor. The vision inspection component includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of visual inspection of the flow channel plate processing quality as described in any one of claims 1 to 9.