Image weak edge detection method and device
By calculating the target direction gradient and weight parameters of the image pixels, the weak edges in the image are determined, which solves the problem of indistinguishability between weak edges and noise in the prior art, and improves the accuracy and reliability of detection.
Patent Information
- Application Number
- CN202411942028.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-07-22
- Filing Date
- 2024-12-25
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art is difficult to effectively distinguish between weak edges and noise in image edge detection, resulting in false detection or missed detection of weak edges, affecting the detection effect.
The weak edges in the image are determined by calculating the target direction gradient parameters, target weight parameters, including direction consistency weight parameters and gradient weight parameters for each pixel, and calculating the weak edge weight parameters.
It improves the reliability and accuracy of image weak edge detection, reduces the need for image noise reduction processing, thereby ensuring the detection effect of weak edges.
Smart Images

Figure CN119991715A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image weak edge detection method and device. Background Art
[0002] Image edge detection technology is usually used to detect where the grayscale values of adjacent pixels in an image change. It plays an important role in digital image processing fields such as image noise reduction, image contrast improvement, and image enhancement. At present, common image edge detection methods include first-order differential operator method and second-order differential operator method. The former uses the characteristic that the derivative value is often higher where the grayscale changes greatly to describe the edge strength of the image, while the latter uses the zero-crossing point after the second-order differential of each pixel grayscale value to detect the edge of the image. However, it is found through practice that since images are usually noisy in reality, the weak edges of the image may be mixed with the noise and difficult to be distinguished, which can easily cause false detection or missed detection of weak edges, affecting the effect of image edge detection. It can be seen that it is particularly important to provide a method that can improve the accuracy of weak edge detection in images. Summary of the invention
[0003] The present invention provides a method and device for detecting weak edges of images, which improves the reliability and accuracy of weak edge detection of images. In addition, the present invention does not require image noise reduction processing, which is beneficial to ensuring the detection effect of weak edges of images.
[0004] In order to solve the above technical problem, the first aspect of the present invention discloses a method for detecting weak edges of an image, the method comprising:
[0005] Determine the target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and the preset gradient operator; the target direction gradient parameter includes a horizontal direction gradient parameter and a vertical direction gradient parameter;
[0006] Calculating a target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel; the target weight parameter includes a direction consistency weight parameter and a gradient weight parameter;
[0007] Calculate the weak edge weight parameter corresponding to each pixel according to the target weight parameter corresponding to each pixel;
[0008] According to the weak edge weight parameters corresponding to all the pixels, a target pixel whose weak edge weight parameter is greater than or equal to a preset weight threshold is determined from all the pixels, and the weak edge of the image to be detected is determined according to the target pixel.
[0009] As an optional implementation manner, in the first aspect of the present invention, calculating the target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel includes:
[0010] Calculating a pixel angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel, and calculating a block angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel;
[0011] Calculating a directional consistency weight parameter corresponding to each pixel based on a pixel angle parameter and a corresponding block angle parameter corresponding to each pixel;
[0012] According to the target direction gradient parameter corresponding to each pixel, the gradient weight parameter corresponding to each pixel is calculated.
[0013] As an optional implementation, in the first aspect of the present invention, the target direction gradient parameter corresponding to each pixel is determined by the following formula:
[0014]
[0015] Among them, G hor (x, y) is the horizontal gradient parameter corresponding to the pixel (x, y) in the image to be detected, S hor is the preset horizontal gradient operator, (i, j) is the horizontal gradient operator S hor The coordinate position parameters in the horizontal direction are respectively n and -n. hor The upper and lower limit parameters of the coordinate index range, G ver (x, y) is the vertical gradient parameter corresponding to the pixel (x, y), S ver is the preset vertical gradient operator, (p, q) is the vertical gradient operator S ver The coordinate position parameters in the vertical direction are respectively m and -m. ver The coordinate index range upper and lower limit parameters, Y is the brightness channel parameter;
[0016] And, the pixel angle parameter corresponding to each pixel is calculated by the following formula:
[0017] Angle_pixel(x,y)=arctan(G ver (x,y),G hor (x,y));
[0018]
[0019] Among them, Angle_pixel_target(x,y) is the pixel angle parameter corresponding to the pixel (x,y).
[0020] As an optional implementation manner, in the first aspect of the present invention, calculating the block angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel includes:
[0021] According to the target directional gradient parameter corresponding to each pixel, a neighborhood pixel block corresponding to each pixel is determined, and a basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated; the basic block angle parameter includes a first block angle parameter, a second block angle parameter and a third block angle parameter;
[0022] Calculating a block angle parameter corresponding to each pixel according to a basic block angle parameter corresponding to a neighborhood pixel block corresponding to each pixel;
[0023] The basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated by the following formula:
[0024]
[0025] sumA is the first block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumB is the second block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumC is the third block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), k is the first coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), l is the second coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), t and -t are the upper and lower limit parameters of the coordinate index range corresponding to the neighborhood pixel block corresponding to the pixel (x, y);
[0026] The block angle parameter corresponding to each pixel is calculated by the following formula:
[0027] Angle_block(x,y)=0.5*arctan(sumA,(sumB-sumC));
[0028]
[0029] Angle_block_target(x,y) is the block angle parameter corresponding to the pixel (x,y).
[0030] As an optional implementation manner, in the first aspect of the present invention, the calculating the directional consistency weight parameter corresponding to each pixel based on the pixel angle parameter corresponding to each pixel and the corresponding block angle parameter includes:
[0031] For each of the pixels, a target difference value and parameter corresponding to the pixel is calculated according to the block angle parameter corresponding to the pixel and the pixel angle parameter corresponding to each target pixel in the neighboring pixel block corresponding to the pixel; the pixel angle parameters corresponding to all the target pixels include the pixel angle parameter corresponding to the pixel, and the target difference value and parameter corresponding to the pixel is used to indicate the sum of the absolute differences between the pixel angle parameter corresponding to each of the target pixels and the block angle parameter corresponding to the pixel;
[0032] A mapping operation is performed on the target difference and the parameter corresponding to each pixel through a preset first mapping curve function to obtain a directional consistency weight parameter corresponding to each pixel;
[0033] The target difference and parameter corresponding to each pixel are calculated by the following formula:
[0034] Angle_diff(x,y) is the target difference and parameter corresponding to the pixel (x,y).
[0035] As an optional implementation, in the first aspect of the present invention, calculating the gradient weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel includes:
[0036] Calculate the target gradient absolute value corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel;
[0037] A mapping operation is performed on the target gradient absolute value corresponding to each pixel through a preset second mapping curve function to obtain a gradient weight parameter corresponding to each pixel;
[0038] The target gradient absolute value corresponding to each pixel is calculated by the following formula:
[0039] G gra (x,y)=abs(G hor (x,y))+abs(G ver (x,y));
[0040] G gra (x, y) is the target gradient absolute value corresponding to the pixel (x, y).
[0041] As an optional implementation, in the first aspect of the present invention, the weak edge weight parameter corresponding to each pixel is calculated by the following formula:
[0042] edge_gain(x,y)=dir_gain(x,y)*G gra _gain(x,y) / f;
[0043] Wherein, edge_gain(x,y) is the weak edge weight parameter corresponding to the pixel (x,y) in the image to be detected, dir_gain(x,y) is the directional consistency weight parameter corresponding to the pixel (x,y), G gra _gain(x,y) is the gradient weight parameter corresponding to the pixel (x,y), and f is the maximum brightness value of the image to be detected.
[0044] A second aspect of the present invention discloses an image weak edge detection device, the device comprising:
[0045] A determination module, used to determine the target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and a preset gradient operator; the target direction gradient parameter includes a horizontal direction gradient parameter and a vertical direction gradient parameter;
[0046] A first calculation module, used to calculate a target weight parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel; the target weight parameter includes a direction consistency weight parameter and a gradient weight parameter;
[0047] A second calculation module, used for calculating a weak edge weight parameter corresponding to each pixel according to a target weight parameter corresponding to each pixel;
[0048] The determination module is also used to determine, from all the pixels, a target pixel whose weak edge weight parameter is greater than or equal to a preset weight threshold according to the weak edge weight parameters corresponding to all the pixels, and determine the weak edge of the image to be detected according to the target pixel.
[0049] As an optional implementation, in the second aspect of the present invention, the first calculation module calculates the target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, specifically including:
[0050] Calculating a pixel angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel, and calculating a block angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel;
[0051] Calculating a directional consistency weight parameter corresponding to each pixel based on a pixel angle parameter and a corresponding block angle parameter corresponding to each pixel;
[0052] According to the target direction gradient parameter corresponding to each pixel, the gradient weight parameter corresponding to each pixel is calculated.
[0053] As an optional implementation, in the second aspect of the present invention, the target direction gradient parameter corresponding to each pixel is determined by the following formula:
[0054]
[0055] Among them, G hor (x, y) is the horizontal gradient parameter corresponding to the pixel (x, y) in the image to be detected, S hor is the preset horizontal gradient operator, (i, j) is the horizontal gradient operator S hor The coordinate position parameters in the horizontal direction are respectively n and -n. hor The upper and lower limit parameters of the coordinate index range, G ver (x, y) is the vertical gradient parameter corresponding to the pixel (x, y), S ver is the preset vertical gradient operator, (p, q) is the vertical gradient operator S ver The coordinate position parameters in the vertical direction are respectively m and -m. ver The coordinate index range upper and lower limit parameters, Y is the brightness channel parameter;
[0056] And, the pixel angle parameter corresponding to each pixel is calculated by the following formula:
[0057] Angle_pixel(x,y)=arctan(G ver (x,y),G hor (x,y));
[0058]
[0059] Among them, Angle_pixel_target(x,y) is the pixel angle parameter corresponding to the pixel (x,y).
[0060] As an optional implementation manner, in the second aspect of the present invention, the first calculation module calculates the block angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, specifically including:
[0061] According to the target directional gradient parameter corresponding to each pixel, a neighborhood pixel block corresponding to each pixel is determined, and a basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated; the basic block angle parameter includes a first block angle parameter, a second block angle parameter and a third block angle parameter;
[0062] Calculating a block angle parameter corresponding to each pixel according to a basic block angle parameter corresponding to a neighborhood pixel block corresponding to each pixel;
[0063] The basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated by the following formula:
[0064]
[0065] sumA is the first block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumB is the second block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumC is the third block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), k is the first coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), l is the second coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), t and -t are the upper and lower limit parameters of the coordinate index range corresponding to the neighborhood pixel block corresponding to the pixel (x, y);
[0066] The block angle parameter corresponding to each pixel is calculated by the following formula:
[0067] Angle_block(x,y)=0.5*arctan(sumA,(sumB-sumC));
[0068]
[0069] Angle_block_target(x,y) is the block angle parameter corresponding to the pixel (x,y).
[0070] As an optional implementation, in the second aspect of the present invention, the first calculation module calculates the directional consistency weight parameter corresponding to each pixel based on the pixel angle parameter and the corresponding block angle parameter corresponding to each pixel, specifically including:
[0071] For each of the pixels, a target difference value and parameter corresponding to the pixel is calculated according to the block angle parameter corresponding to the pixel and the pixel angle parameter corresponding to each target pixel in the neighboring pixel block corresponding to the pixel; the pixel angle parameters corresponding to all the target pixels include the pixel angle parameter corresponding to the pixel, and the target difference value and parameter corresponding to the pixel is used to indicate the sum of the absolute differences between the pixel angle parameter corresponding to each of the target pixels and the block angle parameter corresponding to the pixel;
[0072] A mapping operation is performed on the target difference and the parameter corresponding to each pixel through a preset first mapping curve function to obtain a directional consistency weight parameter corresponding to each pixel;
[0073] The target difference and parameter corresponding to each pixel are calculated by the following formula:
[0074]
[0075] Angle_diff(x,y) is the target difference and parameter corresponding to the pixel (x,y).
[0076] As an optional implementation, in the second aspect of the present invention, the first calculation module calculates the gradient weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, specifically including:
[0077] Calculate the target gradient absolute value corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel;
[0078] A mapping operation is performed on the target gradient absolute value corresponding to each pixel through a preset second mapping curve function to obtain a gradient weight parameter corresponding to each pixel;
[0079] The target gradient absolute value corresponding to each pixel is calculated by the following formula:
[0080] G gra (x,y)=abs(G hor (x,y))+abs(G ver (x,y));
[0081] G gra (x, y) is the target gradient absolute value corresponding to the pixel (x, y).
[0082] As an optional implementation, in the second aspect of the present invention, the weak edge weight parameter corresponding to each pixel is calculated by the following formula:
[0083] edge_gain(x,y)=dir_gain(x,y)*G gra _gain(x,y) / f;
[0084] Wherein, edge_gain(x,y) is the weak edge weight parameter corresponding to the pixel (x,y) in the image to be detected, dir_gain(x,y) is the directional consistency weight parameter corresponding to the pixel (x,y), G gra _gain(x,y) is the gradient weight parameter corresponding to the pixel (x,y), and f is the maximum brightness value of the image to be detected.
[0085] The third aspect of the present invention discloses another image weak edge detection device, the device comprising:
[0086] A memory storing executable program code;
[0087] a processor coupled to the memory;
[0088] The processor calls the executable program code stored in the memory to execute the image weak edge detection method disclosed in the first aspect of the present invention.
[0089] The fourth aspect of the present invention discloses a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the image weak edge detection method disclosed in the first aspect of the present invention.
[0090] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0091] In an embodiment of the present invention, according to the brightness channel parameters and the gradient operator of the image to be detected, the target directional gradient parameters corresponding to each pixel in the image to be detected are determined; according to the target directional gradient parameters corresponding to each pixel, the target weight parameters corresponding to each pixel are calculated, which include the directional consistency weight parameters and the gradient weight parameters; according to the target weight parameters corresponding to each pixel, the weak edge weight parameters corresponding to each pixel are calculated to determine the target pixel with a larger weak edge weight parameter, thereby determining the weak edge of the image to be detected. In this way, the directional consistency weight parameters and the gradient weight parameters corresponding to the pixels in the image to be detected can be used to determine whether the pixels belong to the weak edge, thereby improving the reliability and accuracy of the image weak edge detection. In addition, the present invention does not need to perform image denoising processing, which is conducive to ensuring the detection effect of the image weak edge. BRIEF DESCRIPTION OF THE DRAWINGS
[0092] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 these drawings without creative work.
[0093] Figure 1 It is a flowchart of a method for detecting weak edges of an image disclosed in an embodiment of the present invention;
[0094] Figure 2 It is a flowchart of another image weak edge detection method disclosed in an embodiment of the present invention;
[0095] Figure 3 It is a structural schematic diagram of an image weak edge detection device disclosed in an embodiment of the present invention;
[0096] Figure 4 It is a structural schematic diagram of another image weak edge detection device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0097] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. 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.
[0098] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends.
[0099] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0100] The invention discloses a method and a device for detecting weak edges of images, which improve the reliability and accuracy of weak edge detection of images. In addition, the invention does not require image noise reduction processing, which is beneficial to ensuring the detection effect of weak edges of images.
[0101] Embodiment 1
[0102] See also Figure 1 , Figure 1 : is a flow chart of a method for detecting weak edges of an image disclosed in an embodiment of the present invention. Figure 1 The described image weak edge detection method can be applied to weak edge detection of displayed images of various types of display devices, such as televisions, smart computers, smart phones, tablets, etc., which is not limited by the embodiments of the present invention. Optionally, the method can be implemented by an image weak edge detection device, which can be integrated into the aforementioned display device. When the image weak edge detection device exists independently, it can also be a local server or cloud server for processing the image weak edge detection process, which is not limited by the embodiments of the present invention. Figure 1 As shown, the image weak edge detection method may include the following operations:
[0103] 101. Determine a target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and a preset gradient operator.
[0104] In an embodiment of the present invention, a convolution operation is performed on a preset gradient operator and the image to be detected to obtain a horizontal / vertical gradient map corresponding to the image to be detected, that is, a target direction gradient parameter corresponding to all pixels, wherein the gradient operator includes a horizontal direction gradient operator and a vertical direction gradient operator.
[0105] Optionally, the gradient operator may be a Sobel operator, a Roberts operator, a Prewitt operator, a Laplace operator, etc. Further, the target direction gradient parameter includes a horizontal direction gradient parameter and a vertical direction gradient parameter, wherein, in the process of determining the target direction gradient parameter corresponding to each pixel, the gradient operator used may be of a 3*3 neighborhood type, or other neighborhood types, which may be determined based on the image processing requirements of the image to be detected (such as calculation time, calculation accuracy requirements, etc.).
[0106] Furthermore, the target direction gradient parameter corresponding to each pixel is determined by the following formula:
[0107]
[0108] Among them, G hor (x, y) is the horizontal gradient parameter corresponding to the pixel (x, y) in the image to be detected, Shor is the preset horizontal gradient operator, (i, j) is the horizontal gradient operator S hor The coordinate position parameters in the horizontal direction are respectively n and -n. hor The upper and lower limit parameters of the coordinate index range, G ver (x, y) is the vertical gradient parameter corresponding to the pixel (x, y), S ver is the preset vertical gradient operator, (p,q) is the vertical gradient operator S ver The coordinate position parameters in the vertical direction are respectively m and -m. ver The coordinate index range upper and lower limit parameters, Y is the brightness channel parameter.
[0109] For example, when the gradient operator is a Sobel operator, the horizontal gradient operator in the gradient operator can be: The vertical gradient operator can be: When the center position of the gradient operator is (0,0), the upper and lower limit parameters of its coordinate index range are 1 and -1 respectively (such as S hor (-1,-1)=-1)).
[0110] 102. Calculate a target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel.
[0111] In an embodiment of the present invention, the target weight parameter includes a directional consistency weight parameter and a gradient weight parameter. The directional consistency weight parameter is used to indicate whether the pixel and its neighboring pixels have a clear and unified directionality, while the gradient weight parameter is used to eliminate the degree of strong edge influence on the pixel.
[0112] 103. According to the target weight parameter corresponding to each pixel, a weak edge weight parameter corresponding to each pixel is calculated.
[0113] In the embodiment of the present invention, further, the weak edge weight parameter corresponding to each pixel is calculated by the following formula:
[0114] edge_gain(x,y)=dir_gain(x,y)*G gra _gain(x,y) / f;
[0115] Among them, edge_gain(x,y) is the weak edge weight parameter corresponding to the pixel (x,y) in the image to be detected, dir_gain(x,y) is the directional consistency weight parameter corresponding to the pixel (x,y), G gra_gain(x,y) is the gradient weight parameter corresponding to the pixel (x,y), and f is the maximum brightness value of the image to be detected (that is, if the allowed brightness range of the image to be detected is [0, 255], the maximum brightness value is 255).
[0116] It should be noted that the weak edge weight parameter corresponding to the pixel is used to indicate the probability that the pixel belongs to a weak edge. The larger the weak edge weight parameter is, the greater the probability that the pixel belongs to a weak edge is.
[0117] 104. According to the weak edge weight parameters corresponding to all pixels, a target pixel having a weak edge weight parameter greater than or equal to a preset weight threshold is determined from all pixels, and a weak edge of the image to be detected is determined according to the target pixel.
[0118] In the embodiment of the present invention, the value range of the weak edge weight parameter corresponding to each pixel may be [0, 1], or may be [0, 100%].
[0119] It can be seen that the implementation of the embodiment of the present invention can utilize the directional consistency weight parameters and gradient weight parameters corresponding to the pixels in the image to be detected to determine whether the pixels belong to a weak edge. In this way, the reliability and accuracy of weak edge detection of the image to be detected are improved. In addition, the present invention does not need to perform denoising processing on the image to be detected, which reduces the occurrence of missed detection of weak edges of the image, and is beneficial to ensuring the detection effect of weak edges of the image.
[0120] Embodiment 2
[0121] See also Figure 2 , Figure 2 FIG. 1 is a flow chart of another method for detecting weak edges of an image disclosed in an embodiment of the present invention. Figure 2 The described image weak edge detection method can be applied to weak edge detection of displayed images of various types of display devices, such as televisions, smart computers, smart phones, tablets, etc., which is not limited by the embodiments of the present invention. Optionally, the method can be implemented by an image weak edge detection device, which can be integrated into the aforementioned display device. When the image weak edge detection device exists independently, it can also be a local server or cloud server for processing the image weak edge detection process, which is not limited by the embodiments of the present invention. Figure 2 As shown, the image weak edge detection method may include the following operations:
[0122] 201. Determine a target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and a preset gradient operator.
[0123] 202. Calculate a pixel angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, and calculate a block angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel.
[0124] In the embodiment of the present invention, further, the pixel angle parameter corresponding to each pixel is calculated by the following formula:
[0125] Angle_pixel(x,y)=arctan(G ver (x,y),G hor (x,y));
[0126]
[0127] Among them, Angle_pixel_target(x,y) is the pixel angle parameter corresponding to the pixel (x,y).
[0128] Optionally, the arctan function can be calculated using the Cordic algorithm or other hardware calculation methods. The calculation method of the arctan function can be determined based on the image processing requirement parameters of the image to be detected (such as processing time requirements, processing accuracy requirements, hardware processing requirements, etc.), image type parameters, pixel grayscale value / brightness changes, etc.
[0129] 203. Calculate a directional consistency weight parameter corresponding to each pixel based on the pixel angle parameter corresponding to each pixel and the corresponding block angle parameter.
[0130] In an embodiment of the present invention, the directional consistency weight parameter corresponding to each pixel can be calculated based on the block angle parameter corresponding to the pixel and the pixel angle parameter corresponding to each target pixel in the corresponding neighborhood pixel block (such as a 5*5 neighborhood pixel block, a 7*7 neighborhood pixel block, etc.).
[0131] 204. Calculate the gradient weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel.
[0132] In the embodiment of the present invention, it should be noted that since the detection of strong edges is generally not affected by image noise, the present invention is mainly aimed at the detection of weak edges in images, and the gradient weight parameter is used here to eliminate the influence of strong edges on pixels.
[0133] 205. Calculate a weak edge weight parameter corresponding to each pixel according to the target weight parameter corresponding to each pixel.
[0134] 206. According to the weak edge weight parameters corresponding to all pixels, determine the target pixel whose weak edge weight parameter is greater than or equal to the preset weight threshold from all pixels, and determine the weak edge of the image to be detected according to the target pixel.
[0135] In the embodiment of the present invention, for other descriptions of step 201, step 205 and step 206, please refer to the detailed description of step 101, step 103 and step 104 in the first embodiment, and the embodiment of the present invention will not be repeated.
[0136] It can be seen that the implementation of the embodiment of the present invention can calculate the pixel angle parameter and the block angle parameter corresponding to the pixel according to the target directional gradient parameter corresponding to the pixel, and then calculate the directional consistency weight parameter corresponding to the pixel according to the pixel angle parameter and the block angle parameter corresponding to the pixel; at the same time, the gradient weight parameter corresponding to the pixel is also calculated according to the target directional gradient parameter corresponding to the pixel. In this way, the calculation reliability and accuracy of the directional consistency weight parameter and the gradient weight parameter corresponding to the pixel can be improved, and then the subsequent calculation reliability and accuracy of the weak edge weight parameter of the pixel can be improved, which is conducive to the accurate detection of weak edges in the image to be detected.
[0137] In an optional embodiment, the step 202 above calculates the block angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, including:
[0138] According to the target direction gradient parameter corresponding to each pixel, the neighborhood pixel block corresponding to each pixel is determined, and the basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated;
[0139] The block angle parameter corresponding to each pixel is calculated according to the basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel.
[0140] In this optional embodiment, the process of determining the neighborhood pixel block corresponding to a pixel can be understood as follows: when the neighborhood involved in the target directional gradient parameter corresponding to the pixel is 3*3, the neighborhood pixel block corresponding to the pixel can be a 5*5 neighborhood pixel block; and when the neighborhood involved in the target directional gradient parameter corresponding to the pixel is 5*5, the neighborhood pixel block corresponding to the pixel can be a 7*7 neighborhood pixel block, and so on.
[0141] Specifically, the basic block angle parameter includes a first block angle parameter, a second block angle parameter and a third block angle parameter.
[0142] Furthermore, the basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated by the following formula:
[0143]
[0144] Among them, sumA is the first block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumB is the second block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumC is the third block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), k is the first coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), l is the second coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), t and -t are the upper and lower limit parameters of the coordinate index range corresponding to the neighborhood pixel block corresponding to the pixel (x, y), respectively (for example, when the neighborhood pixel block is a 5*5 neighborhood pixel block, the corresponding upper and lower limit parameters of the coordinate index range are 2 and -2).
[0145] And, the block angle parameter corresponding to each pixel is calculated by the following formula:
[0146] Angle_block(x,y)=0.5*arctan(sumA,(sumB-sumC));
[0147]
[0148] Among them, Angle_block_target(x,y) is the block angle parameter corresponding to the pixel (x,y).
[0149] Optionally, the arctan function can be calculated using the Cordic algorithm or other hardware calculation methods. The calculation method of the arctan function can be determined based on the image processing requirement parameters of the image to be detected (such as processing time requirements, processing accuracy requirements, hardware processing requirements, etc.), image type parameters, pixel grayscale value / brightness changes, etc.
[0150] It should be noted that since noisy images can easily affect the edge direction, the "double angle" (sumA and sumB-sumC) method is used here to obtain it. This method can resist noise interference and make the calculation of the edge direction more accurate.
[0151] It can be seen that this optional embodiment can determine the neighborhood pixel block corresponding to the pixel based on the target directional gradient parameter corresponding to the pixel, and calculate the basic block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel, and then calculate the block angle parameter corresponding to the pixel. In this way, the influence of image noise of the image to be detected on the image edge direction calculation can be reduced, and the calculation reliability and accuracy of the block angle parameter corresponding to the pixel can be improved, thereby improving the subsequent calculation reliability, accuracy and effectiveness of the directional consistency weight parameter corresponding to the pixel.
[0152] In another optional embodiment, the step 203 above calculates the directional consistency weight parameter corresponding to each pixel based on the pixel angle parameter corresponding to each pixel and the corresponding block angle parameter, including:
[0153] For each pixel, the target difference and parameter corresponding to the pixel are calculated according to the block angle parameter corresponding to the pixel and the pixel angle parameter corresponding to each target pixel in the neighboring pixel block corresponding to the pixel;
[0154] Through a preset first mapping curve function, a mapping operation is performed on the target difference and parameter corresponding to each pixel to obtain a directional consistency weight parameter corresponding to each pixel.
[0155] In this optional embodiment, the pixel angle parameters corresponding to all target pixels include the pixel angle parameters corresponding to the pixels, and the target difference values corresponding to the pixels and the parameter is used to indicate the sum of the absolute differences between the pixel angle parameters corresponding to each target pixel and the block angle parameters corresponding to the pixels. Optionally, the first mapping curve function can be determined based on the image type parameters of the image to be detected, the pixel gray value / brightness change, the pixel gray value / brightness value range, etc.
[0156] Specifically, the target difference and parameters corresponding to each pixel are calculated using the following formula:
[0157]
[0158] Among them, Angle_diff(x,y) is the target difference and parameter corresponding to the pixel (x,y).
[0159] It can be seen that this optional embodiment can calculate the target difference and parameters corresponding to the pixel according to the block angle parameters corresponding to the pixel and the pixel angle parameters corresponding to each target pixel in the neighborhood pixel block corresponding to the pixel, and map the target difference and parameters corresponding to the pixel through the first mapping curve function to obtain the directional consistency weight parameter corresponding to the pixel. In this way, the calculation reliability and accuracy of the directional consistency weight parameter corresponding to the pixel can be improved, and then the calculation reliability and accuracy of the weak edge weight parameter corresponding to the pixel can be improved, thereby improving the accuracy and efficiency of weak edge detection of the image to be detected.
[0160] In yet another optional embodiment, the step 204 above calculates the gradient weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, including:
[0161] According to the target direction gradient parameter corresponding to each pixel, the target gradient absolute value corresponding to each pixel is calculated;
[0162] A mapping operation is performed on the target gradient absolute value corresponding to each pixel through a preset second mapping curve function to obtain a gradient weight parameter corresponding to each pixel.
[0163] In this optional embodiment, optionally, the second mapping curve function can be determined based on image type parameters of the image to be detected, pixel grayscale value / brightness changes, pixel grayscale value / brightness value range, etc.
[0164] Furthermore, the absolute value of the target gradient corresponding to each pixel is calculated by the following formula:
[0165] G gra (x,y)=abs(G hor (x,y))+abs(G ver (x,y));
[0166] Among them, G gra (x,y) is the absolute value of the target gradient corresponding to the pixel (x,y).
[0167] It can be seen that this optional embodiment can calculate the target gradient absolute value corresponding to the pixel according to the target direction gradient parameter corresponding to the pixel, and then map the target gradient absolute value corresponding to the pixel through the second mapping curve function to obtain the gradient weight parameter corresponding to the pixel. This is conducive to improving the calculation reliability and accuracy of the gradient weight parameter corresponding to the pixel, and further helps to further improve the calculation reliability and accuracy of the weak edge weight parameter corresponding to the pixel, so that the weak edge in the image to be detected can be detected quickly and accurately.
[0168] Embodiment 3
[0169] See also Figure 3 , Figure 3 Schematic diagram of the structure of an image weak edge detection device disclosed in an embodiment of the present invention. Figure 3 As shown, the image weak edge detection device may include:
[0170] The determination module 301 is used to determine the target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and a preset gradient operator;
[0171] A first calculation module 302 is used to calculate a target weight parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel;
[0172] A second calculation module 303 is used to calculate a weak edge weight parameter corresponding to each pixel according to a target weight parameter corresponding to each pixel;
[0173] The determination module 301 is also used to determine the target pixel whose weak edge weight parameter is greater than or equal to the preset weight threshold from all pixels according to the weak edge weight parameters corresponding to all pixels, and determine the weak edge of the image to be detected according to the target pixel.
[0174] In the embodiment of the present invention, the target direction gradient parameter includes a horizontal direction gradient parameter and a vertical direction gradient parameter; the target weight parameter includes a direction consistency weight parameter and a gradient weight parameter.
[0175] In the embodiment of the present invention, the target direction gradient parameter corresponding to each pixel is determined by the following formula:
[0176]
[0177] Among them, G hor (x, y) is the horizontal gradient parameter corresponding to the pixel (x, y) in the image to be detected, S hor is the preset horizontal gradient operator, (i, j) is the horizontal gradient operator S hor The coordinate position parameters in the horizontal direction are respectively n and -n. hor The upper and lower limit parameters of the coordinate index range, G ver (x, y) is the vertical gradient parameter corresponding to the pixel (x, y), S ver is the preset vertical gradient operator, (p,q) is the vertical gradient operator S ver The coordinate position parameters in the vertical direction are respectively m and -m. ver The coordinate index range upper and lower limit parameters, Y is the brightness channel parameter.
[0178] In the embodiment of the present invention, the weak edge weight parameter corresponding to each pixel is calculated by the following formula:
[0179] edge_gain(x,y)=dir_gain(x,y)*G gra _gain(x,y) / f;
[0180] Among them, edge_gain(x,y) is the weak edge weight parameter corresponding to the pixel (x,y) in the image to be detected, dir_gain(x,y) is the directional consistency weight parameter corresponding to the pixel (x,y), G gra _gain(x,y) is the gradient weight parameter corresponding to the pixel (x,y), and f is the maximum brightness value of the image to be detected.
[0181] It can be seen that implementation Figure 3The described image weak edge detection device can use the directional consistency weight parameters and gradient weight parameters corresponding to the pixels in the image to be detected to determine whether the pixels belong to a weak edge. In this way, the reliability and accuracy of weak edge detection of the image to be detected are improved. In addition, the present invention does not require denoising processing on the image to be detected, reduces the occurrence of missed detection of weak edges of the image, and is beneficial to ensuring the detection effect of weak edges of the image.
[0182] In an optional embodiment, the first calculation module 302 calculates the target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, specifically including:
[0183] Calculating a pixel angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel, and calculating a block angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel;
[0184] Based on the pixel angle parameter and the block angle parameter corresponding to each pixel, a directional consistency weight parameter corresponding to each pixel is calculated;
[0185] According to the target direction gradient parameter corresponding to each pixel, the gradient weight parameter corresponding to each pixel is calculated.
[0186] In this optional embodiment, the pixel angle parameter corresponding to each pixel is calculated by the following formula:
[0187] Angle_pixel(x,y)=arctan(G ver (x,y),G hor (x,y));
[0188]
[0189] Among them, Angle_pixel_target(x,y) is the pixel angle parameter corresponding to the pixel (x,y).
[0190] It can be seen that implementation Figure 3 The described image weak edge detection device can calculate the pixel angle parameter and block angle parameter corresponding to the pixel according to the target directional gradient parameter corresponding to the pixel, and then calculate the directional consistency weight parameter corresponding to the pixel according to the pixel angle parameter and block angle parameter corresponding to the pixel; at the same time, the gradient weight parameter corresponding to the pixel is also calculated according to the target directional gradient parameter corresponding to the pixel. In this way, the calculation reliability and accuracy of the directional consistency weight parameter and gradient weight parameter corresponding to the pixel can be improved, and then the subsequent calculation reliability and accuracy of the weak edge weight parameter of the pixel can be improved, which is conducive to the accurate detection of weak edges in the image to be detected.
[0191] In another optional embodiment, the first calculation module 302 calculates the block angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, specifically including:
[0192] According to the target directional gradient parameter corresponding to each pixel, the neighborhood pixel block corresponding to each pixel is determined, and the basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated; the basic block angle parameter includes a first block angle parameter, a second block angle parameter and a third block angle parameter;
[0193] The block angle parameter corresponding to each pixel is calculated according to the basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel.
[0194] In this optional embodiment, the basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated by the following formula:
[0195]
[0196] Among them, sumA is the first block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumB is the second block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumC is the third block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), k is the first coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), l is the second coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), t and -t are the upper and lower limit parameters of the coordinate index range corresponding to the neighborhood pixel block corresponding to the pixel (x, y), respectively.
[0197] And, the block angle parameter corresponding to each pixel is calculated by the following formula:
[0198] Angle_block(x,y)=0.5*arctan(sumA,(sumB-sumC));
[0199]
[0200] Among them, Angle_block_target(x,y) is the block angle parameter corresponding to the pixel (x,y).
[0201] It can be seen that implementation Figure 3The described image weak edge detection device can determine the neighborhood pixel block corresponding to the pixel based on the target directional gradient parameter corresponding to the pixel, and calculate the basic block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel, and then calculate the block angle parameter corresponding to the pixel. In this way, the influence of image noise of the image to be detected on the image edge direction calculation can be reduced, and the calculation reliability and accuracy of the block angle parameter corresponding to the pixel can be improved, thereby improving the subsequent calculation reliability, accuracy and effectiveness of the directional consistency weight parameter corresponding to the pixel.
[0202] In another optional embodiment, the first calculation module 302 calculates the directional consistency weight parameter corresponding to each pixel based on the pixel angle parameter corresponding to each pixel and the corresponding block angle parameter, specifically including:
[0203] For each pixel, the target difference and parameter corresponding to the pixel are calculated according to the block angle parameter corresponding to the pixel and the pixel angle parameter corresponding to each target pixel in the neighboring pixel block corresponding to the pixel;
[0204] Through a preset first mapping curve function, a mapping operation is performed on the target difference and parameter corresponding to each pixel to obtain a directional consistency weight parameter corresponding to each pixel.
[0205] In this optional embodiment, the pixel angle parameters corresponding to all target pixels include the pixel angle parameters corresponding to the pixels, and the target difference and parameter corresponding to the pixels are used to indicate the sum of the absolute differences between the pixel angle parameter corresponding to each target pixel and the block angle parameter corresponding to the pixel.
[0206] In this optional embodiment, the target difference and parameter corresponding to each pixel are calculated by the following formula:
[0207]
[0208] Among them, Angle_diff(x,y) is the target difference and parameter corresponding to the pixel (x,y).
[0209] It can be seen that implementation Figure 3 The described image weak edge detection device can calculate the target difference and parameters corresponding to the pixel based on the block angle parameters corresponding to the pixel and the pixel angle parameters corresponding to each target pixel in the neighborhood pixel block corresponding to the pixel, and map the target difference and parameters corresponding to the pixel through a first mapping curve function to obtain the directional consistency weight parameter corresponding to the pixel. In this way, the calculation reliability and accuracy of the directional consistency weight parameter corresponding to the pixel can be improved, and then the calculation reliability and accuracy of the weak edge weight parameter corresponding to the pixel can be improved, thereby improving the accuracy and efficiency of weak edge detection of the image to be detected.
[0210] In another optional embodiment, the first calculation module 302 calculates the gradient weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel, specifically including:
[0211] According to the target direction gradient parameter corresponding to each pixel, the target gradient absolute value corresponding to each pixel is calculated;
[0212] A mapping operation is performed on the target gradient absolute value corresponding to each pixel through a preset second mapping curve function to obtain a gradient weight parameter corresponding to each pixel.
[0213] In this optional embodiment, the target gradient absolute value corresponding to each pixel is calculated by the following formula:
[0214] G gra (x,y)=abs(G hor (x,y))+abs(G ver (x,y));
[0215] Among them, G gra (x,y) is the absolute value of the target gradient corresponding to the pixel (x,y).
[0216] It can be seen that implementation Figure 3 The described image weak edge detection device can calculate the target gradient absolute value corresponding to the pixel based on the target direction gradient parameter corresponding to the pixel, and then map the target gradient absolute value corresponding to the pixel through a second mapping curve function to obtain the gradient weight parameter corresponding to the pixel. This is conducive to improving the calculation reliability and accuracy of the gradient weight parameter corresponding to the pixel, and further conducive to further improving the calculation reliability and accuracy of the weak edge weight parameter corresponding to the pixel, so that the weak edge in the image to be detected can be detected quickly and accurately.
[0217] Embodiment 4
[0218] See also Figure 4 , Figure 4 FIG. 1 is a schematic diagram of the structure of another image weak edge detection device disclosed in an embodiment of the present invention. Figure 4 As shown, the image weak edge detection device may include:
[0219] A memory 401 storing executable program codes;
[0220] a processor 402 coupled to the memory 401;
[0221] The processor 402 calls the executable program code stored in the memory 401 to execute the steps of the image weak edge detection method described in the first embodiment of the present invention or the second embodiment of the present invention.
[0222] Embodiment 5
[0223] An embodiment of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute the steps in the image weak edge detection method described in Embodiment 1 or Embodiment 2 of the present invention.
[0224] Embodiment 6
[0225] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps in the image weak edge detection method described in Embodiment 1 or Embodiment 2.
[0226] The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, i.e., they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0227] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or partly contributed to the prior art in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0228] Finally, it should be noted that the image weak edge detection method and device disclosed in the embodiments of the present invention disclose only the preferred embodiments of the present invention, which are only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting weak edges of an image, characterized in that: The method comprises: Determine the target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and the preset gradient operator; the target direction gradient parameter includes a horizontal direction gradient parameter and a vertical direction gradient parameter; Calculating a target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel; the target weight parameter includes a direction consistency weight parameter and a gradient weight parameter; Calculate the weak edge weight parameter corresponding to each pixel according to the target weight parameter corresponding to each pixel; According to the weak edge weight parameters corresponding to all the pixels, a target pixel whose weak edge weight parameter is greater than or equal to a preset weight threshold is determined from all the pixels, and the weak edge of the image to be detected is determined according to the target pixel.
2. The image weak edge detection method according to claim 1, characterized in that: The step of calculating the target weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel includes: Calculating a pixel angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel, and calculating a block angle parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel; Calculating a directional consistency weight parameter corresponding to each pixel based on a pixel angle parameter and a corresponding block angle parameter corresponding to each pixel; According to the target direction gradient parameter corresponding to each pixel, the gradient weight parameter corresponding to each pixel is calculated.
3. The image weak edge detection method according to claim 2, characterized in that: The target direction gradient parameter corresponding to each pixel is determined by the following formula: Among them, G hor (x, y) is the horizontal gradient parameter corresponding to the pixel (x, y) in the image to be detected, S hor is the preset horizontal gradient operator, (i, j) is the horizontal gradient operator S hor The coordinate position parameters in the horizontal direction are respectively n and -n. hor The upper and lower limit parameters of the coordinate index range, G ver (x, y) is the vertical gradient parameter corresponding to the pixel (x, y), S ver is the preset vertical gradient operator, (p, q) is the vertical gradient operator S ver The coordinate position parameters in the vertical direction are respectively m and -m. ver The coordinate index range upper and lower limit parameters, Y is the brightness channel parameter; And, the pixel angle parameter corresponding to each pixel is calculated by the following formula: Angle_pixel(x,y)=arctan(G ver (x,y),G hor (x,y)); Among them, Angle_pixel_target(x,y) is the pixel angle parameter corresponding to the pixel (x,y).
4. The image weak edge detection method according to claim 3, characterized in that: The step of calculating the block angle parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel includes: According to the target directional gradient parameter corresponding to each pixel, a neighborhood pixel block corresponding to each pixel is determined, and a basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated; the basic block angle parameter includes a first block angle parameter, a second block angle parameter and a third block angle parameter; Calculating a block angle parameter corresponding to each pixel according to a basic block angle parameter corresponding to a neighborhood pixel block corresponding to each pixel; The basic block angle parameter corresponding to the neighborhood pixel block corresponding to each pixel is calculated by the following formula: sumA is the first block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumB is the second block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), sumC is the third block angle parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), k is the first coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), l is the second coordinate parameter corresponding to the neighborhood pixel block corresponding to the pixel (x, y), t and -t are the upper and lower limit parameters of the coordinate index range corresponding to the neighborhood pixel block corresponding to the pixel (x, y); The block angle parameter corresponding to each pixel is calculated by the following formula: Angle_block(x,y)=0.5*arctan(sumA,(sumB-sumC)); Angle_block_target(x,y) is the block angle parameter corresponding to the pixel (x,y).
5. The image weak edge detection method according to claim 4, characterized in that: The calculating, based on the pixel angle parameter and the corresponding block angle parameter corresponding to each pixel, the directional consistency weight parameter corresponding to each pixel comprises: For each of the pixels, a target difference value and parameter corresponding to the pixel is calculated according to the block angle parameter corresponding to the pixel and the pixel angle parameter corresponding to each target pixel in the neighboring pixel block corresponding to the pixel; the pixel angle parameters corresponding to all the target pixels include the pixel angle parameter corresponding to the pixel, and the target difference value and parameter corresponding to the pixel is used to indicate the sum of the absolute differences between the pixel angle parameter corresponding to each of the target pixels and the block angle parameter corresponding to the pixel; A mapping operation is performed on the target difference and the parameter corresponding to each pixel through a preset first mapping curve function to obtain a directional consistency weight parameter corresponding to each pixel; The target difference and parameter corresponding to each pixel are calculated by the following formula: Angle_diff(x,y) is the target difference and parameter corresponding to the pixel (x,y).
6. The image weak edge detection method according to claim 3, characterized in that: The step of calculating the gradient weight parameter corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel includes: Calculate the target gradient absolute value corresponding to each pixel according to the target direction gradient parameter corresponding to each pixel; A mapping operation is performed on the target gradient absolute value corresponding to each pixel through a preset second mapping curve function to obtain a gradient weight parameter corresponding to each pixel; The target gradient absolute value corresponding to each pixel is calculated by the following formula: G gra (x,y)=abs(G hor (x,y))+abs(G ver (x,y)); G gra (x, y) is the target gradient absolute value corresponding to the pixel (x, y).
7. The image weak edge detection method according to any one of claims 1 to 6, characterized in that: The weak edge weight parameter corresponding to each pixel is calculated by the following formula: edge_gain(x,y)=dir_gain(x,y)*G gra _gain(x,y) / f; Wherein, edge_gain(x,y) is the weak edge weight parameter corresponding to the pixel (x,y) in the image to be detected, dir_gain(x,y) is the directional consistency weight parameter corresponding to the pixel (x,y), G gra _gain(x,y) is the gradient weight parameter corresponding to the pixel (x,y), and f is the maximum brightness value of the image to be detected.
8. An image weak edge detection device, characterized in that: The device comprises: A determination module, used to determine the target direction gradient parameter corresponding to each pixel in the image to be detected according to the acquired brightness channel parameter of the image to be detected and a preset gradient operator; the target direction gradient parameter includes a horizontal direction gradient parameter and a vertical direction gradient parameter; A first calculation module, used to calculate a target weight parameter corresponding to each pixel according to a target direction gradient parameter corresponding to each pixel; the target weight parameter includes a direction consistency weight parameter and a gradient weight parameter; A second calculation module, used for calculating a weak edge weight parameter corresponding to each pixel according to a target weight parameter corresponding to each pixel; The determination module is also used to determine, from all the pixels, a target pixel whose weak edge weight parameter is greater than or equal to a preset weight threshold according to the weak edge weight parameters corresponding to all the pixels, and determine the weak edge of the image to be detected according to the target pixel.
9. An image weak edge detection device, characterized in that: The device comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the image weak edge detection method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the image weak edge detection method according to any one of claims 1 to 7.