Workpiece surface sealant width measurement method, medium, and apparatus
By preprocessing images of highly reflective curved workpieces and measuring with array calipers, the problem of inaccurate sealant boundary identification was solved, and high-precision sealant width detection was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-21
AI Technical Summary
Existing machine vision inspection technologies suffer from low image contrast and severe reflection interference in measuring the width of sealant on highly reflective curved workpieces, resulting in inaccurate sealant boundary recognition and failing to meet the high-precision inspection requirements of industrial production.
By acquiring the workpiece surface image, the sealant area is cropped and subjected to grayscale scaling and directional filtering to obtain a reference threshold image. Adaptive threshold segmentation is used to achieve accurate segmentation, extract the outer contour of the sealant, and construct an image of the hollow sealant area. Multi-point width measurement is performed using an array caliper.
It significantly improves the accuracy and stability of sealant boundary identification and measurement, enhances the precision and reliability of sealant width detection, and meets the quality requirements of industrial production.
Smart Images

Figure CN122434894A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision measurement technology, and in particular to a method, medium, and equipment for measuring the width of sealant on a workpiece surface. Background Technology
[0002] The machinery manufacturing and automotive parts industries utilize numerous workpieces. The surface characteristics of these workpieces significantly impact product performance. Accurate measurement of surface features such as coating and sealant width is crucial for ensuring product quality. Current machine vision inspection technologies primarily employ industrial cameras combined with traditional visual caliper algorithms to identify target area boundaries and perform dimensional measurements through image acquisition.
[0003] However, the imaging of workpieces often presents challenges, such as a bright center and darker sides, low grayscale contrast between the sealant and the background, and numerous reflective bright spots on the surface, which severely interfere with sealant boundary recognition. Traditional visual caliper algorithms lack effective image preprocessing for these characteristics, resulting in poor stability and low accuracy in sealant measurement, making it difficult to meet the high-precision width detection requirements of industrial production.
[0004] Therefore, how to improve the accuracy of sealant testing on workpieces has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of the above problems, the present invention provides a method, medium, and device for measuring the width of sealant on the surface of a workpiece to overcome or at least partially solve the above problems. The technical solution is as follows:
[0006] A method for measuring the width of sealant on a workpiece surface, comprising:
[0007] Obtain a single-area image of the sealant corresponding to the target workpiece;
[0008] The single-area image of the sealant is subjected to grayscale scaling to obtain a grayscale optimized image;
[0009] The grayscale optimized image is subjected to directional filtering to obtain a baseline threshold image;
[0010] Adaptive threshold segmentation is performed on the grayscale optimized image using the reference threshold image to obtain a preliminary image of the sealant region;
[0011] Morphological processing is performed on the preliminary image of the sealant region to obtain a precisely segmented image of the sealant.
[0012] Extract the outer contour of the sealant from the precisely segmented image, and construct a hollow sealant region image based on the outer contour;
[0013] The image of the hollow sealant area was measured using an array of calipers to obtain a dataset of sealant width.
[0014] Optionally, the step of performing grayscale scaling on the single-area image of the sealant to obtain a grayscale optimized image includes:
[0015] A preset linear grayscale transformation algorithm is used to perform linear grayscale scaling on the single-region image of the sealant to obtain a grayscale optimized image.
[0016] Optionally, the step of performing directional filtering on the grayscale optimized image to obtain a reference threshold image includes:
[0017] The grayscale optimized image is subjected to median filtering using a mask specification that matches the linear distribution characteristics of the sealant on the target workpiece to obtain a baseline threshold image.
[0018] Optionally, the step of using the reference threshold image to perform adaptive threshold segmentation on the grayscale optimized image to obtain a preliminary sealant region image includes:
[0019] The grayscale value of each pixel in the grayscale optimized image is compared with the grayscale value of the corresponding pixel in the baseline threshold image. Pixels that meet the preset grayscale difference threshold are identified as sealant areas and are retained.
[0020] Optionally, the step of measuring the image of the hollow sealant region using an array of calipers to obtain a sealant width dataset includes:
[0021] The initial width of the sealant is determined based on the image of the hollow sealant region;
[0022] Based on the initial width, multiple sets of measuring calipers are evenly arranged along the width direction of the sealant.
[0023] For each set of measuring calipers, the boundary intersection point is calculated based on the image of the hollow sealant area to obtain the local width data of the sealant under the measuring calipers;
[0024] By summing up the local width data corresponding to each of the aforementioned measuring calipers, a sealant width dataset is obtained.
[0025] Optionally, determining the initial width of the sealant based on the image of the hollow sealant region includes:
[0026] Calculate the minimum bounding rectangle of the hollow sealant region image;
[0027] The initial width of the sealant is obtained by using the coordinate difference of the minimum bounding rectangle.
[0028] Optionally, for each set of measuring calipers, the calculation of boundary intersections based on the image of the hollow sealant area to obtain the local width data of the sealant under the measuring calipers includes:
[0029] For each set of measuring calipers, the line connecting the start and end points of the smallest bounding rectangle of the hollow sealant area image is extended to both ends by a predetermined number of pixels to form a measurement baseline.
[0030] Determine the two intersection points between the measurement baseline and the boundary of the hollow sealant area image;
[0031] The local width of the sealant is obtained based on the distance between the two intersection points.
[0032] Optionally, after measuring the image of the hollow sealant region using an array caliper to obtain a sealant width dataset, the method further includes:
[0033] Determine whether all measured sealant width values in the sealant width dataset are within a preset width threshold range. If yes, the target workpiece is deemed to be sealed successfully; otherwise, the target workpiece is deemed to be sealed unsuccessfully.
[0034] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the workpiece surface sealant width measurement method.
[0035] An electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the workpiece surface sealant width measurement method.
[0036] By employing the above technical solutions, the workpiece surface sealant width measurement method, medium, and equipment provided by this invention obtain a single-region image of the sealant corresponding to the target workpiece; perform grayscale scaling on the single-region image of the sealant to obtain a grayscale optimized image; perform directional filtering on the grayscale optimized image to obtain a reference threshold image; use the reference threshold image to perform adaptive threshold segmentation on the grayscale optimized image to obtain a preliminary sealant region image; perform morphological processing on the preliminary sealant region image to obtain a precise sealant segmentation image; extract the outer contour of the sealant in the precise sealant segmentation image, and construct a hollow sealant region image based on the outer contour; measure the hollow sealant region image using an array caliper to obtain a sealant width dataset; and utilize the sealant width dataset for each sealant layer. This invention acquires a surface image of a workpiece and combines it with image preprocessing techniques such as sealant region cropping, grayscale scaling, and directional filtering to achieve precise segmentation of the sealant region. Then, it uses an array caliper to perform multi-point width measurement of the hollow sealant region, effectively improving the accuracy and stability of sealant boundary identification. This solves the problems of low image contrast and severe reflection interference caused by the workpiece surface, significantly improving the accuracy and reliability of sealant width detection and meeting the stringent quality requirements of industrial production for workpiece sealant inspection.
[0037] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0038] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0039] Figure 1 A flowchart illustrating one embodiment of the workpiece surface sealant width measurement method provided by this invention is shown.
[0040] Figure 2 A schematic diagram of a workpiece surface image provided in an embodiment of the present invention is shown;
[0041] Figure 3 A schematic diagram of a single-area image of the sealant provided in an embodiment of the present invention is shown;
[0042] Figure 4 A schematic diagram of a grayscale optimized image provided in an embodiment of the present invention is shown;
[0043] Figure 5 A schematic diagram of a reference threshold image provided in an embodiment of the present invention is shown;
[0044] Figure 6 A schematic diagram of a preliminary area image of the sealant provided in an embodiment of the present invention is shown;
[0045] Figure 7 A schematic diagram of a precisely segmented image of sealant provided in an embodiment of the present invention is shown;
[0046] Figure 8 A schematic diagram showing an image of a hollow sealant region provided in an embodiment of the present invention is shown;
[0047] Figure 9 This is a flowchart illustrating a specific implementation of step S170 in the workpiece surface sealant width measurement method provided in an embodiment of the present invention;
[0048] Figure 10 A schematic diagram of the array caliper arrangement of the double-layer sealant provided in an embodiment of the present invention is shown;
[0049] Figure 11 A schematic diagram of the minimum bounding rectangle provided in an embodiment of the present invention is shown;
[0050] Figure 12 A schematic diagram of local width measurement provided by an embodiment of the present invention is shown;
[0051] Figure 13 This diagram illustrates the structure of the workpiece surface sealant width measuring device provided in an embodiment of the present invention.
[0052] Figure 14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention is shown. Detailed Implementation
[0053] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0054] Metal sleeves are an important component in industries such as machinery manufacturing and automotive parts. The width of the sealant on the outer wall of the sleeve directly affects the sealing performance and service life of the product. Therefore, accurate measurement of the sealant width is of great significance. Currently, the measurement of sealant width mostly relies on traditional visual caliper algorithms combined with machine vision inspection technology. This involves using an industrial camera to capture images of the metal sleeve, and then using caliper algorithms to identify the sealant boundary and calculate its width, thus achieving automated inspection.
[0055] However, existing technologies have significant limitations in measuring the width of sealant on polished, highly reflective curved metal sleeves. Due to the highly reflective and curved surface of the polished sleeve, images often show a bright central area and darker side areas, reducing the grayscale contrast between the sealant and the background and making clear segmentation difficult. Furthermore, the presence of numerous reflective bright spots on the sealant surface further interferes with accurate boundary identification. Traditional visual caliper algorithms lack effective image preprocessing for these highly reflective curved surface characteristics, resulting in low stability and accuracy when directly applied, making it difficult to meet the high-precision sealant width measurement requirements in industrial production.
[0056] Furthermore, existing machine vision caliper measurement technologies lack dedicated image preprocessing solutions for highly reflective curved surfaces. The acquired images generally suffer from uneven brightness, reflective noise interference, and other problems, resulting in poor sealant boundary recognition. Traditional single-linear vision caliper measurement methods are susceptible to local interference, lack array-style arrangement and precise intersection point measurement designs, leading to poor measurement data stability and insufficient repeatability, failing to guarantee consistency and reliability in large-scale production. This not only increases the risk of misjudgments and missed judgments but also limits the application and promotion of machine vision inspection technology in the field of measuring the width of highly reflective curved metal sleeve sealants.
[0057] Based on this, this invention provides a method for measuring the width of sealant on a workpiece surface. The method involves acquiring an image of the workpiece surface, cropping the sealant area, and performing grayscale scaling and directional filtering to obtain a baseline threshold image. This image is then used to adaptively threshold segment the grayscale optimized image to obtain a preliminary sealant area. Morphological processing is then used to achieve precise segmentation, extracting the sealant's outer contour to construct a hollow region image. An array caliper is then used to measure the sealant width dataset. This method effectively solves the problems of low image contrast and reflective interference caused by the workpiece surface, improves the accuracy and stability of sealant boundary recognition, significantly enhances detection precision and reliability, and meets the industrial quality requirements for workpiece sealant width detection.
[0058] like Figure 1 The diagram shows a flowchart of one embodiment of the workpiece surface sealant width measurement method provided by this invention. The method may include:
[0059] S100: Obtain a single-area image of the sealant corresponding to the target workpiece.
[0060] The target workpiece can be an industrial part in the fields of machinery manufacturing and automotive parts. Examples include: automotive engine oil seals, turbocharger housing mating surfaces, and bearing housings. Optionally, the target workpiece provided in this embodiment can be a highly reflective curved surface workpiece with high reflectivity. For example, a metal sleeve with a highly reflective curved surface and black sealant.
[0061] Among them, the sealant single-region image refers to the region of interest (ROI) where the sealant is located, which is extracted from the workpiece surface image. Irrelevant parts of the workpiece are removed, and only the sealant area is included.
[0062] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S100 may specifically include:
[0063] Obtain an image of the target workpiece's surface. This image refers to the overall surface image of the target workpiece, including the sealant and surrounding area, captured using an industrial camera, and is used for subsequent image processing and analysis.
[0064] Specifically, in this embodiment of the invention, an industrial camera can be used to acquire images of the workpiece. To ensure image quality, a suitable light source and shooting angle can be selected to minimize ambient light interference and bright areas caused by reflections, thereby obtaining an original image containing the sealant and the complete surface of the workpiece, providing basic data for subsequent image processing.
[0065] As some examples, see Figure 2 In this embodiment of the invention, an industrial camera can be used to capture images of the outer wall of the metal sleeve, obtaining an original image containing the sealant and the workpiece background.
[0066] The sealant region is cropped from the workpiece surface image to obtain a single-region image of the sealant. Specifically, embodiments of the present invention can employ a region of interest (ROI) selection method to precisely crop the target region containing only the sealant from the original workpiece surface image, removing irrelevant areas to obtain a single-region image retaining only the sealant region. The sealant region cropping operation provided by embodiments of the present invention can be automatically completed by setting a specific pixel coordinate range or based on a target localization algorithm, significantly reducing the amount of data and interference from invalid information in subsequent processing.
[0067] As some examples, in Figure 2 Based on the workpiece surface image shown, a region of interest containing only the sealant is precisely defined and cropped from the workpiece surface. Interference from the workpiece itself and other irrelevant backgrounds is removed, resulting in a single-region image focused on the sealant being tested. Figure 3 As shown.
[0068] This invention, by first acquiring an image of the target workpiece surface and then cropping the sealant region, can accurately locate and extract a single region image of the sealant. This reduces the computational burden for subsequent grayscale processing, filtering, segmentation, and measurement, and provides a precise and efficient image foundation, thereby improving the accuracy and reliability of sealant width detection.
[0069] S110. Perform grayscale scaling on a single area image of the sealant to obtain a grayscale optimized image.
[0070] The grayscale optimized image refers to the image obtained after performing grayscale scaling on a single region of the sealant. The grayscale optimized image enhances the grayscale contrast between the sealant and the highly reflective background, facilitating subsequent boundary segmentation.
[0071] Specifically, in this embodiment of the invention, the captured single-area image of the sealant can be linearly scaled according to a set linear transformation formula to enhance the grayscale contrast between the black sealant and the bright reflective metal background, thereby solving the problem of blurred sealant boundaries and difficulty in segmentation caused by local reflections or uneven lighting, and outputting a grayscale optimized image that is more suitable for subsequent analysis.
[0072] As some examples, in Figure 3 Based on the single-area image of the sealant shown, a preset linear grayscale transformation is used to enhance the grayscale contrast between the black sealant area and the highly reflective metallic background, resolving local blurring issues caused by uneven lighting or surface reflections. The result is an optimized grayscale image with improved contrast, as shown below. Figure 4 As shown.
[0073] S120. Perform directional filtering on the grayscale optimized image to obtain the baseline threshold image.
[0074] The baseline threshold image refers to the image generated after applying directional median filtering to the grayscale optimized image. Noise in the baseline threshold image is suppressed while preserving the sealant boundary features, serving as a reference for adaptive threshold segmentation.
[0075] Specifically, embodiments of the present invention can apply median filtering to the grayscale optimized image based on the linear distribution characteristics of the sealant, thereby effectively suppressing reflective bright spots and noise along the distribution direction of the sealant, while preserving the true grayscale boundary between the sealant and the metal background to the greatest extent, and outputting a benchmark threshold image as the basis for segmentation.
[0076] As some examples, in Figure 4Based on the grayscale optimized image shown, a slender filter mask adapted to the linear characteristics of the sealant is used to perform median filtering on the grayscale optimized image. This effectively suppresses interference such as speckle noise and reflective bright spots distributed along the sealant's direction, while also preserving the contour information of the sealant's edges. This generates a noise-suppressed baseline threshold image that can be used for subsequent threshold segmentation, as shown below. Figure 5 As shown.
[0077] S130. Adaptive threshold segmentation is performed on the grayscale optimized image using the reference threshold image to obtain the preliminary area image of the sealant.
[0078] The preliminary sealant region image refers to the sealant candidate region image obtained by segmenting the baseline threshold image and the grayscale optimized image using an adaptive threshold rule, which includes the initially separated sealant pixels.
[0079] Specifically, in this embodiment of the invention, the reference threshold image after median filtering can be used as a background grayscale reference. The pixel values of the grayscale optimization image are compared pixel by pixel. According to the dark background extraction rules, the sealant pixels that are lower than the local background are selected to achieve the initial segmentation of the sealant area. The output image contains most of the sealant pixels, but may have boundary noise or small areas of missegmentation of the sealant area.
[0080] As some examples, in Figure 5 Based on the baseline threshold image shown, the baseline threshold image is used as a local background grayscale reference and compared pixel-by-pixel with the grayscale optimized image. According to the preset dark background extraction judgment rules, pixels in the original image whose grayscale values are significantly lower than the corresponding baseline threshold are identified and extracted. This initially separates the sealant region from the complex highly reflective background, resulting in a preliminary binarized region image of the sealant (i.e., the preliminary sealant region image). Figure 6 As shown.
[0081] S140. Perform morphological processing on the preliminary image of the sealant region to obtain a precise segmentation image of the sealant.
[0082] Among them, the sealant precise segmentation image refers to the complete sealant area image without noise and voids obtained after performing morphological operations on the preliminary sealant area image.
[0083] Specifically, embodiments of the present invention can apply morphological operations such as erosion, void filling, noise removal, and dilation to the preliminary segmentation results. First, small noise is removed by erosion, then voids in the area are filled, then isolated points that are not sealant are screened out, and finally the integrity of the sealant outline is restored by dilation, outputting a precise segmented image of the sealant with clear boundaries, complete areas, and no noise.
[0084] As some examples, in Figure 6 Based on the initial image of the sealant region shown, morphological operations such as erosion, void filling, noise removal, and dilation are performed sequentially. These operations remove minute noise points from the image, fill any possible voids within the sealant region, remove isolated non-target noise points, and restore the boundaries lost due to erosion. Finally, a precise segmentation image of the sealant with complete contours and clean regions is obtained, as shown below. Figure 7 As shown.
[0085] S150. Extract the outer contour of the sealant in the precise segmentation image, and construct an image of the hollow sealant region based on the outer contour.
[0086] Among them, the hollow sealant region image refers to the hollow contour image formed by extracting the outer contour of the sealant precise segmentation image and removing the internal filling part, which provides a precise benchmark for boundary measurement and caliper positioning.
[0087] Specifically, embodiments of the present invention can extract the outer contour points of the sealant from a precisely segmented image, regenerate a "hollow" sealant contour area image containing only the boundary line based on the contour, remove the solid fill within the contour, and provide an accurate boundary reference for caliper measurement and boundary intersection calculation.
[0088] As some examples, in Figure 7 Based on the precisely segmented image of the sealant shown, the sequence of external contour points of the sealant region is extracted. Based on this contour information, a closed region containing only the contour boundary is drawn, and the interior of this region is hollowed out, thus constructing a "hollow" image of the sealant region characterized only by contour lines, as shown below. Figure 8 As shown.
[0089] S160. Measure the image of the hollow sealant area using an array caliper to obtain the sealant width dataset.
[0090] Among them, array calipers refer to multiple sets of uniformly linearly arranged measurement line segments that are pre-designed and arranged along the width direction of the sealant. They are used to measure the local width of the sealant at multiple points on the image of the hollow sealant area, thereby improving the comprehensiveness and stability of the measurement.
[0091] The sealant width dataset refers to a set of multiple local width values measured on the image of the hollow sealant area using array calipers, reflecting the spatial distribution characteristics of the sealant width.
[0092] Specifically, in this embodiment of the invention, multiple sets of custom array calipers can be designed and evenly arranged on the image of the hollow sealant area, with equal spacing along the width direction of the sealant. By calculating the local width value of the sealant at the intersection of each set of calipers with the upper and lower boundaries of the sealant, a measurement dataset of the sealant width is obtained, providing comprehensive data support for evaluating the sealant width.
[0093] The present invention provides a method for measuring the width of sealant on a workpiece surface. The method includes: obtaining a single-region image of the sealant corresponding to the target workpiece; performing grayscale scaling on the single-region image to obtain a grayscale optimized image; performing directional filtering on the grayscale optimized image to obtain a reference threshold image; using the reference threshold image to perform adaptive threshold segmentation on the grayscale optimized image to obtain a preliminary sealant region image; performing morphological processing on the preliminary sealant region image to obtain a precise sealant segmentation image; extracting the outer contour of the sealant in the precise segmentation image and constructing a hollow sealant region image based on the outer contour; measuring the hollow sealant region image using an array caliper to obtain a sealant width dataset; and utilizing the sealant width dataset for each sealant layer. This invention acquires a surface image of a workpiece and combines it with image preprocessing techniques such as sealant region cropping, grayscale scaling, and directional filtering to achieve precise segmentation of the sealant region. Then, it uses an array caliper to perform multi-point width measurement of the hollow sealant region, effectively improving the accuracy and stability of sealant boundary identification. This solves the problems of low image contrast and severe reflection interference caused by the workpiece surface, significantly improving the accuracy and reliability of sealant width detection and meeting the stringent quality requirements of industrial production for workpiece sealant inspection.
[0094] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S110 may include:
[0095] A pre-defined linear grayscale transformation algorithm is used to perform linear grayscale scaling on a single-region image of the sealant to obtain a grayscale-optimized image.
[0096] Specifically, in this embodiment of the invention, a preset linear grayscale transformation formula can be applied to a single-area image of sealant extracted from the original image for pixel-level processing. This formula maps and calculates the original grayscale value of each pixel in the input image using specific slope and intercept parameters to generate a new grayscale value.
[0097] As examples, embodiments of the present invention can traverse every pixel within a single region image of the sealant and retrieve its original grayscale value. According to the preset linear grayscale transformation algorithm Perform calculations to convert the grayscale values. A new value is assigned to the pixel, where 'a' represents the magnification factor, which can be 2.42857; and 'b' represents the offset, which can be 56. The magnification factor and offset in this linear grayscale transformation algorithm are specifically set to enhance the contrast between the sealant and the highly reflective metallic background. For example, in this embodiment of the invention, the optimal magnification factor and offset can be obtained through actual measurement and calibration based on the reflective grayscale range of the polished metal sleeve surface and the grayscale interval between the black sealant areas. This is used to enhance the grayscale contrast between the sealant and the highly reflective metallic background, improving their grayscale differentiation. A larger magnification factor results in stronger overall grayscale stretching, raising the grayscale of the bright background areas. The offset adjustment is used to shift the overall grayscale curve, avoiding over-enhancement that could lead to detail loss or insufficient contrast. Therefore, this parameter needs to match the calibration value of the target grayscale interval. Through this linear grayscale transformation, the generated grayscale optimized image can more clearly show the boundary between the sealant and the background, providing a good foundation for subsequent filtering, segmentation, and morphological processing steps, significantly improving the accuracy and stability of automatic sealant area extraction.
[0098] This invention employs a specially designed linear grayscale transformation algorithm to significantly stretch the grayscale difference between the black sealant area and the highly reflective metal background, thereby effectively enhancing the contrast between the target and the background. This compensates for the uneven brightness of local areas in the image caused by the curved surface characteristics of the workpiece and lighting conditions, making the sealant area easier to distinguish in subsequent processing. The final output is an image with optimized grayscale distribution and significantly improved contrast, providing a reliable foundation for subsequent accurate segmentation.
[0099] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S120 may specifically include:
[0100] Median filtering is performed on the grayscale optimized image using a mask specification that matches the linear distribution characteristics of the sealant on the target workpiece to obtain a baseline threshold image.
[0101] Specifically, embodiments of the present invention can process grayscale optimized images after grayscale scaling using a linear filtering mask of a specific shape. The mask's dimensions are specially designed to match the elongated, linear spatial distribution characteristics of the sealant in the image. For example, sealant typically appears as a thin, elongated strip-like linear band extending continuously laterally on the outer wall of a sleeve, with a narrow width and a length much greater than its width. Based on this characteristic, a one-dimensional filtering mask (such as 1×111) with corresponding horizontal and vertical lengths can be selected. During processing, the mask slides along the image. At each position, the grayscale values of all pixels within the mask's coverage area are sorted, and the median value is taken as the new grayscale value of the pixel at that central position, i.e., a linear median filtering operation is performed. This linear median filtering operation can effectively filter out high-frequency noise distributed along the length of the sealant in the image, such as bright spots or random noise formed by reflection on the sealant surface. The mask only extends laterally by the vertical dimension of the specified pixel, avoiding vertical compression and ensuring that the mask completely covers the sealant boundary. While denoising, it maintains edge sharpness and the continuity of linear structure, avoiding excessive smoothing or shape destruction of thin lines.
[0102] If the shape or color of the sealant changes—for example, becoming wider, shorter, or changing from a thin line to a block or dot shape—the mask size needs to be adjusted accordingly to adapt to the new distribution characteristics. For instance, if the width increases, the vertical dimension of the mask should be increased; if the length changes, the horizontal dimension can be adjusted. If the sealant color changes significantly, affecting only the grayscale parameters, then the mask width-to-length ratio does not need to be adjusted. By appropriately selecting and adjusting the filtering mask, the final output image shows significantly suppressed noise and smoothly extracted background grayscale information. This image serves as a reliable baseline threshold image for subsequent adaptive thresholding segmentation.
[0103] As some examples, embodiments of the present invention can target the linear distribution characteristics of the sealant on the highly reflective curved surface of a metal sleeve workpiece, and select a linear mask with a size of 1×111 to perform directional median filtering on the grayscale optimized image along the width direction of the sealant: the sliding mask scans the image line by line, and each time takes 111 pixel grayscale values within the mask coverage area, calculates the median and replaces the center pixel value of the mask.
[0104] This invention utilizes a linear filtering mask to effectively filter out bright spot noise and random clutter caused by high reflectivity on the sealant surface, while preserving the sealant's boundary contour information. This directional filtering results in a smoother grayscale output benchmark image with stronger noise resistance, providing a stable and reliable grayscale reference for subsequent adaptive threshold segmentation to accurately extract the sealant region, significantly improving the distinction between the sealant and the background and enhancing segmentation accuracy.
[0105] Optionally, in the above Figure 1Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S130 may specifically include:
[0106] The grayscale value of each pixel in the grayscale optimized image is compared with the grayscale value of the corresponding pixel in the baseline threshold image. Pixels that meet the preset grayscale difference threshold are identified as sealant areas and are retained.
[0107] Specifically, in this embodiment of the invention, the grayscale values at corresponding positions in the two images are traversed pixel by pixel based on the optimized image after grayscale scaling and the baseline threshold image obtained through directional median filtering. For each pixel, if the pixel is significantly lower than the local background grayscale and is very likely to belong to the black sealant area, then the pixel is retained; otherwise, it is discarded.
[0108] As examples, embodiments of the present invention can use a grayscale-optimized image that has undergone linear grayscale scaling and enhanced contrast as the original image to be segmented, and a baseline threshold image that has undergone directional median filtering and effectively suppressed reflective noise as a local background grayscale reference image. The two images are synchronously traversed and compared pixel by pixel. For each pixel at the same location, its grayscale value in the original image is read. and grayscale values in the thresholded image Based on preset dark background extraction rules adapted to high-reflectivity backgrounds and dark sealant scenarios, a fixed offset 'c' is set on-site, and it is determined whether the pixel meets the requirements. The core of the dark background extraction rule is that a highly reflective metallic background still retains a high grayscale value in the threshold image. The black sealant appears as a low grayscale value in the original image. By setting a sufficiently large offset, pixels with grayscale values significantly lower than their surrounding local background can be accurately identified. For example, in a scenario where the black sealant has low grayscale and the background reflection has high grayscale, the offset can be set to 30. All pixels that meet this criterion are identified as belonging to the sealant area and retained (they can be marked as foreground, such as white), while pixels that do not meet the criterion are identified as background and removed. This initially generates a binary image of the sealant area, effectively separating the target area from a complex background. If the sealant is changed to another color, the image is still processed in grayscale, and the structure of the judgment formula remains unchanged. Only the offset value needs to be adjusted according to the actual grayscale difference. The specific adjustment rule is: the higher the grayscale of the sealant, the smaller the grayscale difference with the background, and the offset needs to be adjusted accordingly; the lower the grayscale of the sealant, the larger the grayscale difference with the background, and the offset can be appropriately increased. Therefore, the offset can be flexibly adjusted according to the color of the sealant and the background reflection conditions to ensure that the judgment rule remains effective in different scenarios.
[0109] By effectively determining the pixels in the sealant region, this invention can adapt to the light and dark characteristics of a highly reflective background on the workpiece surface, greatly eliminating high grayscale stray points caused by reflection. The output binarized preliminary segmentation image accurately reflects the spatial distribution of the sealant region, providing a precise segmentation basis for subsequent morphological processing.
[0110] Optional, based on Figure 1 The method shown is as follows: Figure 9 The diagram shows a specific implementation of step S160 in the workpiece surface sealant width measurement method provided in this embodiment of the invention. Step S170 may specifically include:
[0111] S200. Determine the initial width of the sealant based on the image of the hollow sealant region.
[0112] Specifically, embodiments of the present invention can perform geometric feature analysis on the image of the hollow sealant region, and derive the width reference value characterizing the overall distribution range of the sealant by calculating the spatial dimension parameters of its outer envelope rectangle.
[0113] S210. Based on the initial width, arrange multiple sets of measuring calipers evenly along the width direction of the sealant.
[0114] Specifically, in this embodiment of the invention, the initial width can be linearly and uniformly divided according to a preset number of groups, so as to achieve a uniform arrangement of multiple sets of measuring calipers from left to right along the width direction.
[0115] As examples, embodiments of the present invention can design 20 sets of custom array calipers. Along the width direction of the sealant (i.e., the horizontal direction), with an initial width... Using the overall length as a reference, the calipers are arranged uniformly and linearly. The horizontal position (column coordinate) of the vertical measurement reference line of each group of calipers is determined by calculation using a formula: The starting column coordinates are taken as the starting column coordinates of the smallest bounding rectangle, and the measurement sequence increases sequentially from 0 to 19. It should be noted that the number of caliper groups is not fixed at 20, but is the optimal number caliped according to the product's detection accuracy requirements; it can be 30 groups, 25 groups, or other configurations. The number of caliper groups is positively correlated with detection accuracy. The more groups, the denser the caliper arrangement, the more sampling points, the more comprehensive the detection details, and the higher the accuracy; conversely, the fewer groups, the sparser the sampling, and the coarser the detection results. This embodiment of the invention uses a multi-sequence uniformly arranged caliper to cover the entire width of the sealant for sampling, achieving full-dimensional, equidistant measurement of the sealant width. This significantly differs from the traditional method of using only a single caliper and single point measurement, effectively avoiding misjudgments caused by local defects or noise, and improving the comprehensiveness and stability of the detection.
[0116] S220. For each set of measuring calipers, calculate the boundary intersection based on the image of the hollow sealant area to obtain the local width data of the sealant under the measuring calipers.
[0117] Specifically, in this embodiment of the invention, for each set of measuring calipers, a measurement baseline is first constructed based on the geometric features of the hollow sealant area image. Then, the intersection point of the baseline and the sealant contour boundary is accurately solved through geometric calculations. Finally, local measurement data representing the actual width of the sealant at that location is calculated based on the coordinates of the intersection point.
[0118] S230. Summarize the local width data corresponding to each measuring caliper to obtain the sealant width dataset.
[0119] Specifically, in this embodiment of the invention, after calculating all local width data under the measuring calipers in step S220, a set of width data sequences is collected. If double sealant is present, the process is repeated, and finally, a width dataset containing width data of single or double sealant is obtained.
[0120] As examples, embodiments of the present invention can repeatedly execute step S220, sequentially processing all (e.g., 20 groups) of the arranged measuring calipers. After each group of calipers is measured, its calculated local width data is stored in a preset data list or array. When all caliper measurements are completed in a loop, the list or array contains 20 local width measurements evenly distributed along the entire width direction of the sealant, collectively forming the width dataset of the sealant. (Reference) Figure 10 If there is a second sealant on the sleeve, the process from S200 to S220 is repeated for the second sealant to obtain its corresponding 20 width data points, which are then appended to the same dataset. This results in a complete dataset containing the local width data of all sealants to be tested (e.g., 40 sealants in total for double sealants), providing a comprehensive data foundation for the final qualification determination.
[0121] The embodiments of the present invention, through the uniform arrangement of array calipers and precise measurement of local boundaries, can comprehensively and accurately reflect the local width distribution of the sealant across its entire width range, significantly improving the representativeness and anti-interference ability of sealant width detection, and ensuring the stability and reliability of the detection results.
[0122] Optionally, in the above Figure 9 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S200 may specifically include:
[0123] Calculate the minimum bounding rectangle of the hollow sealant region image; use the coordinate difference of the minimum bounding rectangle to obtain the initial width of the sealant.
[0124] Specifically, in this embodiment of the invention, the bounding rectangle algorithm can be used to calculate the bounding rectangle boundary of the region. This bounding rectangle is the smallest rectangle that completely encloses the sealant outline and whose edges are parallel to the image coordinate axes. Next, the pixel coordinates of the upper left corner (starting point) and lower right corner (ending point) of this bounding rectangle are determined. The width of the rectangle is obtained by calculating the difference between the starting and ending points in the horizontal direction (column coordinates). This width is the initial width of the sealant.
[0125] This invention calculates the minimum bounding rectangle based on the image of the hollow sealant region and uses its coordinate difference to determine the initial width of the sealant. This can accurately quantify the spatial range of the sealant, providing a precise geometric basis for the subsequent uniform arrangement of measuring calipers, and improving the positioning accuracy and stability of sealant width measurement.
[0126] Optionally, in the above Figure 9 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, step S220 may specifically include:
[0127] For each set of measuring calipers, the line connecting the start and end points of the smallest bounding rectangle of the hollow sealant region image is extended to both ends by a predetermined number of pixels to form a measurement baseline; the two intersection points of the measurement baseline and the boundary of the hollow sealant region image are determined; the local width of the sealant is obtained based on the distance between the two intersection points.
[0128] Specifically, in this embodiment of the invention, for each set of measuring calipers, a measurement baseline is first determined. This baseline is formed by extending a certain number of pixels (e.g., 5 pixels) from the starting and ending points of the smallest bounding rectangle (representing the approximate center direction of the sealant) to both ends, ensuring that the line segment completely passes through the sealant area. Then, a geometric intersection operation is performed between this extended baseline segment and the image of the hollow sealant area (containing only the contour boundary), calculating the coordinates of the two intersection points between the baseline segment and the upper and lower contour boundaries of the sealant. Based on the pixel coordinates of these two intersection points, the Euclidean distance (straight-line distance) between them is calculated, and this distance is recorded as the precise local width of the sealant at the location of that set of calipers.
[0129] As some examples, in Figure 8 Based on the hollow sealant region image shown, calculate the minimum bounding rectangle of the hollow sealant region image (e.g., ...). Figure 11 (As shown) to determine its initial width direction. Then, multiple sets of virtual measuring calipers are evenly distributed along this width direction. (Reference) Figure 12 For each set of calipers, calculate the two intersection points between its measurement baseline and the hollow contour boundary line, and use the distance between the intersection points as the local width at that location.
[0130] This invention achieves high-precision measurement of the local width of the sealant by extending the line connecting the start and end points of the smallest circumscribed rectangle to form a measurement baseline, and accurately calculating the intersection point and distance between the baseline and the boundary of the hollow sealant area. This effectively improves the accuracy and robustness of the measurement and avoids the influence of boundary ambiguity or breakage on the measurement results.
[0131] Optionally, in the above Figure 1 Based on one or more corresponding embodiments, in another optional embodiment provided by the present invention, after step S160, the method may further include:
[0132] Determine whether all measured sealant width values in the sealant width dataset are within the preset width threshold range. If so, the target workpiece is deemed to be sealed successfully; otherwise, the target workpiece is deemed to be unsuccessful in sealing.
[0133] Specifically, in this embodiment of the invention, all measured sealant width values can be compared one by one with preset upper and lower width thresholds. If all width data are within the qualified range, the sealant width of the workpiece is determined to be qualified; if any data exceeds the threshold range, it is determined to be unqualified, and the final test conclusion is output, thereby realizing automated and objective sealant width quality judgment.
[0134] This invention achieves automated qualification assessment of the sealing quality of target workpieces by judging the threshold range of the sealant width dataset, thereby improving detection efficiency and judgment accuracy and ensuring that the sealing performance of the product meets the preset standards.
[0135] Although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.
[0136] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0137] Corresponding to the above method embodiments, this invention also provides a workpiece surface sealant width measuring device, the structure of which is as follows: Figure 13 As shown, it may include: a sealant single-region image acquisition unit 001, a grayscale optimized image acquisition unit 002, a baseline threshold image acquisition unit 003, a sealant preliminary region image acquisition unit 004, a sealant precise segmentation image acquisition unit 005, a hollow sealant region image acquisition unit 006, and a sealant width dataset acquisition unit 007.
[0138] The sealant single-area image acquisition unit 001 is used to acquire the sealant single-area image corresponding to the target workpiece.
[0139] The grayscale optimized image acquisition unit 002 is used to perform grayscale scaling on a single-area image of the sealant to obtain a grayscale optimized image.
[0140] The reference threshold image acquisition unit 003 is used to perform directional filtering on the grayscale optimized image to obtain the reference threshold image.
[0141] The sealant preliminary region image acquisition unit 004 is used to perform adaptive threshold segmentation on the grayscale optimized image using a reference threshold image to obtain the sealant preliminary region image.
[0142] The sealant precise segmentation image acquisition unit 005 is used to perform morphological processing on the preliminary sealant region image to obtain a sealant precise segmentation image.
[0143] The hollow sealant region image acquisition unit 006 is used to extract the outer contour of the sealant in the sealant precise segmentation image and construct the hollow sealant region image based on the outer contour.
[0144] The sealant width dataset acquisition unit 007 is used to obtain the sealant width dataset by measuring the image of the hollow sealant area using an array caliper.
[0145] Optionally, the grayscale optimized image acquisition unit 002 can be used to perform linear grayscale scaling on a single-region image of the sealant using a preset linear grayscale transformation algorithm to obtain a grayscale optimized image.
[0146] Optionally, the reference threshold image acquisition unit 003 can be used to perform median filtering on the grayscale optimized image using a mask specification that matches the linear distribution characteristics of the sealant on the target workpiece, in order to obtain the reference threshold image.
[0147] Optionally, the sealant preliminary area image acquisition unit 004 can be used to compare the gray value of each pixel in the gray-scale optimized image with the gray value of the corresponding pixel in the reference threshold image, and determine that the pixel that meets the preset gray-scale difference threshold is the sealant area and retain it.
[0148] Optionally, the sealant width dataset acquisition unit 007 may specifically include: an initial width determination subunit, a measuring caliper uniform arrangement subunit, a local width data acquisition subunit, and a local width data summarization subunit.
[0149] An initial width determination subunit is used to determine the initial width of the sealant based on an image of the hollow sealant region.
[0150] The measuring calipers are evenly distributed in sub-units, which are used to evenly distribute multiple sets of measuring calipers along the width direction of the sealant according to the initial width.
[0151] The local width data acquisition sub-unit is used to calculate the boundary intersection point based on the image of the hollow sealant area for each set of measuring calipers, and obtain the local width data of the sealant under the measuring calipers.
[0152] The local width data aggregation sub-unit is used to aggregate the local width data corresponding to each measuring caliper to obtain the sealant width dataset.
[0153] Optionally, the initial width determination sub-unit can be used to calculate the minimum bounding rectangle of the hollow sealant region image; the initial width of the sealant is obtained by using the coordinate difference of the minimum bounding rectangle.
[0154] Optionally, the local width data acquisition sub-unit can be used to extend the line connecting the start and end points of the smallest bounding rectangle of the hollow sealant region image to both ends by a predetermined number of pixels for each set of measuring calipers, forming a measurement baseline; determine the two intersection points between the measurement baseline and the boundary of the hollow sealant region image; and obtain the local width of the sealant based on the distance between the two intersection points.
[0155] Optionally, the workpiece surface sealant width measuring device may also include: a qualification judgment result acquisition unit.
[0156] The qualification judgment result acquisition unit is used by the sealant width dataset acquisition unit 007 to measure the image of the hollow sealant area with array calipers, obtain the sealant width dataset, and then determine whether all the measured sealant width values in the sealant width dataset are within the preset width threshold range. If so, the target workpiece is judged to be qualified for sealing; otherwise, the target workpiece is judged to be unqualified for sealing.
[0157] The present invention provides a workpiece surface sealant width measuring device, which is used for: obtaining a single-region image of the sealant corresponding to the target workpiece; performing grayscale scaling on the single-region image of the sealant to obtain a grayscale optimized image; performing directional filtering on the grayscale optimized image to obtain a reference threshold image; using the reference threshold image to perform adaptive threshold segmentation on the grayscale optimized image to obtain a preliminary sealant region image; performing morphological processing on the preliminary sealant region image to obtain a precise sealant segmentation image; extracting the outer contour of the sealant in the precise sealant segmentation image and constructing a hollow sealant region image based on the outer contour; measuring the hollow sealant region image using an array caliper to obtain a sealant width dataset; and utilizing the sealant width dataset for each sealant layer. This invention acquires a surface image of a workpiece and combines it with image preprocessing techniques such as sealant region cropping, grayscale scaling, and directional filtering to achieve precise segmentation of the sealant region. Then, it uses an array caliper to perform multi-point width measurement of the hollow sealant region, effectively improving the accuracy and stability of sealant boundary identification. This solves the problems of low image contrast and severe reflection interference caused by the workpiece surface, significantly improving the accuracy and reliability of sealant width detection and meeting the stringent quality requirements of industrial production for workpiece sealant inspection.
[0158] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0159] The workpiece surface sealant width measuring device includes a processor and a memory. The sealant single-area image acquisition unit 001, grayscale optimized image acquisition unit 002, reference threshold image acquisition unit 003, sealant preliminary area image acquisition unit 004, sealant precise segmentation image acquisition unit 005, hollow sealant area image acquisition unit 006, and sealant width dataset acquisition unit 007 are all stored as program units in the memory. The processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0160] The processor contains a kernel that retrieves the corresponding program unit from memory. One or more kernels can be configured. By adjusting kernel parameters, surface images of the workpiece are acquired. Combined with image preprocessing techniques such as sealant region cropping, grayscale scaling, and directional filtering, precise segmentation of the sealant region is achieved. Then, an array of calipers is used to perform multi-point width measurements of the hollow sealant region, effectively improving the accuracy and stability of sealant boundary identification. This solves the problems of low image contrast and severe glare interference caused by the workpiece surface, significantly improving the accuracy and reliability of sealant width detection and meeting the stringent quality requirements of industrial production for workpiece sealant inspection.
[0161] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the method for measuring the width of sealant on the surface of a workpiece.
[0162] This invention provides a processor for running a program, wherein the program executes the workpiece surface sealant width measurement method during operation.
[0163] like Figure 14 As shown, an embodiment of the present invention provides an electronic device 1000, which includes at least one processor 1001, at least one memory 1002 and a bus 1003 connected to the processor 1001; wherein the processor 1001 and the memory 1002 communicate with each other through the bus 1003; the processor 1001 is used to call program instructions in the memory 1002 to execute the above-mentioned workpiece surface sealant width measurement method.
[0164] The present invention also provides a computer program product, which, when executed on an electronic device, is adapted to execute a program that initializes a method for measuring the width of a sealant on a workpiece surface.
[0165] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0166] In a typical configuration, an electronic device includes one or more processors (CPUs), memory, and a bus. The electronic device may also include input / output interfaces, network interfaces, etc.
[0167] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM, and memory includes at least one memory chip. Memory is an example of computer-readable media.
[0168] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0169] In the description of this invention, it should be understood that if the terms "upper", "lower", "front", "rear", "left" and "right" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the position or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.
[0170] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0171] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the present invention.
Claims
1. A method for measuring the width of sealant on a workpiece surface, characterized in that, include: Obtain a single-area image of the sealant corresponding to the target workpiece; The single-area image of the sealant is subjected to grayscale scaling to obtain a grayscale optimized image; The grayscale optimized image is subjected to directional filtering to obtain a baseline threshold image; Adaptive threshold segmentation is performed on the grayscale optimized image using the reference threshold image to obtain a preliminary image of the sealant region; Morphological processing is performed on the preliminary image of the sealant region to obtain a precisely segmented image of the sealant. Extract the outer contour of the sealant from the precisely segmented image, and construct a hollow sealant region image based on the outer contour; The image of the hollow sealant area was measured using an array of calipers to obtain a dataset of sealant width.
2. The method according to claim 1, characterized in that, The step of performing grayscale scaling on the single-area image of the sealant to obtain a grayscale optimized image includes: A preset linear grayscale transformation algorithm is used to perform linear grayscale scaling on the single-region image of the sealant to obtain a grayscale optimized image.
3. The method according to claim 1, characterized in that, The step of performing directional filtering on the grayscale optimized image to obtain a baseline threshold image includes: The grayscale optimized image is subjected to median filtering using a mask specification that matches the linear distribution characteristics of the sealant on the target workpiece to obtain a baseline threshold image.
4. The method according to claim 1, characterized in that, The step of using the reference threshold image to perform adaptive threshold segmentation on the grayscale optimized image to obtain a preliminary sealant region image includes: The grayscale value of each pixel in the grayscale optimized image is compared with the grayscale value of the corresponding pixel in the baseline threshold image. Pixels that meet the preset grayscale difference threshold are identified as sealant areas and are retained.
5. The method according to claim 1, characterized in that, The step of measuring the image of the hollow sealant region using an array caliper to obtain a sealant width dataset includes: The initial width of the sealant is determined based on the image of the hollow sealant region; Based on the initial width, multiple sets of measuring calipers are evenly arranged along the width direction of the sealant. For each set of measuring calipers, the boundary intersection point is calculated based on the image of the hollow sealant area to obtain the local width data of the sealant under the measuring calipers; By summing up the local width data corresponding to each of the aforementioned measuring calipers, a sealant width dataset is obtained.
6. The method according to claim 5, characterized in that, Determining the initial width of the sealant based on the image of the hollow sealant region includes: Calculate the minimum bounding rectangle of the hollow sealant region image; The initial width of the sealant is obtained by using the coordinate difference of the minimum bounding rectangle.
7. The method according to claim 6, characterized in that, For each set of measuring calipers, the boundary intersection point is calculated based on the image of the hollow sealant area to obtain the local width data of the sealant under the measuring calipers, including: For each set of measuring calipers, the line connecting the start and end points of the smallest bounding rectangle of the hollow sealant area image is extended to both ends by a predetermined number of pixels to form a measurement baseline. Determine the two intersection points between the measurement baseline and the boundary of the hollow sealant area image; The local width of the sealant is obtained based on the distance between the two intersection points.
8. The method according to any one of claims 1 to 7, characterized in that, After obtaining the sealant width dataset by measuring the image of the hollow sealant region using an array caliper, the method further includes: Determine whether all measured sealant width values in the sealant width dataset are within a preset width threshold range. If yes, the target workpiece is deemed to be sealed successfully; otherwise, the target workpiece is deemed to be sealed unsuccessfully.
9. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the workpiece surface sealant width measurement method as described in any one of claims 1 to 8.
10. An electronic device, characterized in that, The electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the workpiece surface sealant width measurement method as described in any one of claims 1 to 8.