Edge contour single pixelation method and storage medium

Through Gaussian filtering, discrete differential operators, non-maximum suppression and morphological single-pixelization processing, the problem of non-single-pixel wide edge points in the prior art is solved, and the precise single-pixelization of edge contours is achieved, and the accuracy and efficiency of image processing are improved.

CN119515902AActive Publication Date: 2025-02-25SHENZHEN ZMOTION TECH CO LTD

Patent Information

Application Number
CN202411489271.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-02-25
Estimated Expiration
2044-10-24

AI Technical Summary

Technical Problem

The existing contour extraction methods have problems with edge points that are not single pixel wide, which increases the amount of data and may cause errors in the mechanized processing process, affecting the processing accuracy and efficiency of the product.

Method used

A single pixelation method of edge profile is proposed, including Gaussian filtering, discrete differential operator extraction edge, non-maximum suppression refinement and morphological single pixelation, which is converted into single pixel edge profile.

Benefits of technology

The precise single pixelation of edge contour is achieved, the accuracy and efficiency of image processing are improved, and the demand for high-precision edge contour extraction in industrial production and intelligent manufacturing fields is met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119515902A_ABST
    Figure CN119515902A_ABST
Patent Text Reader

Abstract

The invention provides an edge contour single pixelation method and a storage medium, and relates to the technical field of image processing, and the method comprises the following steps: collecting a target image, and carrying out the Gaussian filtering of the target image; after Gaussian filtering, extracting an edge contour in the target image by adopting a discrete differential operator to obtain a wide edge; refining the wide edge by using non-maximum suppression to obtain a refined edge, and converting the refined edge into an edge contour region; and performing morphological single-pixelation 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. According to the method, the problem that non-single-pixel wide edge points exist in existing contour extraction is solved, accurate single-pixel processing of the edge contour is realized, so that the image processing precision and efficiency are improved, and the urgent requirements of industrial production and intelligent manufacturing fields on high-precision edge contour extraction are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for converting edge contours into single pixels and a storage medium. Background Art

[0002] With the rapid development of science and technology and the intelligent manufacturing industry, the requirements for the performance, accuracy and convenience of product edge contour extraction in industrial production are increasing. For example, in the automotive industry, the precise cutting of part contours is crucial to ensure the assembly accuracy and safety of the entire vehicle; in the textile industry, the precise contour cutting of printed and dyed fabrics directly affects the appearance and quality of the final product; and in the dispensing industry, the dispensing accuracy of the product edge is directly related to the sealing and durability of the product.

[0003] Vision technology is widely used to extract target contours in industrial product images, replacing manual trajectory drawing, greatly improving efficiency and convenience. The single-pixel-wide contour not only brings convenience when finding contour bifurcation points, but also removes redundant information and reduces the amount of data, making the product smoother during mechanized processing.

[0004] Although the existing contour extraction methods can extract the edge contour of the product to a certain extent, there are often edge points that are not single-pixel wide. These non-single-pixel-wide edge points not only increase the amount of data, but may also cause errors in the subsequent mechanized processing process, affecting the processing accuracy and efficiency of the product. Therefore, we need a method to convert edge contours into single pixels. Summary of the invention

[0005] The main purpose of the present invention is to propose a method for converting edge contours into single pixels and a storage medium, aiming to solve the problem that there are non-single-pixel wide edge points in the existing contour extraction.

[0006] In view of the above problems, the present invention proposes a method for converting edge contours into single pixels, comprising the following steps: Acquire a target image, and perform Gaussian filtering on the target image; After Gaussian filtering, a discrete differential operator is used to extract edge contours in the target image to obtain wide edges; Using non-maximum suppression to refine the broad edge, obtain a refined edge and convert it into an edge contour region; The edge contour region is morphologically pixelated to obtain a single-pixel edge region and convert it into a single-pixel edge contour.

