CN113191990B - Image processing method, device, electronic equipment and medium - Google Patents

Image processing method, device, electronic equipment and medium Download PDF

Info

Publication number
CN113191990B
CN113191990B CN202110590447.9A CN202110590447A CN113191990B CN 113191990 B CN113191990 B CN 113191990B CN 202110590447 A CN202110590447 A CN 202110590447A CN 113191990 B CN113191990 B CN 113191990B
Authority
CN
China
Prior art keywords
histogram
value
image
detail
platform
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.)
Active
Application number
CN202110590447.9A
Other languages
Chinese (zh)
Other versions
CN113191990A (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.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co 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 Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN202110590447.9A priority Critical patent/CN113191990B/en
Publication of CN113191990A publication Critical patent/CN113191990A/en
Application granted granted Critical
Publication of CN113191990B publication Critical patent/CN113191990B/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
    • G06T5/40Image enhancement or restoration by the use of histogram techniques
    • 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

Abstract

The embodiment of the application discloses an image processing method, an image processing device, electronic equipment and a medium. The method comprises the following steps: determining an initial histogram and a detail histogram according to a high-pass filtered image of an image to be processed and the image to be processed; determining a first platform threshold and a second platform threshold according to the relation between the first reference threshold and the statistic value of the detail cumulative histogram and the relation between the second reference threshold and the statistic value of the detail cumulative histogram; determining a double-platform histogram according to the first platform threshold, the second platform threshold and the initial histogram; and determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image. The scheme can consider the details of the image when determining the double-platform threshold value, so that the determined double-platform threshold value can be suitable for processing the images under different scenes, and the scene adaptability of the image processing method is improved.

Description

Image processing method, device, electronic equipment and medium
Technical Field
The embodiment of the application relates to the technical field of image processing, in particular to an image processing method, an image processing device, electronic equipment and a medium.
Background
Image processing is a technique in which images are analyzed by a computer to achieve a desired result. Image processing includes image transformation, image encoding compression, image enhancement and restoration, image segmentation, image description, image classification, and the like.
Image enhancement techniques are commonly used for preprocessing images and improving the display quality of the images, and have wide application in digital image processing systems, and image enhancement is generally performed in the spatial domain or the frequency domain, and the most common methods in the spatial domain are linear stretching algorithms, histogram equalization processing, exponential transformation processing and the like. The histogram equalization method is widely applied due to the characteristics of simple algorithm and strong adaptability.
The existing histogram equalization algorithm does not distinguish the image background from the target, so that the background and noise occupy too much gray scale range after part of the scene is enhanced, and the information such as target details occupy less gray scale range, so that the final image effect is poor. Although the improved histogram equalization algorithm can alleviate problems of excessive stretching of the background, loss of image details and the like to a certain extent, the existing improved histogram equalization algorithm is difficult to adaptively determine enhancement parameters aiming at different scenes, so that the effect of image enhancement is limited.
Disclosure of Invention
The embodiment of the application provides an image processing method, an image processing device, electronic equipment and a medium, so as to improve the processing effect on images in different scenes.
In one embodiment, an embodiment of the present application provides an image processing method, including:
determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram;
determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; the first reference threshold value and the second reference threshold value are determined according to the maximum statistical value of the detail cumulative histogram, wherein the detail cumulative histogram is the cumulative histogram of the detail histogram;
determining a dual-plateau histogram according to the first plateau threshold, the second plateau threshold and the initial histogram;
determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
In another embodiment, an image processing apparatus is provided in an embodiment of the present application, including:
the detail histogram determining module is used for determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram, wherein the detail cumulative histogram is a cumulative histogram of the detail histogram;
the threshold determining module is used for determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; wherein the first reference threshold and the second reference threshold are determined according to a maximum statistical value of the cumulative histogram of detail;
the dual-platform histogram determination module is used for determining a dual-platform histogram according to the first platform threshold value, the second platform threshold value and the initial histogram;
the processing module is used for determining a gray mapping relation according to the double-platform cumulative histogram and processing the image to be processed based on the gray mapping relation to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
In yet another embodiment, an electronic device is provided in an embodiment of the present application, including: one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the image processing method as described in any one of the embodiments of the present application.
In one embodiment, the present application further provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the image processing method according to any of the embodiments of the present application.
In the embodiment of the application, an initial histogram is determined according to a high-pass filtered image of an image to be processed and the image to be processed, a detail histogram of the image to be processed is determined according to the initial histogram, so that a high-frequency component of the image to be processed is counted, a detail part of the image to be processed is determined, a first platform threshold value and a second platform threshold value are determined from the statistic of the detail cumulative histogram according to the relationship between a first reference threshold value and the statistic of the detail cumulative histogram and the relationship between a second reference threshold value and the statistic of the detail cumulative histogram, so that the detail part is considered in the determining process of the first platform threshold value and the second platform threshold value, and the dual-platform histogram is determined according to the first platform threshold value, the second platform threshold value and the initial histogram; and determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image, so that the processing effect of the image to be processed is improved.
Drawings
FIG. 1 is a flowchart of an image processing method according to an embodiment of the present application;
FIG. 2 is a flowchart of an image processing method according to another embodiment of the present application;
FIG. 3 is a flowchart of an image processing method according to another embodiment of the present application;
fig. 4 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The present application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present application are shown in the drawings.
Fig. 1 is a flowchart of an image processing method according to an embodiment of the present application. The image processing method provided by the embodiment of the application can be suitable for the situation of processing the image. Typically, the embodiment of the application is applicable to the situation of enhancing an image to be processed based on a double-platform histogram. The method can be specifically executed by an image processing device, the device can be realized by software and/or hardware, the device can be integrated in an electronic device capable of realizing the image processing method, and the electronic device can be a processor of an intelligent image collector, a local processor or a cloud processor which is independent of the image collector, and the like. Referring to fig. 1, the method in the embodiment of the present application specifically includes:
S110, determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram.
The image to be processed may be an image acquired by an image acquisition device, or an image acquired from a local or internet, and the format and bit width of the image to be processed are not particularly limited, and may be any format and bit width of the image to be processed, which may be processed by adopting the method in the embodiment of the present application. The high-pass filtering algorithm is not limited, and can be, for example, non-sharpening mask filtering, sobel operator filtering, DOG operator filtering, LOG operator filtering, laplacian operator filtering and the like. The size of the filter kernel is not limited in the embodiment of the present application, and may be 3*3, 5*5, 7*7, or the like, and the filter kernel may be in the form of
Figure BDA0003089305180000051
Before the filtering kernel is adopted to process the image to be processed, edge expansion processing is carried out on the image to be processed according to the size of the filtering kernel, so that the pixel points at the edge can be positioned at the center of the filtering kernel to carry out convolution processing.
The initial histogram is directly determined according to the high-pass filtered image of the image to be processed and the image to be processed, the abscissa value of the initial histogram can be the gray level in the image to be processed, and the ordinate value of the initial histogram can be the accumulated value of detail data of the pixel point corresponding to the gray level in the high-pass filtered image. And further processing the initial histogram to obtain a detail histogram. The processing of the initial histogram may be, for example, filtering out part of the data in the initial histogram, adjusting the order of the data in the initial histogram, and the like, and may be performed according to actual requirements.
S120, determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; wherein the first reference threshold and the second reference threshold are determined according to a maximum statistical value of the cumulative histogram of detail. Wherein the detail cumulative histogram is a cumulative histogram of the detail histogram;
the statistics value of the detail cumulative histogram may be a statistics value obtained by accumulating the sum of detail data of the detail histogram. The first and second reference thresholds may be determined from the maximum statistical value of the cumulative histogram of detail, for example, the first and second reference thresholds may be calculated according to the following formula:
histSumUp=histSum*t
histSumDown=histSum*(1-t)
the histSumDown may be a first reference threshold, the histssumup may be a second reference threshold, the histSum may be a maximum statistical value of the cumulative histogram of details, 0< t <1, t may be selected according to practical situations, for example, may be selected to be 0.85. In different scenarios, t may take different values.
The detail cumulative histogram calculation formula is:
accSortHist(g)=accSortHist(g-1)+sortHist(g)
where accSortHist (g) is the detail cumulative histogram, sortHist (g) is the detail histogram, and g is the gray level.
Illustratively, the first plateau threshold and the second plateau threshold are determined in the statistics of the cumulative histogram of detail using the first reference threshold and the second reference threshold as references. For example, the statistical value closest to and greater than the first reference threshold among the statistical values of the cumulative histogram of the details may be regarded as the first plateau threshold, the statistical value closest to and greater than the second reference threshold among the statistical values of the cumulative histogram of the details may be regarded as the second plateau threshold, the statistical value closest to and less than the first reference threshold among the statistical values of the cumulative histogram of the details may be regarded as the first plateau threshold, the statistical value closest to and less than the second reference threshold among the statistical values of the cumulative histogram of the details may be regarded as the second plateau threshold, or the statistical value closest to and greater than the first reference threshold among the statistical values of the cumulative histogram of the details may be regarded as the first plateau threshold.
The method has the advantages that the detail cumulative histogram comprises the detail information of the image to be processed, and the first platform threshold value and the second platform threshold value are determined according to the detail cumulative histogram, so that the first platform threshold value and the second platform threshold value are suitable for processing the image to be processed in the current scene, and the image processing effect is improved.
S130, determining a double-platform histogram according to the first platform threshold, the second platform threshold and the initial histogram.
Illustratively, a dual plateau histogram is constructed from the relationship between the first plateau threshold and the statistical value of the initial histogram and the relationship between the second plateau threshold and the statistical value of the initial histogram. Specifically, for example, if the first bin threshold is smaller than the second bin threshold, the relationship between the statistical value of the initial histogram and the first bin threshold and the second bin threshold is determined. And if the statistical value of the initial histogram is larger than or equal to the first plateau threshold value and smaller than or equal to the second plateau threshold value, the statistical value of the initial histogram is reserved, so that a double-plateau histogram is formed.
And S140, determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image. Wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
The gray mapping relation is determined according to the cumulative histogram of the double platforms, so that the value corresponding to each gray level is determined, the value corresponding to each pixel point in the image to be processed is determined according to the gray level of the pixel point, and the pixel point is given to obtain the target image.
The gray mapping relationship may be determined according to an actual situation, for example, according to a statistical value corresponding to each gray level, a statistical value corresponding to a maximum gray level, and a gray mapping range value in the dual-platform cumulative histogram.
In the embodiment of the application, an initial histogram is determined according to a high-pass filtered image of an image to be processed and the image to be processed, a detail histogram of the image to be processed is determined according to the initial histogram, so that a high-frequency component of the image to be processed is counted, a detail part of the image to be processed is determined, a first platform threshold value and a second platform threshold value are determined from the statistic of the detail cumulative histogram according to the relationship between a first reference threshold value and the statistic of the detail cumulative histogram and the relationship between a second reference threshold value and the statistic of the detail cumulative histogram, so that the detail part is considered in the determining process of the first platform threshold value and the second platform threshold value, and the dual-platform histogram is determined according to the first platform threshold value, the second platform threshold value and the initial histogram; and determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image, so that the processing effect of the image to be processed is improved.
Fig. 2 is a flowchart of an image processing method according to another embodiment of the present application. The embodiment of the application is further optimized for the embodiment, and S110 is thinned to S210-S240. Details not described in detail in the embodiments of the present application are detailed in the above embodiments. Referring to fig. 2, the image processing method provided in the embodiment of the present application may include:
s210, traversing the pixel points of the image to be processed, and taking the pixel points of the image to be processed with the same gray level as target pixel points.
Illustratively, traversing is performed from the first pixel point in the upper left corner of the image to be processed, and the gray level of each pixel point is determined. And taking the pixel point with the same pixel level as a target pixel point. For gray levels of which the target pixel points are not zero, each gray level corresponds to a group of target pixel points, and the number of the group of pixel points is at least one.
S220, determining the initial histogram according to the sum of detail data corresponding to the target pixel point in the high-pass filtering image and the corresponding gray level.
For each gray level, the detail data corresponding to the corresponding target pixel point in the high-pass filtered image is determined, the sum of the detail data corresponding to a group of target pixel points corresponding to each gray level in the high-pass filtered image is taken as the detail data statistic corresponding to the gray level, the gray level is taken as an abscissa value, the detail data statistic corresponding to the gray level is taken as an ordinate value, and the initial histogram is determined. In the embodiment of the present application, the gray level of the image to be processed starts from 0, if it is desired that the gray level in the histogram starts from 1, each gray level may be added by one, and the corresponding detail data statistics value is unchanged, so that the abscissa value starts from 1.
Wherein the detail data may be imgHpss (i, j) α imgHpss (i, j) is a value corresponding to a pixel point (i, j) in the high-pass filtered image, alpha is a detail degree, the value can be selected according to actual conditions, if the detail is emphasized, the influence of the detail is increased, alpha can be set to be a larger value, if the detail is not emphasized, the influence of the detail is reduced, alpha can be set to be a smaller value, and alpha is more than or equal to 0.
And S230, removing the item with the ordinate value of zero in the initial histogram, and compressing the abscissa value of the initial histogram to obtain a filtered histogram.
In this embodiment of the present application, the initial histogram is determined according to the sum of the detail data corresponding to the target pixel point in the high-pass filtered image and the corresponding gray level, and the default condition is that the sum of the detail data of the target pixel point is taken as the ordinate, and the corresponding gray level is taken as the abscissa, so as to execute the operations on the abscissa and the ordinate in S230-S240. For example, if the ordinate value in the initial histogram is zero, which indicates that the pixel point range corresponding to the gray level does not include detail information, the ordinate value corresponding to the gray level may be removed to simplify the initial histogram. The ordinate values are removed and the corresponding abscissa values are removed, so that the abscissa values are reduced, and in order to equally distribute the abscissa values, the abscissa values can be compressed to be equally spaced points. For example, the initial histogram has an abscissa value of 1-256 for 256 values, with an interval of 1, if 10 items with an ordinate value of zero are removed, the corresponding abscissa value is also removed, and the abscissa value remains 246 values, the abscissa value is compressed to 1-246, so that the abscissa values are equally spaced. The filtered histogram is formed by the compressed abscissa value and the ordinate value remaining after removing the item with the ordinate value being zero, and the abscissa value and the ordinate value are in one-to-one correspondence in sequence.
The initial histogram is determined according to the sum of the detail data corresponding to the target pixel point in the high-pass filtered image and the corresponding gray level, or in the practical case, the sum of the detail data corresponding to the target pixel point is taken as the abscissa, the corresponding gray level is taken as the ordinate, and when the operations of S230-S240 are subsequently executed, the operation on the ordinate is modified to the operation on the abscissa, the operation on the abscissa is modified to the operation on the ordinate, that is, "the item with the abscissa value of zero in the initial histogram is removed", and the ordinate value of the initial histogram is compressed, so as to obtain the filtered histogram. And arranging the abscissa values of the filtering histogram according to the order of magnitude to obtain a detail histogram.
S240, arranging the ordinate values of the filtering histogram according to the order of magnitude to obtain a detail histogram.
Illustratively, for filtering the histogram, the abscissa value is unchanged, and the ordinate values are arranged according to the order of magnitude, so as to obtain the detail histogram. The ordered detail histogram can more intuitively show the change condition of the ordinate value, and is convenient for subsequent intuitionistic and quick determination of a first platform threshold value and a second platform threshold value according to the detail histogram.
S250, determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; wherein the first reference threshold and the second reference threshold are determined according to a maximum statistical value of the cumulative histogram of detail.
S260, determining a double-platform histogram according to the first platform threshold, the second platform threshold and the initial histogram.
S270, determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image.
In the embodiment of the application, the initial histogram is determined according to the sum of the detail data corresponding to the target pixel point in the high-pass filtered image and the corresponding gray level, the item with the ordinate value of zero in the initial histogram is removed, the abscissa value of the initial histogram is compressed to obtain the filtered histogram, the ordinate values of the filtered histogram are arranged according to the size sequence to obtain the detail histogram, and therefore statistics of high-frequency detail information in the image to be processed is achieved, the dual-platform threshold value is conveniently determined according to the detail information, and the scene applicability of the image processing method is improved.
Fig. 3 is a flowchart of an image processing method according to another embodiment of the present application. In this embodiment, S120 is further optimized to S320, and S140 is refined to S350-S370 when it is required to be described, the refinement of S120 and the refinement of S140 may not be performed simultaneously, and they do not affect each other, and may be performed only in one step, or may be performed in both steps, and details of the detailed description in this embodiment are described in the foregoing embodiments. Referring to fig. 3, the image processing method provided in the embodiment of the present application may include:
s310, determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram.
S320, accumulating statistics of a histogram of details which is larger than the first reference threshold and has the smallest difference value with the first reference threshold as a first platform threshold; and accumulating the statistics of the detail cumulative histogram which is larger than the second reference threshold and has the smallest difference value with the second reference threshold as a second platform threshold.
In the detail cumulative histogram, if there is a statistical value of the detail cumulative histogram that is greater than the first reference threshold value and the difference from the first reference threshold value is the smallest, the statistical value of the detail cumulative histogram is taken as the first plateau threshold value, and if there is a statistical value of the detail cumulative histogram that is greater than the second reference threshold value and the difference from the second reference threshold value is the smallest, the statistical value is taken as the second plateau threshold value.
S330, determining a first gray level corresponding to the first platform threshold value and a second gray level corresponding to the second platform threshold value in the detail cumulative histogram.
Illustratively, a first gray level corresponding to a first plateau threshold and a second gray level corresponding to a second plateau threshold in the cumulative histogram of detail are recorded. If the first plateau threshold is less than the second plateau threshold, the first gray level is less than the second gray level.
S340, determining a double-platform histogram according to the first platform threshold, the second platform threshold and the initial histogram.
In an embodiment of the present application, the first platform threshold is smaller than the second platform threshold; accordingly, determining a dual plateau histogram from the first plateau threshold, the second plateau threshold, and the initial histogram, comprising: if the statistical value of the initial histogram is smaller than the first platform threshold value, replacing the statistical value of the initial histogram by the first platform threshold value; if the statistical value of the initial histogram is larger than the second platform threshold value, replacing the statistical value of the initial histogram by the second platform threshold value; and if the statistical value of the initial histogram is greater than or equal to the first platform threshold value and less than or equal to the second platform threshold value, reserving the statistical value of the initial histogram.
For example, if t >0.5, the first reference threshold is less than the second reference threshold, the first plateau threshold is less than the second plateau threshold, and the first gray level is less than the second gray level. And determining a dual-plateau histogram based on the first plateau threshold, the second plateau threshold, and the initial histogram, wherein the dual-plateau histogram may be determined, for example, according to the following formula:
Figure BDA0003089305180000131
wherein DPHist (g) is the statistical value of the double-platform histogram, hist (g) is the statistical value of the initial histogram, TDown is the first platform threshold, TUp is the second platform threshold, and g is the gray level.
S350, determining a statistic ratio according to the statistic value of the double-platform cumulative histogram corresponding to each gray level and the statistic value of the double-platform cumulative histogram corresponding to the maximum gray level.
Illustratively, determining a dual plateau cumulative histogram from a dual plateau cumulative histogram may be determined according to the following formula:
accDPHist(g)=accDPHist(g-1)+DPHist(g)
wherein accDPHist (g) is the statistics of the double-platform cumulative histogram, and DPHist (g) is the statistics of the double-platform histogram.
By way of example, the statistical scale may be determined according to the following formula:
Figure BDA0003089305180000132
wherein P is the statistic ratio, accDPHist (g) is the statistic of the double-platform cumulative histogram, accDPHist (m) is the statistic of the double-platform cumulative histogram corresponding to the maximum gray level, and m is the maximum gray level in the double-platform cumulative histogram.
S360, determining the gray mapping relation according to the product of the statistic ratio and the gray mapping range value.
Illustratively, the gray mapping relationship may be expressed as:
HistB(g)=P*R
wherein HistB (g) is a gray mapping relation, R is a gray mapping range value, and P is a statistic value proportion.
In an embodiment of the present application, the determining the gray mapping range value includes: determining the maximum gray level of the target image according to the preset bit width of the target image; if the absolute value of the difference between the first gray level and the second gray level is smaller than or equal to the maximum gray level, the gray mapping range value is the absolute value of the difference between the first gray level and the second gray level; and if the absolute value of the difference between the first gray level and the second gray level is larger than the maximum gray level, the gray mapping range value is the maximum gray level.
Illustratively, the gray mapping range value is determined according to the following formula:
Figure BDA0003089305180000141
wherein R is a gray mapping range value, rangeDown is a first gray level, rangeUp is a second gray level, and n is a maximum gray level determined according to a preset bit width of a target image.
And S370, processing the image to be processed based on the gray mapping relation to obtain a target image. Illustratively, the image to be processed is processed based on the following formula:
imgOut(i,j)=HistB(imgIn(i,j)+1)
Wherein imgOut (i, j) is a target image, histB (imgIn (i, j) +1) is a gray mapping relation, imgIn (i, j) is a gray level corresponding to a pixel (i, j) of an image to be processed, and since the gray level of the histogram is counted from 1 in the embodiment of the present application, one is added on the basis of the gray level of the image to be processed, so as to correspond to the gray level in the histogram.
In the embodiment of the application, the first platform threshold value and the second platform threshold value are determined based on the detailed information of the image to be processed, so that the double-platform histogram is determined, the image to be processed is processed, the processing effect on the image to be processed in different scenes is improved, and the image processing method has good scene adaptability to image processing in different scenes.
Fig. 4 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application. The device can be applied to the case of processing an image. Typically, the embodiment of the application is applicable to the situation of enhancing an image to be processed based on a double-platform histogram. The apparatus may be implemented in software and/or hardware, and the apparatus may be integrated in an electronic device. Referring to fig. 4, the apparatus specifically includes:
A detail histogram determining module 410, configured to determine an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determine a detail histogram of the image to be processed according to the initial histogram;
a threshold determining module 420, configured to determine a first plateau threshold and a second plateau threshold from the statistics of the cumulative histogram of details according to a relationship between a first reference threshold and the statistics of the cumulative histogram of details and a relationship between a second reference threshold and the statistics of the cumulative histogram of details; the first reference threshold value and the second reference threshold value are determined according to the maximum statistical value of the detail cumulative histogram, wherein the detail cumulative histogram is the cumulative histogram of the detail histogram;
a dual plateau histogram determination module 430, configured to determine a dual plateau histogram according to the first plateau threshold, the second plateau threshold, and the initial histogram;
the processing module 440 is configured to determine a gray mapping relationship according to the dual-platform cumulative histogram, and process the image to be processed based on the gray mapping relationship to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
In the embodiment of the present application, the detail histogram determination module 410 includes:
the target pixel point determining unit is used for traversing the pixel points of the image to be processed, and taking the pixel points of the image to be processed with the same gray level as target pixel points;
and the initial histogram determining unit is used for determining the initial histogram according to the sum of detail data corresponding to the target pixel point in the high-pass filtered image and the corresponding gray level.
In the embodiment of the present application, the detail histogram determination module 410 includes:
the filtering histogram determining unit is used for removing the item with the ordinate value of zero in the initial histogram and compressing the abscissa value of the initial histogram to obtain a filtering histogram;
and the sorting unit is used for arranging the ordinate values of the filtering histogram according to the size sequence to obtain a detail histogram.
In the embodiment of the present application, the threshold determining module 420 includes:
a first platform threshold determining unit, configured to accumulate, as a first platform threshold, a statistical value of a detail cumulative histogram that is greater than the first reference threshold and has a minimum difference from the first reference threshold; the method comprises the steps of,
A second platform threshold determining unit, configured to accumulate, as a second platform threshold, a statistic value of a detail cumulative histogram that is greater than the second reference threshold and has a minimum difference from the second reference threshold;
correspondingly, the device further comprises:
and the gray level determining unit is used for determining a first gray level corresponding to the first platform threshold value and a second gray level corresponding to the second platform threshold value in the detail cumulative histogram.
In an embodiment of the present application, the first platform threshold is smaller than the second platform threshold;
accordingly, the dual platform histogram determination module 430 includes:
a first comparing unit, configured to replace the statistical value of the initial histogram with the first plateau threshold if the statistical value of the initial histogram is smaller than the first plateau threshold;
a second comparing unit, configured to replace the statistical value of the initial histogram with the second platform threshold if the statistical value of the initial histogram is greater than the second platform threshold;
and the third comparison unit is used for reserving the statistical value of the initial histogram if the statistical value of the initial histogram is larger than or equal to the first platform threshold value and smaller than or equal to the second platform threshold value.
In the embodiment of the present application, the processing module 440 includes:
the statistical proportion value determining unit is used for determining a statistical proportion value according to the statistical value of the double-platform cumulative histogram corresponding to each gray level and the statistical value of the double-platform cumulative histogram corresponding to the maximum gray level;
and the gray mapping relation determining unit is used for determining the gray mapping relation according to the product of the statistic value proportion and the gray mapping range value.
In an embodiment of the present application, the apparatus further includes:
the maximum gray level determining module is used for determining the maximum gray level of the target image according to the preset bit width of the target image;
a first range value determining module, configured to, if an absolute value of a difference between the first gray level and the second gray level is less than or equal to the maximum gray level, determine that the gray mapping range value is the absolute value of the difference between the first gray level and the second gray level;
and the second range value determining module is used for determining that the gray mapping range value is the maximum gray level if the absolute value of the difference between the first gray level and the second gray level is larger than the maximum gray level.
The image processing device provided by the embodiment of the application can execute the image processing method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Fig. 5 illustrates a block diagram of an exemplary electronic device 512 suitable for use in implementing embodiments of the present application. The electronic device 512 shown in fig. 5 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 5, the electronic device 512 may include: one or more processors 516; a memory 528 for storing one or more programs that, when executed by the one or more processors 516, cause the one or more processors 516 to implement the image processing method provided by the embodiments of the present application, comprising:
determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram;
determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; the first reference threshold value and the second reference threshold value are determined according to the maximum statistical value of the detail cumulative histogram, wherein the detail cumulative histogram is the cumulative histogram of the detail histogram;
Determining a dual-plateau histogram according to the first plateau threshold, the second plateau threshold and the initial histogram;
determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
Components of electronic device 512 may include, but are not limited to: one or more processors or processors 516, a memory 528, a bus 518 connecting the different device components (including the memory 528 and the processor 516).
Bus 518 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, processing ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 512 typically includes a variety of computer device readable storage media. Such storage media can be any available storage media that can be accessed by electronic device 512 and includes both volatile and nonvolatile storage media, removable and non-removable storage media.
Memory 528 may include computer device-readable storage media in the form of volatile memory, such as Random Access Memory (RAM) 530 and/or cache memory 532. The electronic device 512 may further include other removable/non-removable, volatile/nonvolatile computer device storage media. By way of example only, the storage system 534 may be used to read from or write to a non-removable, nonvolatile magnetic storage medium (not shown in FIG. 5, commonly referred to as a "hard disk drive"). Although not shown in fig. 5, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical storage medium), may be provided. In such cases, each drive may be coupled to bus 518 through one or more data storage medium interfaces. Memory 528 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of the embodiments of the present application.
A program/utility 540 having a set (at least one) of program modules 542 may be stored in, for example, memory 528, such program modules 542 including, but not limited to, an operating device, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 542 generally perform the functions and/or methods in the embodiments described herein.
The electronic device 512 may also communicate with one or more external devices 514 (e.g., keyboard, pointing device, display 524, etc.), one or more devices that enable a user to interact with the electronic device 512, and/or any devices (e.g., network card, modem, etc.) that enable the electronic device 512 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 522. Also, the electronic device 512 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through the network adapter 520. As shown in fig. 5, the network adapter 520 communicates with other modules of the electronic device 512 over the bus 518. It should be appreciated that although not shown in fig. 5, other hardware and/or software modules may be used in connection with electronic device 512, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID devices, tape drives, data backup storage devices, and the like.
The processor 516 performs various functional applications and data processing by executing at least one of the other programs among the plurality of programs stored in the memory 528, for example, to implement an image processing method provided in the embodiments of the present application.
One embodiment of the present application provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing an image processing method comprising:
determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram;
determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; the first reference threshold value and the second reference threshold value are determined according to the maximum statistical value of the detail cumulative histogram, wherein the detail cumulative histogram is the cumulative histogram of the detail histogram;
determining a dual-plateau histogram according to the first plateau threshold, the second plateau threshold and the initial histogram;
determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
Any combination of one or more computer-readable storage media may be employed as the computer storage media of the embodiments herein. The computer readable storage medium may be a computer readable signal storage medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor device, apparatus, or means, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, 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), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of the present application, a computer-readable storage medium may be any tangible storage medium that can contain, or store a program for use by or in connection with an instruction execution apparatus, device, or means.
The computer readable signal storage medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal storage medium may also be any computer readable storage medium that is not a computer readable storage medium and that can transmit, propagate, or transport a program for use by or in connection with an instruction execution apparatus, device, or apparatus.
Program code embodied on a computer readable storage medium may be transmitted using any appropriate storage medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or device. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present application and the technical principle applied. Those skilled in the art will appreciate that the present application is not limited to the particular embodiments described herein, but is capable of numerous obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the present application. Therefore, while the present application has been described in connection with the above embodiments, the present application is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present application, the scope of which is defined by the scope of the appended claims.

Claims (10)

1. An image processing method, the method comprising:
determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram;
determining a first platform threshold value and a second platform threshold value from the statistic value of the detail cumulative histogram according to the relation between a first reference threshold value and the statistic value of the detail cumulative histogram and the relation between a second reference threshold value and the statistic value of the detail cumulative histogram; the first reference threshold value and the second reference threshold value are determined according to the maximum statistical value of the detail cumulative histogram, wherein the detail cumulative histogram is the cumulative histogram of the detail histogram; the statistical value of the detail cumulative histogram is a statistical value obtained by accumulating the sum of detail data of the detail histogram;
Determining a dual-plateau histogram according to the first plateau threshold, the second plateau threshold and the initial histogram;
determining a gray mapping relation according to the double-platform cumulative histogram, and processing the image to be processed based on the gray mapping relation to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
2. The method of claim 1, wherein determining an initial histogram from a high pass filtered image of an image to be processed and the image to be processed comprises:
traversing the pixel points of the image to be processed, and taking the pixel points of the image to be processed with the same gray level as target pixel points;
and determining the initial histogram according to the sum of detail data corresponding to the target pixel point in the high-pass filtered image and the corresponding gray level.
3. The method of claim 2, wherein determining a detail histogram of the image to be processed from the initial histogram comprises:
removing the item with the ordinate value of zero in the initial histogram, and compressing the abscissa value of the initial histogram to obtain a filtered histogram;
And arranging the ordinate values of the filtering histogram according to the order of magnitude to obtain a detail histogram.
4. A method according to any of claims 1-3, wherein determining a first plateau threshold and a second plateau threshold from the statistics of the cumulative histograms of details based on the relationship of a first reference threshold to the statistics of the cumulative histograms of details and the relationship of a second reference threshold to the statistics of the cumulative histograms of details comprises:
taking the statistic value of the detail cumulative histogram which is larger than the first reference threshold and has the smallest difference value with the first reference threshold as a first platform threshold; the method comprises the steps of,
taking the statistic value of the detail cumulative histogram which is larger than the second reference threshold and has the smallest difference value with the second reference threshold as a second platform threshold;
accordingly, the method further comprises:
and determining a first gray level corresponding to the first platform threshold value and a second gray level corresponding to the second platform threshold value in the detail cumulative histogram.
5. A method according to any of claims 1-3, wherein the first plateau threshold is less than the second plateau threshold;
Accordingly, determining a dual plateau histogram from the first plateau threshold, the second plateau threshold, and the initial histogram, comprising:
if the statistical value of the initial histogram is smaller than the first platform threshold value, replacing the statistical value of the initial histogram by the first platform threshold value;
if the statistical value of the initial histogram is larger than the second platform threshold value, replacing the statistical value of the initial histogram by the second platform threshold value;
and if the statistical value of the initial histogram is greater than or equal to the first platform threshold value and less than or equal to the second platform threshold value, reserving the statistical value of the initial histogram.
6. The method of claim 4, wherein determining a gray mapping from the dual plateau cumulative histogram comprises:
determining a statistic ratio according to the statistic value of the double-platform cumulative histogram corresponding to each gray level and the statistic value of the double-platform cumulative histogram corresponding to the maximum gray level;
and determining the gray mapping relation according to the product of the statistic ratio and the gray mapping range value.
7. The method of claim 6, wherein the determining of the gray mapping range value comprises:
Determining the maximum gray level of the target image according to the preset bit width of the target image;
if the absolute value of the difference between the first gray level and the second gray level is smaller than or equal to the maximum gray level, the gray mapping range value is the absolute value of the difference between the first gray level and the second gray level;
and if the absolute value of the difference between the first gray level and the second gray level is larger than the maximum gray level, the gray mapping range value is the maximum gray level.
8. An image processing apparatus, characterized in that the apparatus comprises:
the detail histogram determining module is used for determining an initial histogram according to a high-pass filtered image of an image to be processed and the image to be processed, and determining a detail histogram of the image to be processed according to the initial histogram;
the threshold determining module is used for determining a first platform threshold and a second platform threshold from the statistic value of the detail cumulative histogram according to the relation between the first reference threshold and the statistic value of the detail cumulative histogram and the relation between the second reference threshold and the statistic value of the detail cumulative histogram; the first reference threshold value and the second reference threshold value are determined according to the maximum statistical value of the detail cumulative histogram, wherein the detail cumulative histogram is the cumulative histogram of the detail histogram; the statistical value of the detail cumulative histogram is a statistical value obtained by accumulating the sum of detail data of the detail histogram;
The dual-platform histogram determination module is used for determining a dual-platform histogram according to the first platform threshold value, the second platform threshold value and the initial histogram;
the processing module is used for determining a gray mapping relation according to the double-platform cumulative histogram and processing the image to be processed based on the gray mapping relation to obtain a target image; wherein the dual plateau cumulative histogram is a cumulative histogram of the dual plateau histogram.
9. An electronic device, the electronic device comprising:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the image processing method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the image processing method according to any one of claims 1-7.
CN202110590447.9A 2021-05-28 2021-05-28 Image processing method, device, electronic equipment and medium Active CN113191990B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110590447.9A CN113191990B (en) 2021-05-28 2021-05-28 Image processing method, device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110590447.9A CN113191990B (en) 2021-05-28 2021-05-28 Image processing method, device, electronic equipment and medium

