CN111915497A - Image black and white enhancement method and device, electronic equipment and readable storage medium - Google Patents

Image black and white enhancement method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN111915497A
CN111915497A CN201910385285.8A CN201910385285A CN111915497A CN 111915497 A CN111915497 A CN 111915497A CN 201910385285 A CN201910385285 A CN 201910385285A CN 111915497 A CN111915497 A CN 111915497A
Authority
CN
China
Prior art keywords
image
value
gray
enhanced
processing
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.)
Granted
Application number
CN201910385285.8A
Other languages
Chinese (zh)
Other versions
CN111915497B (en
Inventor
徐青松
李青
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Glority Software Ltd
Original Assignee
Hangzhou Glority Software Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hangzhou Glority Software Ltd filed Critical Hangzhou Glority Software Ltd
Priority to CN201910385285.8A priority Critical patent/CN111915497B/en
Publication of CN111915497A publication Critical patent/CN111915497A/en
Application granted granted Critical
Publication of CN111915497B publication Critical patent/CN111915497B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The invention provides a method, a device, electronic equipment and a readable storage medium for enhancing image black and white, wherein the method comprises the steps of obtaining an image to be enhanced; carrying out graying processing on an image to be enhanced to obtain a grayscale image; according to the first threshold value, carrying out binarization processing on the gray level image to obtain a binarization image; taking the binary image as a guide image, and carrying out guide filtering processing on the gray level image to obtain a filtered image; determining high-value pixel points in the filtered image according to a second threshold, wherein the gray value of the high-value pixel points is greater than the second threshold; according to a preset expansion coefficient, carrying out expansion processing on the gray value of the high-value pixel point to obtain an expanded image; performing sharpening processing on the extended image to obtain a sharp image; and adjusting the contrast of the clear image to obtain an enhanced image. The invention can convert the color image into the gray image with more obvious black-white contrast, the noise interference of the converted gray image is less, and the image content identification degree and the printing effect can be effectively improved.

Description

Image black and white enhancement method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for black and white enhancement of an image, an electronic device, and a readable storage medium.
Background
In recent years, with the rapid development of digital image processing technology, people have higher and higher requirements on image quality, and image enhancement technology is used for enhancing image details and improving image visual effects through corresponding image processing technology.
In real life, a gray level image is often needed, but the image shot by the current camera is colored, the image needs to be processed to achieve a gray level effect, the conventional mode for achieving the gray level effect mainly directly changes an image color mode from color to gray level, the mode is simple and convenient to operate, but the converted image has poor printing effect due to insufficient obvious black-white contrast. In addition, in real life, the problems that the image is not clear enough due to the insufficient contrast, noise interference, etc. of the photographed image, the image content is not easy to be identified, the printing effect of the image is poor, etc. are often encountered, and therefore, the image which is not clear needs to be converted into a gray image with the obvious black-white contrast and the clear black-white contrast, so as to improve the printing effect of the image.
Disclosure of Invention
The invention aims to provide an image black-white enhancement method, an image black-white enhancement device, an electronic device and a readable storage medium, which can convert a color image or an unclear image into a gray image with obvious black-white contrast and clearness and effectively improve the printing effect of the converted image.
In order to achieve the above object, the present invention provides a method for enhancing black and white of an image, comprising:
acquiring an image to be enhanced;
carrying out graying processing on the image to be enhanced to obtain a grayscale image;
according to a first threshold value, carrying out binarization processing on the gray level image to obtain a binarization image;
taking the binary image as a guide image, and carrying out guide filtering processing on the gray level image to obtain a filtered image;
determining high-value pixel points in the filtered image according to a second threshold, wherein the gray value of the high-value pixel points is greater than the second threshold;
according to a preset expansion coefficient, carrying out expansion processing on the gray value of the high-value pixel point to obtain an expanded image;
performing sharpening processing on the extended image to obtain a sharp image; and
and adjusting the contrast of the clear image to obtain an enhanced image.
Optionally, the preset expansion coefficient is 1.2-1.5.
Optionally, the sharpening the extended image to obtain a sharp image includes:
blurring the extended image to obtain a blurred image; and
and mixing the blurred image and the expanded image in proportion according to a preset mixing coefficient to obtain a clear image.
Optionally, the preset blending coefficient of the extended image is 1.5, and the preset blending coefficient of the blurred image is-0.5.
Optionally, the blurring processing is performed on the extended image, and specifically includes: and performing fuzzification processing on the extended image by adopting Gaussian filtering.
Optionally, the adjusting the contrast of the sharp image includes: and adjusting the gray value of each pixel point of the clear image according to the gray average value of the clear image.
Optionally, the gray value of each pixel point of the clear image is adjusted, specifically, the gray value of each pixel point of the clear image is adjusted by the following formula:
Figure BDA0002054640870000021
wherein f' (i, j) is the gray value of the pixel point of the enhanced image at (i, j),
Figure BDA0002054640870000022
and f (i, j) is the gray value of a pixel point of the clear image at (i, j), and t is an intensity value.
Optionally, the intensity value is 0.1-0.5.
Optionally, the second threshold is a sum of a mean grayscale value of the filtered image and a standard deviation of the grayscale value.
In order to achieve the above object, the present invention further provides an image black and white enhancement apparatus, comprising:
the acquisition module is used for acquiring an image to be enhanced;
the graying module is used for performing graying processing on the image to be enhanced to obtain a grayscale image;
the binarization module is used for carrying out binarization processing on the gray level image according to a first threshold value to obtain a binarization image;
the filtering module is used for performing guiding filtering processing on the gray level image by taking the binary image as a guide image to obtain a filtering image;
the determining module is used for determining high-value pixel points in the filtered image according to a second threshold, and the gray value of the high-value pixel points is greater than the second threshold;
the expansion module is used for expanding the gray value of the high-value pixel point according to a preset expansion coefficient to obtain an expanded image;
the sharpening module is used for sharpening the extended image to obtain a sharp image; and
and the adjusting module is used for adjusting the contrast of the clear image to obtain an enhanced image.
Optionally, the preset expansion coefficient is 1.2-1.5.
Optionally, the sharpening module includes:
the blurring submodule is used for performing blurring processing on the extended image to obtain a blurred image; and
and the mixing submodule is used for mixing the blurred image and the expanded image in proportion according to a preset mixing coefficient to obtain a clear image.
Optionally, the preset blending coefficient of the extended image is 1.5, and the preset blending coefficient of the blurred image is-0.5.
Optionally, the blur sub-module is specifically configured to perform blur processing on the extended image by using gaussian filtering to obtain a blurred image.
Optionally, the adjusting module is specifically configured to adjust the gray value of each pixel point of the clear image according to the gray average value of the clear image.
Optionally, the adjusting module is specifically configured to adjust the gray value of each pixel point of the clear image according to the following formula:
Figure BDA0002054640870000031
wherein f' (i, j) is the gray value of the pixel point of the enhanced image at (i, j),
Figure BDA0002054640870000032
and f (i, j) is the gray value of a pixel point of the clear image at (i, j), and t is an intensity value.
Optionally, the intensity value is 0.1-0.5.
Optionally, the second threshold is a sum of a mean grayscale value of the filtered image and a standard deviation of the grayscale value.
The invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; a memory for storing a computer program; and a processor for implementing the steps of the image black-and-white enhancement method according to any one of the above-mentioned embodiments when executing the program stored in the memory.
The invention also provides a readable storage medium, in which a computer program is stored, and the computer program is executed by a processor to implement the steps of the image black-and-white enhancement method according to any one of the above.
Compared with the prior art, the method has the advantages that the gray level image is obtained by carrying out gray level processing on the image to be enhanced; carrying out binarization processing on the gray level image to obtain a binarized image; then, the binary image is used as a guide image, and guide filtering processing is carried out on the gray level image, so that a filtering image can be obtained; determining all high-value pixel points with the gray values larger than a second threshold value in the filtered image, and expanding the gray values of the high-value pixel points to obtain an expanded image; performing sharpening processing on the expanded image to obtain a sharp image; and finally, adjusting the contrast of the clear image to obtain an enhanced image. The invention can convert the color image or the unclear image into the gray image with more obvious black-white contrast and clear contrast, and can effectively improve the identification degree and the printing effect of the image content because the converted image has less noise interference and obvious black-white contrast.
Drawings
FIG. 1 is a flowchart illustrating a black and white image enhancement method according to an embodiment of the present invention;
FIG. 2 illustrates an image to be enhanced according to an embodiment of the present invention;
FIG. 3 is an enhanced image obtained by processing the image to be enhanced shown in FIG. 2;
FIG. 4 is a schematic structural diagram of an image black-and-white enhancement apparatus according to an embodiment of the present invention;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present invention.
Wherein the reference numbers are as follows:
an acquisition module-201; graying module-202; a binarization module-203; a filtering module-204; determination module-205; an expansion module-206; a sharpening module-207; an adjustment module-208; a processor-301; a communication interface-302; a memory-303; communication bus-304.
Detailed Description
The image black-and-white enhancement method, apparatus, electronic device and readable storage medium according to the present invention are further described in detail with reference to fig. 1 to 5 and specific embodiments. Advantages and features of the present invention will become apparent from the following description and from the claims. It should be noted that the structures, ratios, sizes, and the like shown in the drawings attached to the present specification are only used for matching with the disclosure of the present specification, so as to be understood and read by those skilled in the art, and are not used to limit the implementation conditions of the present invention, so that the present invention has no technical significance, and any structural modification, ratio relationship change or size adjustment should still fall within the scope of the present invention without affecting the efficacy and the achievable purpose of the present invention.
In order to solve the problems in the prior art, the invention provides an image black-white enhancement method, an image black-white enhancement device, an electronic device and a readable storage medium.
The image monochrome enhancement method according to the embodiment of the present invention is applicable to the image monochrome enhancement device according to the embodiment of the present invention, and the image monochrome enhancement device may be disposed in an electronic apparatus. The electronic device may be a personal computer, a mobile terminal, and the like, and the mobile terminal may be a hardware device having various operating systems, such as a mobile phone and a tablet computer.
Fig. 1 is a schematic flow chart of an image black-and-white enhancement method according to an embodiment of the present invention, and referring to fig. 1, the image black-and-white enhancement method according to the present invention may include the following steps:
step S101: and acquiring an image to be enhanced.
The image to be enhanced can be obtained by photographing or scanning.
Step S102: and carrying out graying processing on the image to be enhanced to obtain a grayscale image.
In the image processing, R, G, B three components (R: Red, G: Green, B: Blue) are used for representing true color, namely the three primary colors of Red, Green and Blue, and the value ranges of the R component, the G component and the B component are all 0-255. When R ═ G ═ B, the color represents a gray scale color, where the value of R ═ G ═ B is called the gray scale value.
The graying methods include a component method, a maximum value method, an average value method, and a weighted average method.
The component method is to use the brightness of three components in the color image as the gray values of three gray images, and one gray image can be selected according to the application requirement.
The maximum value method is to set the maximum value of the three-component luminance in a color image as the gray value of a gray scale map.
The average method is to average the three-component brightness in the color image to obtain a gray value.
The weighted average method is to carry out weighted average on the three components with different weights according to importance and other indexes. Since the human eye is most sensitive to green and least sensitive to blue, the weighted average of R, G, B three components according to the following formula results in a more reasonable grayscale image:
f(i,j)=0.30R(i,j)+0.59G(i,j)+0.11B(i,j) (1)
wherein f (i, j) is the gray value of the pixel point of the converted gray image at (i, j), R (i, j) is the R component of the pixel point of the color image at (i, j), and G (i, j) is the G component of the pixel point of the color image at (i, j); b (i, j) is the B component of the pixel point of the color image at (i, j).
In this embodiment, any one of the four methods described above may be adopted to perform graying processing on the image to be enhanced to obtain a grayscale image.
Step S013: and carrying out binarization processing on the gray level image according to a first threshold value to obtain a binarized image.
The binarization processing is a process of setting the gray value of a pixel point on an image to be 0 or 255, namely, the whole image presents an obvious black-and-white effect, and the binarization of the image greatly reduces the data volume in the image, so that the outline of a target can be highlighted.
The most common method for binarization of gray level images is a threshold method, namely, the difference between a target and a background in an image is utilized to set the image into two different levels respectively, and a proper threshold is selected to determine whether a certain pixel point in the image is the target or the background, wherein all pixel points of which the gray level is greater than or equal to the threshold are determined as the target, the gray level is represented by 255, all pixel points of which the gray level is less than the threshold are determined as the background, and the gray level is represented by 0.
Common methods for selecting the binary threshold value include a double-peak method, a P parameter method, an OTSU method, a maximum entropy method, an iteration method and the like.
In this embodiment, any one of the above methods may be used as the method for selecting the first threshold.
S104: and taking the binary image as a guide image, and performing guide filtering processing on the gray level image to obtain a filtered image.
The filter has wide application in the aspects of smoothing, denoising, beautifying and the like of images. At present, common filters include an average filter, a median filter, a gaussian filter, a bilateral filter and a guided filter, and the implementation steps of these filters are substantially the same, and the specific process is as follows:
1) an mxn template is constructed (m and n are typically odd numbers) and then the template is moved through the image so that the center of the template coincides with each pixel in turn (except for the edge pixels).
2) Each coefficient in the template is multiplied by the pixel value of the corresponding pixel point one by one, and all the results are added (other operations are also possible).
3) And the pixel value of the pixel point corresponding to the central position of the template in the image is the calculation result of the previous step.
The guided filtering is to filter the target image (input image) through a guide graph, so that the final output image is similar to the input image in general, and the edge texture is similar to the guide graph. The guide filter can be used as an edge-preserving smoothing operator like a bilateral filter, but the guide filter has better processing effect on the image edge and is one of the fastest edge-preserving filters at present.
The basic principle of guided filtering is as follows:
firstly, a local linear model is introduced, the model comprises a guide image I, an input image p and an output image q, and the guide image I and the input image p can be identical images or different images. Suppose that the output image q is linearly related to the guide map I by:
Figure BDA0002054640870000071
wherein the coefficient akAnd bkAt windowMouth omegakWhile remaining unchanged, assuming window ωkIs r, two sides of the above formula are guided simultaneously to obtain ═ q ═ a ═ I, so the above formula can ensure that the edge of the output image q is similar to the edge of the guide map I.
To determine the coefficient akAnd bkA constraint condition needs to be introduced, and assuming that the output image q is obtained by subtracting the unnecessary texture and noise n from the input image p, the following formula is given:
qi=pi-ni (3)
in order to minimize the difference between the output image q and the input image p, the following cost function is introduced:
Figure BDA0002054640870000072
wherein, is a regularization parameter, the cost function is minimized to obtain akAnd bkExpression (c):
Figure BDA0002054640870000081
Figure BDA0002054640870000082
wherein, mukAnd σk 2Respectively, are directed to the graph I in the window omegakThe | ω | is the window ω |, which is the mean and variance ofkThe number of the middle pixel points. To obtain akAnd bkThen the output pixel point q can be calculatedi. Pixel i participates in the calculation of all windows containing it, so q is calculated using different windowsiOtherwise, averaging them to obtain the following formula:
Figure BDA0002054640870000083
due to the symmetry of the window, the above formula can be rewritten as:
Figure BDA0002054640870000084
wherein the content of the first and second substances,
Figure BDA0002054640870000085
are respectively the window omegakAverage value of (1).
In this step, the binarized image is a guide map, the grayscale image is an input image, and the filtered image is an output image, so that the grayscale image is filtered by the binarized image, a filtered image substantially similar to the grayscale image and having edge textures similar to the binarized image can be output, and after the filtering, noise in the image is significantly reduced.
S105: and determining high-value pixel points in the filtered image according to a second threshold, wherein the gray value of the high-value pixel points is greater than the second threshold.
Preferably, the second threshold is a sum of a mean grayscale value of the filtered image and a standard deviation of grayscale values of the filtered image. That is, the second threshold is equal to the mean of the grays of the filtered image plus the standard deviation of the grays of the filtered image.
S016: and according to a preset expansion coefficient, performing expansion processing on the gray value of the high-value pixel point to obtain an expanded image.
In this step, the gray value of each high-value pixel is multiplied by the preset expansion coefficient to expand the gray value of the high-value pixel, so as to obtain an expanded image with more obvious black-white contrast.
Preferably, the preset expansion coefficient is 1.2-1.5, for example, the preset expansion coefficient is 1.3, and at this time, the gray value of each high-value pixel point in the filtered image is multiplied by 1.3, so as to obtain an expanded image with more obvious black-white contrast.
S107: and carrying out sharpening processing on the extended image to obtain a sharp image.
Thus, by sharpening the extended image, a sharper image can be obtained with respect to the extended image.
Preferably, the sharpening the extended image to obtain a sharp image includes:
blurring the extended image to obtain a blurred image; and mixing the blurred image and the expanded image in proportion according to a preset mixing coefficient to obtain a clear image.
Suppose f1(i, j) is the gray value of the pixel point of the expanded image at (i, j), f2(i, j) is the gray value of the pixel point of the blurred image at (i, j), f3(i, j) is the gray value of the pixel point of the sharp image at (i, j), k1For a predetermined blending coefficient, k, of said expanded image2A predetermined expansion coefficient for the blurred image, f1(i,j)、f2(i,j)、f3(i, j) satisfies the following relationship:
f3(i,j)=k1f1(i,j)+k2f2(i,j) (9)
preferably, the preset blending coefficient of the extended image is 1.5, and the preset blending coefficient of the blurred image is-0.5, then the gray value of the pixel point of the sharp image at (i, j) is:
f3(i,j)=1.5f1(i,j)-0.5f2(i,j) (10)
preferably, the blurring processing is performed on the extended image, and specifically includes: and performing fuzzification processing on the extended image by adopting Gaussian filtering.
The gaussian filter is a linear filter that effectively smoothes (blurs) the image, removing noise, and its template coefficients are related to the distance from the center of the template: the closer the distance to the center of the template, the larger the template coefficient; the further away from the template center, the smaller the template coefficient.
The gaussian filter is defined as follows:
Figure BDA0002054640870000091
where Ω represents the neighborhood window, IpIs the pixel value of p point, GFpIs the output pixel value corresponding to the p point, | | p-t | | | represents the Euclidean distance between the p point and the t point, GsIs a spatial domain kernel function, which is defined as follows:
Figure BDA0002054640870000092
wherein, ItIs the pixel value of point t, σsThe spatial neighborhood standard deviation represents the discrete degree of data, is an important parameter of the Gaussian filter, and determines the blurring degree of the image by the Gaussian filter. When sigma issWhen the image blur effect is small, the template coefficient distribution is concentrated, the coefficient near the center of the template is large, and the coefficient around the template is small, so that the image blur effect is weak; when sigma issWhen the image blur effect is larger, the distribution of the template coefficients is more dispersed, and the difference between the coefficient at the center of the template and the coefficient around the template is not large, so that the image blur effect is more obvious.
S108: and adjusting the contrast of the clear image to obtain an enhanced image.
Thus, by adjusting the contrast of the sharp image, an enhanced image with more obvious black-white contrast can be obtained.
The adjusting of the gray value of each pixel point of the clear image is specifically performed by adjusting the gray value of each pixel point of the clear image according to the following formula:
Figure BDA0002054640870000101
wherein f' (i, j) is the gray value of the pixel point of the enhanced image at (i, j),
Figure BDA0002054640870000102
the gray average value of the clear image, f (i, j) is the gray value of the pixel point of the clear image at (i, j), and t is strongAnd (4) measuring values.
Therefore, the gray value of each pixel point of the clear image can be adjusted according to the formula, and an enhanced image with more obvious black-white contrast is obtained.
Alternatively, the intensity value may be 0.1-0.5, for example, the intensity value may be 0.2. The specific value of the intensity value can be selected according to the black and white enhancement effect to be finally achieved.
Optionally, after the image to be enhanced is acquired and before the image to be enhanced is subjected to the graying processing, the image black-and-white enhancement method further includes the following steps:
and judging whether the image to be enhanced is a gray image.
After the image to be enhanced is acquired, it is first determined whether the image to be enhanced is a grayscale image, and if the image to be enhanced is a grayscale image, it is not necessary to perform graying processing on the image to be enhanced, that is, step S102 is not performed, but step S103 is directly performed. Therefore, when the image to be enhanced is a gray image, the working procedures can be reduced, and the processing speed of the image can be effectively improved.
Fig. 2 schematically shows an image to be enhanced according to a specific example of the present invention, and fig. 3 schematically shows an enhanced image obtained after the image to be enhanced shown in fig. 2 is processed by the image black-and-white enhancement method provided by the present invention, and it can be seen from fig. 2 and fig. 3 that, after the image to be enhanced is processed by the method provided by the present invention, the obtained enhanced image has more obvious black-and-white contrast compared with the image to be enhanced, noise interference is significantly reduced, the image is clearer, and the image content is easier to identify.
In summary, compared with the prior art, the image black-and-white enhancement method provided by the invention obtains a gray image by performing graying processing on the image to be enhanced; carrying out binarization processing on the gray level image to obtain a binarized image; then, the binary image is used as a guide image, and guide filtering processing is carried out on the gray level image, so that a filtering image can be obtained; determining all high-value pixel points with the gray values larger than a second threshold value in the filtered image, and expanding the gray values of the high-value pixel points to obtain an expanded image; performing sharpening processing on the expanded image to obtain a sharp image; and finally, adjusting the contrast of the clear image to obtain an enhanced image. The invention can convert the color image or the unclear image into the gray image with more obvious black-white contrast and clear contrast, and can effectively improve the identification degree and the printing effect of the image content because the converted image has less noise interference and obvious black-white contrast.
Corresponding to the image black-white enhancement method, the invention also provides an image black-white enhancement device. Fig. 4 schematically shows an image black-and-white enhancement device according to an embodiment of the present invention, and as shown in fig. 4, the image black-and-white enhancement device includes:
an obtaining module 201, configured to obtain an image to be enhanced;
the graying module 202 is configured to perform graying processing on the image to be enhanced to obtain a grayscale image;
a binarization module 203, configured to perform binarization processing on the grayscale image according to a first threshold value to obtain a binarized image;
the filtering module 204 is configured to perform guided filtering processing on the grayscale image by using the binarized image as a guide map to obtain a filtered image;
a determining module 205, configured to determine, according to a second threshold, a high-value pixel point in the filtered image, where a gray value of the high-value pixel point is greater than the second threshold;
the expansion module 206 is configured to perform expansion processing on the gray value of the high-value pixel point according to a preset expansion coefficient to obtain an expanded image;
a sharpening module 207, configured to perform sharpening processing on the extended image to obtain a sharp image;
and an adjusting module 208, configured to adjust the contrast of the clear image to obtain an enhanced image.
Optionally, the preset expansion coefficient is 1.2-1.5.
Optionally, the second threshold is a sum of a mean grayscale value of the filtered image and a standard deviation of grayscale values of the filtered image.
Preferably, the sharpening module 207 may include: the blurring submodule is used for performing blurring processing on the extended image to obtain a blurred image; and the mixing submodule is used for mixing the blurred image and the expanded image in proportion according to a preset mixing coefficient to obtain a clear image.
Optionally, the preset blending coefficient of the extended image is 1.5, and the preset blending coefficient of the blurred image is-0.5.
Preferably, the blur sub-module is specifically configured to perform blur processing on the extended image by using gaussian filtering to obtain a blurred image.
The adjusting submodule may be specifically configured to adjust the gray value of each pixel point of the clear image according to the gray average value of the clear image.
Optionally, the adjusting module 208 may be specifically configured to adjust the gray value of each pixel point of the sharp image according to the following formula:
Figure BDA0002054640870000121
wherein f' (i, j) is the gray value of the pixel point of the enhanced image at (i, j),
Figure BDA0002054640870000122
and f (i, j) is the gray value of a pixel point of the clear image at (i, j), and t is an intensity value.
Optionally, the intensity value is 0.1-0.5.
Optionally, the apparatus further includes a determining module, configured to determine whether the image to be enhanced is a grayscale image.
In summary, the image black-and-white enhancement device provided by the invention performs graying processing on the image to be enhanced to obtain a grayscale image; carrying out binarization processing on the gray level image to obtain a binarized image; then, the binary image is used as a guide image, and guide filtering processing is carried out on the gray level image, so that a filtering image can be obtained; determining all high-value pixel points with the gray values larger than a second threshold value in the filtered image, and expanding the gray values of the high-value pixel points to obtain an expanded image; performing sharpening processing on the expanded image to obtain a sharp image; and finally, adjusting the contrast of the clear image to obtain an enhanced image. The invention can convert the color image or the unclear image into the gray image with more obvious black-white contrast and clear contrast, and can effectively improve the identification degree and the printing effect of the image content because the converted image has less noise interference and obvious black-white contrast.
Based on the same inventive concept, the invention also provides electronic equipment. Fig. 5 schematically shows a structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 5, the electronic device includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304.
The processor 301, the communication interface 302 and the memory 303 complete communication with each other through the communication bus 304;
the memory 303 is used for storing computer programs;
the processor 301 is configured to implement the following steps when executing the program stored in the memory 303:
acquiring an image to be enhanced;
carrying out graying processing on the image to be enhanced to obtain a grayscale image;
according to a first threshold value, carrying out binarization processing on the gray level image to obtain a binarization image;
taking the binary image as a guide image, and carrying out guide filtering processing on the gray level image to obtain a filtered image;
determining high-value pixel points in the filtered image according to a second threshold, wherein the gray value of the high-value pixel points is greater than the second threshold;
according to a preset expansion coefficient, carrying out expansion processing on the gray value of the high-value pixel point to obtain an expanded image;
performing sharpening processing on the extended image to obtain a sharp image;
and adjusting the contrast of the clear image to obtain an enhanced image.
For specific implementation and related explanation of each step of the method, reference may be made to the method embodiment shown in fig. 1, which is not described herein again.
In addition, other implementation manners of the image black-and-white enhancement method implemented by the processor 301 executing the program stored in the memory 303 are the same as the implementation manners mentioned in the foregoing method implementation manner, and are not described again here.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable gate array (FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that is the control center for the electronic device and that connects the various parts of the overall electronic device using various interfaces and wires.
The memory may be used to store the computer program, and the processor may implement various functions of the electronic device by running or executing the computer program stored in the memory and calling data stored in the memory.
The memory may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
In summary, the electronic device provided by the present invention performs graying processing on the image to be enhanced to obtain a grayscale image; carrying out binarization processing on the gray level image to obtain a binarized image; then, the binary image is used as a guide image, and guide filtering processing is carried out on the gray level image, so that a filtering image can be obtained; determining all high-value pixel points with the gray values larger than a second threshold value in the filtered image, and expanding the gray values of the high-value pixel points to obtain an expanded image; performing sharpening processing on the expanded image to obtain a sharp image; and finally, adjusting the contrast of the clear image to obtain an enhanced image. The invention can convert the color image or the unclear image into the gray image with more obvious black-white contrast and clear contrast, and can effectively improve the identification degree and the printing effect of the image content because the converted image has less noise interference and obvious black-white contrast.
The present invention also provides a readable storage medium having a computer program stored therein, which when executed by a processor, performs the steps of:
acquiring an image to be enhanced;
carrying out graying processing on the image to be enhanced to obtain a grayscale image;
according to a first threshold value, carrying out binarization processing on the gray level image to obtain a binarization image;
taking the binary image as a guide image, and carrying out guide filtering processing on the gray level image to obtain a filtered image;
determining high-value pixel points in the filtered image according to a second threshold, wherein the gray value of the high-value pixel points is greater than the second threshold;
according to a preset expansion coefficient, carrying out expansion processing on the gray value of the high-value pixel point to obtain an expanded image;
performing sharpening processing on the extended image to obtain a sharp image;
and adjusting the contrast of the clear image to obtain an enhanced image.
For specific implementation and related explanation of each step of the method, reference may be made to the method embodiment shown in fig. 1, which is not described herein again.
In addition, other implementation manners of the image black-and-white enhancement method implemented by the processor executing the computer program stored in the readable storage medium are the same as the implementation manners mentioned in the foregoing method implementation manner, and are not described herein again.
The readable storage medium may be a tangible device that can hold and store instructions for use by an instruction execution device, such as, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing.
In summary, compared with the prior art, the method and the device have the advantages that the gray level image is obtained by performing gray level processing on the image to be enhanced; carrying out binarization processing on the gray level image to obtain a binarized image; then, the binary image is used as a guide image, and guide filtering processing is carried out on the gray level image, so that a filtering image can be obtained; determining all high-value pixel points with the gray values larger than a second threshold value in the filtered image, and expanding the gray values of the high-value pixel points to obtain an expanded image; performing sharpening processing on the expanded image to obtain a sharp image; and finally, adjusting the contrast of the clear image to obtain an enhanced image. The invention can convert the color image or the unclear image into the gray image with more obvious black-white contrast and clearness, and can effectively improve the identification degree and the printing effect of the image content because the noise interference of the converted image is less.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only for the purpose of describing the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention, and any variations and modifications made by those skilled in the art based on the above disclosure are within the scope of the appended claims. It will be apparent to those skilled in the art that various changes and modifications may be made in the invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (20)

1. A method for black and white enhancement of an image, comprising:
acquiring an image to be enhanced;
carrying out graying processing on the image to be enhanced to obtain a grayscale image;
according to a first threshold value, carrying out binarization processing on the gray level image to obtain a binarization image;
taking the binary image as a guide image, and carrying out guide filtering processing on the gray level image to obtain a filtered image;
determining high-value pixel points in the filtered image according to a second threshold, wherein the gray value of the high-value pixel points is greater than the second threshold;
according to a preset expansion coefficient, carrying out expansion processing on the gray value of the high-value pixel point to obtain an expanded image;
performing sharpening processing on the extended image to obtain a sharp image; and
and adjusting the contrast of the clear image to obtain an enhanced image.
2. The method of claim 1, wherein the predetermined expansion factor is 1.2-1.5.
3. The method for black-and-white enhancement of images according to claim 1, wherein said sharpening said extended image to obtain a sharp image comprises:
blurring the extended image to obtain a blurred image; and
and mixing the blurred image and the expanded image in proportion according to a preset mixing coefficient to obtain a clear image.
4. The method of claim 3, wherein the preset blending coefficient of the extended image is 1.5, and the preset blending coefficient of the blurred image is-0.5.
5. The method for black-and-white enhancement of an image according to claim 3, wherein the blurring of the extended image is performed by using Gaussian filtering.
6. The method of claim 1, wherein the adjusting the contrast of the sharp image comprises adjusting the gray level of each pixel of the sharp image according to the mean gray level of the sharp image.
7. The method of claim 6, wherein the adjusting the gray-level value of each pixel of the sharp image is performed by using the following formula:
Figure FDA0002054640860000021
wherein f' (i, j) is the gray value of the pixel point of the enhanced image at (i, j),
Figure FDA0002054640860000022
and f (i, j) is the gray value of a pixel point of the clear image at (i, j), and t is an intensity value.
8. The method of claim 7, wherein the intensity value is 0.1-0.5.
9. The method of claim 1, wherein the second threshold is a sum of a mean grayscale value and a standard deviation grayscale value of the filtered image.
10. An image black and white enhancement device, comprising:
the acquisition module is used for acquiring an image to be enhanced;
the graying module is used for performing graying processing on the image to be enhanced to obtain a grayscale image;
the binarization module is used for carrying out binarization processing on the gray level image according to a first threshold value to obtain a binarization image;
the filtering module is used for performing guiding filtering processing on the gray level image by taking the binary image as a guide image to obtain a filtering image;
the determining module is used for determining high-value pixel points in the filtered image according to a second threshold, and the gray value of the high-value pixel points is greater than the second threshold;
the expansion module is used for expanding the gray value of the high-value pixel point according to a preset expansion coefficient to obtain an expanded image;
the sharpening module is used for sharpening the extended image to obtain a sharp image; and
and the adjusting module is used for adjusting the contrast of the clear image to obtain an enhanced image.
11. The apparatus according to claim 10, wherein the predetermined expansion factor is 1.2-1.5.
12. The image black-and-white enhancement apparatus of claim 10, wherein the sharpening module comprises:
the blurring submodule is used for performing blurring processing on the extended image to obtain a blurred image; and
and the mixing submodule is used for mixing the blurred image and the expanded image in proportion according to a preset mixing coefficient to obtain a clear image.
13. The apparatus according to claim 12, wherein the predetermined blending factor of the extended image is 1.5, and the predetermined blending factor of the blurred image is-0.5.
14. The image black-and-white enhancement apparatus of claim 12, wherein the blur sub-module is configured to blur the extended image using gaussian filtering to obtain a blurred image.
15. The image black-and-white enhancement device according to claim 10, wherein the adjusting module is specifically configured to adjust the gray-level value of each pixel of the sharp image according to the gray-level average of the sharp image.
16. The image black-and-white enhancement device according to claim 15, wherein the adjusting module is specifically configured to adjust the gray-level value of each pixel of the sharp image according to the following formula:
Figure FDA0002054640860000031
wherein f' (i, j) is the gray value of the pixel point of the enhanced image at (i, j),
Figure FDA0002054640860000032
and f (i, j) is the gray value of a pixel point of the clear image at (i, j), and t is an intensity value.
17. The image black-and-white enhancement device according to claim 16, wherein the intensity value is 0.1-0.5.
18. The apparatus according to claim 10, wherein the second threshold is a sum of a mean grayscale value and a standard deviation grayscale value of the filtered image.
19. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-9.
20. A readable storage medium, characterized in that a computer program is stored in the readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-9.
CN201910385285.8A 2019-05-09 2019-05-09 Image black-and-white enhancement method and device, electronic equipment and readable storage medium Active CN111915497B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910385285.8A CN111915497B (en) 2019-05-09 2019-05-09 Image black-and-white enhancement method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910385285.8A CN111915497B (en) 2019-05-09 2019-05-09 Image black-and-white enhancement method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN111915497A true CN111915497A (en) 2020-11-10
CN111915497B CN111915497B (en) 2023-11-03

Family

ID=73242270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910385285.8A Active CN111915497B (en) 2019-05-09 2019-05-09 Image black-and-white enhancement method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111915497B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023077942A1 (en) * 2021-11-04 2023-05-11 青岛海信医疗设备股份有限公司 Ultrasound image processing method and ultrasonic device

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090034871A1 (en) * 2007-07-31 2009-02-05 Renato Keshet Method and system for enhancing image signals and other signals to increase perception of depth
CN101464948A (en) * 2009-01-14 2009-06-24 北京航空航天大学 Object identification method for affine constant moment based on key point
WO2014206394A2 (en) * 2013-06-26 2014-12-31 menschmaschine Publishing GmbH Computer implemented digital blur filter for producing a blurred print corresponding to an incorrectly focused lens system, in an original digital image in an image memory
CN105608676A (en) * 2015-12-23 2016-05-25 浙江宇视科技有限公司 Video image enhancement method and device
CN105740876A (en) * 2014-12-10 2016-07-06 阿里巴巴集团控股有限公司 Image preprocessing method and device
CN105913421A (en) * 2016-04-07 2016-08-31 西安电子科技大学 Remote sensing image cloud detection method based on adaptive shape dark channel
CN107203982A (en) * 2017-06-26 2017-09-26 郑州云海信息技术有限公司 A kind of image processing method and device
US20180053289A1 (en) * 2015-03-05 2018-02-22 Iee International Electronics & Engineering S.A. Method and system for real-time noise removal and image enhancement of high-dynamic range images
CN108062746A (en) * 2016-11-09 2018-05-22 深圳市优朋普乐传媒发展有限公司 A kind of method of video image processing and device, video coding system
CN108734189A (en) * 2017-04-20 2018-11-02 天津工业大学 Vehicle License Plate Recognition System based on atmospherical scattering model and deep learning under thick fog weather
CN109410215A (en) * 2018-08-02 2019-03-01 北京三快在线科技有限公司 Image processing method, device, electronic equipment and computer-readable medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090034871A1 (en) * 2007-07-31 2009-02-05 Renato Keshet Method and system for enhancing image signals and other signals to increase perception of depth
CN101464948A (en) * 2009-01-14 2009-06-24 北京航空航天大学 Object identification method for affine constant moment based on key point
WO2014206394A2 (en) * 2013-06-26 2014-12-31 menschmaschine Publishing GmbH Computer implemented digital blur filter for producing a blurred print corresponding to an incorrectly focused lens system, in an original digital image in an image memory
CN105740876A (en) * 2014-12-10 2016-07-06 阿里巴巴集团控股有限公司 Image preprocessing method and device
US20180053289A1 (en) * 2015-03-05 2018-02-22 Iee International Electronics & Engineering S.A. Method and system for real-time noise removal and image enhancement of high-dynamic range images
CN105608676A (en) * 2015-12-23 2016-05-25 浙江宇视科技有限公司 Video image enhancement method and device
CN105913421A (en) * 2016-04-07 2016-08-31 西安电子科技大学 Remote sensing image cloud detection method based on adaptive shape dark channel
CN108062746A (en) * 2016-11-09 2018-05-22 深圳市优朋普乐传媒发展有限公司 A kind of method of video image processing and device, video coding system
CN108734189A (en) * 2017-04-20 2018-11-02 天津工业大学 Vehicle License Plate Recognition System based on atmospherical scattering model and deep learning under thick fog weather
CN107203982A (en) * 2017-06-26 2017-09-26 郑州云海信息技术有限公司 A kind of image processing method and device
CN109410215A (en) * 2018-08-02 2019-03-01 北京三快在线科技有限公司 Image processing method, device, electronic equipment and computer-readable medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
FUYU TAO等: "Retinex-based image enhancement framework by using region covariance filter", 《SPRINGERLINK》, pages 1399 - 1420 *
孔岩;管庶安;江峰;孙莉红;: "基于二阶梯度的图像增强算法研究", 计算机与数字工程, no. 04, pages 137 - 141 *
钟卿;余鹏飞;李海燕;陈瑞新;: "傣文贝叶经的图像增强与二值化方法研究", 云南大学学报(自然科学版), no. 05, pages 747 - 752 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023077942A1 (en) * 2021-11-04 2023-05-11 青岛海信医疗设备股份有限公司 Ultrasound image processing method and ultrasonic device

Also Published As

Publication number Publication date
CN111915497B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
CN111583157B (en) Image processing method, system and computer readable storage medium
US10410327B2 (en) Shallow depth of field rendering
CN107403421B (en) Image defogging method, storage medium and terminal equipment
CN110706174B (en) Image enhancement method, terminal equipment and storage medium
KR101662846B1 (en) Apparatus and method for generating bokeh in out-of-focus shooting
US9142009B2 (en) Patch-based, locally content-adaptive image and video sharpening
CN110766639B (en) Image enhancement method and device, mobile equipment and computer readable storage medium
CN109584198B (en) Method and device for evaluating quality of face image and computer readable storage medium
CN109214996B (en) Image processing method and device
CN110675334A (en) Image enhancement method and device
US20220398698A1 (en) Image processing model generation method, processing method, storage medium, and terminal
CN113592776A (en) Image processing method and device, electronic device and storage medium
CN113344801A (en) Image enhancement method, system, terminal and storage medium applied to gas metering facility environment
CN112053302A (en) Denoising method and device for hyperspectral image and storage medium
CN113450272B (en) Image enhancement method based on sinusoidal variation and application thereof
CN116580028B (en) Object surface defect detection method, device, equipment and storage medium
CN113810674A (en) Image processing method and device, terminal and readable storage medium
CN111915497B (en) Image black-and-white enhancement method and device, electronic equipment and readable storage medium
CN113744294A (en) Image processing method and related device
CN116934634A (en) Image enhancement method and device based on pixel classification
CN111311610A (en) Image segmentation method and terminal equipment
CN111415317A (en) Image processing method and device, electronic equipment and computer readable storage medium
CN111754413A (en) Image processing method, device, equipment and storage medium
CN113160103B (en) Image processing method and device, storage medium and terminal
RU2383924C2 (en) Method for adaptive increase of sharpness of digital photographs during printing

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
GR01 Patent grant
GR01 Patent grant