[0007] Optionally, the step of extracting edge contours in the target image using a discrete differential operator after Gaussian filtering to obtain wide edges includes: After Gaussian filtering, a discrete differential operator is used to calculate the gradient magnitude and direction of each pixel in the target image to obtain a gradient magnitude map; Normalizing the amplitude of the gradient amplitude map to within a preset range; The strong amplitude values ​​in the gradient amplitude map are retained and the weak amplitude values ​​are suppressed, and the edge contour in the target image is extracted to obtain a wide edge.

[0008] Optionally, the specific steps of retaining the strong amplitudes in the gradient amplitude map and suppressing the weak amplitudes, extracting the edge contour in the target image, and obtaining the wide edge include: If the gradient amplitude of the target pixel in the gradient amplitude map is greater than or equal to a preset amplitude threshold, the gradient amplitude at the target pixel position is retained; If the gradient amplitude of a target pixel in the gradient amplitude map is less than a preset amplitude threshold, the gradient amplitude at the target pixel position is replaced with 0; The pixel positions of the non-zero amplitude thresholds in the gradient amplitude map are edge contour positions.

[0009] Optionally, the specific steps of using non-maximum suppression to refine the wide edge to obtain the refined edge and convert it into an edge contour area include: Using non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient amplitude map to refine the wide edge, the edge of the edge contour after suppression being the refined edge; After the gradient amplitude is suppressed, the gradient amplitude map is binarized to obtain a binary map and the suppressed edge contour is represented by the set pixel values ​​of the binary map; The set pixel values ​​in the binary image are converted into edge contour areas.

[0010] Optionally, the step of using non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient amplitude map to refine the wide edge, wherein the edge of the suppressed edge contour is the refined edge, comprises: In a preset area of ​​a current pixel in the gradient amplitude map, the current pixel is compared with two other pixels in the same gradient direction as the current pixel, and when 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; When the gradient magnitude of the current pixel is not greater than that of the other two pixels, the gradient magnitude of the current pixel is replaced with 0.

[0011] Optionally, the step of thinning the wide edge using non-maximum suppression to obtain the thinned edge and converting it into an edge contour area further comprises: After the gradient direction of each pixel is quantized into four directions, non-maximum suppression is used to suppress the gradient amplitude of each pixel.

[0012] Optionally, after the gradient amplitude suppression, binarizing the gradient amplitude map to obtain a binary image and representing the suppressed edge contour by setting pixel values ​​of the binary image further comprises: In the binary image, the value of the non-zero pixel is set as the set pixel value, and the pixel of the set pixel value is the edge contour at this time.

[0013] Optionally, the specific step of performing morphological single pixelization on the edge contour area to obtain a single pixel edge area and converting it into a single pixel edge contour further includes: Construct four structural elements; Using the four structure elements to continuously perform morphological corrosion and difference operation processing on the edge contour area, single-pixelizing the edge contour area, and obtaining a single-pixel edge area; Convert single-pixel edge regions to single-pixel edge outlines.

[0014] Optionally, the step of using the four structure elements to continuously perform morphological corrosion and difference operation processing on the edge contour area to single-pixelize the edge contour area to obtain a single-pixel edge area further comprises: Using the four structural elements to continuously perform morphological corrosion on the edge contour area, extracting the edge point with a width of two pixels and the four connected pixel points existing in the current pixel point; A difference operation is performed between the edge contour area after extracting the 4-connected pixel points and the original edge contour area, and the 4-connected points are removed from the original edge contour area to form a single-pixel edge area.

[0015] The present invention further proposes a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the steps of the above-mentioned edge contour single-pixelization method.

