CN116228574A - Gray image processing method and device - Google Patents
Gray image processing method and device Download PDFInfo
- Publication number
- CN116228574A CN116228574A CN202310091645.XA CN202310091645A CN116228574A CN 116228574 A CN116228574 A CN 116228574A CN 202310091645 A CN202310091645 A CN 202310091645A CN 116228574 A CN116228574 A CN 116228574A
- Authority
- CN
- China
- Prior art keywords
- image
- threshold
- gray
- value
- max
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 29
- 238000013507 mapping Methods 0.000 claims description 35
- 238000012545 processing Methods 0.000 claims description 24
- 230000015654 memory Effects 0.000 claims description 21
- 230000006870 function Effects 0.000 claims description 15
- 230000003321 amplification Effects 0.000 claims description 9
- 238000003199 nucleic acid amplification method Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 8
- 238000000034 method Methods 0.000 abstract description 14
- 230000000694 effects Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 229910000530 Gallium indium arsenide Inorganic materials 0.000 description 4
- 230000009466 transformation Effects 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 230000001186 cumulative effect Effects 0.000 description 3
- 238000005315 distribution function Methods 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 238000002073 fluorescence micrograph Methods 0.000 description 2
- 238000003707 image sharpening Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- KXNLCSXBJCPWGL-UHFFFAOYSA-N [Ga].[As].[In] Chemical compound [Ga].[As].[In] KXNLCSXBJCPWGL-UHFFFAOYSA-N 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000004069 differentiation Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000000799 fluorescence microscopy Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005057 refrigeration Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
- G06T5/94—Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Facsimile Image Signal Circuits (AREA)
- Image Processing (AREA)
Abstract
The invention provides a gray image processing method and a device, wherein the method comprises the following steps: acquiring original gray data of a first image; based on a preset high cut-off ratio, a preset low cut-off ratio and original gray data, removing pixels of the first image, determining a maximum gray value and a minimum gray value in gray values of residual pixels of the first image, and taking the maximum gray value as a white field threshold value and the minimum gray value as a black field threshold value; and when the maximum gray value of the first image is larger than the first preset multiple of the gray level of the first image and when the maximum gray value of the first image is smaller than or equal to the first preset multiple of the gray level of the first image, respectively carrying out reproduction determination on the gray values of the pixels of the first image so as to obtain the target image. The contrast of the first image can be sufficiently improved and the overexposure of part of the fluorescent signal due to the overexposure of the first image is reduced.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a gray level image processing method and device.
Background
Fluorescence imaging analysis is a visual analysis technology widely applied to living animal imaging at present, and can acquire fluorescence images through an infrared indium gallium arsenide (InGaAs) camera and further research and analysis are carried out by analyzing fluorescence signals detected in the fluorescence images.
The contrast of the fluorescence gray-scale image collected in the prior art is often not high, and a gray-scale stretching method is generally adopted to improve the contrast of the fluorescence gray-scale image, that is, only image data in a specified gray-scale range is reserved, for example: the gray values below a are set to zero and the gray values above b are set to the gray level of the image. However, this stretching method may suffer from the problem of overexposure of a portion of the fluorescent signal by overextensing the image.
Disclosure of Invention
Therefore, the invention aims to solve the technical problem that the stretching method in the prior art can cause overexposure of partial fluorescence signals due to excessive stretching of an image, thereby providing a gray level image processing method and a gray level image processing device.
According to a first aspect, an embodiment of the present invention provides a gray image processing, including the steps of: acquiring original gray data of a first image, wherein the original gray data comprises gray values corresponding to pixels of the first image;
based on a preset high cut-off ratio, a preset low cut-off ratio and the original gray data, the first image is processedCounting the gray values of the residual pixels of the first image, determining the maximum gray value and the minimum gray value in the gray values of the residual pixels of the first image, and taking the maximum gray value as a white field threshold G max The minimum gray value is used as a black field threshold G min ;
When the maximum gray value of the first image is larger than the first preset multiple of the gray level of the first image, the first image is smaller than or equal to the black field threshold G min The gray value of the pixel of (2) is set to be a first gray value which is larger than the black field threshold G min And is smaller than the white field threshold G max According to the gray value of the pixel of the white field threshold G max The black field threshold G min Determining that the white field threshold G is greater than or equal to max Setting the gray value of the pixel of the image sensor to be a second gray value to obtain a target image;
when the maximum gray level of the first image is less than or equal to a first preset multiple of the gray level of the first image, the first image is less than or equal to the black field threshold G min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min According to the maximum gray value of the first image and the black field threshold G min And determining to obtain a target image.
Optionally according to the white field threshold G max The black field threshold G min Determining that the black field threshold G is greater than min And is smaller than the white field threshold G max Gray values of pixels of (1), comprising:
determining that the black field threshold G is greater than min And is smaller than the white field threshold G max Intermediate threshold G of (2) mid And determines the intermediate threshold G mid Corresponding intermediate mapping gray values;
greater than the black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min Determining that it is greater than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max And (5) determining.
Optionally, the determination is greater than the black field threshold G min And is smaller than the white field threshold G max Intermediate threshold G of (2) mid Comprising:
judging whether the second preset multiple of the optimal threshold value is in (G) min ,G max ) In the range, the optimal threshold is a threshold obtained after iterative calculation of the gray value of the pixel in the first image;
if the second preset multiple of the optimal threshold is at (G min ,G max ) Within the range, taking the value of the second preset multiple of the optimal threshold value as the intermediate threshold value G mid ;
If the second preset multiple of the optimal threshold value is not (G min ,G max ) Within the range, determining whether the optimal threshold is within (G min ,G max ) Within the range;
if the optimal threshold is at (G min ,G max ) Within the range, the optimal threshold value is compared with the white field threshold value G max As said intermediate threshold G mid ;
If the optimal threshold is not (G) min ,G max ) Within the range, the black field threshold G min And the white field threshold G max As said intermediate threshold G mid 。
Optionally, the optimal threshold is determined by:
setting an initial threshold T;
determining a gray value corresponding to a first pixel R1 larger than the initial threshold T and a gray value corresponding to a second pixel R2 smaller than or equal to the initial threshold T in the original gray data;
calculating a first average value of gray values corresponding to the first pixel R1 and a second average value of gray values corresponding to the second pixel R2;
calculating an average value of the first average value and the second average value to obtain a third average value;
judging whether the difference value between the third average value and the initial threshold value T is in a preset range or not;
if yes, determining the initial threshold T as the optimal threshold;
otherwise, taking the third average value as the initial threshold value T, and re-executing the steps to determine whether the new initial threshold value T is the optimal threshold value.
Optionally, the intermediate mapped gray value is determined by:
calculating an initial mapped gray value V using a first predetermined function mid The first preset function is the white field threshold G max Black field threshold G min Said intermediate threshold G mid And a relationship function between gray levels of the first image;
mapping the initial gray value V mid And taking the third preset multiple of the intermediate mapping gray value as the intermediate mapping gray value.
Optionally, the first preset function is:
wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, V mid For the initial mapped gray value, M is the gray level of the first image.
Optionally, the gray image processing method further includes:
acquiring a dark background image, and calculating an average value of gray values of pixels of the dark background image;
calculating an analog amplification value, wherein the analog amplification value is the ratio of the gray level of the first image to the maximum gray value Max of the first image;
calculating the background value of the first image according to the average value of the gray values of the pixels of the dark background image and the analog amplification value;
said being greater than said black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min Determining that it is greater than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max Determining, including:
greater than the black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min And the background value of the first image is determined to be larger than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max And determining a background value of the first image.
Optionally, the gray image processing method further includes: carrying out Laplacian sharpening on the target image to obtain a second image; and superposing the target image with the second image or the product of the target image and the sharpening coefficient of the second image to obtain the sharpened target image.
Optionally, when the maximum gray value of the first image is greater than the first preset multiple of the gray level of the first image, determining the target image by the following formula:
determining the target image by the following formula when the maximum gray value of the first image is smaller than or equal to a first preset multiple of the gray level of the first image:
Wherein G is max Is the Bai Chang threshold value, G min And (2) for the black field threshold, max is the maximum gray value of the first image, M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
Optionally, when the maximum gray value of the first image is greater than the first preset multiple of the gray level of the first image, determining the target image by the following formula:
wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, G point And mapping gray values to the middle, wherein M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
According to a second aspect, an embodiment of the present invention provides a grayscale image processing apparatus including:
the acquisition module is used for acquiring original gray data of the first image, wherein the original gray data comprises gray values corresponding to pixels of the first image;
a rejection module, configured to reject pixels of the first image based on a preset high cut-off ratio, a preset low cut-off ratio, and the original gray data, count gray values of remaining pixels of the first image, determine a maximum gray value and a minimum gray value of the gray values of the remaining pixels of the first image, and use the maximum gray value as a white field threshold G max The minimum gray value is used as a black field threshold G min ;
A first generation module for generating a first image when the maximum gray value of the first image is greater than the first imageWhen the gray level of the image is a first preset multiple, the black field threshold G is smaller than or equal to the first image min The gray value of the pixel of (2) is set to be a first gray value which is larger than the black field threshold G min And is smaller than the white field threshold G max According to the gray value of the pixel of the white field threshold G max The black field threshold G min Determining that the white field threshold G is greater than or equal to max Setting the gray value of the pixel of the image sensor to be a second gray value to obtain a target image;
a second generation module configured to, when the maximum gray level of the first image is equal to or less than a first preset multiple of the gray level of the first image, reduce the first image to or less than the black field threshold G min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min According to the maximum gray value of the first image and the black field threshold G min And determining to obtain a target image.
According to a third aspect, an embodiment of the present invention provides a computer device, comprising: the gray image processing device comprises a memory and a processor, wherein the memory and the processor are in communication connection, the memory stores computer instructions, and the processor executes the computer instructions, so that the gray image processing method is executed.
According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer instructions for causing the computer to execute the above-described grayscale image processing method.
The technical scheme of the invention has the following advantages:
in the embodiment of the invention, the two conditions that the first image has a higher effective fluorescent signal and has no higher effective fluorescent signal are fully considered. When the more effective fluorescent signal exists, the gray value of each pixel of the first image is redetermined according to three threshold intervals which are respectively smaller than the black field threshold G min Greater than the black field threshold G min And is less than Bai Chang threshold G max Greater than the white field threshold G max The contrast of the first image can be sufficiently improved; when the higher effective fluorescent signal does not exist, the gray value of each pixel of the first image is determined according to two threshold intervals which are respectively smaller than the black field threshold G min And greater than the black field threshold G min And takes the maximum gray value Max of the first image as the white field threshold G max And the calculation is performed, so that the situation that part of fluorescent signals are excessively exposed due to the fact that the first image is excessively stretched is avoided, and the observation effect is improved. In this embodiment, the maximum gray value and the minimum gray value in the gray values of the remaining pixels of the first image are determined again according to the preset high cut-off ratio and the preset low cut-off ratio, and the maximum gray value in the gray values of the remaining pixels is used as the white field threshold G max Minimum gray value as black field threshold G min Further according to the redetermined white field threshold G max And black field threshold G min The gray value of each pixel of the first image is redetermined, so that the overexposure phenomenon of the target image is reduced, the overall brightness of the target image is improved, and the enhancement processing of the first image is realized. In addition, in the embodiment, the stretching threshold can be effectively determined by adopting an automatic tone algorithm without self-defining the stretching gray value, the overexposure phenomenon is reduced, and the weak fluorescence signal in the fluorescence gray image is better enhanced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a specific example of a grayscale image processing method in embodiment 1 of the present application;
FIG. 2 is a functional diagram showing a specific example of the conventional gray-scale image stretching method in embodiment 1 of the present application;
Fig. 3 is a schematic diagram showing a specific example of the fluorescent low-gray-scale image as the first image in embodiment 1 of the present application;
fig. 4 is a schematic diagram showing a specific example in which the first image is a fluorescence high-gray-scale image in embodiment 1 of the present application;
fig. 5 is a schematic diagram of a specific example of the first image processed as a fluorescent low-gray image in embodiment 1 of the present application;
fig. 6 is a schematic diagram of a specific example of the first image processed as a fluorescent high gray scale image in embodiment 1 of the present application;
FIG. 7 is a functional diagram showing a specific example of the stretching transformation of the fluorescent low gray scale image in embodiment 1 of the present application;
FIG. 8 is a functional diagram showing a specific example of the stretching transformation of the fluorescence high gray scale image in embodiment 1 of the present application;
FIG. 9 is a flowchart of a specific example of determining the intermediate threshold in embodiment 1 of the present application;
FIG. 10 is a flowchart of a specific example of determining the optimal threshold in embodiment 1 of the present application;
fig. 11 is a flowchart of a specific example of the first image processing procedure in embodiment 1 of the present application;
fig. 12 is a schematic block diagram of a specific example of a gradation image processing apparatus in embodiment 2 of the present application;
fig. 13 is a schematic structural diagram of a specific example of a computer device in embodiment 3 of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; the two components can be directly connected or indirectly connected through an intermediate medium, or can be communicated inside the two components, or can be connected wirelessly or in a wired way. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
In addition, the technical features of the different embodiments of the present invention described below may be combined with each other as long as they do not collide with each other.
Example 1
The present embodiment provides a grayscale image processing method that can be executed by a device such as a server or a terminal, and that performs processing of a grayscale image by performing pixel truncation, threshold determination, discrimination, and output of a target image by the device such as the server or the terminal, as shown in fig. 1, including the steps of:
step S101, obtaining original gray data of a first image, where the original gray data includes gray values corresponding to pixels of the first image.
The conventional gray scale image stretching method is to self-define and stretch gray scale values in a certain gray scale interval, that is, gray scale values in a range of [ a, b ] in an image can be stretched to a range of [ c, d ], as shown in fig. 2, mf is the gray scale of an f (x, y) image, and Mg is the gray scale of a g (x, y) image. In practice, only image data in a specified gray scale range is usually reserved, i.e. the gray scale value lower than a is set to zero, and the gray scale value higher than b is set to the gray scale of the image (for example, the 8-bit image is set to 255), so as to highlight the effective fluorescence signal. In the embodiment of the invention, the automatic tone scale algorithm can be adopted to stretch the fluorescence gray scale image, which is specifically as follows.
The first image may be a fluorescent gray scale image, as shown in fig. 3 or fig. 4, wherein the first image in fig. 3 is a fluorescent low gray scale image and the first image in fig. 4 is a fluorescent high gray scale image. And carrying out histogram statistics on the first image, and calculating the number of pixels of each gray level in the first image and a cumulative distribution function of each gray level. Illustrating: taking the first image as an 8-bit image as an example, the gray level of the first image is 255, the gray value of the first image is 0-255, and the number of pixels corresponding to each gray value and the cumulative distribution function are counted for cutting off the pixels of the first image. The original gray data may include a gray value corresponding to each pixel in the first image, and may further include the number of pixels corresponding to each gray value and a cumulative distribution function.
Step S102, based on the preset high cut-off ratio, the preset low cut-off ratio and the original gray data, eliminating the pixels of the first image, counting the gray values of the remaining pixels of the first image, determining the maximum gray value and the minimum gray value of the gray values of the remaining pixels of the first image, and taking the maximum gray value as a white field threshold G max The minimum gray value is used as a black field threshold G min 。
Setting a cut-off ratio including a preset high cut-off ratio C high With a preset low cut-off ratio C low And eliminating pixels corresponding to part of smaller gray values and pixels corresponding to part of larger gray values in the first image. In this embodiment, a low cut-off ratio C is preset low Can be set to 5 percent and preset a high cut-off proportion C high May be set to 0.5% and the histogram of the first image is truncated left and right. Illustrating: setting the total number of pixels of the first image as N and the number of pixels with gray scale value of 0 as N0]From the most of the first imageThe total number of the up-culling from the low pixel gray value is C low *N+N[0]Is a pixel of (1); let the number of pixels with gray level as the pixel gray level be N [ gray level ]]Then the total number of downscales is C from the highest pixel gray value of the first image high * n+N [ gray level ]]Is a pixel of (c). That is, the number N [0 ] of pixels with a pixel gray value of 0 can be removed first]On the basis of the residual pixels, according to a preset low cut-off ratio C low Then reject C upwards low * N. Further, C high * n+N [ gray level ]]And the same is true.
After the pixels of the first image are removed, determining the maximum gray value and the minimum gray value in the gray values of the residual pixels, and taking the maximum gray value in the gray values of the residual pixels as a white field threshold G max Minimum gray value as black field threshold G min . In this embodiment, the maximum gray value of the gray values of the remaining pixels is not the same gray value as the maximum gray value Max of the first image.
Step S103, when the maximum gray level Max of the first image is greater than the first preset multiple of the gray level M of the first image, making the first image smaller than or equal to the black field threshold G min The gray value of the pixel of (2) is set to be a first gray value which is larger than the black field threshold G min And is smaller than the white field threshold G max According to the gray value of the pixel of the white field threshold G max The black field threshold G min Determining that the white field threshold G is greater than or equal to max The gray value of the pixel of (c) is set to the second gray value to obtain the target image.
In this embodiment, the first preset multiple may be less than 1, for example, may be 0.6, and when the maximum gray value Max of the first image is greater than 0.6 times the gray level M of the first image, it may be set that a higher effective fluorescent signal exists in the first image, as shown in fig. 4. For example, the gray value of each pixel of the first image may be redetermined by formula (1) to obtain the target image.
Wherein G is max Is the Bai Chang threshold value, G min And (2) for the black field threshold, max is the maximum gray value of the first image, M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image. In this embodiment, the first gray value may be 0, and the second gray value may be 255.
Step S104, when the maximum gray level Max of the first image is less than or equal to a first preset multiple of the gray level M of the first image, the first image is less than or equal to the black field threshold G min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min According to the maximum gray value of the first image and the black field threshold G min And determining to obtain a target image.
In this embodiment, it may be set that when the maximum gray value Max of the first image is equal to or less than 0.6 times the gray level M of the first image, it is considered that there is no higher effective fluorescent signal in the first image, as shown in fig. 3. The maximum gray value Max of the first image can be used as the white field threshold G max The gray values of the pixels of the first image can be redetermined by formula (2) to obtain the target image.
Wherein G is min And (2) for the black field threshold, max is the maximum gray value of the first image, M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image. The fluorescence low gray image stretching transformation function is shown in fig. 7.
In this embodiment, the two cases when the first image has a higher effective fluorescent signal and no higher effective fluorescent signal are fully considered. When there is a higher effective fluorescence signal, then the gray of each pixel of the first imageThe degree value is redetermined according to three threshold intervals, which are respectively smaller than the black field threshold G min Greater than the black field threshold G min And is less than Bai Chang threshold G max Greater than the white field threshold G max The contrast of the first image can be sufficiently improved; when the higher effective fluorescent signal does not exist, the gray value of each pixel of the first image is determined according to two threshold intervals which are respectively smaller than the black field threshold G min And greater than the black field threshold G min And takes the maximum gray value Max of the first image as the white field threshold G max And the calculation is performed, so that the situation that part of fluorescent signals are excessively exposed due to the fact that the first image is excessively stretched is avoided, and the observation effect is improved. In this embodiment, the maximum gray value and the minimum gray value in the gray values of the remaining pixels of the first image are determined again according to the preset high cut-off ratio and the preset low cut-off ratio, and the maximum gray value in the gray values of the remaining pixels is used as the white field threshold G max Minimum gray value as black field threshold G min Further according to the redetermined white field threshold G max And black field threshold G min The gray value of each pixel of the first image is redetermined, so that the overexposure phenomenon of the target image is reduced, the overall brightness of the target image is improved, and the enhancement processing of the first image is realized. In addition, in the embodiment, the stretching threshold can be effectively determined by adopting an automatic tone algorithm without self-defining the stretching gray value, the overexposure phenomenon is reduced, and the weak fluorescence signal in the fluorescence gray image is better enhanced.
The first image can be a near infrared living animal fluorescent image acquired by a scientific research grade deep refrigeration infrared InGaAs (InGaAs) camera, and can also be other types of gray scale images.
As an alternative implementation manner, in the embodiment of the present invention, according to the white field threshold G max The black field threshold G min Determining that the black field threshold G is greater than min And is smaller than the white field threshold G max Image of (2)Gray values of the elements, comprising:
determining that the black field threshold G is greater than min And is smaller than the white field threshold G max Intermediate threshold G of (2) mid And determines the intermediate threshold G mid Corresponding intermediate mapping gray values;
the black field threshold G or less in the first image min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min Determining that it is greater than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max Determining that the white field threshold G is greater than or equal to max The gray value of the pixel of (c) is set to the second gray value, and a target image is obtained.
When there is a higher effective fluorescence signal in the first image, the image may be stretched in the same proportion, so in order to further reduce the excessive enhancement of the partial fluorescence signal generated after stretching the first image, in this embodiment, the intermediate threshold G may be set mid The gray value of each pixel in the first image is further determined. The gray value of each pixel of the first image can be redetermined by the formula (3) to obtain the target image.
Wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, G point And mapping gray values to the middle, wherein M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image. Fluorescence high gray scale image stretchingThe transformation function is shown in fig. 8.
In the present embodiment, by setting the intermediate threshold G mid Dividing the gray value of each pixel of the first image into four sections which are respectively smaller than the black field threshold G min Greater than the black field threshold G min And is smaller than the intermediate threshold G mid Greater than the intermediate threshold G mid And is less than Bai Chang threshold G max And greater than the white field threshold G max The phenomenon of excessive enhancement is avoided by stretching the image in the same proportion, and the phenomenon that the original high-gray-scale effective fluorescent signal becomes a larger noise point due to excessive enhancement is avoided, so that the monitoring effect of the fluorescent signal is influenced. The condition of overexposure of partial fluorescent signals in the target image is further reduced, and the contrast of the first image is sufficiently improved.
As an alternative implementation, as shown in FIG. 9, in the embodiment of the present invention, the determination is greater than the black field threshold G min And is smaller than the white field threshold G max Intermediate threshold G of (2) mid Comprising:
judging the optimal threshold G t Whether or not the second preset multiple of (2) is at (G) min ,G max ) Within the range, the optimal threshold G t A threshold value obtained after iterative calculation is carried out on the gray value of the pixel in the first image;
wherein the optimal threshold G t The second preset multiple of (2) may be the optimal threshold G t 1.5 times of (i.e., c1=g) t *1.5, judging whether C1 is in (G min ,G max ) Within the range.
If the optimal threshold G t Is at (G) min ,G max ) Within the range, the optimal threshold G t As said intermediate threshold G mid The method comprises the steps of carrying out a first treatment on the surface of the That is, C1 is taken as the intermediate threshold G mid 。
If the optimal threshold G t Is not within (G) min ,G max ) Within the range, judging the optimal threshold G t Whether or not it is at (G) min ,G max ) Range (2)A surrounding inner part;
if the optimal threshold G t At (G) min ,G max ) Within the range, the optimal threshold G t And the white field threshold G max As said intermediate threshold G mid The method comprises the steps of carrying out a first treatment on the surface of the That is, C2 is taken as the intermediate threshold G mid Wherein c2= (G t +G max )/2。
If the optimal threshold G t Is not at (G) min ,G max ) Within the range, the black field threshold G min And the white field threshold G max As said intermediate threshold G mid The method comprises the steps of carrying out a first treatment on the surface of the That is, C3 is taken as the intermediate threshold G mid Wherein c3= (G min +G max )/2。
In this embodiment, the range of the optimal threshold is fully considered, so that an appropriate intermediate threshold is determined according to the optimal threshold, the threshold interval of the gray value is re-divided according to the intermediate threshold, and finally, the target image is determined according to the threshold interval, so that the phenomenon of excessive enhancement caused by stretching the image in the same proportion is avoided.
As an alternative implementation, as shown in FIG. 10, in the embodiment of the present invention, the optimal threshold G is determined by the following steps t :
Setting an initial threshold T;
determining a gray value corresponding to a first pixel R1 larger than the initial threshold T and a gray value corresponding to a second pixel R2 smaller than or equal to the initial threshold T in the original gray data;
calculating a first average value T1 of gray values corresponding to the first pixel R1 and a second average value T2 of gray values corresponding to the second pixel R2;
calculating the average value of the first average value T1 and the second average value T2 to obtain a third average value T3;
judging whether the difference value between the third average value T3 and the initial threshold value T is in a preset range or not;
if so, determining the initial threshold T as the optimal threshold G t 。
If the difference between the third average value T3 and the initial threshold T is not within the preset range, the initial threshold T is changed, and the step is re-executed to determine whether the new initial threshold T is the optimal threshold.
In this embodiment, the optimal threshold is determined through iterative calculation, and further, the intermediate threshold can be determined according to the optimal threshold, so as to avoid the phenomenon of excessive enhancement caused by stretching the image in the same proportion.
As an alternative implementation manner, in the embodiment of the present invention, the intermediate mapping gray value G is determined by the following steps point :
Calculating an initial mapped gray value V using a first predetermined function mid The first preset function is the white field threshold G max Black field threshold G min Said intermediate threshold G mid And a relationship function between gray levels of the first image;
mapping the initial gray value V mid As the third preset multiple of the intermediate mapping gray value G point . In this embodiment, the third preset multiple may be 1.2.
As an optional implementation manner, in the embodiment of the present invention, the first preset function is formula (8):
wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, V mid For the initial mapped gray value, M is the gray level of the first image.
As an alternative implementation manner, in the embodiment of the present invention, the white field threshold G is determined max And the black field threshold G min Thereafter, before stretching the first image, further comprising:
acquiring a dark background image and calculating the gray of each pixel of the dark background imageAverage value G of degree values aver ;
Calculating an analog amplification value amp, wherein the analog amplification value amp is the ratio of the gray level M of the first image to the maximum gray level Max of the first image;
average value G of gray values of pixels according to the dark background image aver Calculating a background value dark of the first image with the analog amplification value amp;
said being greater than said black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min Determining that it is greater than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max Determining, including:
the black field threshold G or less in the first image min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min And the background value of the first image is determined to be larger than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max And determining a background value of the first image to be greater than or equal to the white field threshold G max Setting the gray value of the pixel of (2) to be the second gray value to obtain a target image; the gray value of each pixel of the first image can be redetermined by the formula (4) to obtain the target image. The image after the fluorescent high gray-scale image is processed and sharpened according to formula (4) is shown in fig. 6.
Wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, G point And (3) mapping gray values to the middle, wherein dark is the background value of the first image, M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
When the maximum gray value of the first image is smaller than or equal to a first preset multiple of the gray level of the first image, setting the gray value of the pixel smaller than or equal to the black field threshold value in the first image as the first gray value, wherein the gray value of the pixel larger than the black field threshold value is according to the maximum gray value of the first image and the black field threshold value G min And determining the background value of the first image to obtain a target image. The gray value of each pixel of the first image can be redetermined by the formula (5) to obtain the target image. The image after the fluorescent low gray image is processed and sharpened according to formula (5) is shown in fig. 5.
Wherein G is min The black field threshold value is set as dark, the dark is the background value of the first image, the Max is the maximum gray value of the first image, the M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
In practical applications, if the background of the first image is stretched at the same time, the processing efficiency of the image is reduced, and there are cases in which there is excessive stretching in the background of the target image output after processing, and there is visual interference.
In this embodiment, before stretching the first image, the background of the first image may be removed by adaptive dark background processing, and only the gray value between the black field threshold and the white field threshold is stretched, so that unnecessary stretching processing on the background of the first image may be avoided, and the later image stretching effect may be better balanced. In this embodiment, the background value dark of the first image preferably takes only half of the background value dark, and the output target image is better.
As an optional implementation manner, in an embodiment of the present invention, the gray scale image processing method further includes: carrying out Laplacian sharpening on the target image to obtain a second image;
and superposing the target image with the second image or the product of the target image and the sharpening coefficient of the second image to obtain the sharpened target image.
Aiming at fog noise on the first image due to uneven illumination, thermal effect and the like, the display effect of the first image is further optimized, defogging operation can be carried out through an image sharpening algorithm after the first image is stretched in contrast, the edge and gray level jump part of the image are enhanced, the outline of the image is compensated, and the image is clearer.
In this embodiment, the details of the stretched target image may be highlighted by using a Laplacian sharpening algorithm of second order differentiation, and the Laplacian of the two-dimensional function may be formula (6)
Sharpening the target image g (x, y) and the second image after the Laplacian sharpening processThe superposition can not only keep the background information of the image, but also sharpen and strengthen the stretched target image. In order to optimize the image sharpening effect, an adjustable sharpening coefficient s can be used, which is +_ associated with the second image >After multiplication, the target image g (x, y) is superimposed, and finally the sharpened target image h (x, y) is obtained, and the calculation formula of the sharpened target image h (x, y) is shown in the following formula (7)
The sharpening coefficient s is reasonable in value, and if the value of s is too large, the image contour can overshoot; if the value of s is too small, the sharpening effect of the image is not obvious.
As shown in fig. 11, in an embodiment of the present invention, the above-mentioned dark background removal may be performed on the first image, the contrast stretching may be performed according to a threshold value, the first image may be enhanced, the stretched image may be further sharpened, so as to correct the stretched image, and finally the sharpened target image may be output. The method not only can improve the processing efficiency of the image, improve the contrast of the first image and avoid excessive enhancement, but also can enhance the edge of the first image so that the outline is clearer.
In this embodiment, as an alternative implementation manner, when the maximum gray value of the first image is greater than the first preset multiple of the gray level of the first image, the target image is determined by the following formula (1):
determining the target image by the following formula (2) when the maximum gray value of the first image is equal to or less than a first preset multiple of the gray level of the first image:
Wherein G is max Is saidWhite field threshold, G min And (2) for the black field threshold, max is the maximum gray value of the first image, M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
As an alternative implementation manner, in an embodiment of the present invention, when the maximum gray value of the first image is greater than a first preset multiple of the gray level of the first image, the target image is determined by the following formula (3):
wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, G point And mapping gray values to the middle, wherein M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
Example 2
The present embodiment provides a grayscale image processing apparatus that can be used to execute the grayscale image processing method in embodiment 1 described above, the apparatus can be provided inside a server or other devices, and the modules cooperate with each other to realize the processing of a grayscale image, as shown in fig. 12, the apparatus includes:
An obtaining module 201, configured to obtain original gray data of a first image, where the original gray data includes gray values corresponding to pixels of the first image;
a rejection module 202, configured to reject pixels of the first image based on a preset high cut-off ratio, a preset low cut-off ratio, and the original gray data, count gray values of remaining pixels of the first image, determine a maximum gray value and a minimum gray value of the gray values of the remaining pixels of the first image, and use the maximum gray value as a white field threshold G max The minimum gray value is used as a black field threshold G min ;
A first generation module 203 for generating the first image to be less than or equal to the black field threshold G when the maximum gray level of the first image is greater than a first preset multiple of the gray level of the first image min The gray value of the pixel of (2) is set to be a first gray value which is larger than the black field threshold G min And is smaller than the white field threshold G max According to the gray value of the pixel of the white field threshold G max The black field threshold G min Determining that the white field threshold G is greater than or equal to max Setting the gray value of the pixel of the image sensor to be a second gray value to obtain a target image;
a second generation module 204 configured to, when the maximum gray level of the first image is equal to or less than a first preset multiple of the gray level of the first image, reduce the first image to or less than the black field threshold G min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min According to the maximum gray value of the first image and the black field threshold G min And determining to obtain a target image.
In this embodiment, the two cases when the first image has a higher effective fluorescent signal and no higher effective fluorescent signal are fully considered. When the more effective fluorescent signal exists, the gray value of each pixel of the first image is redetermined according to three threshold intervals which are respectively smaller than the black field threshold G min Greater than the black field threshold G min And is less than Bai Chang threshold G max Greater than the white field threshold G max The contrast of the first image can be sufficiently improved; when the higher effective fluorescent signal does not exist, the gray value of each pixel of the first image is determined according to two threshold intervals which are respectively smaller than the black field threshold G min And greater than the black field threshold G min And takes the maximum gray value Max of the first image as the white field threshold G max And the calculation is performed, so that the situation that part of fluorescent signals are excessively exposed due to the fact that the first image is excessively stretched is avoided, and the observation effect is improved. In this embodiment, the remaining pixels of the first image are determined again according to the preset high cut-off ratio and the preset low cut-off ratio Maximum gray value and minimum gray value among gray values of the remaining pixels, and the maximum gray value among gray values of the remaining pixels is taken as a white field threshold G max Minimum gray value as black field threshold G min Further according to the redetermined white field threshold G max And black field threshold G min The gray value of each pixel of the first image is redetermined, so that the overexposure phenomenon of the target image is reduced, the overall brightness of the target image is improved, and the enhancement processing of the first image is realized. In addition, in the embodiment, the stretching threshold can be effectively determined by adopting an automatic tone algorithm without self-defining the stretching gray value, the overexposure phenomenon is reduced, and the weak fluorescence signal in the fluorescence gray image is better enhanced.
For a specific description of the above device portion, reference may be made to the above method embodiment, and no further description is given here.
Example 3
The present embodiment provides a computer device, as shown in fig. 13, which includes a processor 301 and a memory 302, where the processor 301 and the memory 302 may be connected by a bus or other means, and in fig. 13, the connection is exemplified by a bus.
The processor 301 may be a central processing unit (Central Processing Unit, CPU). The processor 301 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), graphics processors (Graphics Processing Unit, GPU), embedded Neural network processor (Neural-network Processing Unit, NPU) or other dedicated deep learning coprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field-programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above.
The memory 302 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as a gray scale image processing method in an embodiment of the invention. Corresponding program instructions/modules. The processor 301 executes various functional applications of the processor and data processing, that is, implements the grayscale image processing method in the above-described method embodiment, by running non-transitory software programs, instructions, and modules stored in the memory 302.
The memory 302 stores one or more modules that, when executed by the processor 301, perform the grayscale image processing method of the embodiment shown in fig. 1.
The details of the above computer device may be understood correspondingly with respect to the corresponding relevant descriptions and effects in the embodiment shown in fig. 1, which are not repeated here.
Embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions that can perform the grayscale image processing method of any of the above embodiments. Wherein the storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
It is apparent that the above examples are given by way of illustration only and are not limiting of the embodiments. Other variations or modifications of the above teachings will be apparent to those of ordinary skill in the art. It is not necessary here nor is it exhaustive of all embodiments. While still being apparent from variations or modifications that may be made by those skilled in the art are within the scope of the invention.
Claims (13)
1. A gray image processing method, characterized by comprising the steps of:
acquiring original gray data of a first image, wherein the original gray data comprises gray values corresponding to pixels of the first image;
based on the preset high cut-off ratio, the preset low cut-off ratio and the original gray data, pixels of the first image are removed, gray values of residual pixels of the first image are counted, the maximum gray value and the minimum gray value in the gray values of the residual pixels of the first image are determined, and the maximum gray value is used as a white field threshold G max The minimum gray value is used as a black field threshold G min ;
When the maximum gray value of the first image is larger than the first preset multiple of the gray level of the first image, the first image is smaller than or equal to the black field threshold G min The gray value of the pixel of (2) is set to be a first gray value which is larger than the black field threshold G min And is smaller than the white field threshold G max According to the gray value of the pixel of the white field threshold G max The black field threshold G min Determining that the white field threshold G is greater than or equal to max Setting the gray value of the pixel of the image sensor to be a second gray value to obtain a target image;
when the maximum gray level of the first image is less than or equal to a first preset multiple of the gray level of the first image, the first image is less than or equal to the black field threshold G min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min According to the maximum gray value of the first image and the black field threshold G min And determining to obtain a target image.
2. The gray image processing method according to claim 1, wherein according to the white field threshold G max The black field threshold G min Determining that the black field threshold G is greater than min And is smaller than the white field threshold G max Gray values of pixels of (1), comprising:
determining that the black field threshold G is greater than min And is smaller than the white field threshold G max Intermediate threshold G of (2) mid And determines the intermediate threshold G mid Corresponding intermediate mapping gray values;
greater than the black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min Determining that it is greater than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max And (5) determining.
3. The grayscale image processing method according to claim 2, wherein the determination is greater than the black field threshold G min And is smaller than the white field threshold G max Intermediate threshold G of (2) mid Comprising:
judging whether the second preset multiple of the optimal threshold value is in (G) min ,G max ) In the range, the optimal threshold is a threshold obtained after iterative calculation of the gray value of the pixel in the first image;
if the second preset multiple of the optimal threshold is at (G min ,G max ) Within the range, taking the value of the second preset multiple of the optimal threshold value as the intermediate threshold value G mid ;
If the second preset multiple of the optimal threshold value is not (G min ,G max ) Within the range, determining whether the optimal threshold is within (G min ,G max ) Within the range;
if you getThe optimal threshold value is at (G min ,G max ) Within the range, the optimal threshold value is compared with the white field threshold value G max As said intermediate threshold G mid ;
If the optimal threshold is not (G) min ,G max ) Within the range, the black field threshold G min And the white field threshold G max As said intermediate threshold G mid 。
4. A grayscale image processing method according to claim 3, characterized in that the optimal threshold is determined by:
setting an initial threshold T;
determining a gray value corresponding to a first pixel R1 larger than the initial threshold T and a gray value corresponding to a second pixel R2 smaller than or equal to the initial threshold T in the original gray data;
Calculating a first average value of gray values corresponding to the first pixel R1 and a second average value of gray values corresponding to the second pixel R2;
calculating an average value of the first average value and the second average value to obtain a third average value;
judging whether the difference value between the third average value and the initial threshold value T is in a preset range or not;
if yes, determining the initial threshold T as the optimal threshold;
otherwise, taking the third average value as the initial threshold value T, and re-executing the steps to determine whether the new initial threshold value T is the optimal threshold value.
5. The grayscale image processing method according to claim 2, wherein the intermediate mapped grayscale value is determined by:
calculating an initial mapped gray value V using a first predetermined function mid The first preset function is the white field threshold G max Black field threshold G min Said intermediate threshold G mid And a relational function between gray levels of the first imageA number;
mapping the initial gray value V mid And taking the third preset multiple of the intermediate mapping gray value as the intermediate mapping gray value.
6. The grayscale image processing method according to claim 5, wherein the first preset function is:
Wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, V mid For the initial mapped gray value, M is the gray level of the first image.
7. The grayscale image processing method according to claim 2, characterized by further comprising:
acquiring a dark background image, and calculating an average value of gray values of pixels of the dark background image;
calculating an analog amplification value, wherein the analog amplification value is the ratio of the gray level of the first image to the maximum gray value Max of the first image;
calculating the background value of the first image according to the average value of the gray values of the pixels of the dark background image and the analog amplification value;
said being greater than said black field threshold G min And is less than or equal to the intermediate threshold G mid According to the intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min Determining that it is greater than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max Determining, including:
greater than the black field threshold G min And is less than or equal to the intermediate threshold G mid According to the gray value of the pixel of (2) The intermediate mapping gray value, the intermediate threshold G mid The black field threshold G min And the background value of the first image is determined to be larger than the intermediate threshold G mid And is smaller than the white field threshold G max According to the intermediate mapping gray value, the intermediate threshold G mid The white field threshold G max And determining a background value of the first image.
8. The grayscale image processing method according to claim 1, further comprising:
carrying out Laplacian sharpening on the target image to obtain a second image;
and superposing the target image with the second image or the product of the target image and the sharpening coefficient of the second image to obtain the sharpened target image.
9. The grayscale image processing method according to claim 1, wherein when the maximum grayscale value of the first image is greater than a first preset multiple of the grayscale level of the first image, the target image is determined by the following formula:
determining the target image by the following formula when the maximum gray value of the first image is smaller than or equal to a first preset multiple of the gray level of the first image:
wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, max is the maximum gray value of the first image, M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, g (x, y) is the targetGray values corresponding to pixels of the image.
10. The grayscale image processing method according to claim 2, wherein when the maximum grayscale value of the first image is greater than a first preset multiple of the grayscale level of the first image, the target image is determined by the following formula:
wherein G is max Is the Bai Chang threshold value, G min For the black field threshold, G mid For the intermediate threshold value, G point And mapping gray values to the middle, wherein M is the gray level of the first image, f (x, y) is the gray value corresponding to the pixel of the first image, and g (x, y) is the gray value corresponding to the pixel of the target image.
11. A gradation image processing apparatus, characterized by comprising:
the acquisition module is used for acquiring original gray data of the first image, wherein the original gray data comprises gray values corresponding to pixels of the first image;
a rejection module, configured to reject pixels of the first image based on a preset high cut-off ratio, a preset low cut-off ratio, and the original gray data, count gray values of remaining pixels of the first image, determine a maximum gray value and a minimum gray value of the gray values of the remaining pixels of the first image, and use the maximum gray value as a white field threshold G max The minimum gray value is used as a black field threshold G min ;
A first generation module for generating the first image to be less than or equal to the black field threshold G when the maximum gray level of the first image is greater than a first preset multiple of the gray level of the first image min The gray value of the pixel of (2) is set to be a first gray value which is larger than the black field threshold G min And is smaller than the white field threshold G max According to the gray value of the pixel of the white field threshold G max The black field threshold G min Determining that the white field threshold G is greater than or equal to max Setting the gray value of the pixel of the image sensor to be a second gray value to obtain a target image;
a second generation module configured to, when the maximum gray level of the first image is equal to or less than a first preset multiple of the gray level of the first image, reduce the first image to or less than the black field threshold G min The gray value of the pixel of (2) is set to be the first gray value, which is larger than the black field threshold G min According to the maximum gray value of the first image and the black field threshold G min And determining to obtain a target image.
12. A computer device, comprising:
a memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the grayscale image processing method of any one of claims 1-10.
13. A computer-readable storage medium storing computer instructions for causing the computer to execute the grayscale image processing method according to any one of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310091645.XA CN116228574A (en) | 2023-02-09 | 2023-02-09 | Gray image processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310091645.XA CN116228574A (en) | 2023-02-09 | 2023-02-09 | Gray image processing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116228574A true CN116228574A (en) | 2023-06-06 |
Family
ID=86580000
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310091645.XA Pending CN116228574A (en) | 2023-02-09 | 2023-02-09 | Gray image processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116228574A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117938307A (en) * | 2023-12-15 | 2024-04-26 | 国网四川省电力公司电力科学研究院 | Gray code-based power grid communication node disaster recovery self-repairing method, device and medium |
-
2023
- 2023-02-09 CN CN202310091645.XA patent/CN116228574A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117938307A (en) * | 2023-12-15 | 2024-04-26 | 国网四川省电力公司电力科学研究院 | Gray code-based power grid communication node disaster recovery self-repairing method, device and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107507173B (en) | No-reference definition evaluation method and system for full-slice image | |
US9842382B2 (en) | Method and device for removing haze in single image | |
CN105046655B (en) | A kind of automatic sharpening method of video image and device | |
CN106651818A (en) | Improved Histogram equalization low-illumination image enhancement algorithm | |
WO2016206087A1 (en) | Low-illumination image processing method and device | |
WO2013099772A1 (en) | Cell contour forming device and method, storage medium storing computer-processable cell contour forming program | |
KR101361644B1 (en) | Image processing device and image defogging method | |
CN109325421B (en) | Eyelash removing method and system based on edge detection | |
CN107038704B (en) | Retina image exudation area segmentation method and device and computing equipment | |
CN108470343A (en) | A kind of improved method for detecting image edge | |
CN116228574A (en) | Gray image processing method and device | |
CN103489168A (en) | Enhancing method and system for infrared image being converted to pseudo color image in self-adaptive mode | |
CN113781421A (en) | Underwater-based target identification method, device and system | |
CN113450340B (en) | Skin texture detecting system | |
CN113808135B (en) | Image brightness abnormality detection method, electronic device, and storage medium | |
CN113450272B (en) | Image enhancement method based on sinusoidal variation and application thereof | |
CN113870143A (en) | Distribution line inspection image enhancement method and system | |
CN110136085B (en) | Image noise reduction method and device | |
CN110415185B (en) | Improved Wallis shadow automatic compensation method and device | |
CN116109511A (en) | Method and system for infrared image edge enhancement | |
WO2021217445A1 (en) | Image processing method, device and system, and storage medium | |
CN112819838A (en) | Image enhancement method, electronic device, and storage medium | |
US11803942B2 (en) | Blended gray image enhancement | |
CN117422656B (en) | Low-illumination fuzzy traffic image enhancement method, device, equipment and medium | |
CN116051425B (en) | Infrared image processing method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |