Fluorescence grayscale image adaptive enhancement method, device, equipment, medium and product
By classifying fluorescent grayscale images and automatically determining the threshold, adaptive contrast stretching of the images is solved, and the problem that the grayscale stretching method in the prior art fails to adaptively enhance different image features, achieving the accuracy and efficiency of image processing.
Patent Information
- Application Number
- CN202510123301.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-05-23
AI Technical Summary
The prior art grayscale stretching method fails to adaptively enhance the different image features, which may lead to excessive stretching of effective fluorescence signals or stretching of background noise, reducing image contrast.
By classifying fluorescent grayscale images, the low and high thresholds of grayscale stretching are automatically determined, and adaptive contrast stretching is performed in combination with different image features.
The accuracy and efficiency of image processing are achieved, signal overexposure and detail loss are avoided, and contrast and signal-to-reflection ratio of the image are improved.
Smart Images

Figure CN120031767A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method, device, equipment, medium and product for adaptively enhancing a fluorescent grayscale image. Background Art
[0002] Small animal in vivo fluorescence imaging technology can be used to track cells, molecules or pathological processes in living small animals to study the mechanisms of tumors, cardiovascular diseases, etc. At present, small animal in vivo fluorescence imaging technology generally uses a microscope or other optical equipment to capture and record the activities of biological molecules, cells or tissues in small animals in real time.
[0003] The original fluorescence grayscale images acquired by a high-sensitivity camera are limited by the fluorescence signal intensity, acquisition environment, background noise, etc., and usually require further grayscale stretching processing to enhance the effective fluorescence signal, improve the image resolution and contrast, and present better image observation and display effects, allowing researchers to obtain clearer fluorescence images and analyze fluorescence signals more accurately.
[0004] However, the inventors found that the currently commonly used grayscale stretching method is too simple and does not perform adaptive enhancement for different image features. There may be problems such as the effective fluorescent signal being over-stretched and overexposed, or the background noise being synchronously stretched, thereby reducing the image contrast. Summary of the invention
[0005] In view of this, the present invention provides a fluorescent grayscale image adaptive enhancement method, device, equipment, medium and product to solve the problem that the grayscale stretching method in the prior art does not perform adaptive enhancement for different image features.
[0006] In a first aspect, the present invention provides a method for adaptively enhancing a fluorescent grayscale image, the method comprising:
[0007] Acquire the fluorescence grayscale image to be enhanced;
[0008] Determine the image category of the fluorescent grayscale image to be enhanced, the image categories including: low grayscale fluorescent image, low grayscale uniform fluorescent image, high grayscale fluorescent image and high grayscale uniform fluorescent image;
[0009] Based on the image category of the fluorescent grayscale image to be enhanced, a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced are calculated;
[0010] Based on the grayscale stretching low threshold and the grayscale stretching high threshold, the contrast of the fluorescence grayscale image to be enhanced is adaptively stretched to obtain the enhanced fluorescence grayscale image.
[0011] The fluorescent grayscale image adaptive enhancement method provided by the present invention automatically determines high and low stretching thresholds for different types of fluorescent grayscale images through fluorescent grayscale image classification, so that different image features can be combined for adaptive enhancement, making image processing more accurate and efficient.
[0012] In an optional implementation, determining the image category of the fluorescent grayscale image to be enhanced includes:
[0013] Determine the type of acquisition equipment;
[0014] Based on the type of acquisition equipment, determining a preset empirical value of the fluorescent grayscale image to be enhanced;
[0015] Calculate the grayscale mean of the fluorescent grayscale image to be enhanced;
[0016] When the grayscale mean value is less than the preset empirical value, determining whether a first difference between the preset empirical value and the grayscale mean value is less than a first preset value;
[0017] When the first difference is less than the first preset value, determining that the fluorescent grayscale image to be enhanced is a low-grayscale fluorescent image;
[0018] When the first difference is greater than or equal to the first preset value, it is determined that the fluorescent grayscale image to be enhanced is a low-grayscale uniform fluorescent image.
[0019] In this embodiment, based on the difference between the grayscale mean, the maximum grayscale value and the preset empirical value, the category of the image is automatically determined, so that the appropriate enhancement strategy can be selected according to different image features. This can make the image processing more accurate and efficient, while reducing manual intervention and improving the overall processing effect.
[0020] In an optional implementation, determining the image category of the fluorescent grayscale image to be enhanced includes:
[0021] Obtain the maximum grayscale value of the fluorescent grayscale image to be enhanced;
[0022] When the grayscale mean is greater than or equal to the preset empirical value, determining whether a second difference between the maximum grayscale value and the grayscale mean is less than the preset empirical value;
[0023] When the second difference is less than a preset empirical value, determining that the fluorescent grayscale image to be enhanced is a high grayscale uniform fluorescent image;
[0024] When the second difference is greater than or equal to the preset empirical value, it is determined that the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image.
[0025] In an optional implementation, based on the image category of the fluorescent grayscale image to be enhanced, calculating the grayscale stretching low threshold and the grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced includes:
[0026] When the image category of the fluorescent grayscale image to be enhanced is a low grayscale uniform fluorescent image, the grayscale stretching low threshold L t XX / 6, grayscale stretching high threshold H t For GX;
[0027] When the image category of the fluorescent grayscale image to be enhanced is a low grayscale fluorescent image, the grayscale stretching low threshold L t XX / 6, grayscale stretching high threshold H t is the maximum gray value of the fluorescent gray image to be enhanced;
[0028] Wherein, X is the grayscale mean, and G is the grayscale level of the fluorescent grayscale image to be enhanced.
[0029] In an optional implementation, when the image category of the fluorescent grayscale image to be enhanced is a high grayscale uniform fluorescent image, the grayscale stretching low threshold L t =XX / 2, grayscale stretching high threshold H t is: the maximum value of GX and twice the maximum grayscale value;
[0030] When the image category of the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image, determining a high and low cutoff ratio of the fluorescent grayscale image to be enhanced;
[0031] The fluorescence grayscale image to be enhanced is truncated according to the high and low truncation ratios to obtain a truncated fluorescence grayscale image to be enhanced;
[0032] Determine the minimum grayscale value and the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced;
[0033] Based on a preset iterative threshold method, determining the optimal threshold of the fluorescent grayscale image to be enhanced;
[0034] Grayscale stretch low threshold L t For: G min +|TG min | / 8, grayscale stretching high threshold H t is the maximum grayscale value of the fluorescent grayscale image to be enhanced after truncating;
[0035] If the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced is less than or equal to the grayscale stretching low threshold L t , then the grayscale is stretched to the low threshold L t Reset to G min ;
[0036] Among them, G min is the minimum gray value of the fluorescent gray image to be enhanced after truncation, and T is the optimal threshold.
[0037] In this embodiment, the low threshold and high threshold of grayscale stretching are set according to the image category of the fluorescent grayscale image to be enhanced. The low threshold controls the brightness of the darker areas in the image to ensure that these areas will not be overstretched and lose details. The high threshold controls the brightness of the brighter areas in the image to avoid excessive enhancement of the bright areas, resulting in overexposure of the signal or loss of details. By setting reasonable high and low thresholds, the integrity and details of the signal can be maintained while enhancing the contrast of the fluorescent image, making the image more suitable for analysis and observation.
[0038] In an optional implementation, performing adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on a grayscale stretching low threshold and a grayscale stretching high threshold includes:
[0039] When the fluorescent grayscale image to be enhanced is a low-grayscale uniform fluorescent image or a low-grayscale fluorescent image, determining whether the number of high grayscale values exceeding a preset high grayscale value in the fluorescent grayscale image to be enhanced is less than one thousandth of the total number of pixels in the fluorescent grayscale image to be enhanced;
[0040] When the number of high gray values is less than one thousandth of the total number of pixels in the fluorescent gray image to be enhanced, performing adaptive contrast stretching according to a first preset function;
[0041] When the number of high gray values is greater than or equal to one thousandth of the total number of pixels of the fluorescent gray image to be enhanced, or when the fluorescent gray image to be enhanced is a high gray uniform fluorescent image or a high gray fluorescent image, performing adaptive contrast stretching according to a second preset function;
[0042] Among them, the first preset function is:
[0043]
[0044] The second preset function is:
[0045]
[0046] Among them, f(x, y) is the fluorescence grayscale image to be enhanced, g(x, y) is the enhanced fluorescence grayscale image, L t is the grayscale stretching low threshold, H t is the grayscale stretching high threshold, and G is the grayscale level of the fluorescent grayscale image to be enhanced.
[0047] In this embodiment, different stretching formulas are set according to the image category of the fluorescent grayscale image to be enhanced, and the corresponding high and low thresholds are substituted into the stretching formula to automatically perform adaptive contrast stretching.
[0048] In a second aspect, the present invention provides a fluorescent grayscale image adaptive enhancement device, the device comprising:
[0049] An acquisition module, used for acquiring the fluorescent grayscale image to be enhanced;
[0050] A determination module, used to determine the image category of the fluorescent grayscale image to be enhanced, the image categories including: low grayscale fluorescent image, low grayscale uniform fluorescent image, high grayscale fluorescent image and high grayscale uniform fluorescent image;
[0051] A calculation module, used for calculating a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced based on the image category of the fluorescent grayscale image to be enhanced;
[0052] The enhancement module is used to perform adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on a grayscale stretching low threshold and a grayscale stretching high threshold to obtain an enhanced fluorescent grayscale image.
[0053] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for adaptive enhancement of fluorescent grayscale images of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0054] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the method for adaptively enhancing fluorescent grayscale images according to the first aspect or any corresponding embodiment thereof.
[0055] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the method for adaptively enhancing a fluorescent grayscale image according to the first aspect or any corresponding embodiment thereof.
[0056] It should be noted that the fluorescent grayscale image adaptive enhancement device, computer device, computer readable storage medium and computer program product provided by the present invention correspond to the fluorescent grayscale image adaptive enhancement method described above. Therefore, for the beneficial effects of the fluorescent grayscale image adaptive enhancement device, computer device, computer readable storage medium and computer program product, please refer to the description of the corresponding beneficial effects of the fluorescent grayscale image adaptive enhancement method above, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 is a schematic flow chart of a method for adaptively enhancing a fluorescent grayscale image according to an embodiment of the present invention;
[0059] Figure 2 is a schematic diagram of a process for determining an image category of a fluorescent grayscale image to be enhanced according to an embodiment of the present invention;
[0060] Figure 3 is a schematic diagram of a process for determining a grayscale stretching low threshold and a grayscale stretching high threshold according to an embodiment of the present invention;
[0061] Figure 4 is a schematic diagram of a flow chart of an iterative threshold method according to an embodiment of the present invention;
[0062] Figure 5 is a schematic diagram of a low grayscale fluorescent image according to an embodiment of the present invention;
[0063] Figure 6 is a schematic diagram of a low grayscale uniform fluorescent image according to an embodiment of the present invention;
[0064] Figure 7 is a schematic diagram of a high grayscale fluorescent image according to an embodiment of the present invention;
[0065] Figure 8 is a schematic diagram of a high grayscale uniform fluorescent image according to an embodiment of the present invention;
[0066] Fig. 9 is a schematic diagram of a low grayscale fluorescence enhanced image according to an embodiment of the present invention;
[0067] Fig.10 is a schematic diagram of a low grayscale uniform fluorescence enhanced image according to an embodiment of the present invention;
[0068] Fig.11 is a schematic diagram of a high grayscale fluorescence enhanced image according to an embodiment of the present invention;
[0069] Fig.12 is a schematic diagram of a high grayscale uniform fluorescence enhanced image according to an embodiment of the present invention;
[0070] Fig.13 is a structural block diagram of a fluorescent grayscale image adaptive enhancement device according to an embodiment of the present invention;
[0071] Fig.14 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0073] According to an embodiment of the present invention, an embodiment of a method for adaptively enhancing a fluorescent grayscale image is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0074] In this embodiment, a method for adaptively enhancing a fluorescent grayscale image is provided, which can be executed by a server, a terminal, a mobile terminal, etc. Figure 1 is a flow chart of a method for adaptively enhancing a fluorescent grayscale image according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0075] Step S101, obtaining a fluorescent grayscale image to be enhanced. The fluorescent grayscale image may be a fluorescent grayscale image of a living small animal, which may be acquired by an image acquisition device. When acquiring a fluorescent grayscale image, the background of the fluorescent image may present different noise levels according to different exposure times. When the background noise is large, a dark background image under the exposure time may be acquired (the excitation light source is turned off at this time), and the fluorescent image is subtracted from the dark background image, that is, after dark background subtraction processing, a fluorescent grayscale image with a higher signal-to-background ratio is obtained.
[0076] Step S102 , determining the image category of the fluorescent grayscale image to be enhanced, the image categories including: low grayscale fluorescent image, low grayscale uniform fluorescent image, high grayscale fluorescent image and high grayscale uniform fluorescent image.
[0077] After acquiring the fluorescent grayscale image, the global mean X of the fluorescent grayscale image is calculated. The grayscale mean X can be compared with a preset empirical value to classify different fluorescent grayscale images. The classification results include low grayscale fluorescent images, low grayscale uniform fluorescent images, high grayscale fluorescent images, and high grayscale uniform fluorescent images.
[0078] Step S103 , based on the image category of the fluorescent grayscale image to be enhanced, a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced are calculated.
[0079] Specifically, when the image category of the fluorescent grayscale image to be enhanced is a low grayscale uniform fluorescent image, the grayscale stretching low threshold L can be set to t XX / 6, grayscale stretching high threshold H t =GX; When the image category of the fluorescent grayscale image to be enhanced is a low grayscale fluorescent image, the grayscale stretching low threshold L can be set t XX / 6, grayscale stretching high threshold H t is the maximum grayscale value of the fluorescent grayscale image to be enhanced; when the image category of the fluorescent grayscale image to be enhanced is a high grayscale uniform fluorescent image, the grayscale stretching low threshold L can be set t =XX / 2, grayscale stretching high threshold H t is: the maximum value of GX and twice the maximum grayscale value; when the image category of the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image, the grayscale stretching low threshold L can be set t For: G min +|TG min | / 8, grayscale stretching high threshold H t is the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced.
[0080] Step S104 , performing adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on the grayscale stretching low threshold and the grayscale stretching high threshold to obtain an enhanced fluorescent grayscale image.
[0081] In this embodiment, different grayscale stretching high and low thresholds are calculated for different types of fluorescent grayscale images, and then the fluorescent grayscale image to be enhanced is subjected to adaptive contrast stretching according to the corresponding grayscale stretching high and low thresholds.
[0082] The fluorescent grayscale image adaptive enhancement method provided by the present invention automatically determines high and low stretching thresholds for different types of fluorescent grayscale images through fluorescent grayscale image classification, so that different image features can be combined for adaptive enhancement, making image processing more accurate and efficient.
[0083] In some optional implementations, the above step S102, i.e. determining the image category of the fluorescent grayscale image to be enhanced, includes:
[0084] Determine the type of acquisition equipment;
[0085] Based on the type of acquisition equipment, determine a preset empirical value P of the fluorescent grayscale image to be enhanced;
[0086] Calculate the grayscale mean X of the fluorescent grayscale image to be enhanced;
[0087] When the grayscale mean value X is less than the preset empirical value P, it is determined whether the first difference between the preset empirical value P and the grayscale mean value X is less than the first preset value;
[0088] When the first difference is less than the first preset value, it is determined that the fluorescence grayscale image to be enhanced is a low-grayscale fluorescence image;
[0089] When the first difference is greater than or equal to the first preset value, it is determined that the fluorescence grayscale image to be enhanced is a low-grayscale uniform fluorescence image.
[0090] Refer to Figure 2 As shown, first compare the image grayscale mean value X with the preset empirical value P. When using an InGaAs detector for near-infrared fluorescence imaging, the preset empirical value P is obtained by collecting a dark background image with an exposure time of 1 s and statistically calculating its image grayscale mean value X , and setting with an appropriate offset. Taking an 8-bit image as an example, the preset empirical value P in this system is set to 35 (the empirical value is 35 * 256 for a 16-bit image); similarly, when using a CCD detector for visible light fluorescence imaging, the empirical value is obtained by collecting a dark background image with an exposure time of 5 min and statistically calculating its image grayscale mean value X , and setting with an appropriate offset. Taking an 8-bit image as an example, the preset empirical value P in this system is set to 4 (the preset empirical value P for a 16-bit image is 4 * 256). When the image grayscale mean value X is less than the preset empirical value P, it is determined whether the first difference between the preset empirical value P and the image grayscale mean value X is less than the first preset value H, where H = 2 ^ (the number of image bits - 8) (i.e., H = 256 for a 16-bit image). If it is less, it is determined that the fluorescence grayscale image to be enhanced is a low-grayscale fluorescence image; otherwise, it is determined that the fluorescence grayscale image to be enhanced is a low-grayscale uniform fluorescence image.
[0091] In some alternative embodiments, determining the image category of the fluorescence grayscale image to be enhanced includes:
[0092] Obtaining the maximum grayscale value of the fluorescence grayscale image to be enhanced;
[0093] When the grayscale mean value X is greater than or equal to the preset empirical value P, it is determined whether the second difference between the maximum grayscale value maxGrayValue and the grayscale mean value X is less than the preset empirical value P;
[0094] When the second difference is less than the preset empirical value P, it is determined that the fluorescence grayscale image to be enhanced is a high-grayscale uniform fluorescence image;
[0095] When the second difference is greater than or equal to the preset empirical value P, it is determined that the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image.
[0096] In this embodiment, based on the difference between the grayscale mean, the maximum grayscale value and the preset empirical value, the category of the image is automatically determined, so that a suitable enhancement strategy can be selected according to different image features. This can make the image processing more accurate and efficient, while reducing manual intervention and improving the overall processing effect.
[0097] In some optional implementations, the above step S102, i.e., calculating the grayscale stretching low threshold and the grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced based on the image category of the fluorescent grayscale image to be enhanced, includes:
[0098] When the image category of the fluorescent grayscale image to be enhanced is a low grayscale uniform fluorescent image, the grayscale stretching low threshold L is set. t XX / 6, grayscale stretching high threshold H t For: GX;
[0099] When the image category of the fluorescent grayscale image to be enhanced is a low grayscale fluorescent image, the grayscale stretching low threshold L is set. t XX / 6, grayscale stretching high threshold H t is the maximum gray value maxGrayValue of the fluorescent gray image to be enhanced;
[0100] Wherein, X is the grayscale mean, and G is the grayscale level of the fluorescent grayscale image to be enhanced. Regarding the grayscale level of the fluorescent grayscale image to be enhanced, in this embodiment, an 8-bit image is taken as an example, then G=2^8=256 (G=65536 for a 16-bit image).
[0101] In some optional implementations, when the image category of the fluorescent grayscale image to be enhanced is a high grayscale uniform fluorescent image, the grayscale stretching low threshold L is set to t =XX / 2, grayscale stretching high threshold H t is: the maximum value of GX and twice the maximum grayscale value;
[0102] When the image category of the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image, determining a high and low cutoff ratio of the fluorescent grayscale image to be enhanced;
[0103] Truncating the fluorescent grayscale image to be enhanced according to the high and low truncation ratios to obtain a truncated fluorescent grayscale image to be enhanced;
[0104] Determine the minimum grayscale value and the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced;
[0105] Determine the optimal threshold of the fluorescence grayscale image to be enhanced based on the preset iterative threshold method;
[0106] Set the low threshold L of grayscale stretching t to be: G min +|T - G min | / 8, and the high threshold H of grayscale stretching t is the maximum grayscale value of the truncated fluorescence grayscale image to be enhanced;
[0107] If the maximum grayscale value of the truncated fluorescence grayscale image to be enhanced is less than or equal to the low threshold L of grayscale stretching t , then reset the low threshold L of grayscale stretching t to G min ;
[0108] where G min is the minimum grayscale value of the truncated fluorescence grayscale image to be enhanced, and T is the optimal threshold.
[0109] When the image is a high - grayscale fluorescence image or a high - grayscale uniform fluorescence image, as Figure 3 shown.
[0110] Calculate the number of pixels of each grayscale level of the fluorescence grayscale image, and statistically calculate the cumulative distribution function of each grayscale level. Then set the truncation ratio of the fluorescence grayscale image, including the low truncation ratio L tr and the high truncation ratio H tr . In this embodiment, the truncation ratio is set according to the situation of the fluorescence grayscale image. For example: L tr = 5%, H tr = 0.5%. Perform left - and - right truncation on the histogram according to the preset truncation ratio, that is, starting from the lowest pixel grayscale value of the image, truncate and remove a total of L tr *N + Num[0] pixels upwards, where N is the total number of pixels of the fluorescence grayscale image, and Num[0] is the number of pixels with a pixel grayscale value of 0. And starting from the highest pixel grayscale value of the fluorescence grayscale image to be enhanced, truncate and remove a total of H tr *N + Num[G - 1] pixels downwards.
[0111] Judge whether the grayscale difference between the maximum grayscale value maxGrayValue of the fluorescence grayscale image and the image grayscale mean X is less than the preset empirical value P; if (maxGrayValue - X) < P (i.e., when it is a high - grayscale uniform fluorescence image), set the low threshold L t = X - X / 2, and the high threshold H t then take the larger value of G - X and maxGrayValue×2; conversely, when it is a high - grayscale fluorescence image, statistically calculate the minimum grayscale value G min and the maximum grayscale value G max , and through as Figure 4 The flowchart of the iterative threshold method for obtaining the optimal threshold is shown in the figure. The optimal threshold T is calculated and the low threshold L is set. t =G min +|TG min | / 8, high threshold H t =G max , if G max Less than or equal to the lower threshold L t , low threshold L t L t Then reset to G min , that is, L t =G min .
[0112] Regarding the iterative threshold method, first set the initial threshold T, and then determine the part R1 with a grayscale value greater than T and the part R2 less than or equal to 1 in the original fluorescent grayscale image. Then calculate the mean T1 and T2 of R1 and R2, and calculate the new threshold T0, T0 = (T1 + T2) / 2. Determine whether |T0-T| is less than or equal to 0. If so, determine the optimal threshold T. If not, assign T0 to T and start the judgment again. In this way, you can find a threshold that is most suitable for segmentation by continuously iterating and updating the threshold until convergence.
[0113] In this embodiment, the low threshold and high threshold of grayscale stretching are set according to the image category of the fluorescent grayscale image to be enhanced. The low threshold controls the brightness of the darker areas in the image to ensure that these areas will not be overstretched and lose details. The high threshold controls the brightness of the brighter areas in the image to avoid excessive enhancement of the bright areas, resulting in overexposure of the signal or loss of details. By setting reasonable high and low thresholds, the integrity and details of the signal can be maintained while enhancing the contrast of the fluorescent image, making the image more suitable for analysis and observation.
[0114] In some optional implementations, performing adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on a grayscale stretching low threshold and a grayscale stretching high threshold includes:
[0115] In the case where the fluorescent grayscale image to be enhanced is a low-grayscale uniform fluorescent image or a low-grayscale fluorescent image, it is determined whether the number of high grayscale values exceeding a preset high grayscale value in the fluorescent grayscale image to be enhanced is less than one thousandth of the total number of pixels in the fluorescent grayscale image to be enhanced. Specifically, in this embodiment, an 8-bit image can be taken as an example, with a grayscale value range of 0-255, and grayscale values in the fluorescent grayscale image greater than 210 (based on empirical settings, 210*256 for 16-bit images) are determined as high grayscale values, and the image is traversed to count the number of high grayscale values.
[0116] When the number of high gray values is less than one thousandth of the total number of pixels in the fluorescent gray image to be enhanced, adaptive contrast stretching is performed according to the first preset function.
[0117] When the number of high gray values is greater than or equal to one thousandth of the total number of pixels in the fluorescent gray image to be enhanced, or when the fluorescent gray image to be enhanced is a high gray uniform fluorescent image or a high gray fluorescent image, adaptive contrast stretching is performed according to the second preset function.
[0118] Among them, the first preset function is:
[0119]
[0120] The second preset function is:
[0121]
[0122] Among them, f(x, y) is the fluorescence grayscale image to be enhanced, g(x, y) is the enhanced fluorescence grayscale image, L t is the grayscale stretching low threshold, H t is the grayscale stretching high threshold, and G is the grayscale level of the fluorescent grayscale image to be enhanced.
[0123] In this embodiment, different stretching formulas are set according to the image category of the fluorescent grayscale image to be enhanced, and the corresponding high and low thresholds are substituted into the stretching formula to automatically perform adaptive contrast stretching.
[0124] The fluorescent grayscale image adaptive enhancement method provided by the present invention focuses on reducing image noise and improving image quality when the fluorescent grayscale image is judged to be a uniform image, and does not have many effective fluorescent signals and shows a relatively flat grayscale distribution; conversely, it focuses on enhancing the effective fluorescent signal in the fluorescent grayscale image to improve the contrast and signal-to-background ratio of the region of interest in the image. The fluorescent grayscale image adaptive enhancement method can combine image features in different application scenarios, effectively improve the signal-to-background ratio of the region of interest of the fluorescent grayscale image, and reduce image noise, which helps to improve the visualization effect of the fluorescent signal and facilitates the monitoring of the effective fluorescent signal.
[0125] In this embodiment, the original fluorescence grayscale image collected by near-infrared small animal living fluorescence imaging is as follows: Figures 5 to 8 As shown, Figure 5 For low grayscale fluorescence images, Figure 6 For low grayscale uniform fluorescence images, Figure 7 For high grayscale fluorescence images, Figure 8 is a high grayscale uniform fluorescent image. The grayscale image obtained by the adaptive grayscale enhancement method provided by the present invention is as follows: Figures 9 to 12 As shown, Fig. 9 Enhance images for low grayscale fluorescence, Fig.10 For low grayscale uniform fluorescence enhancement images, Fig.11 For high grayscale fluorescence enhancement images, Fig.12 It is a high grayscale uniform fluorescence enhanced image. It can be seen that the enhanced image obtained by the adaptive grayscale enhancement method provided by the present invention effectively improves the image clarity and the signal-to-background ratio of the region of interest, provides a better fluorescence display effect, realizes the enhancement of the grayscale image, and is helpful for fluorescence signal monitoring.
[0126] In this embodiment, a fluorescent grayscale image adaptive enhancement device is also provided, which is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0127] This embodiment provides a fluorescent grayscale image adaptive enhancement device, such as Fig.13 As shown, the device comprises:
[0128] An acquisition module 201 is used to acquire a fluorescent grayscale image to be enhanced;
[0129] A determination module 202 is used to determine the image category of the fluorescent grayscale image to be enhanced, where the image categories include: low grayscale fluorescent image, low grayscale uniform fluorescent image, high grayscale fluorescent image and high grayscale uniform fluorescent image;
[0130] A calculation module 203, configured to calculate a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced based on the image category of the fluorescent grayscale image to be enhanced;
[0131] The enhancement module 204 is used to perform adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on the grayscale stretching low threshold and the grayscale stretching high threshold to obtain an enhanced fluorescent grayscale image.
[0132] In some optional implementations, the determination module 202 includes:
[0133] The determination unit is used to determine the type of acquisition device; based on the type of acquisition device, determine the preset empirical value of the fluorescent grayscale image to be enhanced; calculate the grayscale mean of the fluorescent grayscale image to be enhanced; when the grayscale mean is less than the preset empirical value, determine whether the first difference between the preset empirical value and the grayscale mean is less than the first preset value; when the first difference is less than the first preset value, determine that the fluorescent grayscale image to be enhanced is a low grayscale fluorescent image; when the first difference is greater than or equal to the first preset value, determine that the fluorescent grayscale image to be enhanced is a low grayscale uniform fluorescent image. It is also used to obtain the maximum grayscale value of the fluorescent grayscale image to be enhanced; when the grayscale mean is greater than or equal to the preset empirical value, determine whether the second difference between the maximum grayscale value and the grayscale mean is less than the preset empirical value; when the second difference is less than the preset empirical value, determine that the fluorescent grayscale image to be enhanced is a high grayscale uniform fluorescent image; when the second difference is greater than or equal to the preset empirical value, determine that the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image.
[0134] In some optional implementations, the calculation module 203 includes:
[0135] The threshold determination unit is used to determine the high and low truncation ratios of the fluorescent grayscale image to be enhanced when the image category of the fluorescent grayscale image to be enhanced is a high grayscale fluorescent image; truncate the fluorescent grayscale image to be enhanced according to the high and low truncation ratios to obtain the truncated fluorescent grayscale image to be enhanced; determine the minimum grayscale value and the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced; and determine the optimal threshold of the fluorescent grayscale image to be enhanced based on a preset iterative threshold method.
[0136] In some optional implementations, the enhancement module 204 includes:
[0137] A stretching unit is used to determine whether the number of high grayscale values exceeding a preset high grayscale value in the fluorescent grayscale image to be enhanced is less than one thousandth of the total number of pixels of the fluorescent grayscale image to be enhanced when the fluorescent grayscale image to be enhanced is a low grayscale uniform fluorescent image or a low grayscale fluorescent image; when the number of high grayscale values is less than one thousandth of the total number of pixels of the fluorescent grayscale image to be enhanced, perform adaptive contrast stretching according to a first preset function; when the number of high grayscale values is greater than or equal to one thousandth of the total number of pixels of the fluorescent grayscale image to be enhanced, or when the fluorescent grayscale image to be enhanced is a high grayscale uniform fluorescent image or a high grayscale fluorescent image, perform adaptive contrast stretching according to a second preset function.
[0138] The fluorescent grayscale image adaptive enhancement device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0139] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0140] The embodiment of the present invention also provides a computer device having the above Fig.13 The fluorescent grayscale image adaptive enhancement device shown.
[0141] See also Fig.14 , Fig.14 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.14 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.14 A processor 10 is taken as an example.
[0142] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0143] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0144] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0145] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0146] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0147] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0148] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0149] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for adaptive enhancement of fluorescent grayscale images, characterized in that: The method comprises: Acquire the fluorescence grayscale image to be enhanced; Determine the image category of the fluorescent grayscale image to be enhanced, the image category including: low grayscale fluorescent image, low grayscale uniform fluorescent image, high grayscale fluorescent image and high grayscale uniform fluorescent image; Based on the image category of the fluorescent grayscale image to be enhanced, calculating a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced; Based on the grayscale stretching low threshold and the grayscale stretching high threshold, adaptive contrast stretching is performed on the fluorescent grayscale image to be enhanced to obtain an enhanced fluorescent grayscale image.
2. The method according to claim 1, characterized in that The step of determining the image category of the fluorescent grayscale image to be enhanced comprises: Determine the type of acquisition equipment; Based on the type of the acquisition device, determining a preset empirical value of the fluorescent grayscale image to be enhanced; Calculating the grayscale mean of the fluorescent grayscale image to be enhanced; In the case where the grayscale mean is less than the preset empirical value, determining whether a first difference between the preset empirical value and the grayscale mean is less than a first preset value; When the first difference is less than the first preset value, determining that the fluorescent grayscale image to be enhanced is the low-grayscale fluorescent image; When the first difference is greater than or equal to the first preset value, it is determined that the fluorescent grayscale image to be enhanced is the low-grayscale uniform fluorescent image.
3. The method according to claim 2, characterized in that The step of determining the image category of the fluorescent grayscale image to be enhanced comprises: Acquire the maximum grayscale value of the fluorescent grayscale image to be enhanced; In the case where the grayscale mean is greater than or equal to the preset empirical value, determining whether a second difference between the maximum grayscale value and the grayscale mean is less than the preset empirical value; When the second difference is less than the preset empirical value, determining that the fluorescent grayscale image to be enhanced is the high grayscale uniform fluorescent image; When the second difference is greater than or equal to the preset empirical value, it is determined that the fluorescent grayscale image to be enhanced is the high grayscale fluorescent image.
4. The method according to claim 3, characterized in that: The calculating, based on the image category of the fluorescent grayscale image to be enhanced, a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced comprises: In the case where the image category of the fluorescent grayscale image to be enhanced is the low grayscale uniform fluorescent image, the grayscale stretching low threshold L t =XX / 6, the grayscale stretching high threshold H t For: GX; In the case where the image category of the fluorescent grayscale image to be enhanced is the low grayscale fluorescent image, the grayscale stretching low threshold L t =XX / 6, the grayscale stretching high threshold H t is the maximum grayscale value of the fluorescent grayscale image to be enhanced; Wherein, X is the grayscale mean, and G is the grayscale level of the fluorescent grayscale image to be enhanced.
5. The method according to claim 4, characterized in that In the case where the image category of the fluorescent grayscale image to be enhanced is the high grayscale uniform fluorescent image, the grayscale stretching low threshold L t =XX / 2, the grayscale stretching high threshold H t is: the maximum value of GX and twice the maximum grayscale value; In a case where the image category of the fluorescent grayscale image to be enhanced is the high grayscale fluorescent image, determining a high and low truncation ratio of the fluorescent grayscale image to be enhanced; Truncating the fluorescent grayscale image to be enhanced according to the high and low truncation ratios to obtain a truncated fluorescent grayscale image to be enhanced; Determining the minimum grayscale value and the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced; Determining the optimal threshold of the fluorescent grayscale image to be enhanced based on a preset iterative threshold method; The grayscale stretching low threshold L t For: G min +|TG min | / 8, the grayscale stretching high threshold H t is the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced; If the maximum grayscale value of the truncated fluorescent grayscale image to be enhanced is less than or equal to the grayscale stretching low threshold L t , then the grayscale is stretched to a low threshold value L t Reset to G min ; Among them, G min is the minimum grayscale value of the truncated fluorescent grayscale image to be enhanced, and T is the optimal threshold.
6. The method according to claim 1, characterized in that The step of performing adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on the grayscale stretching low threshold and the grayscale stretching high threshold comprises: In a case where the fluorescent grayscale image to be enhanced is the low-grayscale uniform fluorescent image or the low-grayscale fluorescent image, determining whether the number of high grayscale values exceeding a preset high grayscale value in the fluorescent grayscale image to be enhanced is less than one thousandth of the total number of pixels in the fluorescent grayscale image to be enhanced; When the number of high gray values is less than one thousandth of the total number of pixels of the fluorescent gray image to be enhanced, performing adaptive contrast stretching according to a first preset function; When the number of high gray values is greater than or equal to one thousandth of the total number of pixels of the fluorescent gray image to be enhanced, or when the fluorescent gray image to be enhanced is the high gray uniform fluorescent image or the high gray fluorescent image, performing adaptive contrast stretching according to a second preset function; Wherein, the first preset function is: The second preset function is: Wherein, f(x, y) is the fluorescent grayscale image to be enhanced, g(x, y) is the fluorescent grayscale image after enhancement, L t is the grayscale stretching low threshold, H t is the grayscale stretching high threshold, and G is the grayscale level of the fluorescent grayscale image to be enhanced.
7. A fluorescent grayscale image adaptive enhancement device, characterized in that: The device comprises: An acquisition module, used for acquiring the fluorescent grayscale image to be enhanced; A determination module, used to determine the image category of the fluorescent grayscale image to be enhanced, wherein the image category includes: low grayscale fluorescent image, low grayscale uniform fluorescent image, high grayscale fluorescent image and high grayscale uniform fluorescent image; A calculation module, configured to calculate a grayscale stretching low threshold and a grayscale stretching high threshold corresponding to the fluorescent grayscale image to be enhanced based on the image category of the fluorescent grayscale image to be enhanced; The enhancement module is used to perform adaptive contrast stretching on the fluorescent grayscale image to be enhanced based on the grayscale stretching low threshold and the grayscale stretching high threshold to obtain an enhanced fluorescent grayscale image.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for adaptively enhancing a fluorescent grayscale image according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the fluorescent grayscale image adaptive enhancement method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the method for adaptively enhancing a fluorescent grayscale image according to any one of claims 1 to 6.