[0016] The present invention converts the edge contour after non-maximum suppression into an edge contour area, then performs morphological processing on the edge contour area to obtain a single-pixel wide area, and finally converts the single-pixel wide area into a single-pixel wide contour to complete contour extraction. The present invention solves the problem of non-single-pixel wide edge points in existing contour extraction, realizes accurate single-pixel conversion of edge contours, thereby improving the accuracy and efficiency of image processing, and meeting the urgent needs of industrial production and intelligent manufacturing fields for high-precision edge contour extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0018] Figure 1 A single pixel wide contour extraction flow chart of an embodiment of an edge contour single pixelization method of the present invention; Figure 2 A gradient direction quantization map of an embodiment of a method for converting edge contours into single pixels according to the present invention; Figure 3 An edge contour image after non-maximum suppression represented by a binary image in an embodiment of an edge contour single pixelization method of the present invention; Figure 4 A schematic diagram of the coexistence of 4-connected and 8-connected edge points with a width of two pixels and a current pixel point according to an embodiment of a method for converting edge contours to single pixels of the present invention; Figure 5 A schematic diagram of a structural element of an embodiment of a method for converting edge contours into single pixels according to the present invention; Figure 6 In one embodiment of a method for converting edge contours to single pixels of the present invention, a binary image is used to represent the edge contour image after single pixel conversion.

[0019] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0020] The following will be combined with the attached embodiment of the present invention Figures 1 to 6 , the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0022] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0023] In addition, in the present invention, descriptions such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0024] With the rapid development of science and technology and intelligent manufacturing industry, the performance, accuracy and convenience of product edge contour extraction in industrial production are becoming increasingly higher, so as to process products conveniently, quickly and accurately. Vision technology is widely used in the extraction of target contours in industrial product images, replacing manual trajectory drawing, which greatly improves efficiency and convenience.

[0025] Although the existing contour extraction method can extract the edge contour of the product to a certain extent, there is often a problem of edge points that are not single-pixel wide. The present invention proposes a single-pixel edge contour method, which includes the following steps: The target image is collected and Gaussian filtered. Gaussian filtering can remove the fine contours with unclear contrast and drastic fluctuations in the image, as well as remove interfering random noise, which is conducive to the extraction of the main edge contours.

[0026] It is worth noting that the edge contour single pixel method of this scheme is aimed at grayscale images, so in this step, the target image is an image that has been grayscaled.

[0027] After Gaussian filtering, the edge contour in the target image is extracted using a discrete differential operator to obtain a wide edge; commonly used discrete differential operators include the Sobel operator, Prewitt operator, and Roberts operator, which can calculate the first-order derivative of the image to detect the edge. In this step, the edge contour of the target image can be obtained. At this time, the edge of the edge contour is usually a wide edge, which requires edge refinement.

[0028] Use non-maximum suppression to refine the wide edge, obtain the refined edge and convert it into the edge contour area; non-maximum suppression is the key step of edge refinement, which reduces the edge width from multiple pixels to single pixel, but there are still some two-pixel wide pixels in this step. Therefore, the edge contour of the refined edge is converted into the edge contour area to facilitate the next step of single pixelization.

[0029] Non-Maximum Suppression (NMS) is a technique used to refine edges in image processing, especially in edge detection. Its basic principle is to suppress non-maximum elements, that is, to retain the pixel with the largest local gradient amplitude, and set the gradient amplitude of other pixels to 0 or a lower value, so as to achieve edge refinement. When processing wide edges, the effect of non-maximum suppression is particularly significant.

[0030] The specific process of non-maximum suppression for wide edge refinement is as follows: For each pixel in the image, consider its neighboring pixels in the direction of the gradient. Depending on the gradient direction, select an appropriate neighborhood for comparison (for example, in the direction of 0°, 45°, 90°, 135°, etc.).

[0031] If the gradient magnitude of the current pixel is not the largest in its neighborhood in the gradient direction, the gradient magnitude of the point is set to 0 or a lower value to suppress non-edge points. The purpose of this step is to retain the local maximum point on the edge and remove the stray points next to the edge, thereby achieving edge refinement.

[0032] For wide edges, non-maximum suppression can effectively remove non-maximum points inside the edge, making the edge clearer and more refined. By comparing the gradient magnitude of each pixel on the edge with its adjacent pixels in the gradient direction, it can ensure that only the strongest points on the edge are retained.