Publications (2)

Publication Number Publication Date
CN113191990A CN113191990A (en) 2021-07-30
CN113191990B true CN113191990B (en) 2023-05-23

Family

ID=76985936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110590447.9A Active CN113191990B (en) 2021-05-28 2021-05-28 Image processing method, device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113191990B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115660997B (en) * 2022-11-08 2023-06-02 杭州微影软件有限公司 Image data processing method and device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521813A (en) * 2011-11-21 2012-06-27 华中科技大学 Infrared image adaptive enhancement method based on dual-platform histogram
CN109377464A (en) * 2018-10-08 2019-02-22 嘉应学院 A kind of Double plateaus histogram equalization method and its application system of infrared image

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102456224A (en) * 2010-10-19 2012-05-16 高森 Real-time digital image enhancement method based on field programmable gate array (FPGA)
CN103778900B (en) * 2012-10-23 2016-04-20 浙江大华技术股份有限公司 A kind of image processing method and system
CN103353349B (en) * 2013-06-18 2016-08-10 南京理工大学 Infrared-thermometerself-adaption self-adaption three platform histogram equalization system and method thereof
CN106097286B (en) * 2016-06-21 2019-02-12 浙江大华技术股份有限公司 A kind of method and device of image procossing
EP3627442A4 (en) * 2017-05-31 2020-05-20 Shanghai United Imaging Healthcare Co., Ltd. Method and system for image processing
CN107292856A (en) * 2017-06-12 2017-10-24 北京理工大学 A kind of method of infrared focal plane detector image enhaucament
US20190392311A1 (en) * 2018-06-21 2019-12-26 Deep Force Ltd. Method for quantizing a histogram of an image, method for training a neural network and neural network training system
US11276152B2 (en) * 2019-05-28 2022-03-15 Seek Thermal, Inc. Adaptive gain adjustment for histogram equalization in an imaging system
CN111784609B (en) * 2020-07-02 2023-11-07 烟台艾睿光电科技有限公司 Image dynamic range compression method, device and computer readable storage medium
CN112348763A (en) * 2020-11-09 2021-02-09 西安宇视信息科技有限公司 Image enhancement method, device, electronic equipment and medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521813A (en) * 2011-11-21 2012-06-27 华中科技大学 Infrared image adaptive enhancement method based on dual-platform histogram
CN109377464A (en) * 2018-10-08 2019-02-22 嘉应学院 A kind of Double plateaus histogram equalization method and its application system of infrared image

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于双平台直方图的红外图像增强算法;宋岩峰,等;红外与激光工程(第02期);125-128 *
基于改进型平台直方图的红外均衡化算法;毛义伟,等;光学与光电技术(第05期);66-69 *

