Edge profile single pixelization method and storage medium
By combining Gaussian filtering, discrete differential operators, nonmaximum suppression, and morphological processing, the problem of non-single-pixel wide edge points in existing contour extraction is solved, achieving accurate single-pixel extraction of edge contours and improving the accuracy and efficiency of image processing.
Patent Information
- Application Number
- CN202411489271.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-10-24
AI Technical Summary
Existing contour extraction methods suffer from edge points that are not single-pixel wide, affecting product processing accuracy and efficiency.
A combined approach of Gaussian filtering, discrete differential operators, nonmaximum suppression, and morphological processing is adopted, including Gaussian filtering for noise reduction, discrete differential operators for edge extraction, nonmaximum suppression for edge thinning, morphological erosion, and difference operations, to achieve single-pixel rendering of edge contours.
It achieves precise single-pixel extraction of edge contours, improving the accuracy and efficiency of image processing and meeting the needs of industrial production and intelligent manufacturing for high-precision edge contour extraction.
Smart Images

Figure CN119515902B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to an edge contour single-pixelization method and a storage medium. BACKGROUND
[0002] With the rapid development of science and technology and intelligent manufacturing industry, the performance, precision and convenience of product edge contour extraction in industrial production are increasingly required. For example, in the automotive industry, the accurate cutting of part contours is crucial to ensure the assembly precision and safety of the whole vehicle; in the textile industry, the accurate contour cutting of printed cloth directly affects the appearance and quality of the final product; and in the point gluing industry, the point gluing precision of product edges is directly related to the sealing and durability of the product.
[0003] Visual technology is widely used in the extraction of target contours in industrial product images, replacing manual trajectory drawing and greatly improving efficiency and convenience. Single-pixel wide contours not only facilitate the detection of contour bifurcation points, but also remove redundant information and reduce data volume, making the product more smooth and fluent in mechanical processing.
[0004] Existing contour extraction methods can extract the edge contours of products to some extent, but often have non-single-pixel wide edge points. These non-single-pixel wide edge points not only increase the data volume, but also may cause errors in subsequent mechanical processing, affecting the processing precision and efficiency of the product. Therefore, we need a method for single-pixelization of edge contours. SUMMARY
[0005] The main purpose of the present application is to provide an edge contour single-pixelization method and a storage medium, aiming to solve the problem of non-single-pixel wide edge points in existing contour extraction.
[0006] To solve the above problems, the present application provides an edge contour single-pixelization method, comprising the following steps:
[0007] Collecting a target image and performing Gaussian filtering on the target image;
[0008] Based on Gaussian filtering, a discrete differential operator is used to extract the edge contours in the target image, obtaining wide edges;
[0009] Using non-maximum suppression to thin the wide edges, obtaining thinned edges and converting them into edge contour regions;
[0010] Performing morphological single-pixelization on the edge contour regions, obtaining single-pixel edge regions and converting them into single-pixel edge contours.
[0011] Optionally, the specific steps of extracting the edge contour in the target image by using a discrete differential operator after the Gaussian filtering include:
[0012] Based on the Gaussian filtering, the gradient amplitude and direction of each pixel in the target image are calculated by using a discrete differential operator to obtain a gradient amplitude map.
[0013] The amplitude of the gradient amplitude map is normalized to a preset range.
[0014] The strong amplitude in the gradient amplitude map is retained and the weak amplitude is suppressed to extract the edge contour in the target image to obtain a wide edge.
[0015] Optionally, the specific steps of extracting the edge contour in the target image by using a discrete differential operator after the Gaussian filtering include:
[0016] In the gradient amplitude map, if the gradient amplitude of a target pixel is greater than or equal to a preset amplitude threshold, the gradient amplitude of the target pixel position is retained.
[0017] In the gradient amplitude map, if the gradient amplitude of a target pixel is less than a preset amplitude threshold, the gradient amplitude of the target pixel position is replaced with 0.
[0018] In the gradient amplitude map, the pixel position with a non-0 amplitude threshold is an edge contour position.
[0019] Optionally, the specific steps of using non-maximum suppression to refine the wide edge to obtain a refined edge and converting the refined edge into an edge contour region include:
[0020] Each pixel in the gradient amplitude map is subjected to gradient amplitude suppression by using non-maximum suppression to refine the wide edge, and the edge of the suppressed edge contour is a refined edge.
[0021] Based on the gradient amplitude suppression, the gradient amplitude map is subjected to binarization processing to obtain a binary image and the suppressed edge contour is represented by a set pixel value of the binary image.
[0022] The set pixel value in the binary image is converted into an edge contour region.
[0023] Optionally, the specific steps of using non-maximum suppression to refine the wide edge by suppressing the gradient amplitude of each pixel in the gradient amplitude map include:
[0024] In a preset region of the current pixel in the gradient magnitude map, the current pixel and two other pixels in the same gradient direction as the current pixel are compared, and when the gradient magnitude of the current pixel is greater than the two other pixels, the gradient magnitude of the current pixel is retained;
[0025] When the gradient magnitude of the current pixel is not greater than the two other pixels, the gradient magnitude of the current pixel is replaced with 0.
[0026] Optionally, the step of using non-maximum suppression to thin the wide edge to obtain a thinned edge and converting the thinned edge into an edge contour region further comprises:
[0027] After quantizing the gradient direction of each pixel into four directions, non-maximum suppression is used to suppress the gradient magnitude of each pixel.
[0028] Optionally, the step of performing binarization processing on the gradient magnitude map after gradient magnitude suppression to obtain a binary image and representing the edge contour after suppression by a set pixel value of the binary image further comprises:
[0029] In the binary image, the value of a non-0 pixel is set as the set pixel value, and the pixel with the set pixel value is the edge contour at this time.
[0030] Optionally, the specific step of performing morphological single-pixelization on the edge contour region to obtain a single-pixel edge region and converting the single-pixel edge region into a single-pixel edge contour further comprises:
[0031] Four structuring elements are constructed;
[0032] The four structuring elements are used to successively perform morphological erosion and set difference operation processing on the edge contour region to single-pixelize the edge contour region and obtain a single-pixel edge region;
[0033] The single-pixel edge region is converted into a single-pixel edge contour.
[0034] Optionally, the step of using the four structuring elements to successively perform morphological erosion and set difference operation processing on the edge contour region to single-pixelize the edge contour region and obtain a single-pixel edge region further comprises:
[0035] The four structuring elements are used to successively perform morphological erosion on the edge contour region to extract 4-connected pixel points existing between a two-pixel-wide edge point and a current pixel point;
[0036] The edge contour region after extracting the 4-connected pixel points is subjected to set difference operation with the original edge contour region to remove the 4-connected points from the original edge contour region, thereby forming a single-pixel edge region.
[0037] The application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the edge contour single-pixelization method.
[0038] The application converts the non-maximum suppression edge contour into an edge contour region, then performs morphological processing on the edge contour region to obtain a single-pixel-wide region, and finally converts the single-pixel-wide region into a single-pixel-wide contour to complete the contour extraction. The application solves the problem of non-single-pixel-wide edge points in the existing contour extraction, realizes accurate single-pixelization of the edge contour, and thus improves the accuracy and efficiency of image processing, and meets the urgent needs of high-precision edge contour extraction in the field of industrial production and intelligent manufacturing. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only constitute some embodiments of the application, and for those skilled in the art, other drawings can also be obtained from the structures shown in the drawings without creative labor.
[0040] Figure 1 A single-pixel-wide contour extraction flowchart for an embodiment of the edge contour single-pixelization method of the application;
[0041] Figure 2 A gradient direction quantization diagram for an embodiment of the edge contour single-pixelization method of the application;
[0042] Figure 3 An edge contour diagram after non-maximum suppression represented by a binary graph for an embodiment of the edge contour single-pixelization method of the application;
[0043] Figure 4 A schematic diagram of coexistence of two-pixel-wide edge points and current pixel points 4 connected and 8 connected for an embodiment of the edge contour single-pixelization method of the application;
[0044] Figure 5 A structural element schematic diagram for an embodiment of the edge contour single-pixelization method of the application;
[0045] Figure 6 An edge contour diagram after single-pixelization represented by a binary graph for an embodiment of the edge contour single-pixelization method of the application.
[0046] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0047] The following will combine the drawings in the embodiments of the applicationFigures 1-6 The technical solutions in the embodiments of the present application are described clearly and completely, obviously, the described embodiments are only part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor belong to the scope of protection of the present application.
[0048] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present application are only used to explain the relative positional relationship, motion condition, etc. between components in a certain posture (as shown in the drawings), and if the certain posture changes, the directional indications will also change accordingly.
[0049] In the present application, unless otherwise explicitly specified and limited, the terms "connection", "fixation" and the like should be understood broadly, for example, "fixation" can be fixed connection, or detachable connection, or integral; can be mechanical connection, or electrical connection; can be direct connection, or indirect connection through intermediate medium; can be internal communication of two elements or interaction relationship between two elements, unless otherwise explicitly limited. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0050] In addition, the description of "first", "second" and the like in the present application is only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the indicated technical features or implicitly indicating the number of the indicated technical features. Therefore, the features limited by "first" and "second" can explicitly or implicitly include at least one of the features. In addition, the technical solutions of each embodiment can be combined with each other, but it must be based on the fact that those skilled in the art can realize it, when the combination of technical solutions appears contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, nor within the scope of protection claimed by the present application.
[0051] With the rapid development of science and technology and intelligent manufacturing industry, the performance, precision and convenience of product edge contour extraction in industrial production are increasingly required, so as to facilitate, quickly and accurately process the product. Visual technology is widely used in the extraction of target contour in industrial product image, replacing manual manual trajectory drawing, greatly improving the efficiency and convenience.
[0052] For the existing contour extraction method, although the edge contour of the product can be extracted to a certain extent, there is often a problem of non-single-pixel-wide edge point. The present application provides a single-pixel edge contour method, comprising the following steps:
[0053] Collect the target image, and perform Gaussian filtering on the target image; Gaussian filtering can remove small contours with inconspicuous and drastic fluctuations in contrast and remove interference random noise, which is conducive to the extraction of main edge contours.
[0054] Notably, the edge contour single-pixelization method of the present scheme is directed to grayscale images, so in this step, the target image is an image that has been grayscale.
[0055] Based on Gaussian filtering, a discrete differential operator is used to extract the edge contours in the target image, obtaining wide edges; common discrete differential operators include Sobel operators, Prewitt operators, and Roberts operators, etc., which can calculate the first derivative of an image to detect edges. In this step, the edge contours of the target image can be obtained, and the edges of the edge contours at this time are usually wide edges, which need to be thinned.
[0056] Non-maximum suppression is used to thin the wide edges, obtaining thinned edges and converting them into edge contour regions; non-maximum suppression is a key step in edge thinning, which reduces the edge width from multiple pixels to a single pixel, but there are still some two-pixel-wide pixel points in this step. Therefore, the edge contours of the thinned edges are converted into edge contour regions to facilitate the next step of single-pixelization.
[0057] Non-maximum suppression (NMS) is a technique used in image processing, particularly in edge detection, to thin edges. The basic principle is to suppress non-maximum elements, i.e., to retain the pixel points with the largest local gradient amplitude, and to set the gradient amplitudes of other pixel points to 0 or lower values, thereby achieving edge thinning. Non-maximum suppression plays a particularly significant role in processing wide edges.
[0058] The specific process of non-maximum suppression for thinning wide edges is as follows:
[0059] For each pixel point in the image, consider its neighboring pixel points in the gradient direction. According to the gradient direction, select an appropriate neighborhood for comparison (e.g., in 0°, 45°, 90°, 135°, etc. directions).
[0060] If the gradient amplitude of the current pixel point is not the largest in its gradient direction neighborhood, set the gradient amplitude of the point to 0 or a lower value to suppress non-edge points. The purpose of this step is to retain the local maximum points on the edge and remove the stray points next to the edge, thereby achieving edge thinning.
[0061] For wide edges, non-maximum suppression can effectively remove non-maximum points inside the edge, making the edge clearer and thinner. By comparing the gradient amplitudes of each pixel on the edge with its neighboring pixels in the gradient direction, it can be ensured that only the strongest points on the edge are retained.
[0062] After non-maximum suppression, the output is a refined edge image. The edges in this image will be clearer, continuous, and thin, making it easier for subsequent image analysis and processing.
[0063] The edge contour region is morphologically single-pixelized to obtain a single-pixel edge region and convert it into a single-pixel edge contour. Finally, through morphological erosion and set difference operations, the edge of the edge contour region is refined to a single-pixel width and converted into a single-pixel edge contour, completing the extraction of the single-pixel edge contour.
[0064] In image processing, morphological erosion and set difference operations are two commonly used techniques, which are often used in the processing of edge contour regions to achieve specific goals such as noise removal, edge detection, feature extraction, etc.
[0065] Morphological erosion is a basic morphological operation that shrinks foreground objects or eliminates small objects by reducing the highlighted areas in the image (for binary images, i.e., white parts). The erosion operation uses a structure element (also known as a convolution kernel or template) to slide over the image and calculates the minimum value of the covered area as the corresponding pixel value of the output image. This process causes the object boundaries in the image to shrink inward, thus removing small details or noise.
[0066] In edge contour region processing, the erosion operation can be used to remove edge burrs, small protrusions, or connect adjacent small objects. By adjusting the size and shape of the structure element, the degree of erosion can be controlled to achieve the desired edge smoothing effect.
[0067] Set difference operation is a concept in set theory, but in image processing, it usually refers to the result of subtracting one image (or part of an image) from another. In the context of morphological processing, the set difference operation can be considered as the difference between the original region and the region after some morphological processing (such as erosion, dilation, etc.).
[0068] In edge contour region processing, one common application of set difference operation is to extract the details of the edge or contour. For example, you can first perform an erosion operation on the original region, then subtract the eroded region from the original region (i.e., perform a set difference operation) to highlight the edge details in the original region that were removed during the erosion process. This method is sometimes called the "Top-hat" transformation, which is particularly suitable for extracting small structures or textures in the region.
[0069] The present application converts the non-maximum suppression edge contour into an edge contour region, then performs morphological processing on the edge contour region to obtain a single-pixel wide region, and finally converts the single-pixel wide region into a single-pixel wide contour to complete the extraction of the contour. The present application solves the problem of non-single-pixel wide edge points existing in the existing contour extraction, realizes accurate single-pixelization of the edge contour, thereby improving the precision and efficiency of image processing, and meets the urgent needs of high-precision edge contour extraction in the field of industrial production and intelligent manufacturing.
[0070] As shown in Figures 1-6 The following is an embodiment of the present application.
[0071] S1: Collect a target image and perform Gaussian filtering on the target image.
[0072] Gaussian filtering is a linear smoothing filter that can smooth details and textures in an image and remove some random noise, improving the quality of the image and making the image look softer. Performing Gaussian filtering on an image can remove small contours with inconspicuous and severe fluctuations in contrast, as well as remove interfering random noise, which is beneficial to the extraction of main edge contours. It replaces each pixel in the image with a weighted average of the pixels in its neighborhood through convolution operation, and the weights are given by the Gaussian function (also known as the normal distribution function). This way of assigning weights makes the pixels closer to the center pixel have a greater impact on the result, while the pixels farther away have a gradually decreasing impact.
[0073] Since Gaussian filtering has smoothed the image, it can effectively remove random noise in the image, especially Gaussian noise. This is very helpful in improving the signal-to-noise ratio of the image; although Gaussian filtering smooths details and textures in the image, it has some ability to preserve edge information in the image. This is because edges are usually caused by sharp changes in pixel values in the image, and the smoothing effect of Gaussian filtering is relatively weak at edges.
[0074] S2: Based on the Gaussian filtering, calculate the gradient amplitude and direction of each pixel in the target image using a discrete differential operator to obtain a gradient amplitude map.
[0075] The discrete differential operator detects the image edge contour of the Gaussian smoothed target image, and the discrete differential operator is preferably a Sobel operation. Sobel is a discrete differential operator for edge detection that detects edges by calculating the gradient of each pixel in the image. Horizontal and vertical filters are used to convolve the image sliding window to obtain horizontal and vertical gradient images, and the edge amplitude gradient map is obtained by operating on the two gradient maps.
[0076] The filter is as follows:
[0077]
[0078] where g x is a horizontal filter that detects the gradient in the horizontal direction, i.e. the vertical edge straight line; g y is a vertical filter that detects the gradient in the vertical direction, i.e. the horizontal edge straight line. After using the filters to respectively convolve the image with a sliding window, the horizontal and vertical gradient maps g x ,g y are obtained. Then, the gradient magnitude mag
[0079] .
[0080] S3: Normalize the magnitude of the gradient magnitude map to a preset range.
[0081] Preferably, the preset range is 0-255. In image processing, pixel values usually represent the brightness or color intensity of each point in the image. For a grayscale image, the pixel value range is usually from 0 (black) to 255 (white), where 0 represents the darkest (black) and 255 represents the brightest (white), and the intermediate values represent different levels of gray.
[0082] Therefore, a pixel with a value of 255 represents the brightest white color in a grayscale image. This means that in a grayscale image, if the brightness of this pixel is set to 255, it will appear as pure white without any gray or shadow.
[0083] S4: Retain strong amplitude values and suppress weak amplitude values in the gradient magnitude map to extract the edge contour in the target image and obtain a wide edge.
[0084] If the gradient amplitude of the target pixel in the gradient magnitude map is greater than or equal to a preset amplitude threshold, the gradient amplitude of the target pixel position is retained; if the gradient amplitude of the target pixel in the gradient magnitude map is less than the preset amplitude threshold, the gradient amplitude of the target pixel position is replaced with 0; the pixel position with a non-0 amplitude threshold in the gradient magnitude map is an edge contour position.
[0085] S5: Use non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient magnitude map to refine the wide edge, and the edge of the suppressed edge contour is a refined edge.
[0086] The edges obtained in S4 are usually wide edges, which need to be thinned. Non-maximum suppression is used to thin the edges. In the gradient magnitude map, a pixel is taken as the current pixel. In the preset region of the current pixel in the gradient magnitude map, the current pixel and another two pixels in the same gradient direction as the current pixel are compared. When the gradient magnitude of the current pixel is greater than the other two pixels, the gradient magnitude of the current pixel is retained; when the gradient magnitude of the current pixel is not greater than the other two pixels, the gradient magnitude of the current pixel is replaced by 0.
[0087] More specifically, as in the 3x3 field of the current pixel, the current pixel and another two pixels in the same gradient direction as the current pixel are compared. If the gradient magnitude of the current pixel is the maximum, the gradient magnitude of the current pixel is retained; otherwise, the gradient magnitude of the current pixel is replaced by 0.
[0088] Notably, as shown in Figure 2 , after quantizing the gradient direction of each pixel into four directions, non-maximum suppression is used to suppress the gradient magnitude of each pixel. The gradient direction of a pixel is , ranging from [-180, 180). Before gradient magnitude suppression, the gradient direction θ needs to be quantized into four directions d1, d2, d3 and d4, where d1 is a horizontal edge, d2 is a 45° edge, d3 is a vertical edge, and d4 is a -45° edge.
[0089] S6: Based on the gradient magnitude suppression, the gradient magnitude map is binarized to obtain a binary image bw, and the set pixel value of the binary image represents the edge profile after suppression.
[0090] In the binary image, the value of the non-0 pixel is set to the set pixel value, and the pixel of the set pixel value is the edge profile at this time. The gradient magnitude map after non-maximum suppression in S5 is binarized to obtain a binary image, and the non-0 pixel is set to 255. Binarization is a basic operation in image processing, which sets the pixel value of an image to 0 or 255, thereby creating a binary image. This process is usually based on a threshold, and the pixel value higher than the threshold is set to a value (such as 255), and the pixel value lower than the threshold is set to another value (such as 0). The edge profile is represented in the form of a binary image, and the pixel with a value of 255 is the edge profile, as shown in Figure 3 .
[0091] In Figure 3In the embodiment, most of the edge profiles after non-maximum suppression are single-pixel wide, but there are still some two-pixel wide pixels. The edge profiles after non-maximum suppression, the two-pixel wide edge pixels are present in the 45° or -45° direction, and the feature is that the 4-connected pixels and 8-connected pixels with the current pixel point exist at the same time. Generally, taking 4-connected or 8-connected pixels can represent the trend of the profile and reduce the number of profile pixels, and in the embodiment, 8-connected pixels are taken, and the 4-connected pixels are removed. There are a total of 8 kinds of situations in which 4-connected and 8-connected pixels exist at the same time with the current pixel point, a, b, c, d, e, f, g, h, as shown in FIG. 6. Figure 4
[0092] S7: Convert the set pixel value in the binary image into an edge profile region.
[0093] The pixels with a binary image value of 255 in S6 are converted into a region, and the region is stored in the form of a run set to reduce the data amount and improve the calculation performance. The run is defined as a structure of continuous adjacent pixels in an image row, that is, the run r = {row, cb, ce}, wherein row is the row coordinate of the adjacent target pixel, cb is the start coordinate of the adjacent target pixel, and ce is the end coordinate of the adjacent target pixel, and the region region = {r i} is obtained. Converting the edge profile in the binary image into a region not only can reduce the data storage amount, but also is beneficial to the subsequent morphological processing of single-pixelization and can improve the calculation performance.
[0094] S8: Perform morphological single-pixelization on the edge profile region, use four structure elements to successively perform morphological erosion and difference set operation processing on the edge profile region, single-pixelize the edge profile region, and obtain a single-pixel edge region.
[0095] The four structure elements are successively used to perform morphological erosion on the edge profile region, and the 4-connected pixels present between the two-pixel wide edge pixels and the current pixel point are extracted; the edge profile region after extracting the 4-connected pixels is subjected to a difference set operation with the original edge profile region, the 4-connected pixels are removed from the original edge profile region, and a single-pixel edge region is formed.
[0096] More specifically, four structure elements st are designed, and the four structure elements are successively used to perform morphological erosion and difference set operation on the region region in S7 to single-pixelize the region, , . Wherein “ ” represents a region morphological erosion operation, and “-” represents a region morphological difference set operation.
[0097] After the erosion operation on the edge contour region, 4-connected pixel points are extracted, and then a difference set operation is performed with the original region to remove the 4-connected points from the original region. The structural element is as shown in Figure 5 , and the thickened black "1" in the center is the anchor point of the structural element. The morphological erosion operation of the structural element stA on the region can obtain 4-connected pixel points of two types of edge contours a and b in Figure 3 ; the morphological erosion operation of the structural element stB on the region can obtain 4-connected pixel points of two types of edge contours c and d in Figure 3 ; the morphological erosion operation of the structural element stC on the region can obtain 4-connected pixel points of two types of edge contours e and f in Figure 3 ; and the morphological erosion operation of the structural element stD on the region can obtain 4-connected pixel points of two types of edge contours g and h in Figure 4 .
[0098] S9: Convert the single-pixel edge region into a single-pixel edge contour, and complete the single-pixel contour extraction. As shown in Figure 6 , the single-pixelization post-processing result of Figure 3 is as shown in Figure 5 , and the extraction of the single-pixel contour is completed as shown in Figure 5 .
[0099] In an embodiment, the present application further provides a computer readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the edge contour single-pixelization method as described above.
[0100] The above description is only optional embodiments of the present application, and does not limit the patent scope of the present application, and any equivalent structural transformation, direct / indirect application in other related technical fields within the inventive concept of the present application, and the contents of the specification and drawings are included in the patent protection scope of the present application.
Claims
1. A method of edge profile single pixelation, characterized by, The method comprises the following steps: Collecting a target image and performing Gaussian filtering on the target image; Based on Gaussian filtering, a discrete differential operator is used to extract the edge contour in the target image to obtain a wide edge; Using non-maximum suppression to thin the wide edge to obtain a thinned edge and convert it into an edge contour region; Four structure elements are constructed, and the edge contour region is sequentially eroded using the four structure elements to extract four-connected pixel points existing between a two-pixel-wide edge point and a current pixel point; each structure element erodes the edge contour region to obtain two types of four-connected pixel points, and through the erosion operation of the four structure elements, eight types of four-connected pixel points are obtained; A difference set operation is performed on the edge contour region after the four-connected pixel points are extracted and the original edge contour region to remove the four-connected points from the original edge contour region to form a single-pixel edge region.
2. The edge profile single pixelation method of claim 1, wherein, The specific steps of the method based on Gaussian filtering and using a discrete differential operator to extract the edge contour in the target image to obtain a wide edge include: Based on Gaussian filtering, a discrete differential operator is used to calculate the gradient amplitude and direction of each pixel in the target image to obtain a gradient amplitude map; The amplitude of the gradient amplitude map is normalized to a predetermined range; The strong amplitude in the gradient amplitude map is retained and the weak amplitude is suppressed to extract the edge contour in the target image to obtain a wide edge.
3. The edge profile single pixelation method of claim 2, wherein, The specific steps of the method of retaining the strong amplitude in the gradient amplitude map and suppressing the weak amplitude to extract the edge contour in the target image to obtain a wide edge include: If the gradient amplitude of a target pixel in the gradient amplitude map is greater than or equal to a predetermined amplitude threshold, the gradient amplitude of the target pixel position is retained; If the gradient amplitude of a target pixel in the gradient amplitude map is less than a predetermined amplitude threshold, the gradient amplitude of the target pixel position is replaced with 0; The pixel position with a non-0 amplitude threshold in the gradient amplitude map is an edge contour position.
4. The edge profile single pixelation method of claim 1, wherein, The specific steps of the method of using non-maximum suppression to thin the wide edge to obtain a thinned edge and convert it into an edge contour region include: Non-maximum suppression is used to suppress the gradient amplitude of each pixel in the gradient amplitude map to thin the wide edge, and the edge of the suppressed edge contour is a thinned edge; Based on the gradient amplitude suppression, the gradient amplitude map is binarized to obtain a binary image and the suppressed edge contour is represented by a set pixel value of the binary image; The set pixel value in the binary image is converted into an edge contour region.
5. The edge profile single pixelation method of claim 4, wherein, The specific steps of the method of using non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient amplitude map to thin the wide edge, and the edge of the suppressed edge contour is a thinned edge include: In a predetermined region of a current pixel in the gradient amplitude map, the current pixel and another two pixels in the same gradient direction as the current pixel are compared, and if the gradient amplitude of the current pixel is greater than that of the other two pixels, the gradient amplitude of the current pixel is retained; If the gradient amplitude of the current pixel is not greater than that of the other two pixels, the gradient amplitude of the current pixel is replaced with 0.
6. The edge profile single pixelation method of claim 4, wherein, The step of using non-maximum suppression to thin the wide edge to obtain a thinned edge and convert the thinned edge into an edge contour region further comprises: The step of using non-maximum suppression to suppress the gradient amplitude of each pixel based on quantizing the gradient direction of each pixel into four directions.
7. The edge profile single pixelation method of claim 4, wherein, The step of binarizing the gradient amplitude map to obtain a binary map and representing the edge contour after suppression by a set pixel value of the binary map further comprises: In the binary map, the value of the non-0 pixel is set as the set pixel value, and the pixel of the set pixel value is the edge contour at this time.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the steps of the edge contour single pixelization method according to any one of claims 1-7.
Citation Information
Patent Citations
Edge detection method of Canny operator based on high and low thresholds
CN114399522A
Heat pipe orifice circle center positioning method based on random Hough transform
CN115908543A