[0033] After non-maximum suppression processing, a refined edge image is output. The edges in this image will be clearer, continuous, and thinner, which is convenient for subsequent image analysis and processing.

[0034] The edge contour area is morphologically pixelated to obtain a single-pixel edge area and converted into a single-pixel edge contour; finally, the edge of the edge contour area is refined into a single-pixel width through morphological erosion and difference operations, and converted into a single-pixel edge contour to complete the extraction of the single-pixel edge contour.

[0035] In image processing, morphological erosion and difference operation are two commonly used techniques, which are often used to process edge contour areas to achieve specific processing goals, such as denoising, edge detection, feature extraction, etc.

[0036] Morphological erosion is a basic morphological operation that shrinks foreground objects or eliminates small objects by reducing the highlight area (white part for binary images) in the image. The erosion operation slides a structural element (also called a convolution kernel or template) on the image and calculates the minimum value of the area covered by the structural element as the corresponding pixel value of the output image. This process causes the boundaries of objects in the image to shrink inward, thereby removing small details or noise.

[0037] In edge contour area processing, the erosion operation can be used to remove burrs, small protrusions on the edge or connect adjacent small objects. By adjusting the size and shape of the structural element, the degree of erosion can be controlled to achieve the desired edge smoothing effect.

[0038] The 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 image. In the context of morphological processing, the difference operation can be considered as the difference between the original region and the region after some morphological processing (such as erosion, dilation, etc.).

[0039] In edge contour region processing, a common application of the difference operation is to extract edge or contour details. For example, you can first perform an erosion operation on the original region, and then subtract the eroded region from the original region (i.e., perform a difference operation) to highlight the edge details in the original region that were removed during the erosion process. This method is sometimes called a "top-hat" transformation, and it is particularly suitable for extracting fine structures or textures in a region.

[0040] The present invention converts the edge contour after non-maximum suppression into an edge contour area, then performs morphological processing on the edge contour area to obtain a single-pixel wide area, and finally converts the single-pixel wide area into a single-pixel wide contour to complete contour extraction. The present invention solves the problem of non-single-pixel wide edge points in existing contour extraction, realizes accurate single-pixel conversion of edge contours, thereby improving the accuracy and efficiency of image processing, and meeting the urgent needs of industrial production and intelligent manufacturing fields for high-precision edge contour extraction.

[0041] like Figures 1 to 6 As shown, the following is an embodiment of the present invention.

[0042] S1: Collect the target image and perform Gaussian filtering on the target image.

[0043] Gaussian filtering is a linear smoothing filter that can smooth the details and textures in an image and remove some random noise, improving the quality of the image and making it look softer. Gaussian filtering can remove fine contours with unclear contrast and violent fluctuations in the image, as well as remove interfering random noise, which is conducive to the extraction of major edge contours. It replaces each pixel in the image with the weighted average of the pixels in its neighborhood through a convolution operation, and the weight is given by a Gaussian function (also known as a normal distribution function). This weight distribution method makes the pixels closer to the center pixel have a greater impact on the result, while the influence of pixels farther away gradually decreases.

[0044] Since Gaussian filtering smoothes the image, it can effectively remove random noise, especially Gaussian noise, in the image. This is very helpful for improving the signal-to-noise ratio of the image; although Gaussian filtering will smooth the details and textures in the image, it has a certain ability to retain edge information in the image. This is because the edge is usually caused by a sharp change in pixel values ​​in the image, and the smoothing effect of Gaussian filtering will be relatively weak at the edge.

[0045] S2: After Gaussian filtering, the discrete differential operator is used to calculate the gradient magnitude and direction of each pixel in the target image to obtain a gradient magnitude map.

