Marine phytoplankton image edge detection method based on non-local mean denoising mode
By using non-local mean denoising algorithm and Canny edge detection algorithm in phytoplankton image processing, the problems of phytoplankton image noise and edge blur are solved, and clearer and more accurate edge extraction is achieved.
Patent Information
- Application Number
- CN202510233240.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-03-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Due to instability of light source, sensor noise and optical error, the phytoplankton images contain strong noise and blurred edges, which affects the accuracy of the subsequent analysis process.
The non-local mean denoising method is adopted, combined with the Canny edge detection algorithm, the edge details of the image are preserved through the non-local mean denoising algorithm, and the image is edge extracted using the Canny edge detection algorithm.
Effectively remove noise, preserve image details and structural information, reduce the impact of noise on edge detection, and significantly improve the accuracy and image quality of edge extraction.
Smart Images

Figure CN119722720A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of phytoplankton image edge detection, and in particular to a marine phytoplankton image edge detection method based on a non-local mean denoising method. Background Art
[0002] Phytoplankton is the main primary producer in the ocean. It uses solar energy to convert CO2 into organic carbon through photosynthesis, thus starting the energy and material flow of the marine ecosystem and opening the marine food chain. Its accurate classification and identification is of great significance to marine biological resource surveys, environmental water quality monitoring, aquaculture and other fields.
[0003] Phytoplankton cells have complex morphology and usually have subtle edges. In addition, during microscope imaging, the acquired phytoplankton images contain strong noise and have blurred edges due to unstable light source, sensor noise, optical errors in the imaging process, etc., which directly affects the accuracy of subsequent analysis processes (such as morphological feature extraction, species identification, etc.). In view of this, a marine phytoplankton image edge detection method based on non-local mean denoising is provided. Summary of the invention
[0004] The purpose of the present invention is to provide a method for edge detection of marine phytoplankton images based on non-local mean denoising, so as to solve the problem that the phytoplankton cell morphology is complex and the edges are usually fine, and in addition, during the microscope imaging process, due to unstable light source, sensor noise, optical errors in the imaging process, etc., the acquired phytoplankton images contain strong noise and blurred edges, which directly affects the accuracy of subsequent analysis processes (such as morphological feature extraction, species identification, etc.).
[0005] To achieve the above object, the present invention aims to provide a method for edge detection of marine phytoplankton images based on non-local mean denoising, comprising the following steps: S1. Place the marine phytoplankton image file to be detected into the folder of the program project. The program will automatically read the image into the code in the folder and load the image to be processed; S2, retaining edge details of marine phytoplankton images based on non-local means denoising algorithm; S3, for the image data after retaining edge details, edge extraction is performed on the image based on the Canny edge detection algorithm; S4. Output the marine phytoplankton image with edge details preserved.
[0006] As a further improvement of the technical solution, in S2, the detailed operation steps of the non-local mean denoising algorithm are: S2.1. For each pixel point in the marine phytoplankton image, determine a template window and a search window; S2.2, calculating the similarity weights between all template windows and the central pixel template window within the search window; S2.3, performing weighted averaging on the pixels in the search window according to the calculated similarity weights to obtain an estimated value of the center pixel; S2.4, traverse the entire marine phytoplankton image, denoise each pixel by weighted averaging, and finally output the denoised image.
[0007] As a further improvement of the present technical solution, in S2.1, for each pixel point, a small window centered on the pixel is selected as the template window, and a larger window is selected, usually including the template window, to find an area similar to the template window.
[0008] As a further improvement of the technical solution, in S2.2, the Euclidean distance of pixel values is used as a similarity metric, and a weighted Gaussian function is combined to measure the similarity. and pixels within the search area , its similarity weight Use the following formula to express it: ; in, It's pixels and The similarity weight between them is used to preserve the outline and details of the plant image; Represents the grayscale intensity function of the marine phytoplankton image, Represents the pixels in the marine phytoplankton image The gray intensity value at Represents the pixels in the marine phytoplankton image The gray intensity value at represents the target pixel, represents the pixels within the search area; is a parameter used to maintain the fine structure of phytoplankton; is the target pixel neighborhood area.
[0009] As a further improvement of the technical solution, in S2.3, the weighted average process is expressed by the following formula: ; in, is the target pixel value of the marine phytoplankton image after denoising, that is, the estimated value of the center pixel.
[0010] As a further improvement of the technical solution, in S3, the detailed operation steps of the Canny edge detection algorithm are: S3.1. For the marine phytoplankton image after non-local mean denoising, the image needs to be smoothed by Gaussian filtering first, and then the noise is removed again; S3.2, using the Sobel operator to calculate the gradient magnitude and direction of each pixel of the image after the noise is removed; S3.3, for each pixel, check whether it is a local maximum in the gradient direction; S3.4. The edge is finally determined by double thresholding and edge connection.
[0011] As a further improvement of the technical solution, in S3.1, since the noise in the marine phytoplankton image may cause misdetection, it is necessary to smooth the image by a convolution Gaussian filter, and the Gaussian filter formula is: ; in, Represents the Gaussian function at the point The value at represents the value at position The impact of Represents the spatial horizontal coordinate, which represents the offset relative to the current pixel position; represents the spatial ordinate, indicating the offset relative to the current pixel position; σ is the standard deviation of the Gaussian distribution, which is used to remove noise while retaining important edge information.
[0012] As a further improvement of the technical solution, in S3.2, the Sobel operator is used to calculate the gradient amplitude and direction of each pixel of the image, and the steps of calculating the gradient are as follows: ; ; in, Represents the horizontal gradient of the marine phytoplankton image; Represents the gradient of the image in the vertical direction; Represents the grayscale intensity function of the marine phytoplankton image, is a function defined on the image plane, where are the coordinate points in the image; The calculation formula for the gradient magnitude and direction is: ; ; in, is the edge strength of the marine phytoplankton image at a certain point, Represents the angle of the edge relative to the phytoplankton image coordinate system.
[0013] As a further improvement of the technical solution, in S3.3, the specific steps of non-maximum suppression are: S3.3.1, quantize the continuous gradient direction into four main directions of 0°, 45°, 90° and 135°, which helps to determine the specific neighborhood pixels that need to be compared; S3.3.2. For each pixel, select two neighboring pixels for comparison based on its gradient direction. If the gradient magnitude of the current pixel is not the largest of the two neighboring pixels, it is considered not to be a local maximum and should not be considered to be part of the edge. If the gradient direction is close to 0° or 180°, the pixels on the left and right sides are compared; if the gradient direction is close to 90°, the pixels on the top and bottom sides are compared; if the gradient direction is close to 45°, the pixels on the upper left and lower right are compared; if the gradient direction is close to 135°, the pixels on the upper right and lower left are compared; S3.3.3. If the gradient magnitude of the current pixel is not the largest among the neighboring pixels in its gradient direction, the gradient magnitude of the pixel is set to 0.
[0014] As a further improvement of the technical solution, in S3.4, the high threshold and the low threshold are used to classify the gradient amplitude into strong edge, weak edge and non-edge, and the expression of the double threshold processing is: ; in, Indicate point The value at depends on and Given a threshold relationship, where represents a non-edge, Indicates a strong edge, Indicates a weak edge; Indicates the high threshold, represents the low threshold, and ; Traverse all pixels marked as weak edges and check whether the pixels of weak edges are connected to the pixels of strong edges. The expression of edge connection is: ; in, represents the final image of the edge of the ocean phytoplankton. Indicates The pixel set in the 8-neighborhood centered at Indicates that there is at least one coordinate The pixels are located at The 8-neighborhood is centered on the pixel (i.e., the 8 neighboring pixels around it), and the 8-neighborhood includes pixels in the up, down, left, right, and four diagonal directions.
[0015] Compared with the prior art, the present invention has the following beneficial effects: In the marine phytoplankton image edge detection method based on non-local mean denoising, by combining non-local mean denoising with Canny edge detection, it is possible to more effectively remove noise, retain image details and structural information, and reduce the impact of noise on edge detection, thereby extracting clearer and more accurate edges; in images with large noise, it can especially significantly improve the accuracy of edge extraction and the quality of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flow chart of the overall method of the present invention; Figure 2 This is the original image of the marine phytoplankton (Noctiluca scintillans) cell of the present invention; Figure 3 This is a diagram showing the effect of edge detection of phytoplankton images (Noctiluca scintillans) based on the non-local mean denoising method of the present invention; Figure 4 This is a diagram showing the effect of canny edge detection after Gaussian filtering in the present invention; Figure 5 This is a diagram showing the effect of canny edge detection after mean filtering in the present invention; Figure 6 This is a diagram showing the effect of canny edge detection after median filtering in the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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.
[0018] Example: See Figure 1-6 As shown, this embodiment provides a method for edge detection of marine phytoplankton images based on non-local mean denoising, comprising the following steps: S1. Place the marine phytoplankton image file to be detected into the folder of the program project. The program will automatically read the image into the code in the folder and load the image to be processed; S2, retaining edge details of marine phytoplankton images based on non-local means denoising algorithm; S3, for the image data after retaining edge details, edge extraction is performed on the image based on the Canny edge detection algorithm; S4. Output the marine phytoplankton image with edge details preserved.
[0019] In S2 of this embodiment, for the image of marine phytoplankton, the non-local mean denoising method can better maintain the outline and details of the plant and avoid losing the complex shape and texture information in the image. It is not so sensitive to the type and intensity of noise and can handle various types of noise (such as salt and pepper noise, Gaussian noise, etc.). This adaptive characteristic makes the non-local mean denoising more suitable for processing the complex noise situation in the marine phytoplankton image. The detailed operation steps of the non-local mean denoising algorithm are: S2.1. For each pixel point in the marine phytoplankton image, determine a template window and a search window; S2.2, calculating the similarity weights between all template windows and the central pixel template window within the search window; S2.3, performing weighted averaging on the pixels in the search window according to the calculated similarity weights to obtain an estimated value of the center pixel; S2.4, traverse the entire marine phytoplankton image, denoise each pixel by weighted averaging, and finally output the denoised image.
[0020] In S2.1 of this embodiment, for each pixel point, a small window centered on the pixel is selected as the template window, and a larger window is selected, usually including the template window, to find an area similar to the template window.
[0021] In S2.2 of this embodiment, the Euclidean distance of pixel values is used as a similarity metric, and a weighted Gaussian function is combined to measure the similarity. and pixels within the search area , its similarity weight Use the following formula to express it: ; in, It's pixels and The similarity weight between them is used to preserve the outline and details of the plant image; Represents the grayscale intensity function of the marine phytoplankton image, Represents the pixels in the marine phytoplankton image The gray intensity value at Represents the pixels in the marine phytoplankton image The gray intensity value at represents the target pixel, represents the pixels within the search area; is a parameter used to maintain the fine structure of phytoplankton; is the target pixel neighborhood area.
[0022] In S2.3 of this embodiment, the weighted average process is expressed by the following formula: ; in, is the target pixel value of the marine phytoplankton image after denoising, that is, the estimated value of the center pixel.
[0023] In S3 of this embodiment, the Canny edge detection algorithm can more accurately detect the edges in the image, especially the complex, tiny or delicate boundaries, which can not only better identify the real edges in the image, but also effectively reduce the pseudo-edges and false detection phenomena, thereby improving the accuracy of the final edge detection; the detailed operation steps of the Canny edge detection algorithm are: S3.1. For the marine phytoplankton image after non-local mean denoising, the image needs to be smoothed by Gaussian filtering first, and then the noise is removed again; S3.2, using the Sobel operator to calculate the gradient magnitude and direction of each pixel of the image after the noise is removed; S3.3, for each pixel, check whether it is a local maximum in the gradient direction; S3.4. The edge is finally determined by double thresholding and edge connection.
[0024] In S3.1 of this embodiment, since the noise in the marine phytoplankton image may cause misdetection, it is necessary to smooth the image by a convolution Gaussian filter, and the Gaussian filter formula is: ; in, Represents the Gaussian function at the point The value at represents the value at position The impact of Represents the spatial horizontal coordinate, which represents the offset relative to the current pixel position; represents the spatial ordinate, indicating the offset relative to the current pixel position; σ is the standard deviation of the Gaussian distribution, which is used to remove noise while retaining important edge information.
[0025] In S3.2 of this embodiment, the Sobel operator is used to calculate the gradient magnitude and direction of each pixel of the image, and the steps of calculating the gradient are as follows: ; ; in, Represents the horizontal gradient of the marine phytoplankton image; Represents the gradient of the image in the vertical direction; Represents the grayscale intensity function of the marine phytoplankton image, is a function defined on the image plane, where are the coordinate points in the image; The calculation formula for the gradient magnitude and direction is: ; ; in, is the edge strength of the marine phytoplankton image at a certain point, Represents the angle of the edge relative to the phytoplankton image coordinate system.
[0026] In S3.3 of this embodiment, the specific steps of non-maximum suppression are: S3.3.1, quantize the continuous gradient direction into four main directions of 0°, 45°, 90° and 135°, which helps to determine the specific neighborhood pixels that need to be compared; S3.3.2. For each pixel, select two neighboring pixels for comparison based on its gradient direction. If the gradient magnitude of the current pixel is not the largest of the two neighboring pixels, it is considered not to be a local maximum and should not be considered to be part of the edge. If the gradient direction is close to 0° or 180°, the pixels on the left and right sides are compared; if the gradient direction is close to 90°, the pixels on the top and bottom sides are compared; if the gradient direction is close to 45°, the pixels on the upper left and lower right are compared; if the gradient direction is close to 135°, the pixels on the upper right and lower left are compared; S3.3.3. If the gradient magnitude of the current pixel is not the largest among the neighboring pixels in the gradient direction, the gradient magnitude of the pixel is set to 0 (or to a very small number), indicating that it is not part of the edge. When it is close to 0° and 180°, the arithmetic expression of non-maximum suppression is: ; in, is the marine phytoplankton image after non-maximum suppression. Indicates the current pixel is The gradient magnitude of the neighboring pixels on the left in the direction, Indicates the current pixel is The gradient magnitude of the neighboring pixels on the right side in the direction; When it is close to 45°, the arithmetic expression of non-maximum suppression is: ; in, Indicates the current pixel is and The gradient magnitude of the upper left neighboring pixel in the direction, Indicates the current pixel is and The gradient magnitude of the lower right neighboring pixel in the direction; When it is close to 90°, the arithmetic expression of non-maximum suppression is: ; in, Indicates the current pixel is The gradient magnitude of the neighboring pixels above the direction, Indicates the current pixel is The gradient magnitude of the neighboring pixels above and below the direction; When it is close to 135°, the arithmetic expression of non-maximum suppression is: ; in, Indicates the current pixel is and The gradient magnitude of the upper right neighboring pixel in the direction, Indicated in and The gradient magnitude of the lower left neighboring pixel in the direction.
[0027] In S3.4 of this embodiment, the high threshold and the low threshold are used to classify the marine phytoplankton image gradient amplitude into strong edge, weak edge and non-edge, and the expression of the double threshold processing is: ; in, Indicate point The value at depends on and Given a threshold relationship, where represents a non-edge, Indicates a strong edge, Indicates a weak edge; Indicates the high threshold, represents the low threshold, and ; Traverse all pixels marked as weak edges and check whether the pixels of weak edges are connected to the pixels of strong edges. The expression of edge connection is: ; in, represents the final image of the edge of the ocean phytoplankton. Indicates The pixel set in the 8-neighborhood centered at Indicates that there is at least one coordinate The pixels are located at The 8-neighborhood is centered on the pixel (i.e., the 8 neighboring pixels around it), and the 8-neighborhood includes pixels in the up, down, left, right, and four diagonal directions.
[0028] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for edge detection of marine phytoplankton images based on non-local mean denoising, characterized in that: The following steps are involved: S1. Place the marine phytoplankton image file to be detected into the folder of the program project. The program will automatically read the image into the code in the folder and load the image to be processed; S2, retaining edge details of marine phytoplankton images based on non-local means denoising algorithm; S3, for the image data after retaining edge details, edge extraction is performed on the image based on the Canny edge detection algorithm; S4. Output the marine phytoplankton image with edge details preserved.
2. The marine phytoplankton image edge detection method based on non-local mean denoising method according to claim 1 is characterized in that: In S2, the detailed operation steps of the non-local mean denoising algorithm are: S2.
1. For each pixel point in the marine phytoplankton image, determine a template window and a search window; S2.2, calculating the similarity weights between all template windows and the central pixel template window within the search window; S2.3, performing weighted averaging on the pixels in the search window according to the calculated similarity weights to obtain an estimated value of the center pixel; S2.4, traverse the entire marine phytoplankton image, denoise each pixel by weighted averaging, and finally output the denoised image.
3. The marine phytoplankton image edge detection method based on non-local means denoising according to claim 2 is characterized in that: In S2.1, for each pixel, a small window centered on the pixel is selected as a template window, and a larger window is selected to find an area similar to the template window.
4. The marine phytoplankton image edge detection method based on non-local mean denoising method according to claim 2 is characterized in that: In S2.2, the Euclidean distance of pixel values is used as a similarity metric, and a weighted Gaussian function is combined to measure the similarity. and pixels within the search area , its similarity weight Use the following formula: ; in, It's pixels and The similarity weight between them is used to preserve the outline and details of the plant image; Represents the grayscale intensity function of the marine phytoplankton image, Represents the pixels in the marine phytoplankton image The gray intensity value at Represents the pixels in the marine phytoplankton image The gray intensity value at represents the target pixel, represents the pixels within the search area; is a parameter used to maintain the fine structure of phytoplankton; is the target pixel neighborhood area.
5. The marine phytoplankton image edge detection method based on non-local mean denoising method according to claim 2 is characterized in that: In S2.3, the weighted average process is expressed by the following formula: ; in, is the target pixel value of the marine phytoplankton image after denoising, that is, the estimated value of the center pixel.
6. The marine phytoplankton image edge detection method based on non-local mean denoising method according to claim 1 is characterized in that: In S3, the detailed operation steps of the non-local mean denoising algorithm are as follows: S3.
1. For the marine phytoplankton image after non-local mean denoising, the image needs to be smoothed by Gaussian filtering first, and then the noise is removed again; S3.2, using the Sobel operator to calculate the gradient magnitude and direction of each pixel of the image after the noise is removed; S3.3, for each pixel, check whether it is a local maximum in the gradient direction; S3.
4. The edge is finally determined by double thresholding and edge connection.
7. The marine phytoplankton image edge detection method based on non-local mean denoising according to claim 6 is characterized in that: In S3.1, since the noise in the marine phytoplankton image may cause misdetection, it is necessary to smooth the image through a convolution Gaussian filter, and the Gaussian filter formula is: ; in, Represents the Gaussian function at the point The value at represents the value at position The impact of Represents the spatial horizontal coordinate, which represents the offset relative to the current pixel position; represents the spatial ordinate, indicating the offset relative to the current pixel position; σ is the standard deviation of the Gaussian distribution, which is used to remove noise while retaining important edge information.
8. The marine phytoplankton image edge detection method based on non-local means denoising according to claim 6, characterized in that: In S3.2, the Sobel operator is used to calculate the gradient magnitude and direction of each pixel of the image, and the steps for calculating the gradient are as follows: ; ; in, Represents the horizontal gradient of the marine phytoplankton image; Represents the gradient of the image in the vertical direction; Represents the grayscale intensity function of the marine phytoplankton image, is a function defined on the image plane, where are the coordinate points in the image; The gradient magnitude and direction are calculated as: ; ; in, is the edge strength of the marine phytoplankton image at a certain point, Represents the angle of the edge relative to the phytoplankton image coordinate system.
9. The marine phytoplankton image edge detection method based on non-local mean denoising according to claim 6, characterized in that: In S3.3, the specific steps of non-maximum suppression are: S3.3.1, quantize the continuous gradient direction into four main directions: 0°, 45°, 90° and 135°; S3.3.
2. For each pixel, select two neighboring pixels for comparison based on its gradient direction; S3.3.
3. If the gradient magnitude of the current pixel is not the largest among the neighboring pixels in its gradient direction, the gradient magnitude of the pixel is set to 0.
10. The marine phytoplankton image edge detection method based on non-local mean denoising according to claim 6, characterized in that: In S3.4, the high threshold and the low threshold are used to classify the gradient amplitude of the marine phytoplankton image into strong edge, weak edge and non-edge, and the expression of the double threshold processing is: ; in, Indicate point The value at depends on and Given a threshold relationship, where represents a non-edge, Indicates a strong edge, Indicates a weak edge; Indicates the high threshold, represents the low threshold, and ; Traverse all pixels marked as weak edges and check whether the pixels of weak edges are connected to the pixels of strong edges. The expression of edge connection is: ; in, represents the final edge image, Indicates The pixel set in the 8-neighborhood centered at Indicates that there is at least one coordinate The pixels are located at The 8-neighborhood is centered.
Citation Information
Patent Citations
Edge detection based on self-adaptive nonlocal mean denoising method
CN104036465A
Improved canny edge detection based non-local means MRI (magnetic resonance image) denoising method
CN104200442A
Crack defect detection method used in industrial welding seam X-ray image
CN113436168A
Denoising medical images
WO2010073251A2
Non-local means image denoising with an adaptive directional spatial filter
WO2016153639A1
Cited By
Self-adaptive threshold sparse gradient spectral line graph optimization method and system
CN120195668A
A Method and System for Optimizing Spectrogram Based on Adaptive Threshold Sparse Gradient
CN120195668B
Infrared image noise reduction edge enhancement method
CN121837074A
Plant phenotypic feature extraction method and system based on machine vision
CN122243769A
Plant phenotyping feature extraction method and system based on machine vision
CN122243769B