Machine vision-based method for detecting overall dimension of porcelain part of mixed porcelain post insulator
The method for detecting the outer dimensions of ceramic parts by using a binocular camera and a multi-scale feature fusion mechanism solves the problems of large detection errors and low efficiency in traditional methods, and achieves high-precision and high-efficiency measurement of the outer dimensions of ceramic parts. It is suitable for the industrial production of ceramic parts for hybrid ceramic support insulators.
Patent Information
- Application Number
- CN202511249674.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2025-12-26
AI Technical Summary
Traditional manual inspection suffers from large errors and low efficiency. Laser ranging and ultrasonic ranging technologies have low accuracy, slow response, and environmental requirements. Monocular vision lacks depth information, and existing binocular camera 3D reconstruction is not adapted to the size and shape of ceramic parts, resulting in edge extraction errors. These factors affect the accuracy and efficiency of detecting the outer dimensions of ceramic parts in hybrid ceramic support insulators.
The system employs a binocular camera to simultaneously acquire images and performs distortion correction and grayscale normalization. It combines a multi-scale feature fusion mechanism to identify the type of porcelain piece, extracts edges in different regions and performs edge-guided 3D reconstruction, generates a disparity map through a stereo matching algorithm and calculates the outer dimensions of the porcelain piece, and configures LED auxiliary lighting and an embedded edge computing unit to improve detection accuracy and real-time performance.
It improves the accuracy and efficiency of ceramic part dimension inspection, ensures the product yield of injection molding process, and meets the rapid inspection needs of industrial production.
Smart Images

