An object edge detection method integrating gradient and neural network
By combining gradient and neural network, combined with non-local mean filtering and grayscale threshold segmentation, the target edge detection problem under noise interference in digital hologram reproduction images is solved, and more accurate edge detection and post-processing is achieved.
Patent Information
- Application Number
- CN202111500567.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2041-12-09
AI Technical Summary
The reproduced image of a digital hologram is difficult to detect the target edge due to the complexity of coherent noise, defocused image noise and background noise, and existing methods are difficult to achieve effective detection.
The target edge detection method of fusion gradient and neural network is adopted to remove coherent noise through non-local mean filtering, calculate the grayscale threshold for threshold segmentation to remove background noise, and combine gradient calculation and neural network identification to obtain the target edge.
Improve the accuracy of edge detection, effectively remove background noise, and greatly facilitate post-processing of reproducing images.
Smart Images

Figure CN114187315B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital holographic microscopic imaging, and in particular to a target edge detection method for fusion gradient and neural network suitable for holographic image reconstruction. Background Art
[0002] Since digital holograms are essentially interference patterns, they contain a large amount of coherent noise, and there is crosstalk between the reproduced images obtained through numerical reconstruction, which contains serious defocused image noise, and the background of the target will introduce background noise. Therefore, the reproduced image of the digital hologram faces complex coherent noise, defocused image noise and background noise, which brings great challenges to the edge detection of the target. It is difficult to achieve effective target edge detection simply by relying on gray threshold segmentation method, gradient calculation method and neural network method. Therefore, it is necessary to study a target edge detection method that combines multiple methods, combines their advantages, and obtains more accurate target edges. Summary of the invention
[0003] The present invention provides a target edge detection method integrating gradient and neural network, which can effectively detect the edge of the target from complex noise, thereby preparing conditions for the post-processing of the reproduced image.
[0004] The specific technical solution adopted by the present invention is as follows:
[0005] A method for detecting an edge of an object by integrating gradient and neural network, comprising the steps of:
[0006] (1) Remove the coherent noise in the reproduced image by using the non-local mean filtering algorithm;
[0007] Since the reproduced image contains complex noise, which greatly interferes with gradient calculation and neural network recognition, the method of the present invention removes most of the background noise by grayscale threshold segmentation after using the non-local mean filtering algorithm to remove coherent noise.
[0008] (2) Calculate the grayscale threshold of the reproduced image, and then perform threshold segmentation on the reproduced image to remove most of the background and obtain a reproduced image that mainly contains the target. The specific process includes:
[0009] 2-1. Calculate the gray threshold of the reproduced image by an iterative method, and set the gray threshold in the iterative process to T k , which divides the reproduced image f(x,y) into the background reproduced image f A (x,y) and the target reproduced image f B (x,y),
[0010]
[0011] So the new gray threshold T k+1 It can be expressed as:
[0012]
[0013] Judge T k+1 With T k Is the absolute value of the difference less than the given value δ, that is:
[0014] |T k+1 -T k |≤δ (3)
[0015] If |T k+1 -T k |≤δT k+1 , then T k+1 As the optimal grayscale threshold, enter the next iteration process;
[0016] Since it is difficult to obtain a perfect grayscale threshold that can completely separate the target from the background, and the grayscale ratio of the target to the background of the reproduced image will change as the reconstruction distance changes, this method introduces a weight coefficient that changes with the reconstruction distance in front of the grayscale threshold.
[0017] 2-2. According to the reconstruction distance of the reproduced image, the grayscale threshold calculated in step (2-1) is multiplied by a weight coefficient to be used as the final grayscale threshold. Taking the reconstruction distance of the target's centerline as the origin, the weight coefficient increases nonlinearly with the distance of the reconstruction distance of the reproduced image from the origin. The specific relationship can be expressed as:
[0018] T=a(l′-l′0) 4 +b(l′-l′0) 3 +c(l′-l′0) 2 +d(l′-l′0)+e (5)
[0019] Where a, b, c, d and e are coefficients, which are set as follows: 1.642×10 -17 7.677×10 -14 , 2.417×10 -10 , -7.099×10 -6 and 1.011. l' is the reconstruction distance of the reconstructed image, and l0' is the reconstruction distance of the reconstructed image located at the target centerline.
[0020] (3) calculating the edge of the target in the reconstructed image mainly containing the target described in step (2) by using an image processing and machine vision toolkit, denoted as E1(x,y), where x=1,2,…,m, y=1,2,…,n, and m and n are the number of pixels in the height and width directions of the reconstructed image, respectively;
[0021] The toolkit determines the edge of the object by respectively calculating the first gradient, the second gradient and the third gradient of the reproduced image, and draws the approximate edge according to the calculated edge (which may be multiple isolated edges) as the edge calculated by the gradient.
[0022] (4) finding the edge of the target in the reconstructed image mainly including the target described in step (2) by using a neural network, and recording it as E2(x,y);
[0023] Since the existing HED networks are mostly written in Python, in order to be able to run on MATLAB, Pyinstaller is used to package the trained HED network to generate an exe file that can run independently, and then MATLAB calls the modified exe file.
[0024] (5) Binarize and fill E1(x, y) and E2(x, y) respectively to obtain the enclosed regions M1(x, y) and M2(x, y). Perform a logical AND operation on the two regions to obtain the common region M(x, y).
[0025]
[0026] Find the edge E(x,y) of the region M(x,y) as the final edge of the target.
[0027] Beneficial effects of the present invention:
[0028] The present invention removes most of the background noise of the reproduced image by setting a suitable grayscale threshold, obtains the target edge by combining gradient calculation and neural network recognition, improves the accuracy of edge detection, and greatly facilitates the post-processing of the reproduced image. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 The reconstructed image after removing the coherent noise.
[0030] Figure 2 Schematic diagram of the target edge detection method that integrates gradient and neural network.
[0031] Figure 3 The reconstructed image after removing the coherent noise.
[0032] Figure 4 is a reproduced image mainly containing the target.
[0033] Figure 5 is the target edge calculated by image processing and machine vision toolkit.
[0034] Figure 6 are the target edges identified by the trained HED.
[0035] Figure 7 It is the result of the area and operation M1(x,y).
[0036] Figure 8 It is the area AND operation result M2(x,y).
[0037] Fig. 9 It is the result of the area and operation M(x,y).
[0038] Fig.10 is the final target edge. DETAILED DESCRIPTION
[0039] The present invention will be described in detail below with reference to the embodiments and the accompanying drawings, but the present invention is not limited thereto.
[0040] In this embodiment, the original reproduced image is obtained by numerically reconstructing the hologram captured by the digital holographic microscopy imaging optical path, such as Figure 1 All algorithms are written in the Matlab2018a environment, and the hardware conditions for running the algorithms are corei5 processors with a main frequency of 2.6GHz and 4GB of memory.
[0041] A schematic diagram of a target edge detection method integrating gradient and neural network in this embodiment is shown in FIG. Figure 2 As shown, the following steps are included:
[0042] (1) Remove the coherent noise in the reproduced image by using the non-local mean filtering algorithm;
[0043] To improve the operation speed, the non-local mean filtering algorithm is set with a weight of 30, a search window size of 11, and a filter window size of 7. The reconstructed image after removing the coherent noise is shown in Figure 3 shown.
[0044] (2) Calculate the grayscale threshold of the reproduced image, and then perform threshold segmentation on the reproduced image to remove most of the background and obtain a reproduced image that mainly contains the target, such as Figure 4 The specific process includes:
[0045] 2-1. Calculate the gray threshold of the reproduced image by an iterative method, and set the gray threshold in the iterative process to T k , which divides the reproduced image f(x,y) into the background reproduced image f A (x,y) and the target reproduced image f B (x,y),
[0046]
[0047] So the new gray threshold T k+1 It can be expressed as:
[0048]
[0049] Judge T k+1 With T k Is the absolute value of the difference less than the given value δ (δ = 25), that is:
[0050] |T k+1 -T k |≤δ (3)
[0051] If |T k+1 -T k |≤δT k+1 , then T k+1 As the optimal grayscale threshold, enter the next iteration process;
[0052] 2-2. According to the reconstruction distance of the reproduced image, the grayscale threshold calculated in step (2-1) is multiplied by a weight coefficient to be used as the final grayscale threshold. Taking the reconstruction distance of the target's centerline as the origin, the weight coefficient increases nonlinearly with the distance of the reconstruction distance of the reproduced image from the origin. The specific relationship can be expressed as:
[0053] T=a(l′-l′0) 4 +b(l′-l′0) 3 +c(l′-l′0) 2 +d(l′-l′0)+e (5)
[0054] Where a, b, c, d and e are coefficients, which are set as follows: 1.642×10 -17 ,7.677×10 -14 , 2.417×10 -10 , -7.099×10 -6 and 1.011. l' is the reconstruction distance of the reconstructed image, and l0' is the reconstruction distance of the reconstructed image located at the target centerline.
[0055] (3) calculating the edge of the target in the reconstructed image mainly containing the target described in step (2) by using an image processing and machine vision toolkit, denoted as E1(x,y), where x=1,2,…,m, y=1,2,…,n, and m and n are the number of pixels in the height and width directions of the reconstructed image, respectively;
[0056] (4) finding the edge of the target in the reconstructed image mainly including the target described in step (2) by using a neural network, and recording it as E2(x,y);
[0057] The neural network uses the HED (Holistically-Nested Edge Detection) network. Its training set consists of 3520 reproduced images and their manually drawn edges. The number of training times is 200. The target edges of the reproduced images identified by the trained HED are as follows: Figure 6 shown.
[0058] (5) Binarize and fill E1(x, y) and E2(x, y) respectively, and use the "imfill" function of Matlab to obtain the areas M1(x, y) and M2(x, y) respectively. Perform a logical AND operation on the two areas to obtain the area M(x, y) they both contain.
[0059]
[0060] Find the edge E(x,y) of the region M(x,y) as the final edge of the target.
[0061] Figure 7-Figure 9 Given regions M1(x,y), M2(x,y) and M(x,y), the final target edge is Fig.10 As shown. Figure 5 and Figure 6 In comparison, the edge is closer to the actual edge of the target.
[0062] The above description is only an example of a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A target edge detection method integrating gradient and neural network, characterized in that: Includes steps: (1) Remove the coherent noise in the reproduced image through the non-local mean filtering algorithm; (2) Calculate the grayscale threshold of the reproduced image, and then perform threshold segmentation on the reproduced image to remove most of the background and obtain a reproduced image that mainly contains the target; (3) The edge of the target in the reconstructed image mainly containing the target described in step (2) is calculated by image processing and machine vision toolkit, and is denoted as E 1( x , y ), x =1,2, …, m , y =1,2, …, n , m and n are the number of pixels of the reproduced image in the height and width directions, respectively; (4) Using a neural network, find the edge of the target in the reconstructed image that mainly contains the target described in step (2), denoted as E 2( x , y ); (5) Respectively E 1( x , y )and E 2( x , y ) perform binarization and filling operations to obtain the areas surrounded by each other M 1( x , y )and M 2( x , y ), perform a logical AND operation on the two regions to obtain the region that is commonly included M ( x , y ), (1) Find the area M ( x , y ) E ( x , y ) as the final edge of the target; Among them, in step (2), the specific steps of determining the grayscale threshold include: (2.1) Calculate the grayscale threshold of the reproduced image by an iterative method, and set the grayscale threshold in the iterative process to T k , it will reproduce the image f (x,y) segmentation as background reconstruction image f A (x,y) and the target reproduced image f B (x,y), (2) So the new gray threshold T k+1 It can be expressed as: (3) judge T k+1 and T k Is the absolute value of the difference less than the given value? δ ,Right now: (4) like T k+1 ,but T k+1 As the optimal grayscale threshold; (2.2) According to the reconstruction distance of the reproduced image, the grayscale threshold calculated in step (2.1) is multiplied by a weight coefficient to obtain the final grayscale threshold; Taking the reconstruction distance of the target's centerline as the origin, the weight coefficient increases nonlinearly with the distance of the reconstruction distance of the reproduced image from the origin. The specific relationship is expressed as: (5) in a , b , c , d and e The coefficients are set as follows: 1.642×10 -17 7.677×10 -14 , 2.417×10 -10 , -7.099×10 -6 and 1.011, l ' is the reconstruction distance of the reproduced image, l 0' is the reconstruction distance of the reconstructed image located at the target centerline.
2. The target edge detection method of integrating gradient and neural network according to claim 1, characterized in that: In step (2.1), T k+1 and T k Is the absolute value of the difference less than the given value? δ Later also includes: like T k+1 , then T k+1 Set the current grayscale threshold and repeat step (2.1).
Citation Information
Patent Citations
Machine-vision-based online dimensional measurement method of precise instrument
CN103292701A
Image super-resolution reconstruction method based on back-propagation neural network
CN106846253A