Also Published As

Publication number Publication date
CN113191990A (en) 2021-07-30

Similar Documents

Publication Publication Date Title
JP5478047B2 (en) Video data compression pre-processing method, video data compression method and video data compression system using the same
CN111950723A (en) Neural network model training method, image processing method, device and terminal equipment
CN108416740B (en) Iterative adaptive median filtering method for eliminating salt and pepper noise
CN109255752B (en) Image self-adaptive compression method, device, terminal and storage medium
CN109214996B (en) Image processing method and device
CN112348763A (en) Image enhancement method, device, electronic equipment and medium
CN111882565B (en) Image binarization method, device, equipment and storage medium
CN113191990B (en) Image processing method, device, electronic equipment and medium
CN111861938B (en) Image denoising method and device, electronic equipment and readable storage medium
CN115660976A (en) Image processing method, device, equipment and computer readable storage medium
CN110796624B (en) Image generation method and device and electronic equipment
CN114298985B (en) Defect detection method, device, equipment and storage medium
CN111027564A (en) Low-illumination imaging license plate recognition method and device based on deep learning integration
CN115965537A (en) Video image denoising method and device and computer storage medium
US10964028B2 (en) Electronic device and method for segmenting image
CN111311610A (en) Image segmentation method and terminal equipment
CN113888635B (en) Visual positioning method and related device
CN114596210A (en) Noise estimation method, device, terminal equipment and computer readable storage medium
CN113158773A (en) Training method and training device for living body detection model
CN113762027A (en) Abnormal behavior identification method, device, equipment and storage medium
CN113674158A (en) Image processing method, device, equipment and storage medium
CN114691603A (en) Target information storage method, device, electronic equipment and medium
JP2019165434A (en) Method and apparatus for generating hdr image with reduced clipped area
CN113875247A (en) High dynamic range video format detection
CN111770330B (en) Image compression method and device and electronic equipment

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