Figure CN121213637A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of machine vision detection, size and quality control of porcelain parts of insulators, and particularly relates to a method for detecting the outer contour size of a porcelain part of a hybrid porcelain post insulator based on machine vision. BACKGROUND
[0002] The new hybrid porcelain post insulator takes a porcelain insulating post as the inner core and is coated with high-temperature vulcanized silicone rubber on the outside. The production process of the hybrid porcelain post insulator requires that the finished porcelain insulating part be placed into an injection machine to form high-temperature vulcanized silicone rubber in one injection. The injection mold needs to be opened according to the size and model of the injection product. Once the mold is opened, it cannot be changed. The size deviation of the injection part will affect the quality of the final product, for example, causing uneven thickness of the surface silicone rubber. The cost of opening the mold is high, so once the mold is opened, the industry will choose to control the size precision of the injection part to improve the yield of the product. Therefore, in order to improve the production efficiency and yield, it is necessary to find a way to control the size deviation of the injection porcelain insulating part within a certain range.
[0003] The error measurement efficiency is low due to subjective factors and fatigue problems in traditional manual detection. Although traditional methods such as laser ranging, ultrasonic ranging and infrared ranging perform well in some aspects, they have problems such as low precision, slow response, unstable work and demand for measurement environment. When measuring objects, monocular vision systems lack depth information and cannot accurately obtain size information in three-dimensional space. Therefore, it is suitable to use binocular cameras to shoot left-eye images and right-eye images, and to perform three-dimensional reconstruction of the porcelain insulating post through the left-eye images and the right-eye images, and then to detect the size of the three-dimensional model.
[0004] The porcelain part of the hybrid porcelain post insulator has various sizes and shapes, and the existing binocular camera three-dimensional reconstruction method does not make corresponding adjustments to the edge extraction of the porcelain part according to the size and shape of the porcelain part. For example, the edge extraction is first performed on the porcelain part with a larger size, and then the edge extraction is performed on the porcelain part with a smaller size. At this time, the camera needs to be focused, resulting in different resolutions of the two porcelain part images. However, the existing edge extraction algorithm does not perform edge extraction on the two porcelain part images with different resolutions respectively, resulting in a difference in the clarity of the edge images of the two porcelain parts. When edge extraction is performed on porcelain parts of various sizes, the error is large. In addition, the porcelain part may have a complex shape. The existing edge extraction method usually performs edge extraction on the entire image at one time. This overall edge extraction method is often affected by the extraction accuracy when facing porcelain parts with complex shapes, resulting in inaccurate edge contours of the porcelain parts. SUMMARY
[0005] To address the shortcomings and deficiencies of existing technologies, this invention provides a machine vision-based method for detecting the outer dimensions of ceramic components in hybrid porcelain post insulators. This method aims to solve the problems of large errors and low efficiency in traditional manual inspection, low accuracy, slow response, and environmental requirements of laser and ultrasonic ranging technologies, lack of depth information in monocular vision, and edge extraction errors caused by the incompatibility of existing binocular camera 3D reconstruction with the size and shape of the ceramic components. This improves the accuracy, stability, and efficiency of detecting the outer dimensions of ceramic components in hybrid porcelain post insulators, ensuring a high product yield in subsequent injection molding processes.
[0006] This method first uses a binocular camera to simultaneously acquire left and right eye images of the porcelain piece to be inspected, and then preprocesses the acquired images to eliminate imaging interference: distortion correction is performed using the Zhang Zhengyou calibration method to remove radial and tangential distortions; gray-level normalization is achieved using a contrast-limited adaptive histogram equalization algorithm, with the block size set to 8×8 and the contrast threshold set to 2.0, effectively suppressing the influence of uneven illumination; noise reduction is achieved by combining median filtering with a 3×3 window and bilateral filtering with spatial domain parameter σs=5 and gray-level parameter σr=75, preserving image edge details while removing noise.
[0007] Next, a multi-scale feature fusion mechanism is used to accurately identify the type of porcelain piece: the SwinTransformer model is used to extract multi-scale feature maps from the preprocessed image. This model maps the image into sequence features through the Patch Partition module, and generates multiple scale features through a stage module that includes a Patch Merging downsampling module and a Swin Transformer Block (containing multi-head self-attention of windows and multi-head self-attention of shifted windows). The feature maps of each scale are then input into a feedforward neural network. This network generates a probability distribution vector for the corresponding porcelain piece type for each scale feature map. After accumulating the probability distribution vectors of all scales, the type with the highest probability is selected as the type of porcelain piece to be detected, thereby offsetting the influence of different sizes of porcelain pieces on type recognition.
[0008] Subsequently, edge extraction was performed on different regions based on the identified porcelain type: the preprocessed image was segmented into multiple region images adapted to the local shape of the porcelain piece using the Segment Anything Model (SAM model). This model utilizes an image encoder (using Vision...) The system employs a Transformer architecture, a cue encoder (processing interactive cues and converting them into cue feature vectors), and a mask decoder (combining image feature vectors and cue feature vectors to generate a segmentation mask) to achieve accurate segmentation. Edge extraction is performed independently on each region of the image. First, the gradient magnitude is calculated based on the Sobel operator to determine edge strength. Then, the Canny algorithm (high threshold 0.3, low threshold 0.1) is used to filter candidate edges and suppress false edges. The Hough line transform (minimum line length 30 pixels, maximum gap 5 pixels) and ellipse fitting algorithm are combined to extract the key contours of the ceramic piece. Simultaneously, edge reliability is verified through contour closure (the ratio of the total length of closable edge pixels to the sum of the lengths of all edge pixels) and boundary connectivity (the ratio of the number of pixels in the identified connected edge regions to the total number of edge pixels). Finally, the edges of each region are stitched together to form complete left and right eye edge images, solving the problem of low overall edge extraction accuracy for complex-shaped ceramic pieces.
[0009] Subsequently, edge-guided 3D reconstruction was performed based on binocular edge images: a semi-global matching algorithm was used to generate a dense disparity map. First, a Census transform cost volume was constructed to measure local texture similarity. Then, the matching cost was aggregated along eight directional paths. At the same time, an edge guidance term was introduced, prioritizing the continuity constraint of the disparity values of neighboring pixels along the contour line of the ceramic piece. This enhanced the continuity weight of the disparity values of pixels on the contour line and reduced disparity abrupt changes, thereby improving the accuracy of the disparity map in low-texture areas. Based on the disparity map, the spatial depth of the pixels was calculated by triangulation. The depth map was back-projected onto the camera coordinate system to generate a dense point cloud. After denoising the dense point cloud using voxel filtering with a grid size of 2mm, a regularized 3D model of the ceramic piece was formed by reconstructing it using normal vectors.
[0010] Finally, the outer dimensions are calculated: the 3D point cloud in the camera coordinate system is transformed to the world coordinate system to eliminate the influence of viewing angle tilt on the dimension measurement; principal component analysis is performed on the point cloud in the world coordinate system to calculate the eigenvectors of the point cloud covariance matrix, and the point cloud is rotated to the direction of maximum variance to make the axis of the ceramic piece consistent with the coordinate axes; the minimum bounding box of the aligned point cloud is solved by the oriented bounding box algorithm, and the length, width and height of the ceramic piece are calculated based on the extreme values of the projection of the vertices of the cuboid in the x-axis, y-axis and z-axis directions.
[0011] Furthermore, this invention incorporates an LED auxiliary lighting system during image acquisition to provide uniform and stable illumination for the ceramic piece to be inspected, further ensuring image quality. Simultaneously, an embedded edge computing unit is used to perform image preprocessing operations. The preprocessed image is then transmitted to a host computer processing platform, where the host computer completes the steps of ceramic piece type identification, regional edge extraction, 3D reconstruction, and size calculation. This effectively improves the real-time performance of the inspection process and meets the needs of rapid size inspection of ceramic pieces in industrial production.
[0012] The present invention specifically employs the following technical means:
[0013] A machine vision-based method for detecting the external dimensions of ceramic components in hybrid porcelain post insulators includes:
[0014] A binocular camera is used to simultaneously acquire left and right eye images of the porcelain piece to be inspected, and the left and right eye images are preprocessed to eliminate imaging interference.
[0015] Multi-scale features of the preprocessed image are extracted through a multi-scale feature fusion mechanism. A classification network is used to predict the probability of porcelain type for each scale feature. After summing the probability distribution vectors of all scales, the type with the highest probability is selected as the type of porcelain to be detected.
[0016] Based on the type of porcelain piece, the preprocessed image is divided into multiple region images that are adapted to the local shape of the porcelain piece. The edges of each region image are extracted independently and stitched together to form a complete edge image, so as to process the complex edges of the porcelain piece that are difficult to extract as a whole.
[0017] Based on the complete edge images of the left and right eyes, a disparity map is generated through a stereo matching algorithm. During the disparity optimization process, an edge guidance term is introduced to prioritize maintaining disparity continuity along the outline of the ceramic piece. After reconstructing the 3D model of the ceramic piece, its outer dimension parameters are calculated.
[0018] Furthermore, the preprocessing includes distortion correction, grayscale normalization, and denoising. Distortion correction is performed based on the Zhang Zhengyou calibration method, which obtains the radial and tangential distortion coefficients of the binocular camera and substitutes them into the geometric correction formula to calculate the corrected pixel coordinates to eliminate radial and tangential distortion. Grayscale normalization adopts a contrast-limited adaptive histogram equalization algorithm, setting the block size of the algorithm to 8×8 and the contrast threshold to 2.0 to suppress uneven illumination. Denoising combines median filtering with a 3×3 window and bilateral filtering with spatial domain parameter σs=5 and grayscale domain parameter σr=75 to suppress noise while preserving image edges.
[0019] Furthermore, the multi-scale feature fusion mechanism is implemented through the Swing Transformer model. The Swing Transformer model includes a Patch Partition module and multiple stage modules. The Patch Partition module consists of convolutional layers and is used to map the preprocessed image into sequential features. Each stage module includes a Patch Merging downsampling module and multiple Swing Transformer Blocks. The Swing Transformer Blocks contain window multi-head self-attention and displacement window multi-head self-attention. Window multi-head self-attention calculates self-attention within a fixed window of a given size, while displacement window multi-head self-attention is used to achieve cross-window information transfer to generate feature maps of multiple scales.
[0020] Furthermore, the classification network is a feedforward neural network, including an input layer, a hidden layer, and an output layer. The input layer transforms multi-scale feature maps into initial feature vectors through multi-layer convolutional modules. The hidden layer contains multiple layers of neurons, and the feature vectors are passed layer by layer in the hidden layer. Each neuron performs non-linear feature extraction on the input feature vector through a weight matrix, activation function, and bias vector. The output layer receives the output feature vector of the last hidden layer, and generates the probability distribution vector of each type of ceramic piece after processing by the softmax function.
[0021] Furthermore, the segmentation of the preprocessed image into multiple region images adapted to the local shape of the ceramic piece is performed through the Segment Anything Model. The Segment Anything Model includes an image encoder, a cue encoder, and a mask decoder. The image encoder adopts a Vision Transformer structure to map the preprocessed image into an image feature vector. The cue encoder processes interactive cue and converts it into a cue feature vector. The mask decoder adopts a lightweight Transformer structure, combines the image feature vector and the cue feature vector to generate a segmentation mask, and achieves image segmentation through the segmentation mask.
[0022] Furthermore, the independent edge extraction for each region image includes: calculating the gradient magnitude of the region image based on the Sobel operator, screening candidate edges using the Canny algorithm, and extracting the key contours of the porcelain piece by combining the Hough line transform and ellipse fitting algorithm; after edge extraction, the reliability of the edges is verified by contour closure and boundary connectivity, wherein the contour closure is calculated by the ratio of the total pixel length of the closable edges to the sum of the pixel lengths of all edges, and the boundary connectivity is calculated by the ratio of the number of pixels in the identified connected edge regions to the total number of edge pixels.
[0023] Furthermore, the stereo matching algorithm is a semi-global matching algorithm; when generating the disparity map, the Census transform cost volume is first constructed to measure local texture similarity, and then the matching cost is aggregated along the 8-direction path; the specific optimization method of the edge guidance term is as follows: prioritize the continuity constraint of the disparity value of the neighboring pixels along the porcelain outline direction in the complete edge image, and enhance the disparity value continuity weight when the neighboring pixels are located on the outline to reduce disparity abrupt changes, so as to improve the accuracy of the disparity map in the low texture area.
[0024] Furthermore, the reconstructed 3D model of the ceramic piece includes: calculating the spatial depth of pixels based on the disparity map through triangulation, back-projecting the depth map onto the camera coordinate system to generate a dense point cloud, using voxel filtering with a given grid size to reduce noise in the dense point cloud, and then reconstructing a regularized 3D mesh model through normal vectors.
[0025] Furthermore, the calculation of its outer dimension parameters includes: transforming the point cloud in the camera coordinate system to the world coordinate system to eliminate the effect of view tilt; performing principal component analysis on the point cloud in the world coordinate system and rotating it to the direction of maximum variance so that the axis of the ceramic piece is consistent with the coordinate axis; then solving the minimum bounding box algorithm to find the minimum bounding box; and calculating the length, width and height of the ceramic piece based on the extreme values of the projection of the vertices of the cuboid in the x-axis, y-axis and z-axis directions.
[0026] Furthermore, when using a binocular camera to simultaneously acquire the left and right eye images of the ceramic piece to be inspected, an LED auxiliary lighting system is configured; the LED auxiliary lighting system is used to provide uniform and stable illumination for the ceramic piece to be inspected.
[0027] The preprocessing of the left and right eye images is performed by the embedded edge computing unit. The preprocessed left and right eye images are transmitted to the host computer processing platform, which performs multi-scale feature fusion for ceramic type recognition, regional adaptive edge extraction, edge-guided 3D reconstruction, and size calculation.
[0028] And a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described above.
[0029] A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described above.
[0030] Compared to existing technologies, this invention and its preferred solution effectively offset the impact of different sized ceramic pieces on type recognition through a multi-scale feature fusion mechanism, improving the accuracy of ceramic piece type judgment. Based on a regional edge extraction strategy for ceramic piece type, independent edge extraction and stitching of local areas are performed for complex-shaped ceramic pieces, reducing accuracy loss during overall edge extraction and improving the integrity and reliability of the left and right eye edge images. An edge guidance term is introduced during 3D reconstruction to optimize disparity continuity, and combined with high-precision edge images, stereo matching accuracy is improved, thereby enhancing the reconstruction quality of the ceramic piece's 3D model. Through principal component analysis and oriented bounding box algorithms, accurate extraction of the ceramic piece's external dimension parameters is achieved, providing a reliable dimensional detection basis for subsequent injection molding processes. Simultaneously, through the collaborative work of the embedded edge computing unit and the host computer processing platform, combined with an LED auxiliary lighting system, the system optimizes real-time performance and stability while ensuring detection accuracy, meeting the needs of rapid ceramic piece size detection in industrial production. Attached Figure Description
[0031] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:
[0032] Figure 1 This is a schematic diagram of the image preprocessing process according to an embodiment of the present invention;
[0033] Figure 2 This is a schematic diagram of the binocular detection module according to an embodiment of the present invention;
[0034] Figure 3 This is a schematic diagram of the Swin Transformer model according to an embodiment of the present invention;
[0035] Figure 4 This is a schematic diagram of the structure of the Swing Transformer Block according to an embodiment of the present invention;
[0036] Figure 5 This is a flowchart illustrating the edge filtering module according to an embodiment of the present invention;
[0037] Figure 6 This is a schematic diagram of the device structure for the specific implementation of the machine vision-based scheme for detecting the outer dimensions of ceramic components in hybrid ceramic post insulators according to an embodiment of the present invention. Detailed Implementation
[0038] In the following, specific embodiments of this application will be described in detail with reference to the accompanying drawings. Based on these detailed descriptions, those skilled in the art will be able to clearly understand and implement this application. Without departing from the principles of this application, features from various embodiments can be combined to obtain new implementations, or certain features from some embodiments can be substituted to obtain other preferred implementations.
[0039] To address the problems of existing technologies, this invention provides a machine vision-based method for detecting the outer dimensions of ceramic components in hybrid ceramic post insulators. First, the Swing Transformer model is used to divide the input image into feature maps of multiple scales. These feature maps are then input into a feedforward neural network for component type identification. The feedforward neural network generates a probability distribution vector for each scale of feature map. The closer the feature map is to the size of the ceramic component being tested, the higher the probability of that component type in its corresponding probability distribution vector. The probability distribution vectors corresponding to all scales are summed, and the type of insulator ceramic component with the highest probability is the type of the ceramic component being tested. This method effectively cancels out the influence of different ceramic component sizes on type identification. Next, the shape of the porcelain piece to be tested will be determined based on its type. The input image will be segmented according to the shape of the porcelain piece, and complex contours that are difficult to extract as a whole will be segmented and extracted separately. The extracted edges will then be stitched together to form a complete edge. This reduces the impact of complex shapes on edge extraction and improves the overall accuracy of the left and right eye edge images. Finally, 3D reconstruction will be performed using the high-precision left and right eye edge images to obtain a high-precision 3D model of the porcelain piece. Finally, the dimensions of the high-precision 3D model of the porcelain piece will be checked to improve the accuracy of dimension detection.
[0040] The overall process of the embodiments of the present invention will be shown and described in more detail below with reference to the accompanying drawings:
[0041] 1. Image preprocessing
[0042] like Figure 1 As shown, image preprocessing aims to eliminate imaging interference and provide stable input for subsequent algorithms. The process includes:
[0043] First, for the radial distortion coefficient set (k1, k2, k3) and tangential distortion coefficient set (p1, p2) of the stereo camera, the distortion coefficient set D=[k1, k2, p1, p2, k3] is obtained based on Zhang Zhengyou's calibration method, and the distortion is eliminated through geometric correction formula:
[0044] x′=x(1+k1r 2 +k2r 4 +k3r 6 )+2p1xy+p2(r 2 +2x 2 )
[0045] y′=y(1+k1r 2 +k2r 4 +k3r 6 )+p1(r 2 +2y 2)+2p2xy
[0046] In the formula, (x, y) are the original pixel coordinates, and r 2 =x 2 +y 2 , where (x′, y′) are the corrected coordinates.
[0047] Then, the CLAHE algorithm (Contrast-Limited Adaptive Histogram Equalization) was used to normalize the grayscale distribution to suppress uneven illumination. The block size was set to 8×8 and the contrast threshold to 2.0.
[0048] Subsequently, denoising is performed using a combination of median filtering (3×3 window, noise suppression) and bilateral filtering (spatial domain σs=5, gray-level domain σr=75, edge preservation). Finally, the gradient magnitude is calculated using the Sobel operator.
[0049] G(x, y) =
[0050] In the formula, G x G y G(x, y) represents the grayscale change rate of the image along the x-axis and y-axis, respectively, and G(x, y) represents the gradient intensity of the pixel, which is used to determine the edge intensity.
[0051] After preprocessing, the left and right eye images are obtained.
[0052] 2. Edge extraction from left and right eye images
[0053] A binocular detection module is constructed, which includes a first branch network and a second branch network. The first branch network includes a first Swin Transformer model, a first feedforward neural network, a first segmentation module, and a first edge filtering module.
[0054] The second branch network includes a second Swin Transformer model, a second feedforward neural network, a second segmentation module, and a second edge filtering module.
[0055] The structure of the binocular detection module obtained thus is as follows: Figure 2 As shown.
[0056] The Swin Transformer model consists of a Patch Partition module and multiple stage modules. The Patch Partition module is composed of convolutional layers and maps the input image into sequence features. The stage modules include a Patch Merging downsampling module and multiple Swin Transformer Blocks.
[0057] The preferred option is the SwinTransformer model, which consists of three phase modules, each containing two Swin Transformer Blocks. Its structure diagram is shown below. Figure 3 As shown.
[0058] The structure of the Swin Transformer Block is as follows: Figure 4 As shown.
[0059] W-MSA is window-based multi-head self-attention, which calculates self-attention within a fixed window (default 7×7). SW-MSA is displacement-window-based multi-head self-attention, enabling cross-window information transfer.
[0060] A feedforward neural network consists of an input layer, a hidden layer, and an output layer. The input layer receives the image, the hidden layer contains multiple layers of neurons, each layer of neurons processes the data through weighted summation and activation functions, and the output layer generates the probability distribution vector for the final classification. The image is passed from the input layer through the hidden layer to the output layer.
[0061] The multi-layer convolutional modules in the input layer transform the image into feature vectors. ,Will Nonlinear feature extraction is performed on the first layer of neurons in the hidden layer to obtain the output feature vector of the first layer of neurons. The feature vector is passed layer by layer in the hidden layers, and the expression is:
[0062]
[0063] in, This represents the output feature vector of the l-th layer neuron. This represents the weight matrix of the neurons in the l-th layer. This represents the bias vector of the neurons in the l-th layer. This represents the activation function.
[0064] The output feature vector of the last layer of neurons is input into the output layer, and after being processed by the softmax function, the probability distribution vector is obtained.
[0065] The segmentation module employs the SAM (Segment Anything Model), which includes an image encoder, a cue encoder, and a mask decoder. The image encoder uses a ViT (Vision Transformer) structure to map the input image into image feature vectors. The cue encoder processes interactive prompts input by the user, supporting point, bounding box, text (via CLIP encoding), and mask inputs, converting interactive information into cue feature vectors. The mask decoder uses a lightweight Transformer structure, combining the image feature vectors and cue feature vectors to generate a segmentation mask. The segmentation mask is then used to segment the image, obtaining multiple region images.
[0066] The edge filtering module is used to locate the edge contours of the porcelain components of the hybrid porcelain post insulator from the region image. Its process is as follows: Figure 5 As shown.
[0067] First, the gradient magnitude map is calculated based on the Sobel operator, and its pixel value G(x, y) is defined as:
[0068]
[0069] In the formula, I represents the grayscale image, and the gradient magnitude reflects the edge intensity; G x G y These represent the gradient operators in the horizontal and vertical directions, respectively. To avoid interference from complex backgrounds, the Canny algorithm (high threshold 0.3, low threshold 0.1) is used to filter candidate boundaries, and breakpoints are connected by a hysteresis threshold to suppress false edges.
[0070] Hough line transform (minimum line length 30 pixels, maximum gap 5 pixels) and ellipse fitting algorithm are used to extract key features such as the edges and top contour of the ceramic piece. To improve the reliability of the contour, contour closure (CCR) and boundary connectivity (BCI) are defined:
[0071]
[0072] In the formula, L closed L is the total pixel length of the closable edge. total N is the sum of the lengths of all edge pixels; connected N represents the number of pixels in the identified connected edge regions. total The total number of edge pixels is used to measure contour closure and boundary connectivity, respectively.
[0073] Based on the above design, the engineering process for obtaining the first branch network is as follows:
[0074] The left-eye image is input into the first branch network. First, the first Swin Transformer model extracts multi-scale features of the left-eye image to obtain left-eye feature maps at multiple scales. ,in This represents the feature map of the left eye at the nth scale.
[0075] The left-eye feature map at each scale is predicted probably by the first feedforward neural network. Each left-eye feature map generates a probability distribution vector, which contains the probabilities of all insulator ceramic types. The n probability distribution vectors are added together to obtain the final probability of each insulator ceramic type. The insulator ceramic type with the highest final probability is taken as the insulator ceramic type of the left-eye image.
[0076] Based on the type of insulator ceramic component, the left-eye image is segmented into several region images by the first segmentation module. For example, if the insulator ceramic component is a cylinder with a handle, the left-eye image is segmented into a cylinder region image and a handle region image. The first edge filtering module extracts the edges of each region image to obtain the edge images of each region, and then the edge images of each region are stitched together to form the left-eye edge image.
[0077] The engineering process for the second branch network is the same as that for the first branch network, and will not be repeated here.
[0078] 3. Three-dimensional reconstruction
[0079] This invention's three-dimensional reconstruction is based on a binocular stereo matching algorithm, aiming to recover the spatial model of the outer contour of the ceramic component of a hybrid ceramic support insulator from the feature-extracted image. First, the intrinsic parameter matrix K, extrinsic parameter rotation matrix R, and translation vector T of the binocular camera are obtained using the Zhang Zhengyou calibration method, establishing the geometric mapping relationship between the left and right views:
[0080] P right =R·P left +T.
[0081] In the formula, P left and P right These are the coordinates of the matching points in the left and right edge images, respectively.
[0082] Subsequently, a dense disparity map d(x, y) is generated using the semi-global matching (SGM) algorithm. The energy function E(d) is optimized by constructing a cost volume (using Census transform to measure local texture similarity) and aggregating matching costs along eight-directional paths.
[0083]
[0084] In the formula, C(p, d) is the matching cost of pixel p under disparity d, p1 and p2 are smoothing constraint parameters, I is an indicator function (1 if the condition is met, 0 otherwise), and d p d q These represent the disparity values between the current pixel and its neighboring pixels. To improve accuracy in low-texture regions, an edge guidance term is introduced, prioritizing the optimization of disparity continuity along the feature-extracted contour lines. Based on the disparity map, depth is calculated through triangulation.
[0085]
[0086] In the formula, Z represents depth, f represents focal length, B represents baseline length, and d(x, y) represents disparity value, used to calculate the actual distance using disparity. The depth map is back-projected onto the camera coordinate system to generate a dense point cloud. After voxel filtering (grid size 2mm) for noise reduction and normal vector reconstruction, a regularized 3D mesh model is formed, providing high-precision input for size calculation.
[0087] 4. Dimension Calculation Method
[0088] Based on the point cloud data reconstructed in 3D, in this embodiment, the size calculation is performed by extracting the length (L), width (W), and height (H) contour parameters of the hybrid porcelain post insulator through geometric analysis. First, the point cloud P in the camera coordinate system... C Transform to the world coordinate system W.
[0089] P W =R T ·P C +T
[0090] In the formula, P W P represents the coordinates (set) of a 3D point cloud in the world coordinate system. C Let R be the coordinates (set) of the 3D point cloud in the camera coordinate system, R be the rotation matrix, and T be the translation vector to eliminate the influence of viewpoint tilt on dimensional measurement. To optimize boundary fitting, Principal Component Analysis (PCA) is used to align the principal directions of the point cloud: the eigenvectors of the covariance matrix are calculated, and the point cloud is rotated to the direction of maximum variance, so that the axis of the ceramic piece is aligned with the coordinate axes. After alignment, the minimum bounding box (OBB) algorithm is used to solve for the smallest bounding box, and the dimensions are determined by the extreme values of the vertex projections.
[0091] L=max(x)-min(x), W=max(y)-min(y), H=max(z)-min(z)
[0092] In the formula, x, y, and z represent the projection distribution of the aligned point cloud along the three coordinate axes, and L, W, and H represent the length, width, and height of the ceramic piece, respectively.
[0093] refer to Figure 6This is a specific implementation device structure for the machine vision-based scheme of detecting the outer dimensions of hybrid porcelain post insulator ceramic components, according to an embodiment of the present invention. Components 1 and 2 together form a binocular camera, 3 is an LED auxiliary lighting system, 4 is the ceramic component, 5 is a host computer processing platform, and 6 is an embedded edge computing unit.
[0094] This invention improves the real-time performance and stability of the system: based on a binocular vision system, it enables high real-time and high-stability measurements. Through a multi-view binocular vision perception method for target size measurement, the accuracy of target 3D reconstruction is effectively improved, thereby enhancing the accuracy of target contour size measurement. It can detect whether the dimensions of ceramic parts meet requirements and whether subsequent injection work can proceed.
[0095] Based on the same inventive concept, this invention also provides a computer device, comprising: one or more processors, and a memory for storing one or more computer programs; the programs include program instructions, and the processor executes the program instructions stored in the memory. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, used to implement one or more instructions, specifically for loading and executing one or more instructions stored in a computer storage medium to implement the above-described method.
[0096] It should be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, performs the above-described method. This storage medium can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0097] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0098] The foregoing has shown and described the basic principles, main features, and advantages of this disclosure. Those skilled in the art should understand that this disclosure is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of this disclosure. Various changes and modifications can be made to this disclosure without departing from its spirit and scope, and all such changes and modifications fall within the scope of this disclosure as claimed.
[0099] This invention is not limited to the preferred embodiment described above. Anyone inspired by this invention can derive various other forms of machine vision-based methods for detecting the outer dimensions of ceramic components in hybrid ceramic post insulators. All equivalent variations and modifications made within the scope of the claims of this invention should be considered within the scope of this invention.
Claims
1. A method for detecting the outer dimensions of ceramic components in hybrid porcelain post insulators based on machine vision, characterized in that, include: A binocular camera is used to simultaneously acquire left and right eye images of the porcelain piece to be inspected, and the left and right eye images are preprocessed to eliminate imaging interference. Multi-scale features of the preprocessed image are extracted through a multi-scale feature fusion mechanism. A classification network is used to predict the probability of porcelain type for each scale feature. After summing the probability distribution vectors of all scales, the type with the highest probability is selected as the type of porcelain to be detected. Based on the type of porcelain piece, the preprocessed image is divided into multiple region images that are adapted to the local shape of the porcelain piece. The edges of each region image are extracted independently and stitched together to form a complete edge image, so as to process the complex edges of the porcelain piece that are difficult to extract as a whole. Based on the complete edge images of the left and right eyes, a disparity map is generated through a stereo matching algorithm. During the disparity optimization process, an edge guidance term is introduced to prioritize maintaining disparity continuity along the outline of the ceramic piece. After reconstructing the 3D model of the ceramic piece, its outer dimension parameters are calculated.
2. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: The preprocessing includes distortion correction, grayscale normalization, and denoising. Distortion correction is performed based on the Zhang Zhengyou calibration method. The radial and tangential distortion coefficients of the binocular camera are obtained and substituted into the geometric correction formula to calculate the corrected pixel coordinates to eliminate radial and tangential distortion. Grayscale normalization uses a contrast-limited adaptive histogram equalization algorithm with a block size of 8×8 and a contrast threshold of 2.0 to suppress uneven illumination. Denoising combines median filtering with a 3×3 window and bilateral filtering with spatial domain parameter σs=5 and grayscale domain parameter σr=75 to suppress noise while preserving image edges.
3. The method for detecting the outer dimensions of hybrid porcelain post insulator porcelain components based on machine vision according to claim 1, characterized in that: The multi-scale feature fusion mechanism is implemented through the Swing Transformer model. The Swing Transformer model includes a Patch Partition module and multiple stage modules. The Patch Partition module consists of convolutional layers and is used to map the preprocessed image into sequential features. Each stage module includes a Patch Merging downsampling module and multiple Swing Transformer Blocks. The Swing Transformer Blocks contain window multi-head self-attention and shifted window multi-head self-attention. Window multi-head self-attention calculates self-attention within a fixed window of a given size, while shifted window multi-head self-attention is used to achieve cross-window information transfer to generate feature maps of multiple scales.
4. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: The classification network is a feedforward neural network, including an input layer, a hidden layer, and an output layer. The input layer transforms multi-scale feature maps into initial feature vectors through multi-layer convolutional modules. The hidden layer contains multiple layers of neurons, and the feature vectors are passed layer by layer in the hidden layer. Each neuron performs non-linear feature extraction on the input feature vector through a weight matrix, activation function, and bias vector. The output layer receives the output feature vector of the last hidden layer, and generates the probability distribution vector of each type of ceramic piece after processing by the softmax function.
5. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: The process of segmenting the preprocessed image into multiple region images adapted to the local shape of the ceramic piece is performed through the Segment Anything Model. The Segment Anything Model includes an image encoder, a cue encoder, and a mask decoder. The image encoder adopts a Vision Transformer structure to map the preprocessed image into image feature vectors. The cue encoder processes interactive cue and converts it into cue feature vectors. The mask decoder adopts a lightweight Transformer structure, combines the image feature vectors and cue feature vectors to generate a segmentation mask, and achieves image segmentation through the segmentation mask.
6. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: The independent edge extraction for each region image includes: calculating the gradient magnitude of the region image based on the Sobel operator, screening candidate edges using the Canny algorithm, and extracting the key contours of the porcelain piece by combining the Hough line transform and ellipse fitting algorithm; after edge extraction, the reliability of the edges is verified by contour closure and boundary connectivity, wherein the contour closure is calculated by the ratio of the total pixel length of the closable edges to the sum of the pixel lengths of all edges, and the boundary connectivity is calculated by the ratio of the number of pixels in the identified connected edge regions to the total number of edge pixels.
7. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: The stereo matching algorithm is a semi-global matching algorithm. When generating the disparity map, the Census transform cost volume is first constructed to measure local texture similarity, and then the matching cost is aggregated along the 8-direction path. The specific optimization method of the edge guidance term is as follows: prioritize the continuity constraint of the disparity value of the neighboring pixels along the porcelain outline direction in the complete edge image. When the neighboring pixels are located on the outline, the disparity value continuity weight is enhanced to reduce disparity abrupt changes, so as to improve the accuracy of the disparity map in the low texture area.
8. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: The reconstructed 3D model of the ceramic piece includes: calculating the spatial depth of pixels based on the disparity map through triangulation, back-projecting the depth map onto the camera coordinate system to generate a dense point cloud, using voxel filtering with a given grid size to reduce noise in the dense point cloud, and then reconstructing a regularized 3D mesh model through normal vectors.
9. The method for detecting the outer dimensions of hybrid porcelain post insulator porcelain components based on machine vision according to claim 1, characterized in that: The calculation of its outer dimensions includes: transforming the point cloud in the camera coordinate system to the world coordinate system to eliminate the effect of view tilt; performing principal component analysis on the point cloud in the world coordinate system and rotating it to the direction of maximum variance so that the axis of the ceramic piece is consistent with the coordinate axis; then solving the minimum bounding box algorithm to find the minimum bounding box; and calculating the length, width and height of the ceramic piece based on the extreme values of the projection of the vertices of the cuboid in the x-axis, y-axis and z-axis directions.
10. The method for detecting the outer dimensions of hybrid porcelain post insulator ceramic components based on machine vision according to claim 1, characterized in that: When using a binocular camera to simultaneously acquire left and right eye images of the ceramic piece to be inspected, an LED auxiliary lighting system is configured; the LED auxiliary lighting system is used to provide uniform and stable illumination for the ceramic piece to be inspected. The preprocessing of the left and right eye images is performed by the embedded edge computing unit. The preprocessed left and right eye images are transmitted to the host computer processing platform, which performs multi-scale feature fusion for ceramic type recognition, regional adaptive edge extraction, edge-guided 3D reconstruction, and size calculation.