A histogram-based image contrast enhancement detection method
Through the detection method based on histogram features, using the cumulative distribution function and zero-gap span features, combined with the SVM model, the detection problem of multiple contrast enhancement operations in the existing technology is solved, and high-accuracy classification and gamma parameters are achieved It is estimated that the accuracy of image tampering detection is improved.
Patent Information
- Application Number
- CN202210214813.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-03-07
AI Technical Summary
The existing technology is difficult to simultaneously detect multiple contrast enhancement operations and distinguish contrast enhancement methods with different parameter values, and cannot effectively detect the degree of contrast enhancement, which affects the accuracy of image tampering detection.
The detection method based on histogram features constructs feature vectors by calculating the cumulative distribution function and zero-gap span features of the image, and uses the SVM model for training and classification, extracts trace features and gamma parameter values, and implements various contrast enhancement operations. Discrimination and estimation of gamma parameters.
It achieves effective differentiation of multiple contrast enhancement operations, with a classification accuracy higher than 95% and accurate gamma parameter value estimation, reducing the negative impact of image tampering on society.
Smart Images

Figure CN114677333B
Abstract
Description
Technical Field
[0001] The invention relates to an image contrast enhancement detection method based on histogram features, and belongs to the technical fields of digital image processing, computer vision, machine learning, etc. Background Art
[0002] With the rapid development of digital imaging and processing technology, a large number of powerful media editing software have emerged, making complex image forgeries easy and frequent. Therefore, human trust in the integrity and authenticity of digital images cannot be guaranteed. The spread of these forged images will also bring many adverse effects to society. Therefore, there is an increasing need to develop technology to study image processing. Digital image forensics is such a technology. Image forensics can be roughly divided into two categories: active methods and passive methods. Active methods use prior information of images for verification, while passive methods do not require prior information of images and only rely on the image itself for evidence collection. Since active methods cannot guarantee the timeliness and effectiveness of data processing, passive methods have become a hot area in image forensics. In recent years, many passive methods have been proposed. According to whether the semantic content of the tampered image has changed, they are usually divided into local tampering and global tampering. Local tampering tampered with certain parts of the image. Common tampering methods include copying, moving and splicing. Global tampering usually acts after the local tampering operation to hide the traces of local tampering. Common global tampering operation methods include contrast enhancement, filtering, JPEG compression, etc. Contrast enhancement operations have been widely used due to their simplicity and ease of use. However, this global tampering operation will affect the detection effect of local operations, so it is becoming increasingly important to detect global tampering operations.
[0003] Several methods have been proposed for contrast enhancement detection. These methods can be roughly divided into traditional feature extraction methods and neural network-based methods. Traditional feature extraction is generally performed in the spatial domain and frequency domain. Common spatial domain methods are calculated through statistical features, such as histograms and gray-level co-occurrence matrices. Before feature extraction in the frequency domain, the image needs to be transformed, such as discrete Fourier transform and wavelet transform, that is, the data is converted from the spatial domain to the frequency domain, and then the traces are extracted by calculating the difference between high and low frequencies. Neural network-based methods usually extract tampering traces first and then input them into the neural network for classification. Although existing methods have achieved detection effects to a certain extent, they still have some defects: (1) Existing methods can only detect a specific contrast enhancement operation and cannot distinguish multiple contrast enhancement operations at the same time; (2) Contrast enhancement methods of the same type with different parameter values cannot be distinguished at the same time; (3) The degree of contrast enhancement cannot be known, and clues cannot be provided for subsequent tasks.
[0004] After searching, CN111161163A is a method for contrast enhancement of infrared images with dual gamma correction of histogram. The technical scheme of the method includes: calculating the theoretical grayscale range and effective grayscale level of the image; performing histogram mean normalization processing; counting the proportion of effective grayscale levels in the histogram, and calculating the correction parameters Gamma0 and Gamma1; classifying the histogram data, and then performing power exponential correction with parameters Gamma0 and Gamma1 respectively; obtaining a mapping table using the corrected histogram, performing table lookup and replacement operations on all data according to the mapping table, and finally obtaining a contrast enhanced image. Except for the statistical histogram of the whole image, the rest of the operations of this method are all point processing algorithms. Therefore, the processing efficiency is high, the resource occupation is small, the real-time performance is good, and the method complexity is low. By dividing the histogram into two parts and performing Gamma power exponential correction processing respectively, the histogram is reasonably controlled and adjusted, and the internal parameters are adaptively controlled, a good contrast enhancement effect can be achieved. The method has a wide range of applications. This method can enhance various types of infrared images, including thermal infrared and near infrared. The Gamma parameter in the method is automatically adjusted according to the unique information of the image histogram to enhance the histogram.
[0005] This patent is a method for infrared image contrast enhancement based on histogram dual gamma correction. It is an image contrast enhancement method by statistics and classification of image histogram data, selecting two different gamma parameter values to perform gamma correction operations on the classified histogram data. The present invention is a method for detecting images after contrast enhancement. Through this algorithm, it can be distinguished which images have undergone contrast enhancement operations. The present invention is also based on a histogram. The cumulative distribution function of the image is first calculated to select the effective selection range for feature extraction, and then the distance between two adjacent zero-gap boxes in the histogram is calculated to construct a feature vector, that is, a zero-gap span feature, and this feature is used as a trace feature to distinguish different contrast enhancement operations. Summary of the invention
[0006] The present invention aims to solve the above problems of the prior art. A histogram-based image contrast enhancement detection method is proposed. The technical solution of the present invention is as follows:
[0007] A histogram-based image contrast enhancement detection method comprises the following steps:
[0008] (1) Obtaining publicly available original image samples for image tampering detection;
[0009] (2) Perform global tampering operations on the collected original image samples using contrast enhancement operations and complete the construction of the tampered image dataset;
[0010] (3) Extracting trace features from the histogram of the tampered image; this step includes selecting the effective range for extracting trace features and extracting zero gap span features;
[0011] (4) Using SVM to train the model of the obtained zero gap span features;
[0012] (5) Use the trained model to test the input image and obtain the final detection result;
[0013] (6) Use the zero gap span feature obtained in step (3) to estimate the gamma parameter value of the gamma corrected image.
[0014] Furthermore, the global tampering operation performed using the contrast enhancement operation in step (2) includes histogram equalization and gamma correction.
[0015] Furthermore, the (3) extracts trace features from the histogram of the tampered image; including selecting an effective range for extracting trace features and extracting trace features, specifically including:
[0016] The zero gap in the histogram caused by the contrast enhancement operation is defined as:
[0017] b k =0,min{b k-1 ,b k+1}>τ
[0018] where b k is the height of the kth box in the normalized histogram of the image. The first sub-equation in the formula ensures that the corresponding box height is 0, and the second sub-equation keeps the adjacent boxes at a certain height. The histogram-based zero gap span feature is proposed as a trace feature of the contrast enhancement operation. The zero gap span refers to the distance between two adjacent zero gaps in the image histogram. Assume that K is a set containing the indices of all zero gap positions in the histogram, which is defined as follows:
[0019]
[0020] The zero gap span feature Z is a 256-dimensional feature vector, corresponding to 256 pixels of the histogram. i is the i-th element in the K set. The above formula counts the number of boxes between two zero gaps in the histogram, and the value is recorded in the corresponding index of the zero gap span feature Z.
[0021] Furthermore, considering extracting trace features only in the rising interval of the cumulative distribution function, in order to find the effective range, the slope cdf'(t) at point t on the cumulative distribution function curve cdf of the image is defined as:
[0022]
[0023] Where x(t)∈{0,1,...,255} is the grayscale value of the pixel at t, and the starting grayscale level R of the effective selection range is proposed s and R e The definition is as follows:
[0024] R s =min{x(t)|cdf'(t)≠0,cdf(t)≠0}
[0025] R e =min{x(t)|cdf'(t)<δ,cdf(t)≠0}
[0026] Among them, δ cannot be set too large, otherwise the effective range for extracting zero gap span features will become shorter and useful grayscale values will be lost, making the extracted trace features insufficient to represent the fingerprint left by the contrast enhancement operation.
[0027] Furthermore, the (4) uses SVM to perform model training on the obtained zero gap span feature, specifically including:
[0028] The training process of SVM uses grid search and cross-validation to optimize two hyperparameters that affect the classification accuracy and generalization ability of the classifier, the penalty factor c and the kernel parameter g, where the range of c is set to [2 -2 ,2 4 ], the range of g is set to [2 -4 ,2 4 ].
[0029] Furthermore, the step (6) uses the zero gap span feature obtained in step (3) to estimate the gamma parameter value of the gamma corrected image, and the specific steps are as follows:
[0030] Define two variables that are most affected by gamma correction as features for estimating the gamma parameter value, where the first variable is the maximum span value S1 in the zero gap span feature Z, defined as follows:
[0031]
[0032] The second variable is the span maximum value S2 in the zero gap span value, which is defined as follows:
[0033] S2=maxZ(i)
[0034] Then, a quadratic curve is fitted for the non-zero part of the extracted zero gap span feature, and the middle position a of the maximum span value, the middle position b of the second largest span value, and the middle position c of the third largest span value are selected; then the slopes g'(a), g'(b), and g'(c) of these three points on this curve are determined; the approximate range of the gamma parameter value is determined by the relationship between these three slopes: after gamma correction of γ < 1, the slope values of these three points increase in turn; after gamma correction of γ > 1, the slope values of these three points decrease in turn;
[0035] Finally, the gamma parameter value is estimated by logistic regression, which is defined as follows:
[0036]
[0037] Among them, different α, β and θ are used for γ<1 and γ>1.
[0038] The advantages and beneficial effects of the present invention are as follows:
[0039] The image contrast enhancement detection method based on histogram features proposed in the present invention is a general and effective method based on image histogram that can be applied to a variety of contrast enhancement detections. This method basically solves the problems existing in previous contrast enhancement detection methods, can effectively distinguish and maintain a high classification accuracy when facing multiple contrast enhanced images at the same time, and can perform the task of estimating gamma correction parameter values.
[0040] The present invention uses digital image processing, computer vision, machine learning and other technologies to achieve contrast enhancement detection tasks. The present invention is a method based on histogram features. By extracting trace features according to the histogram of the image and then using SVM for classification, a good classification result can be obtained. The proposed features can also be used to estimate the gamma parameter value of the gamma-corrected image. The present invention has the following advantages:
[0041] (1) Use the MATLAB platform for training and testing, which is low-cost;
[0042] (2) It is a feature extraction method based on image histogram. The present invention first selects the effective range of feature extraction through the cumulative distribution function to ensure that the most obvious trace of the contrast enhancement operation is selected. Then, the trace feature of the contrast enhancement operation is detected by calculating the specific distance between two adjacent zero-gap boxes in the histogram, that is, the zero-gap span feature. The present invention can extract the universal trace feature for detecting a variety of contrast enhancement methods by relying only on the zero-gap span feature in the image histogram, which is simple and effective.
[0043] (3) The trace features extracted by the present invention can distinguish multiple contrast enhancement operations at the same time, and also have a good distinguishing effect on the same contrast enhancement operation methods with different parameter values. At the same time, the gamma parameter value estimation of the gamma-corrected image has a certain accuracy. The present invention has a high accuracy rate, and its classification accuracy rate is higher than 95% for any different types of contrast enhancement operations; for different gamma parameter values, the mean square error between the estimated value and the actual value is less than 0.1156.
[0044] (4) It can assist related image forensics or image security work, thereby reducing the adverse effects of image tampering on individuals and society. It has practical significance and achieves good results. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 is a system flow chart of a preferred embodiment provided by the present invention;
[0046] Figure 2 (a1)-(a4) are the original images and the images after different contrast enhancement operations;
[0047] Figure 2 (b1)-(b4) are the histograms corresponding to the original image and the images after different contrast enhancement operations;
[0048] Figure 2 (c1)-(c4) are the trace features (zero gap span features) extracted from different images based on histograms. DETAILED DESCRIPTION
[0049] The following will describe the technical solutions in the embodiments of the present invention in detail in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention.
[0050] The technical solution of the present invention to solve the above technical problems is:
[0051] System flow chart as follows Figure 1 As shown, a contrast enhancement detection method based on histogram features comprises the following steps:
[0052] Step 1: Collect and organize publicly available original image samples for image tampering detection;
[0053] Step 2: Use common contrast enhancement methods to perform global tampering operations on the collected tampered image samples and complete the construction of the tampered image dataset;
[0054] Preferably, the global tampering operation using the contrast enhancement operation includes histogram equalization and gamma correction.
[0055] Step 3: Extract trace features from the histogram of the tampered image. This step includes the selection of the effective range for trace feature extraction and the extraction of trace features. The specific steps are as follows:
[0056] Since the contrast enhancement operation will cause the remapping of pixel values, this will directly lead to the appearance of peaks and zero gaps in the image histogram. For different contrast enhancement operations, the locations of zero gaps and peaks are also different. The present invention only focuses on the zero gaps in the histogram caused by the contrast enhancement operation, which are defined as follows:
[0057] b k =0,min{b k-1 ,b k+1}>τ
[0058] where b k is the height of the kth box in the normalized histogram of the image. The first sub-equation in the formula ensures that the corresponding box height is 0, and the second sub-equation keeps the adjacent boxes at a certain height. The present invention proposes a histogram-based zero gap span feature as a trace feature of the contrast enhancement operation. The zero gap span refers to the distance between two adjacent zero gaps in the image histogram. Assuming that K is a set containing the indexes of all zero gap positions in the histogram, the definition of the zero gap span feature is as follows:
[0059]
[0060] The zero gap span feature Z is a 256-dimensional feature vector, corresponding to 256 pixels of the histogram. i is the i-th element in the K set. The above formula counts the number of boxes between two zero gaps in the histogram, and the value is recorded in the corresponding index of the zero gap span feature Z.
[0061] It can be noted that the existing image contrast enhancement operation detection methods all directly extract features within a fixed grayscale detection range. However, since there may be large sections of continuous grayscale levels with no pixel value distribution at both ends of the image histogram, this will result in a straight line with a slope of 0 on the cumulative distribution function curve. Grayscale levels without pixel value distribution cannot reflect the traces left by the contrast enhancement operation, so the trace features extracted within the entire image grayscale range seriously affect the detection effect. Therefore, we consider extracting trace features only in the rising interval of the cumulative distribution function. In order to find this effective range, the slope cdf'(t) at point t on the image cumulative distribution function curve cdf is defined as:
[0062]
[0063] Where x(t)∈{0,1,...,255} is the pixel grayscale value at t. The starting grayscale level R of the proposed effective selection range iss and R e The definition is as follows:
[0064] R s =min{x(t)|cdf'(t)≠0,cdf(t)≠0}
[0065] R e =min{x(t)|cdf'(t)<δ,cdf(t)≠0}
[0066] Among them, δ cannot be set too large, otherwise the effective range for extracting zero-gap span features will become shorter and useful grayscale values will be lost, making the extracted trace features insufficient to represent the fingerprint of the contrast enhancement operation.
[0067] Step 4: Use SVM to train the zero gap span feature obtained in step (3);
[0068] The training process of SVM involves optimizing two hyperparameters (penalty factor c and kernel parameter g) that affect the classification accuracy and generalization ability of the classifier, where the range of c is set to [2 -2 ,2 4 ], the range of g is set to [2 -4 ,2 4 ].
[0069] Step 5: Use the model trained in step (4) to test the zero gap span feature of the input image to obtain the final classification result.
[0070] Step 6: Estimate the gamma parameter value of the gamma-corrected image using the zero-gap span feature. The specific steps are as follows:
[0071] Define two variables that are most affected by gamma correction as features for estimating the gamma parameter value, where the first variable is the maximum span value S1 in the zero gap span feature Z, defined as follows:
[0072]
[0073] The second variable is the span maximum value S2 in the zero gap span value, which is defined as follows:
[0074] S2=maxZ(i)
[0075] Then, a quadratic curve is fitted for the non-zero part of the extracted zero gap span feature, and the middle position a of the maximum span value, the middle position b of the second largest span value, and the middle position c of the third largest span value are selected. Then the slopes g'(a), g'(b), and g'(c) of these three points on this curve are determined. The approximate range of the gamma parameter value is determined by the relationship between these three slopes: after gamma correction of γ < 1, the slope values of these three points increase successively; after gamma correction of γ > 1, the slope values of these three points decrease successively.
[0076] Finally, the gamma parameter value is estimated by logistic regression, which is defined as follows:
[0077]
[0078] Among them, different α, β and θ are used for γ<1 and γ>1.
[0079] Experimental methods:
[0080] In this experiment, we collected and sorted out a variety of publicly tampered images, and used 50% of them as training sets to train the SVM classifier, and used the other 50% as test sets to test the detection accuracy of the proposed histogram-based contrast enhancement detection method, and estimated the gamma parameter values for all images after gamma correction operations.
[0081] The first step is to use histogram equalization and gamma correction to perform contrast enhancement on all the collected tampered images, that is, to generate contrast enhanced images of different degrees for each image.
[0082] Step 2: Use Matlab to run the program, input the training set images and corresponding labels into SVM, and after tuning the training parameters, obtain the final trained model.
[0083] Step 3: Use the trained model to test the images in the test set and calculate the classification accuracy of the detection based on the corresponding labels.
[0084] Step 4: Estimate the gamma parameter value of the gamma-corrected image using the zero-gap span feature.
[0085] Experiments show that the proposed method can effectively distinguish different contrast-enhanced images after training, and the classification accuracy of any combination of contrast-enhanced images is higher than 95%. For the gamma parameter value of the gamma-corrected image, the mean square error between the estimated value and the true value is lower than 0.1156.
[0086] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0087] The above embodiments should be understood to be only used to illustrate the present invention and not to limit the protection scope of the present invention. After reading the contents of the present invention, technicians can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A histogram-based image contrast enhancement detection method, characterized in that: The following steps are involved: (1) Obtaining publicly available original image samples for image tampering detection; (2) Perform global tampering operations on the collected original image samples using contrast enhancement operations and complete the construction of the tampered image dataset; (3) Extracting trace features from the histogram of the tampered image; this step includes selecting the effective range for extracting trace features and extracting zero gap span features; (4) Using SVM to train the model of the obtained zero gap span features; (5) Use the trained model to test the input image and obtain the final detection result; (6) using the zero gap span feature obtained in step (3) to estimate the gamma parameter value of the gamma-corrected image; The (3) extracting trace features from the histogram of the tampered image; Including the selection of effective range for trace feature extraction and extraction of trace features, specifically including: The zero gap in the histogram caused by the contrast enhancement operation is defined as: b k =0,min{b k-1 ,b k+1 }>t where b k is the height of the kth box in the normalized histogram of the image. The first sub-equation in the formula ensures that the corresponding box height is 0, and the second sub-equation keeps the adjacent boxes at a certain height. The histogram-based zero gap span feature is proposed as a trace feature of the contrast enhancement operation. The zero gap span refers to the distance between two adjacent zero gaps in the image histogram. Assume that K is a set containing the indices of all zero gap positions in the histogram, which is defined as follows: The zero gap span feature Z is a 256-dimensional feature vector, corresponding to the 256 pixels of the histogram; i is the i-th element in the K set. The above formula counts the number of boxes between two zero gaps in the histogram, and the value is recorded in the corresponding index of the zero gap span feature Z.
2. The histogram-based image contrast enhancement detection method according to claim 1, characterized in that: The global tampering operation performed using the contrast enhancement operation in step (2) includes histogram equalization and gamma correction.
3. The histogram-based image contrast enhancement detection method according to claim 1, characterized in that: Considering that the trace feature is extracted only in the rising interval of the cumulative distribution function, in order to find the effective range, the slope cdf'(t) at point t on the cumulative distribution function curve cdf of the image is defined as: Where x(t)∈{0,1,...,255} is the grayscale value of the pixel at t, and the starting grayscale level R of the effective selection range is proposed s and R e The definition is as follows: R s =min{x(t)|cdf'(t)≠0,cdf(t)≠0} R e =min{x(t)|cdf'(t)<δ,cdf(t)≠0} Among them, δ cannot be set too large, otherwise the effective range for extracting zero gap span features will become shorter and useful grayscale values will be lost, making the extracted trace features insufficient to represent the fingerprint left by the contrast enhancement operation.
4. The histogram-based image contrast enhancement detection method according to claim 1, characterized in that: The (4) uses SVM to perform model training on the obtained zero gap span feature, specifically including: The training process of SVM uses grid search and cross-validation to optimize two hyperparameters that affect the classification accuracy and generalization ability of the classifier, the penalty factor c and the kernel parameter g, where the range of c is set to [2 -2 ,2 4 ], the range of g is set to [2 -4 ,2 4 ].
5. The histogram-based image contrast enhancement detection method according to claim 4, characterized in that: The step (6) uses the zero gap span feature obtained in step (3) to estimate the gamma parameter value of the gamma corrected image, and the specific steps are as follows: Define two variables that are most affected by gamma correction as features for estimating the gamma parameter value, where the first variable is the maximum span value S1 in the zero gap span feature Z, defined as follows: The second variable is the span maximum value S2 in the zero gap span value, which is defined as follows: S2=maxZ(i) Then, a quadratic curve is fitted for the non-zero part of the extracted zero gap span feature, and the middle position a of the maximum span value, the middle position b of the second largest span value, and the middle position c of the third largest span value are selected; then the slopes g'(a), g'(b), and g'(c) of these three points on this curve are determined; the range of the gamma parameter value is determined by the relationship between these three slopes: after gamma correction of γ < 1, the slope values of these three points increase in turn; after gamma correction of γ > 1, the slope values of these three points decrease in turn; Finally, the gamma parameter value is estimated by logistic regression, which is defined as follows: Among them, different α, β and θ are used for γ<1 and γ>1.
Citation Information
Patent Citations
Infrared image contrast enhancement method based on histogram dual gamma correction
CN111161163A
Rapid area-of-interest detection method based on depth kernelized hashing
CN106408001A
Contrast adjustment system and contrast adjustment method
US20200334797A1