[0046] The target image after Gaussian smoothing is subjected to a discrete differential operator to detect the edge contour of the image, and the discrete differential operator is preferably a Sobel operation. Sobel is a discrete differential operator used for edge detection, which detects edges by calculating the gradient of each pixel in the image. The image is convolved with sliding windows using filters in the horizontal and vertical directions to obtain horizontal and vertical gradient images, and the edge amplitude gradient map is obtained by operating the two gradient maps.

[0047] The filter is as follows:

[0048] where g x is a horizontal filter that detects the horizontal gradient, i.e. the vertical edge line; g y is a vertical filter that detects the vertical gradient, that is, the horizontal edge line. The horizontal and vertical gradient maps g are obtained by using the filter to perform convolution sliding window processing on the image. x ,g y After that, the gradient amplitude mag is calculated at each pixel position in the image according to the gradient values ​​in the two gradient maps. .

[0049] S3: Normalize the amplitude of the gradient amplitude map to within a preset range.

[0050] Preferably, the preset range is 0-255. In image processing, the pixel value usually represents 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), 255 represents the brightest (white), and the intermediate values ​​represent different levels of grayscale.

[0051] Therefore, a pixel with a value of 255 represents the brightest white in a grayscale image. This means that in a grayscale image, if the brightness of that pixel is set to 255, it will appear pure white without any shades of gray or shading.

[0052] S4: Retain the strong amplitude in the gradient amplitude map and suppress the weak amplitude, extract the edge contour in the target image, and obtain the wide edge.

[0053] If the gradient amplitude of the target pixel in the gradient amplitude map is greater than or equal to the preset amplitude threshold, the gradient amplitude of the target pixel position is retained; if the gradient amplitude of the target pixel in the gradient amplitude 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-zero amplitude threshold in the gradient amplitude map is the edge contour position.

[0054] S5: Use non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient amplitude map to refine the wide edge, and the edge of the edge contour after suppression is the refined edge.

[0055] The edges obtained in S4 are usually wide edges, which need to be refined. Non-maximum suppression is used to refine the edges. In the gradient amplitude map, a pixel is taken as the current pixel. In the preset area of ​​the current pixel in the gradient amplitude map, the current pixel is compared with the other two pixels in the same gradient direction as the current pixel. When 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; when 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.

[0056] More specifically, within the 3x3 region of the current pixel, the current pixel is compared with the other two pixels in the same gradient direction as the current pixel. If the current pixel has the largest gradient amplitude, the gradient amplitude of the current pixel is retained; otherwise, it is suppressed and replaced with 0.

[0057] It is worth noting that Figure 2 As shown in Figure 1, after quantizing the gradient direction of each pixel into four directions, non-maximum suppression is used to suppress the gradient amplitude of each pixel. The pixel gradient direction is , range [-180,180). Before gradient amplitude 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.

[0058] S6: After the gradient amplitude is suppressed, the gradient amplitude map is binarized to obtain a binary map bw, and the suppressed edge contour is represented by the set pixel values ​​of the binary map.

[0059] In the binary image, the value of non-zero pixels is set to the set pixel value, and the pixel with the set pixel value is the edge contour at this time. Binarize the gradient amplitude map after non-maximum suppression in S5 to obtain a binary image, and set the non-zero pixels to 255. Binarization is a basic operation in image processing. It sets the pixel values ​​of the image to 0 or 255 to create a binary image. This process is usually based on a threshold. Pixel values ​​above the threshold are set to one value (such as 255), and those below the threshold are set to another value (such as 0). The edge contour is represented by a binary image, and the pixel with a value of 255 is the edge contour, such as Figure 3 .

[0060] exist Figure 3 In the figure, most of the edge contours after non-maximum suppression are single-pixel wide, but there are still some two-pixel wide pixels. After non-maximum suppression, the edge contours and two-pixel wide edge points all appear in the 45° or -45° direction, and are characterized by the coexistence of 4-connected points and 8-connected points with the current pixel. Generally, taking 4-connected or 8-connected points can represent the trend of the contour direction and can also reduce the number of contour points. In this embodiment, 8-connected points are taken and 4-connected points are removed. There are a total of 8 situations where 4-connected and 8-connected points exist with the current pixel, such as a, b, c, d, e, f, g, and h. Figure 4 Specifically, the middle pixel in the 3x3 region is the current pixel, and 1 represents interconnected points.

