A step-type image edge detection method and system based on edge line fusion
By fusing the results of the modulus maximum algorithm and scale independent algorithm of wavelet transform in image edge detection, and combining the overlap of edge lines, the problem of edge discontinuity and inequality in the prior art is solved, and accurate detection of step-type edges and high-precision edge image generation are achieved.
Patent Information
- Application Number
- CN202210815899.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-07-12
AI Technical Summary
When detecting step-type image edges, the prior art cannot distinguish between step-type edges and roof-type edges, resulting in discontinuous edges and inconsistency in response times.
Using an edge line fusion method, the modulus maximum algorithm of wavelet transformation is fused with the results of the scale independent algorithm. By calculating the overlap of edge lines, highly overlapping edge lines are retained to generate the final edge image.
Accurate detection of step-type edges is achieved, with continuous edges and unique corresponding times, avoiding noise interference and improving the accuracy of edge detection.
Smart Images

Figure CN115170595B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image edge detection, and in particular to a step-type image edge detection method and system based on edge line fusion. Background Art
[0002] Computer vision has become an important field of artificial intelligence. Computer vision allows computers and systems to obtain meaningful information from images and make instructions or take actions based on the information discovered or observed, which is of great significance to the development of artificial intelligence. Image processing is a foundation for realizing computer vision. Edge detection is an important research content in the field of digital image processing. The edge of an image contains important information. When the computer extracts the local area of interest in the image, edge detection is particularly important. The ideal result of edge detection is to generate a continuous closed edge curve to represent the edge of the image area. At the same time, the use of edge detection technology can eliminate irrelevant information and retain the most important structural information of the image. Step edge, ridge edge and pulse edge are three basic edge types. Step edge is widely used in practical problems such as the edge of Chinese characters, grain particles, cell contours, etc. The detection of step edge of an image has a wide range of application backgrounds and is of great significance.
[0003] The development of digital image processing has provided many different edge detection methods. These methods have their own advantages and disadvantages when detecting step edges. Using wavelets for edge detection has been an important research direction in recent years. Wavelet transform has strong flexibility in local time-frequency domain analysis and can focus on any details of the signal time period and frequency band. It is known as the microscope of time-frequency domain analysis. When using wavelet transform for edge detection, the modulus maximum method is usually used, but this method cannot distinguish between step edges and ridge edges. In the edge detection process, all types of edges will be extracted, and step edges cannot be extracted separately. The wavelet transform with modulus angle separation uses a scale-independent algorithm to distinguish between step edges and ridge edges, and can then accurately extract step edges. However, the image edges obtained by this scale-independent algorithm are discontinuous, and the number of edge responses is not unique. Summary of the invention
[0004] In view of the above problems, the present invention proposes a step image edge detection method and system based on edge line fusion, which fuses the edge images obtained by the scale-independent algorithm and the modulus maximum detection algorithm, and solves the problems of discontinuity of step edges and non-uniqueness of edge response times obtained by existing methods while extracting step edges.
[0005] According to one aspect of the present invention, a step-type image edge detection method based on edge line fusion is provided, the method comprising the following steps:
[0006] Step 1, obtain a grayscale image;
[0007] Step 2: Use the modulus maximum algorithm of wavelet transform to perform edge detection on the grayscale image to obtain a first edge image;
[0008] Step 3: Use a scale-independent algorithm to perform edge detection on the grayscale image to obtain a second edge image;
[0009] Step 4: For any edge line in the first edge image, highly overlapping edge lines are searched in the second edge image and retained. The retained pixel points are the detected edge points, and the final edge image is output.
[0010] Furthermore, the specific steps of step 2 include:
[0011] Perform wavelet transform on the image and calculate the modulus and argument of the wavelet coefficients;
[0012] Determine the local maximum point along the same gradient direction, and suppress the remaining gradients except the local maximum gradient;
[0013] For the local modulus maximum points in each gradient direction obtained, a first intensity threshold is set, and pixel points whose local modulus maximum points are higher than the first intensity threshold are retained as edge points through threshold detection, and edge detection is completed to obtain a first edge image.
[0014] Furthermore, the specific steps of step 3 include:
[0015] In wavelet transform, the second intensity threshold T is set W , remember the symbol Represents the modulus of the two-dimensional modulus angle separation wavelet transform coefficient, where α, β represent the horizontal and vertical coordinates of the two-dimensional image signal, p i Represents the scale, and retains the conditions that meet the conditions by comparing them one by one Pixels of
[0016] Set the equalization threshold T R Among the above-retained pixels, retain the pixels that meet the following conditions to obtain step edge points:
[0017]
[0018] Where N represents the scale range of wavelet transform.
[0019] Furthermore, the specific steps of step 4 include: for any edge line in the first edge image, taking the first non-zero pixel point scanned as the starting point, determining the total number of pixels on the edge line, recorded as m I; The number of points on the corresponding edge line in the second edge image whose pixel values are greater than 0 is recorded as m II ; The overlap degree of each edge line in the first edge image and the second edge image is recorded as D overlap , which is defined as:
[0020]
[0021] Calculate the overlap of each edge line and set the overlap threshold T in the range of [0,1] D , if D overlap >T D , then the edge line is retained, otherwise the pixel value on the edge line is recorded as 0.
[0022] According to another aspect of the present invention, a step-type image edge detection system based on edge line fusion is provided, the system comprising:
[0023] An image acquisition module configured to acquire a grayscale image;
[0024] A first edge detection module is configured to perform edge detection on the grayscale image using a modulus maximum algorithm of wavelet transform to obtain a first edge image;
[0025] A second edge detection module is configured to perform edge detection on the grayscale image using a scale-independent algorithm to obtain a second edge image;
[0026] The screening module is configured to search for and retain highly overlapping edge lines in the second edge image for any edge line in the first edge image, and the retained pixel points are the detected edge points, and the final edge image is output.
[0027] Furthermore, the specific steps of obtaining the first edge image in the first edge detection module include:
[0028] Perform wavelet transform on the image and calculate the modulus and argument of the wavelet coefficients;
[0029] Determine the local maximum point along the same gradient direction, and suppress the remaining gradients except the local maximum gradient;
[0030] For the local modulus maximum points in each gradient direction obtained, a first intensity threshold is set, and pixel points whose local modulus maximum points are higher than the first intensity threshold are retained as edge points through threshold detection, and edge detection is completed to obtain a first edge image.
[0031] Furthermore, the specific steps of obtaining the second edge image in the second edge detection module include:
[0032] In wavelet transform, the second intensity threshold T is set W , remember the symbol Represents the modulus of the two-dimensional modulus angle separation wavelet transform coefficient, where α, β represent the horizontal and vertical coordinates of the two-dimensional image signal, p i Represents the scale, and retains the conditions that meet the conditions by comparing them one by one Pixels of
[0033] Set the equalization threshold T R Among the above-retained pixels, retain the pixels that meet the following conditions to obtain step edge points:
[0034]
[0035] Where N represents the scale range of wavelet transform.
[0036] Furthermore, the specific steps of searching for and retaining highly overlapping edge lines in the second edge image for any edge line in the first edge image in the screening module include: for any edge line in the first edge image, taking the first non-zero pixel point scanned as the starting point, determining the total number of pixels on the edge line, recorded as m I ; The number of points on the corresponding edge line in the second edge image whose pixel values are greater than 0 is recorded as m II ; The overlap degree of each edge line in the first edge image and the second edge image is recorded as D overlap , which is defined as:
[0037]
[0038] Calculate the overlap of each edge line and set the overlap threshold T in the range of [0,1] D , if D overlap >T D , then the edge line is retained, otherwise the pixel value on the edge line is recorded as 0.
[0039] The beneficial technical effects of the present invention are:
[0040] The present invention provides a step-type image edge detection method and system based on edge line fusion, which can accurately capture the step-type edge displayed in the image, and the obtained edge is continuous and the edge response number is unique. The method solves the problem that the modulus maximum method cannot distinguish between step-type edges and ridge-type edges, and at the same time solves the problem that the image edge obtained by the scale-independent algorithm is discontinuous and the edge response number is not unique. Since traditional algorithms such as the scale-independent algorithm are sensitive to image noise and are affected by various noises or other interference factors, the accuracy of edge information is not high and the detection result is not ideal. The present invention can avoid the interference of noise and fine lines as much as possible, and at the same time will not create false edges in the edge image, and can accurately extract important features in the image, and the accuracy of edge detection is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The present invention can be better understood by referring to the description given below in conjunction with the accompanying drawings, which together with the following detailed description are included in this specification and form a part of this specification, and are used to further illustrate the preferred embodiments of the present invention and explain the principles and advantages of the present invention.
[0042] Figure 1 It is a flow chart of a step-type image edge detection method based on edge line fusion of the present invention;
[0043] Figure 2 A comparison diagram of edge detection of text images using the present invention, the modulus maximum algorithm, and the scale-independent algorithm;
[0044] Figure 3 This is a comparison chart of edge detection of the present invention with that of the modulus maximum algorithm and the scale-independent algorithm in real image edge detection in an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the scheme of the present invention, exemplary implementations or embodiments of the present invention will be described below in conjunction with the accompanying drawings. Obviously, the described implementations or embodiments are only implementations or embodiments of a part of the present invention, not all of them. Based on the implementations or embodiments of the present invention, all other implementations or embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present invention.
[0046] The purpose of the present invention is to address the shortcomings of existing edge detection algorithms in detecting step edges and propose an image edge detection method using edge lines as fusion units. The present invention uses the modulus maximum method and the scale-independent algorithm to perform edge detection on an image, respectively, to obtain two different edge images, calculate the overlap of each edge line in the two edge images using the edge line as a unit, and then set an overlap threshold based on the edge image obtained by the modulus maximum method, retain edge lines with overlaps higher than the threshold, and obtain the final edge image.
[0047] The embodiment of the present invention provides a step edge detection method based on edge line fusion, which achieves ideal results in step edge detection of images. Figure 1 As shown, the method comprises the following steps:
[0048] Step S1. Read the original image and convert the color image into a grayscale image.
[0049] Step S2. Use the modulus maximum algorithm of wavelet transform to perform edge detection on the grayscale image to obtain edge image I (ie, the first edge image), and use the scale-independent algorithm to perform edge detection on the grayscale image to obtain image II (ie, the second edge image).
[0050] According to an embodiment of the present invention, the steps of obtaining the edge image I by using the modulus maximum algorithm are as follows:
[0051] S211. Perform wavelet transform on the image to calculate the modulus and radius of the wavelet coefficients; if a smaller wavelet is selected, a more subtle image edge will be obtained; if a larger wavelet is selected, an edge of the image overview will be obtained;
[0052] S212. Determine the local maximum point of the model along the same gradient direction, and suppress the remaining gradients except the local maximum gradient;
[0053] S213. Set a first intensity threshold T for the local modulus maximum points in each direction obtained. S1 , through threshold detection, retain the wavelet coefficient modulus value higher than the threshold T S1 The points are edge points, edge detection is completed, and image I is obtained.
[0054] Here, the points with higher wavelet coefficient modulus values are retained and the points with lower wavelet coefficient modulus values are set to zero, which has the function of denoising and removing weak edges.
[0055] The specific steps of obtaining edge image II using the scale-independent algorithm are as follows:
[0056] S221. In wavelet transform, set the second intensity threshold T W , remember the symbol Represents the modulus of the two-dimensional modulus angle separation wavelet transform coefficient, where α, β represent the horizontal and vertical coordinates of the two-dimensional image signal, p i Represents scale i; by comparing one by one, retain the ones that meet the conditions point;
[0057] S222. Take a real number T that is very close to 1 but greater than 1 R , then:
[0058]
[0059] Among them, N represents the scale range of wavelet transform, and the real number T R is the equalization threshold. The closer its value is to 1, the closer the retained edge is to the ideal step edge. The function of the equalization threshold is to distinguish step edges from other types of edges and retain step edges.
[0060] Points satisfying the above conditions are retained in the signal obtained in step S221, that is, step edge points are obtained and stored in image II.
[0061] Step S3: Taking an edge as a unit, retain the edge lines that are highly overlapped with the edge image II obtained by the scale-independent algorithm in the edge image I obtained by the modulus maximum algorithm. The details are as follows:
[0062] In order to find the edge of the image, scan the image I to obtain an edge line, and record the total number of points on this edge line as m I ; Scan the points corresponding to this edge line in image II, and record the number of points with pixel values greater than 0 as m II ; The overlap of each edge line in the two edge images is recorded as D overlap , calculate the overlap of each edge line. Set the overlap threshold T D , if D overlap >T D If the edge line is not found in the image I, the edge line is retained, otherwise the pixel value of the point on the edge line is recorded as 0; each edge line in the image I is traversed, its overlap is calculated and it is determined whether to retain the edge line, until no new edge line is found in the image I. Specifically, the following steps may be included:
[0063] S31. Find the edge of the image, scan the image I, and when a non-zero pixel is encountered, trace the edge line starting from this point to the end of the edge line, and record the total number of points on this edge line as m I Scan the points corresponding to this edge line in image II, and record the number of points with pixel values greater than 0 as m II .
[0064] S32. The overlap degree of each edge line in the two edge images is recorded as D overlap , which is defined as:
[0065]
[0066] Calculate an edge line L i The overlap degree, set the overlap threshold T D , if D overlap >T D If the value is 0, the edge is retained, otherwise the pixel value of the point on the edge is recorded as 0. The value range of the overlap threshold is [0,1]. The closer the value is to 1, the higher the proportion of step edge points on the edge line.
[0067] S33. The edge line L i Mark as visited, return to step S32, and look for the next edge line L i+1 , repeat steps S31 and S32 to access each edge line Li , calculate the edge line L i The overlap degree of the edge line is determined and whether to keep the edge line is determined until no new edge line is found in the image I. The point finally retained is the detected edge point, and the final edge image is output.
[0068] The technical effect of the present invention is further verified through experiments.
[0069] For text images, such as Figure 2 As shown, Figure 2 (a) is the image to be detected. Two types of noise that are difficult to remove by classical operators are added to the text image: salt and pepper noise and thin lines; (b) is the image obtained by the modulus maximum edge detection algorithm. This algorithm detects all edges, but since the modulus maximum algorithm cannot distinguish between step edges and ridge edges, some noise is also detected; (c) is the image obtained by the scale-independent algorithm. Although the noise is removed well, the edges of the image obtained by this method are discontinuous, and the number of responses to the same edge is not unique; (d) is the image obtained by the method of the present invention, which is the most ideal edge image. It detects step edges well, and the edge lines are continuous, the number of edge responses is unique, and no noise appears.
[0070] For actual images, such as Figure 3 As shown, Figure 3 (a) is the image to be detected, which is a real photo. There are desktop textures and fine lines in the image. The purpose of detection is to identify the outline of the mobile phone; (b) is the image obtained by the modulus maximum edge detection algorithm. This algorithm detects all edges, but does not distinguish between step edges and jump edges. Therefore, fine lines are detected as double-line edges, and some larger desktop texture interference is also detected; (c) is the image detected by the scale-independent algorithm. Although the interference of fine lines and desktop texture is well removed, the image edge obtained by this method is discontinuous, and the number of responses to the same edge is not unique; (d) is the image obtained by the method of the present invention, and the most ideal mobile phone outline edge image is obtained. It can be seen that the method of the present invention inherits the advantages of the first two methods, detects step edges well, detects the outline of the mobile phone, and the edges are continuous, the number of edge responses is unique, and there is no noise.
[0071] Experimental results show that the edge pixels obtained by the present invention have good noise resistance, edge continuity, low edge response times, and at the same time ensure the accuracy of edge positioning, so that the detection of step edges can achieve ideal results and has high practical value.
[0072] Another embodiment of the present invention provides a step-type image edge detection system based on edge line fusion, the system comprising:
[0073] An image acquisition module configured to acquire a grayscale image;
[0074] A first edge detection module is configured to perform edge detection on the grayscale image using a modulus maximum algorithm of wavelet transform to obtain a first edge image;
[0075] A second edge detection module is configured to perform edge detection on the grayscale image using a scale-independent algorithm to obtain a second edge image;
[0076] The screening module is configured to search for and retain highly overlapping edge lines in the second edge image for any edge line in the first edge image, and the retained pixel points are the detected edge points, and the final edge image is output.
[0077] In this embodiment, optionally, the specific step of obtaining the first edge image in the first edge detection module includes:
[0078] Perform wavelet transform on the image and calculate the modulus and argument of the wavelet coefficients;
[0079] Determine the local maximum point along the same gradient direction, and suppress the remaining gradients except the local maximum gradient;
[0080] For the local modulus maximum points in each gradient direction obtained, a first intensity threshold is set, and pixel points whose local modulus maximum points are higher than the first intensity threshold are retained as edge points through threshold detection, and edge detection is completed to obtain a first edge image.
[0081] In this embodiment, optionally, the specific step of obtaining the second edge image in the second edge detection module includes:
[0082] In wavelet transform, the second intensity threshold T is set W , remember the symbol Represents the modulus of the two-dimensional modulus angle separation wavelet transform coefficient, where α, β represent the horizontal and vertical coordinates of the two-dimensional image signal, p i Represents the scale; by comparing one by one, retaining the conditions that meet Pixels of
[0083] Set the equalization threshold T R Among the above-retained pixels, retain the pixels that meet the following conditions to obtain step edge points:
[0084]
[0085] Where N represents the scale range of wavelet transform.
[0086] In this embodiment, optionally, the specific step of searching for and retaining a highly overlapping edge line in the second edge image for any edge line in the first edge image in the screening module includes: for any edge line in the first edge image, taking the first non-zero pixel point scanned as the starting point, determining the total number of pixels on the edge line, recorded as m I ; The number of points on the corresponding edge line in the second edge image whose pixel values are greater than 0 is recorded as m II ; The overlap degree of each edge line in the first edge image and the second edge image is recorded as D overlap , which is defined as:
[0087]
[0088] Calculate the overlap of each edge line and set the overlap threshold T in the range of [0,1] D , if D overlap >T D , then the edge line is retained, otherwise the pixel value on the edge line is recorded as 0.
[0089] The function of the step-type image edge detection system based on edge line fusion described in this embodiment can be explained by the aforementioned step-type image edge detection method based on edge line fusion. Therefore, for the parts not described in detail in this embodiment, please refer to the above method embodiments and will not be repeated here.
[0090] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments are contemplated within the scope of the invention thus described. The disclosure of the present invention is intended to be illustrative rather than restrictive of the scope of the invention, which is defined by the appended claims.
Claims
1. A step-type image edge detection method based on edge line fusion, characterized in that: The following steps are involved: Step 1, obtain a grayscale image; Step 2, using the modulus maximum algorithm of wavelet transform to perform edge detection on the grayscale image to obtain a first edge image; including: performing wavelet transform on the image to calculate the modulus and argument of the wavelet coefficients; determining the local maximum point of the modulus along the same gradient direction, and suppressing the remaining gradients except the local maximum gradient; setting a first intensity threshold for the local modulus maximum points in each gradient direction obtained, retaining the pixel points whose local modulus maximum points are higher than the first intensity threshold as edge points through threshold detection, completing edge detection, and obtaining the first edge image; Step 3: Use a scale-independent algorithm to perform edge detection on the grayscale image to obtain a second edge image; including: in the wavelet transform, setting a second intensity threshold T W , remember the symbol Represents the modulus of the two-dimensional modulus angle separation wavelet transform coefficient, where α, β represent the horizontal and vertical coordinates of the two-dimensional image signal, p i Represents the scale; by comparing one by one, retaining the conditions that meet Pixel points; set the equalization threshold T R Among the above-retained pixels, retain the pixels that meet the following conditions to obtain step edge points: Where N represents the scale range of wavelet transform; Step 4: For any edge line in the first edge image, highly overlapping edge lines are searched in the second edge image and retained. The retained pixel points are the detected edge points, and the final edge image is output.
2. The step-type image edge detection method based on edge line fusion according to claim 1, characterized in that: The specific steps of step 4 include: for any edge line in the first edge image, taking the first non-zero pixel point scanned as the starting point, determining the total number of pixels on the edge line, recorded as m I ; The number of points on the corresponding edge line in the second edge image whose pixel values are greater than 0 is recorded as m II ; The overlap degree of each edge line in the first edge image and the second edge image is recorded as D overlap , which is defined as: Calculate the overlap of each edge line and set the overlap threshold T in the range of [0,1] D , if D overlap >T D , then the edge line is retained, otherwise the pixel value on the edge line is recorded as 0.
3. A step-type image edge detection system based on edge line fusion, characterized in that: include: An image acquisition module configured to acquire a grayscale image; The first edge detection module is configured to perform edge detection on the grayscale image using the modulus maximum algorithm of wavelet transform to obtain a first edge image; the module includes: performing wavelet transform on the image to calculate the modulus and the argument of the wavelet coefficient; determining the local maximum point of the modulus along the same gradient direction, and suppressing the remaining gradients except the local maximum gradient; setting a first intensity threshold for the local modulus maximum points on each gradient direction obtained, retaining the pixel points whose local modulus maximum points are higher than the first intensity threshold as edge points through threshold detection, completing edge detection, and obtaining the first edge image; The second edge detection module is configured to perform edge detection on the grayscale image using a scale-independent algorithm to obtain a second edge image; including: setting a second intensity threshold T in wavelet transform. W , remember the symbol Represents the modulus of the two-dimensional modulus angle separation wavelet transform coefficient, where α, β represent the horizontal and vertical coordinates of the two-dimensional image signal, p i Represents the scale, and retains the conditions that meet the conditions by comparing them one by one Pixel points; set the equalization threshold T R Among the above-retained pixels, retain the pixels that meet the following conditions to obtain step edge points: Where N represents the scale range of wavelet transform; The screening module is configured to search for and retain highly overlapping edge lines in the second edge image for any edge line in the first edge image, and the retained pixel points are the detected edge points, and the final edge image is output.
4. The step-type image edge detection system based on edge line fusion according to claim 3, characterized in that: The specific steps of searching for and retaining a highly overlapping edge line in the second edge image for any edge line in the first edge image in the screening module include: For any edge line in the first edge image, the total number of pixels on the edge line is determined from the first non-zero pixel point scanned as the starting point, which is recorded as m. I ; The number of points on the corresponding edge line in the second edge image whose pixel values are greater than 0 is recorded as m II ; The overlap degree of each edge line in the first edge image and the second edge image is recorded as D overlap , which is defined as: Calculate the overlap of each edge line and set the overlap threshold T in the range of [0,1] D , if D overlap >T D If the edge line is not larger than 0, the edge line is retained; otherwise, the pixel value on the edge line is recorded as 0.
Citation Information
Patent Citations
Edge feature-based unmanned aerial vehicle image blur judgment method and system
CN106530281A
Method and system for replacing low-resolution target image with high-resolution target image
CN113191939A