A method and system for detecting the clarity of microscopic images, and computer equipment
By performing white balance correction, grayscale conversion and feature extraction on microscopic images, combining color and texture features, the foreground images are extracted and the definition value is calculated, the limitations and noise of the microscopic image definition evaluation method in the prior art are solved. Interference problem, high-precision and high-efficiency image detection is achieved.
Patent Information
- Application Number
- CN202210674343.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2042-06-15
AI Technical Summary
The existing microscopic image clarity evaluation methods have limitations in terms of sensitivity, unbiasedness, unimodality, etc., and are easily affected by environmental noise, resulting in the occurrence of pseudo-peaks and affecting image quality.
A method for detecting microscopic image sharpness is proposed. By acquiring Bayer images, white balance correction and grayscale conversion are performed, feature images are extracted using gradient algorithm and mean filtering algorithm, foreground images are extracted based on color and texture features, and microscopic images are calculated. the definition value.
This method improves the accuracy and efficiency of microscopic image sharpness detection, can effectively denoise and sharpen images, eliminate interference from environmental noise, and ensure image quality.
Smart Images

Figure CN114972108B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of microscopic image processing, in particular to a microscopic image clarity detection method and system, and computer equipment. Background Art
[0002] A microscopic image refers to an image observed through a microscope. When using a microscope to collect microscopic images, it is necessary to automatically focus the sample through the objective lens. The autofocus process includes: collecting a series of microscopic images at different heights through the objective lens; using an image clarity evaluation function to evaluate the clarity of this series of microscopic images; and focusing the objective lens to the height corresponding to the microscopic image with the highest clarity.
[0003] The image clarity evaluation methods used in the autofocus process include spatial domain method, frequency domain method and machine learning-based method. These methods have their own limitations in terms of sensitivity, unbiasedness, and unimodality. In addition, environmental noise is easily collected during the microscopic image acquisition process. The influence of this environmental noise will also cause multiple pseudo-peaks to appear in the clarity evaluation process, affecting the accuracy of the microscopic image clarity evaluation method and resulting in poor quality of the collected microscopic image. Summary of the Invention
[0004] The present invention provides a method and system for detecting the clarity of a microscopic image, and computer equipment, which are used to overcome the defects of the prior art such as low precision.
[0005] To achieve the above object, the present invention proposes a method for detecting the clarity of a microscopic image, comprising the following steps:
[0006] Obtain microscopic images of the sample in each field of view and save them as Bayer images;
[0007] Performing white balance correction on the Bayer image, performing four-channel color separation and extraction on the Bayer image after white balance correction according to R, G1, G2, and B, and obtaining a grayscale image using a grayscale conversion method based on the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image;
[0008] Based on the grayscale image, a gradient image is calculated using a gradient algorithm, a filtered image is calculated using a mean filtering algorithm, a first feature image is calculated based on the grayscale image, the gradient image, and the filtered image, and a second feature image is calculated based on the first feature image and the grayscale image;
[0009] Extracting a foreground image according to the R channel sub-image, the G1 channel sub-image, the B channel sub-image and the gradient image;
[0010] Calculating an average threshold factor, a second segmentation threshold, and a valid foreground image based on the second feature image and the foreground image;
[0011] The clarity value of the microscopic image is calculated based on the effective foreground image, the foreground image, the average threshold factor and the second segmentation threshold.
[0012] To achieve the above object, the present invention further provides a microscopic image clarity detection system, comprising:
[0013] Image acquisition module, used to obtain microscopic images of the sample in each field of view and save them as Bayer images;
[0014] An image processing module is configured to perform white balance correction on the Bayer image, perform four-channel color separation and extraction on the white balance-corrected Bayer image according to R, G1, G2, and B channels, obtain a grayscale image based on the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image using a grayscale conversion method, calculate a gradient image based on the grayscale image using a gradient algorithm, calculate a filtered image based on the mean filtering algorithm, calculate a first feature image based on the grayscale image, the gradient image, and the filtered image, and then calculate a second feature image based on the first feature image and the grayscale image, extract a foreground image based on the R channel sub-image, G1 channel sub-image, B channel sub-image, and the gradient image, and calculate an average threshold factor, a second segmentation threshold, and an effective foreground image based on the second feature image and the foreground image;
[0015] The clarity calculation module is used to calculate the clarity value of the microscopic image according to the effective foreground image, the foreground image, the average threshold factor and the second segmentation threshold.
[0016] To achieve the above object, the present invention further proposes a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0017] To achieve the above object, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0018] Compared with the prior art, the present invention has the following beneficial effects:
[0019] The present invention provides a method for detecting the clarity of microscopic images. First, a Bayer image of the sample is acquired, white-balanced, and converted into a grayscale image. The grayscale image is then filtered for denoising and gradient feature extraction, resulting in a feature image. Next, a foreground image is extracted based on color and texture features, and the feature image is used to optimize the obtained foreground image to obtain an effective foreground image. Finally, the clarity value of the microscopic image is calculated. This method is computationally simple, efficient, and highly accurate.
[0020] 2. The first and second characteristic images in the microscopic image clarity detection method provided by the present invention serve to denoise and sharpen the image. The principle of image sharpening is to make the black and white relationship in the target image more distinct. The first characteristic image in the present invention can make the "black darker" and the "white whiter" in the image. Considering that in actual practice, the color of cell nuclei in microscopic images is often darker, the present invention weights the grayscale value of the corresponding position in the image as an adaptive parameter to the first characteristic image, which can appropriately reduce the "black darker" effect. In other words, the second characteristic image proposed by the present invention can enhance the brightness of cell nuclei in microscopic images.
[0021] 3. The microscopic image clarity detection method provided by the present invention extracts a foreground image based on the R channel sub-image, the G1 channel sub-image, the B channel sub-image, and the gradient image, making full use of the color and texture information in the microscopic image. It can eliminate the interference of some small and isolated cells (such as inflammatory cells) in the microscopic image on the gradient calculation, thereby ensuring the accuracy of foreground image extraction.
[0022] 4. The method for detecting the clarity of a microscopic image provided by the present invention can, on the one hand, be applied to the automatic focus of a microscope to perform a clarity detection on the microscopic image collected after the automatic focus is completed, and to refocus the fields of view whose clarity values do not meet the requirements, to ensure that all fields of view collected by scanning the sample are clear; on the other hand, it can be applied to the post-processing stage of the microscopic image to perform a clarity detection on the microscopic image before automatically analyzing the microscopic image, to screen out the blurred areas, and to guide the user to manually read the image under the microscope or rescan the blurred areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0024] Figure 1 Flowchart of the method for detecting the clarity of a microscopic image provided by the present invention;
[0025] Figure 2 This is a schematic diagram of the internal storage of Bayer image data used in the present invention.
[0026] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0027] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0028] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in this field can implement it. When the combination of technical solutions is mutually contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0029] The present invention proposes a method for detecting the clarity of a microscopic image. Figure 1 As shown, the following steps are included:
[0030] 101: Obtain microscopic images of the sample in each field of view and save them as Bayer images.
[0031] The sample can be a tissue section, an exfoliated cell specimen, a peripheral blood smear, or other biological samples or material samples that can be observed under a microscope.
[0032] The Bayer image is the original image inside the camera. The Bayer image is formed by the three color channels R (red), G (green), and B (blue) in a certain arrangement. Among them, the G color channel includes two sub-channels G1 and G2, that is, the number of pixels in the G color channel is the sum of the number of pixels in the R color channel and the B color channel. The internal storage of Bayer image data is as follows Figure 2 shown.
[0033] 102: Perform white balance correction on the Bayer image, perform four-channel color separation and extraction on the Bayer image after white balance correction according to R, G1, G2, and B, and obtain a grayscale image using a grayscale conversion method based on the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image.
[0034] 103: Based on the grayscale image, a gradient image is calculated using a gradient algorithm, a filtered image is calculated using a mean filtering algorithm, a first feature image is calculated based on the grayscale image, the gradient image, and the filtered image, and a second feature image is calculated based on the first feature image and the grayscale image.
[0035] 104: Extract a foreground image according to the R channel sub-image, the G1 channel sub-image, the B channel sub-image, and the gradient image.
[0036] The foreground image contains color features and texture features.
[0037] 105: Calculate an average threshold factor, a second segmentation threshold, and a valid foreground image according to the second feature image and the foreground image.
[0038] 106 : Calculate a clarity value of the microscopic image according to the effective foreground image, the foreground image, the average threshold factor, and the second segmentation threshold.
[0039] In one embodiment, for step 101 , a sample to be scanned is placed on a stage of a microscope, and each field of view of the sample is automatically focused using the microscope to acquire microscopic images of each field of view of the sample.
[0040] In this embodiment, the image clarity evaluation function used for autofocus is a gradient function. The gradient function performs edge detection on the image, extracts gradient information, and thus calculates the image clarity value. Commonly used gradient-based clarity evaluation functions include the sum of absolute grayscale differences (SMD), the Brenner function, the image grayscale gradient energy function (Tenengrad), and the Laplace energy function (Lapalace).
[0041] In the next embodiment, in step 102, white balance correction is performed on the Bayer image, including:
[0042] 201: Calculate the mean of the three color channels R, G, and B in the Bayer image
[0043]
[0044]
[0045]
[0046] Where B_im represents the Bayer image, mod() represents the remainder operation, abs() represents the absolute value operation, and M×N represents the size of the Bayer image.
[0047] 202: Calculate the gain value R of the three color channels R, G, and B in the Bayer image based on the mean value. gain 、B gain , G gain ;
[0048]
[0049]
[0050]
[0051] 203: The gain values of the three color channels are weighted to all pixels corresponding to the three color channels R, G, and B in the Bayer image to achieve white balance correction.
[0052] In step 102, based on the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image, a grayscale image is obtained using a grayscale conversion method. The specific formula is as follows:
[0053]
[0054] Where, Represents the R channel sub-image, represents the G1 channel sub-image, Represents the B channel sub-image.
[0055] In another embodiment, for step 103, based on the grayscale image, a gradient image is calculated using a gradient algorithm, and a filtered image is calculated using a mean filtering algorithm, including:
[0056] According to the grayscale image, a gradient image is calculated using a gradient algorithm.
[0057] Grad(i,j)=abs(Gray(i-1,j)-Gray(i+1,j))+abs(Gray(i,j-1)-Gray(i,j+1))
[0058] Where Grad(i,j) represents the gradient value at position (i,j) in the gradient image, Gray(i-1,j) represents the grayscale value at position (i-1,j) in the grayscale image, Gray(i+1,j) represents the grayscale value at position (i+1,j) in the grayscale image, Gray(i,j-1) represents the grayscale value at position (i,j-1) in the grayscale image, and Gray(i,j+1) represents the grayscale value at position (i,j+1) in the grayscale image;
[0059] The filtered image is obtained by using the mean filtering algorithm.
[0060]
[0061] Where Gray_blur(i,j) represents the pixel value at position (i,j) in the filtered image, Gray(i,j) represents the grayscale value at position (i,j) in the grayscale image, S represents the filter window, and the size of the filter window can be 3×3, 5×5, 7×7, etc. NUM represents the total number of pixels covered by the filter window.
[0062] In one embodiment, for step 103, calculating a first feature image based on the grayscale image, the gradient image, and the filtered image, and then calculating a second feature image based on the first feature image and the grayscale image includes:
[0063] A first feature image is obtained by calculating the grayscale image, the gradient image and the filtered image,
[0064]
[0065] Then, the second feature image is calculated based on the first feature image and the grayscale image.
[0066]
[0067] Where F(i,j) represents the eigenvalue at position (i,j) in the first feature image, F_im(i,j) represents the eigenvalue at position (i,j) in the second feature image, gamma_v represents the adjustment factor, which ranges from 1.0 to 3.0, ratio represents the proportional coefficient, which is generally 2, 4, 6, 8, etc., abs() represents the absolute value operation, pow() represents the calculation of the power of a given value, Gray_blur(i,j) represents the pixel value at position (i,j) in the filtered image, Gray(i,j) represents the grayscale value at position (i,j) in the grayscale image; Grad(i,j) represents the gradient value at position (i,j) in the gradient image.
[0068] In the next embodiment, for step 104, extracting a foreground image based on the R channel sub-image, the G1 channel sub-image, the B channel sub-image, and the gradient image includes:
[0069] 401: Calculate a saturation image based on the R channel sub-image, the G1 channel sub-image, and the B channel sub-image;
[0070]
[0071] Where S(i,j) represents the saturation value at position (i,j) in the saturation image, Represents the pixel value at position (i, j) in the R channel sub-image, Represents the pixel value at position (i, j) in the G1 channel sub-image, Represents the pixel value at position (i, j) in the B channel sub-image.
[0072] 402: Calculating a saturation mask map S_mask according to the saturation image, and dilating the saturation mask map using a morphological dilation algorithm to obtain a dilated saturation mask map S_mask_dilate;
[0073]
[0074] Where S_mask(i,j) represents the pixel value at position (i,j) in the saturation mask image. The saturation mask image is a binary image. T_s represents the saturation segmentation threshold, which ranges from 25 to 40.
[0075] The morphological dilation algorithm dilates the highlight part of the image to achieve domain expansion. Its principle is: given a convolution kernel and a reference point, the convolution kernel can be of any size and shape, convolve the convolution kernel and the image, calculate the maximum value of the pixels in the area covered by the convolution kernel, and assign this maximum value to the pixel specified by the reference point to achieve expansion of the highlight area in the image.
[0076] 403: Calculate a gradient mask image according to the gradient image and the expanded saturation mask image;
[0077]
[0078]
[0079] Where m×n represents the size of the gradient image, Grad_mask(i,j) represents the pixel value at position (i,j) in the gradient mask image, S_mask_dilate(i,j) represents the pixel value at position (i,j) in the expanded saturation mask image, T_grad represents the gradient segmentation threshold; Grad(i,j) represents the gradient value at position (i,j) in the gradient image.
[0080] 404: Calculate the foreground image based on the expanded saturation mask image and the gradient mask image.
[0081] FG_mask(i,j)=S_mask_dilate(i,j)&Grad_mask(i,j)
[0082] Where & represents the bitwise AND operation, and FG_mask(i,j) represents the pixel value at position (i,j) in the foreground image.
[0083] In another embodiment, in step 105, calculating and obtaining the effective foreground image according to the second feature image and the foreground image includes:
[0084] 501: Calculate a first segmentation threshold according to the second feature image;
[0085]
[0086]
[0087]
[0088] Where F_im(i,j) represents the eigenvalue at position (i,j) in the second feature image; T_1 represents the first segmentation threshold.
[0089] 502: Calculate the average of the first segmentation thresholds of all successfully focused fields of view before the current field of view as an average threshold factor;
[0090] 503: Calculate a second segmentation threshold according to the second feature image and the average threshold factor;
[0091]
[0092]
[0093] Where avg_T represents the average threshold factor; T_2 represents the second segmentation threshold.
[0094] 504: Binarize the second feature image according to the average threshold factor to obtain a binary feature image;
[0095]
[0096] Where F_im_binary represents the binary feature image; avg_T represents the average threshold factor; F_im(i,j) represents the feature value at position (i,j) in the second feature image.
[0097] 505: dilating the binary feature image using a morphological dilation algorithm to obtain a dilated binary feature image;
[0098] 506: Calculate and obtain an effective foreground image based on the foreground image and the expanded binary feature image.
[0099] FG_useful(i,j)=F_im_binary_dilate(i,j)&FG_mask(i,j)
[0100] Where FG_useful represents the effective foreground image; FG_mask represents the foreground image; F_im_binary_dilate represents the binary feature image after expansion.
[0101] In one embodiment, in step 106, the clarity value of the microscopic image is calculated based on the effective foreground image, the foreground image, the average threshold factor, and the second segmentation threshold.
[0102]
[0103] Where F_definition represents the definition value, T_2 represents the second segmentation threshold, avg_T represents the average threshold factor, FG_useful represents the effective foreground image, FG_mask represents the foreground image, and countNonZero() represents the number of non-zero pixels in the statistical image.
[0104] The present invention also provides a microscopic image clarity detection system, comprising:
[0105] Image acquisition module, used to obtain microscopic images of the sample in each field of view and save them as Bayer images;
[0106] An image processing module is configured to perform white balance correction on the Bayer image, perform four-channel color separation and extraction on the white balance-corrected Bayer image according to R, G1, G2, and B channels, obtain a grayscale image based on the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image using a grayscale conversion method, calculate a gradient image based on the grayscale image using a gradient algorithm, calculate a filtered image based on the mean filtering algorithm, calculate a first feature image based on the grayscale image, the gradient image, and the filtered image, and then calculate a second feature image based on the first feature image and the grayscale image, extract a foreground image based on the R channel sub-image, G1 channel sub-image, B channel sub-image, and the gradient image, and calculate an average threshold factor, a second segmentation threshold, and an effective foreground image based on the second feature image and the foreground image;
[0107] The clarity calculation module is used to calculate the clarity value of the microscopic image according to the effective foreground image, the foreground image, the average threshold factor and the second segmentation threshold.
[0108] The present invention further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0109] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above-mentioned method when executed by a processor.
[0110] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made by using the contents of the present invention description and drawings under the inventive concept of the present invention, or direct / indirect application in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A method for detecting the clarity of a microscopic image, characterized in that: The following steps are involved: Obtain microscopic images of the sample in each field of view and save them as Bayer images; Performing white balance correction on the Bayer image, performing four-channel color separation and extraction on the Bayer image after white balance correction according to R, G1, G2, and B, and obtaining a grayscale image by using a grayscale conversion method according to the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image; According to the grayscale image, a gradient image is calculated using a gradient algorithm, a filtered image is calculated using a mean filtering algorithm, a first feature image is calculated according to the grayscale image, the gradient image and the filtered image, and a second feature image is calculated according to the first feature image and the grayscale image; Extracting a foreground image according to the R channel sub-image, the G1 channel sub-image, the B channel sub-image and the gradient image; According to the second feature image and the foreground image, an average threshold factor, a second segmentation threshold and a valid foreground image are calculated; According to the effective foreground image, the foreground image, the average threshold factor and the second segmentation threshold, the clarity value of the microscopic image is calculated: Where, F_definition represents the definition value, T_2 represents the second segmentation threshold, avg_T represents the average threshold factor, FG_useful represents the effective foreground image, FG_mask represents the foreground image, and countNonZero() represents the number of non-zero pixels in the statistical image; In the formula, , F_im(i, j)) represents the feature value at position (i, j) in the second feature image.
2. The method for detecting the clarity of a microscopic image according to claim 1, characterized in that: Performing white balance correction on the Bayer image, comprising: Calculate the mean of the three color channels R, G, and B in the Bayer image; According to the mean, the gain values of the three color channels R, G, and B in the Bayer image are calculated; The gain values of the three color channels are weighted to all pixels corresponding to the three color channels of R, G, and B in the Bayer image to achieve white balance correction.
3. The method for detecting the clarity of a microscopic image according to claim 1, characterized in that: According to the grayscale image, a gradient image is calculated using a gradient algorithm, and a filtered image is calculated using a mean filtering algorithm, including: According to the grayscale image, a gradient image is obtained by using a gradient algorithm. Grad(i,j)=abs(Gray(i-1,j)-Gray(i+1,j))+abs(Gray(i,j-1)-Gray(i,j+1)) Wherein, Grad(i, j) represents the gradient value at position (i, j) in the gradient image, Gray(i-1, j) represents the gray value at position (i-1, j) in the grayscale image, Gray(i+1, j) represents the gray value at position (i+1, j) in the grayscale image, Gray(i, j-1) represents the gray value at position (i, j-1) in the grayscale image, and Gray(i, j+1) represents the gray value at position (i, j+1) in the grayscale image; The filtered image is calculated using the mean filtering algorithm. Where Gray_blur(i, j) represents the pixel value at position (i, j) in the filtered image, Gray(i, j) represents the grayscale value at position (i, j) in the grayscale image, S represents the filter window, and NUM represents the total number of pixels covered by the filter window.
4. The method for detecting the clarity of a microscopic image according to claim 1, wherein: Calculating a first feature image according to the grayscale image, the gradient image, and the filtered image, and then calculating a second feature image according to the first feature image and the grayscale image, including: A first feature image is obtained by calculating the grayscale image, the gradient image and the filter image, Then, according to the first feature image and the grayscale image, a second feature image is calculated. In the formula, F(i, j) represents the eigenvalue at position (i, j) in the first feature image, F_im(i, j) represents the eigenvalue at position (i, j) in the second feature image, gamma_v represents the adjustment factor, and its value range is 1.0~3.0, ratio represents the proportional coefficient, abs() represents the absolute value operation, pow() represents the power calculation of a given value, Gray_blur(i, j) represents the pixel value at position (i, j) in the filtered image, Gray(i, j) represents the grayscale value at position (i, j) in the grayscale image; Grad(i, j) represents the gradient value at position (i, j) in the gradient image.
5. The method for detecting the clarity of a microscopic image according to claim 1, wherein: Extracting a foreground image according to the R channel sub-image, the G1 channel sub-image, the B channel sub-image and the gradient image, including: A saturation image is obtained by calculation according to the R channel sub-image, the G1 channel sub-image and the B channel sub-image; Calculating a saturation mask map according to the saturation image, and performing dilation processing on the saturation mask map using a morphological dilation algorithm to obtain a dilated saturation mask map; Calculating a gradient mask image according to the gradient image and the expanded saturation mask image; The foreground image is calculated based on the expanded saturation mask map and the gradient mask image.
6. The method for detecting the clarity of a microscopic image according to claim 1, wherein: Calculating an effective foreground image according to the second feature image and the foreground image includes: Calculating a first segmentation threshold according to the second feature image; Calculate the average of the first segmentation thresholds of all successfully focused fields before the current field of view as the average threshold factor; Calculating a second segmentation threshold according to the second feature image and the average threshold factor; According to the average threshold factor, binarizing the second feature image to obtain a binary feature image; Using a morphological dilation algorithm to dilate the binary feature image, to obtain a dilated binary feature image; An effective foreground image is calculated based on the foreground image and the dilated binary feature image.
7. A microscopic image clarity detection system, characterized in that: include: An image acquisition module is used to acquire microscopic images of the sample in each field of view and save them as Bayer images; An image processing module is used to perform white balance correction on the Bayer image, perform four-channel color separation and extraction on the Bayer image after white balance correction according to R, G1, G2, and B, and obtain a grayscale image using a grayscale conversion method based on the extracted R channel sub-image, G1 channel sub-image, and B channel sub-image; According to the grayscale image, a gradient image is calculated using a gradient algorithm, a filtered image is calculated using a mean filtering algorithm, a first feature image is calculated according to the grayscale image, the gradient image and the filtered image, and a second feature image is calculated according to the first feature image and the grayscale image; Extracting a foreground image according to the R channel sub-image, the G1 channel sub-image, the B channel sub-image and the gradient image; calculating an average threshold factor, a second segmentation threshold and a valid foreground image according to the second feature image and the foreground image; The clarity calculation module is used to calculate the clarity value of the microscopic image according to the effective foreground image, the foreground image, the average threshold factor and the second segmentation threshold: Where, F_definition represents the definition value, T_2 represents the second segmentation threshold, avg_T represents the average threshold factor, FG_useful represents the effective foreground image, FG_mask represents the foreground image, and countNonZero() represents the number of non-zero pixels in the statistical image; In the formula, , F_im(i, j) represents the feature value at position (i, j) in the second feature image.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Medical microscopic image definition evaluation method for coarse focusing and fine focusing
CN106548471A
Image enhancement method based on improved Retinex algorithm
CN110473152A