[0061] S7: Convert the set pixel value in the binary image into an edge contour area.

[0062] The pixels with a bw value of 255 in the binary image S6 are converted into regions. The regions are stored in the form of a run set to reduce the amount of data and improve the computing performance. A run is defined as a structure of consecutive adjacent pixels in an image row, that is, a run r = {row, cb, ce}, where row is the row coordinate of the adjacent target point pixel, cb is the starting coordinate of the adjacent target point pixel, ce is the ending coordinate of the adjacent target point pixel, and region region = {r iConverting the edge contours in a binary image into regions can not only reduce the amount of data storage, but also facilitate subsequent single-pixel morphological processing and improve computing performance.

[0063] S8: morphologically pixelate the edge contour region, use four structure elements to continuously perform morphological erosion and difference operations on the edge contour region, pixelate the edge contour region, and obtain a single-pixel edge region.

[0064] Four structural elements are used to continuously perform morphological corrosion on the edge contour area to extract the two-pixel wide edge points and the 4-connected pixels existing at the current pixel point; the edge contour area after extracting the 4-connected pixels is subtracted from the original edge contour area to remove the 4-connected points from the original edge contour area to form a single-pixel edge area.

[0065] More specifically, this embodiment designs four structural elements st, and uses the four structural elements to continuously perform morphological corrosion and difference operations on the region region in S7 to convert the region into a single pixel. , .in" " indicates the regional morphological erosion operation, and "-" indicates the regional morphological difference operation.

[0066] After the edge contour area is eroded, 4-connected pixels are extracted, and then the 4-connected pixels are removed from the original area by performing a difference operation with the original area. Figure 5 The bold black "1" in the center is the structural element anchor point. The structural element stA is eroded by the region to obtain Figure 3 There are two types of 4-connected pixels in a and b edge contours; the structural element stB is eroded by morphological operation on the region to obtain Figure 3 There are two types of 4-connected pixels in c and d. The structural element stC is eroded by morphological operation on the region to obtain Figure 3 There are two types of 4-connected pixels in e and f. The structural element stD is eroded by the region to obtain Figure 4 There are two types of 4-connected pixels: g and h edge contours.

[0067] S9: Convert the single-pixel edge region into a single-pixel edge contour to complete the single-pixel contour extraction. Figure 6 As shown, Figure 5 For this embodiment Figure 3 The single pixel post-processing result. Figure 5 As shown, the extraction of single-pixel contour is completed.

[0068] In one embodiment, the present invention further proposes a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the steps of the above-mentioned edge contour single-pixelization method.

[0069] The above descriptions are only optional embodiments of the present invention, and are not intended to limit the patent scope of the present invention. All equivalent structural changes made using the contents of the present invention's specification and drawings, or directly / indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.

Claims

1. A method for converting edge contours into single pixels, characterized in that: The following steps are involved: Acquire a target image, and perform Gaussian filtering on the target image; After Gaussian filtering, a discrete differential operator is used to extract edge contours in the target image to obtain wide edges; Using non-maximum suppression to refine the broad edge, obtain a refined edge and convert it into an edge contour region; The edge contour region is morphologically pixelated to obtain a single-pixel edge region and convert it into a single-pixel edge contour.

2. The edge contour single pixel method according to claim 1, characterized in that: The specific steps of extracting the edge contour in the target image by using a discrete differential operator after Gaussian filtering to obtain the wide edge include: After Gaussian filtering, a discrete differential operator is used to calculate the gradient magnitude and direction of each pixel in the target image to obtain a gradient magnitude map; Normalizing the amplitude of the gradient amplitude map to within a preset range; The strong amplitude values ​​in the gradient amplitude map are retained and the weak amplitude values ​​are suppressed, and the edge contour in the target image is extracted to obtain a wide edge.

3. The edge contour single pixel method according to claim 2, characterized in that: The specific steps of retaining the strong amplitude in the gradient amplitude map and suppressing the weak amplitude, extracting the edge contour in the target image, and obtaining the wide edge include: If the gradient amplitude of the target pixel in the gradient amplitude map is greater than or equal to a preset amplitude threshold, the gradient amplitude at the target pixel position is retained; If the gradient amplitude of a target pixel in the gradient amplitude map is less than a preset amplitude threshold, the gradient amplitude at the target pixel position is replaced with 0; The pixel positions of the non-zero amplitude thresholds in the gradient amplitude map are edge contour positions.

4. The edge contour single pixel method according to claim 1, characterized in that: The specific steps of using non-maximum suppression to refine the wide edge, obtain the refined edge and convert it into an edge contour area include: Using non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient amplitude map to refine the wide edge, the edge of the edge contour after suppression being the refined edge; After the gradient amplitude is suppressed, the gradient amplitude map is binarized to obtain a binary map and the suppressed edge contour is represented by the set pixel values ​​of the binary map; The set pixel values ​​in the binary image are converted into edge contour areas.

5. The edge contour single pixel method according to claim 4, characterized in that: The step of using non-maximum suppression to suppress the gradient amplitude of each pixel in the gradient amplitude map to refine the wide edge, wherein the edge of the edge contour after suppression is the refined edge, comprises: In a preset area of ​​a current pixel in the gradient amplitude map, the current pixel is compared with two other pixels in the same gradient direction as the current pixel, and when 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; When the gradient magnitude of the current pixel is not greater than that of the other two pixels, the gradient magnitude of the current pixel is replaced with 0.

6. The edge contour single pixel method according to claim 4, characterized in that: The thinning of the wide edge using non-maximum suppression to obtain the thinned edge and converting it into an edge contour area also includes: After the gradient direction of each pixel is quantized into four directions, non-maximum suppression is used to suppress the gradient amplitude of each pixel.

7. The edge contour single pixel method according to claim 4, characterized in that: After the gradient amplitude suppression, binarizing the gradient amplitude map to obtain a binary map and representing the suppressed edge contour by setting pixel values ​​of the binary map further comprises: In the binary image, the value of the non-zero pixel is set as the set pixel value, and the pixel of the set pixel value is the edge contour at this time.

8. The edge contour single pixel method according to claim 1, characterized in that: The specific step of performing morphological single pixelization on the edge contour area to obtain a single pixel edge area and converting it into a single pixel edge contour also includes: Construct four structural elements; Using the four structure elements to continuously perform morphological corrosion and difference operation processing on the edge contour area, single-pixelizing the edge contour area, and obtaining a single-pixel edge area; Convert single-pixel edge regions to single-pixel edge outlines.

9. The edge contour single pixel method according to claim 8, characterized in that: The method of using the four structure elements to continuously perform morphological corrosion and difference operation on the edge contour area to single-pixelize the edge contour area to obtain a single-pixel edge area further includes: Using the four structural elements to continuously perform morphological corrosion on the edge contour area, extracting the edge point with a width of two pixels and the four connected pixel points existing in the current pixel point; A difference operation is performed between the edge contour area after extracting the 4-connected pixel points and the original edge contour area, and the 4-connected points are removed from the original edge contour area to form a single-pixel edge area.

10. A computer-readable storage medium having a computer program stored thereon, 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 to 9.

Citation Information

Patent Citations

  • Method for detecting self-adaptive growth of a plurality of dim target tracks in image domain

    CN101872484A

  • Edge detection method based on underwater image statistical property

    CN102903108A

  • Extraction and grain region isolation method for linear side length of wafer at any inclination angle

    CN110276750A

  • 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

Cited By

  • Star map stray light processing method based on multidirectional gradient

    CN121074076A