Search

CN-117115052-B - Image processing method, device, equipment and medium

CN117115052BCN 117115052 BCN117115052 BCN 117115052BCN-117115052-B

Abstract

The application discloses an image processing method, an image processing device, image processing equipment and a medium, which are used for improving the contrast ratio of an image. The method comprises the steps of determining dissimilarity factors of pixel points based on the pixel points and pixel values of a plurality of pixel points in the neighborhood of the pixel points, determining dissimilarity histogram vectors corresponding to an original image, enabling the value of a kth element in the dissimilarity histogram vectors to be the sum value of dissimilarity factors of the pixel points corresponding to the kth gray level in a gray value range corresponding to the original image, dividing the dissimilarity histogram vectors into a plurality of sub-dissimilarity histogram vectors based on the gray value corresponding to each element in the dissimilarity histogram vectors and an adjustment threshold, correcting the sub-dissimilarity histogram vectors based on the dissimilarity mean value of the sub-dissimilarity histogram vectors according to each sub-dissimilarity histogram vector, and remapping the corrected sub-dissimilarity histogram vectors based on the adjustment threshold to obtain a target image. Thereby improving image contrast.

Inventors

  • GAO YUAN
  • LI JUN
  • CHEN ZHENXIN
  • LIU QUANKAI
  • LU WUPING

Assignees

  • 浙江华感科技有限公司

Dates

Publication Date
20260512
Application Date
20230802

Claims (11)

  1. 1. An image processing method, comprising: For each pixel in an original image, determining a dissimilarity factor of the pixel based on the pixel and pixel values of a plurality of pixels in the neighborhood of the pixel; Determining dissimilar histogram vectors corresponding to the original image, wherein the value of a kth element in the dissimilar histogram vectors is the sum value of dissimilar factors of pixel points corresponding to a kth gray level in a gray value range corresponding to the original image, and the gray value range corresponding to the original image is 0 to 0 The value of k is 0 to L is an integer greater than or equal to 8; dividing the dissimilar histogram vector into at least two sub-dissimilar histogram vectors based on the gray value and at least one adjustment threshold value corresponding to each element in the dissimilar histogram vector; For each sub-dissimilar histogram vector, correcting the sub-dissimilar histogram vector based on the dissimilar mean value of the sub-dissimilar histogram vector to obtain a corrected sub-dissimilar histogram vector; remapping at least two dissimilar histogram vectors of the modifier based on the at least one adjustment threshold to obtain a target image; Correcting the sub-dissimilar histogram vector based on the dissimilar mean value of the sub-dissimilar histogram vector to obtain a corrected sub-dissimilar histogram vector, including: Determining a dissimilar mean value of each of the sub-dissimilar histogram vectors; setting the value of an element larger than the dissimilar mean value in the sub-dissimilar histogram vector as the dissimilar mean value for each sub-dissimilar histogram vector, and keeping the value of an element not larger than the dissimilar mean value in the sub-dissimilar histogram vector unchanged to obtain a limited sub-dissimilar histogram vector corresponding to the sub-dissimilar histogram vector; averaging the values of the elements in the sub-dissimilar histogram vectors, which are larger than the dissimilar mean value of the sub-dissimilar histogram vectors, by adopting the number of non-0 elements in the sub-dissimilar histogram vectors to obtain the dissimilar compensation value of the limiting sub-dissimilar histogram vector; And setting the value of an element A in the limiter dissimilar histogram vector as the sum of the value of an element B and a dissimilar compensation value corresponding to the limiter dissimilar histogram vector to obtain a modifier dissimilar histogram vector, wherein the element A is an element which is larger than and equal to the dissimilar mean value corresponding to the limiter dissimilar histogram vector, and the element B is an element which is smaller than the dissimilar mean value corresponding to the limiter dissimilar histogram vector.
  2. 2. The method of claim 1, wherein determining a dissimilarity mean value for each of the sub-dissimilarity histogram vectors comprises: And adding the values of the elements in the sub-dissimilar histogram vectors aiming at each sub-dissimilar histogram vector, and dividing the values by the number of non-0 elements in the sub-dissimilar histogram vector to obtain the dissimilar mean value of the sub-dissimilar histogram vector.
  3. 3. The method of claim 1, wherein dividing the dissimilar histogram vector into two sub-dissimilar histogram vectors based on the gray value and an adjustment threshold value for each element in the dissimilar histogram vector, comprises: The value of a first element in the dissimilar histogram vector is kept unchanged, and the value of a second element in the dissimilar histogram vector is set to 0, so that a sub dissimilar histogram vector is obtained; setting the value of a first element in the dissimilar histogram vector to 0, and keeping the value of a second element in the dissimilar histogram vector unchanged to obtain another dissimilar histogram vector; The first element is an element corresponding to a gray value smaller than or equal to the adjustment threshold in the dissimilar histogram vector, and the second element is an element corresponding to a gray value larger than or equal to the adjustment threshold in the dissimilar histogram vector.
  4. 4. The method of claim 1, wherein averaging values of elements in the sub-dissimilar histogram vector that are greater than a dissimilar mean of the sub-dissimilar histogram vector using a number of non-0 elements in the sub-dissimilar histogram vector to obtain a dissimilarity compensation value that limits the sub-dissimilar histogram vector, comprises: selecting an element 1 with a value larger than the dissimilar mean value of the sub dissimilar histogram vector for each sub dissimilar histogram vector, determining the difference value of the dissimilar mean value of each element 1 and the dissimilar histogram vector, averaging the sum value of the difference values by adopting the number of non-zero elements in the sub dissimilar histogram vector to obtain a dissimilar compensation value of a limited sub dissimilar histogram vector corresponding to the sub dissimilar histogram vector, or; Selecting an element 1 with a value larger than the dissimilar mean value of the dissimilar histogram vectors of each sub-dissimilar histogram vector, determining the difference value of the dissimilar mean value of each element 1 and the dissimilar histogram vector, determining the sum value S1 of the difference values of a plurality of elements 1 in the dissimilar histogram vectors and the dissimilar mean value of the corresponding sub-dissimilar histogram vector, and averaging the sum value S1 by adopting the sum value S2 of the number of non-zero elements in the dissimilar histogram vectors to obtain the dissimilar compensation value of the limited dissimilar histogram vector corresponding to each dissimilar histogram vector.
  5. 5. The method of claim 1, wherein prior to dividing the dissimilar histogram vector into two sub-dissimilar histogram vectors based on the gray value and an adjustment threshold value for each element in the dissimilar histogram vector, further comprising: Determining an average gray value Tm1 of the pixel points based on the sum of gray values of the pixel points in the original image and the number of the pixel points in the original image; Determining an average gray value Tm2 of the dissimilarity factor based on the dissimilarity histogram vector corresponding to the original image; And determining an adjustment threshold value Tm based on the average gray value Tm1 of the pixel point and the average gray value Tm2 of the similarity factor.
  6. 6. The method of claim 5, wherein determining the average gray value Tm2 of the dissimilarity factor based on the dissimilarity histogram vector corresponding to the original image comprises: Determining the product of the gray value of each pixel point in the original image and the dissimilarity factor of the pixel point; Adding products corresponding to all the pixel points; and averaging the product addition result by adopting the sum of the dissimilarity factors of the original image to obtain an average gray value Tm2 of the dissimilarity factors.
  7. 7. The method of claim 1, wherein remapping at least two of the modifier dissimilar histogram vectors based on the at least one adjustment threshold to obtain a target image, comprising: Determining a probability density function vector corresponding to each corrected sub-histogram vector; determining an accumulated distribution function vector corresponding to each corrected sub-histogram vector according to the probability density function vector corresponding to each corrected sub-histogram vector; Determining a mapping function vector from the gray scale range of the original image to a preset gray scale range according to the accumulated distribution function vector corresponding to the corrected sub-histogram vectors and the at least one adjustment threshold; and determining a target image according to the mapping function vector.
  8. 8. The method of claim 7, wherein determining a mapping function vector of the gray scale range of the original image to the preset gray scale range based on the accumulated distribution function vector corresponding to the plurality of corrected sub-histogram vectors and the at least one adjustment threshold comprises: By the following formula: F(i)=tmpmin+Tm wherein i is more than or equal to 1 and less than or equal to Tm; F(i)=Tm+1+[(tmpmax-tmpmin)-(Tm+1)] wherein Tm+1 is less than or equal to i is less than or equal to ; Determining the value F (i) of the ith element in the mapping function vector F, wherein tmpmin is less than or equal to tmpmax,0< tmpmin < ,0<tmpmax< Tm represents the threshold value of the adjustment, Representing the value of the ith element in a cumulative distribution function vector, Representing the value of the ith element in another cumulative distribution function vector.
  9. 9. An image processing apparatus, comprising: A dissimilar histogram module, configured to determine, for each pixel in an original image, a dissimilar factor of the pixel based on the pixel and pixel values of a plurality of pixels in the neighborhood of the pixel, determine a dissimilar histogram vector corresponding to the original image, wherein the value of a kth element in the dissimilar histogram vector is a sum of dissimilar factors of pixels corresponding to a kth gray level in a gray value range corresponding to the original image, and the gray value range corresponding to the original image is 0 to The value of k is 0 to L is an integer greater than or equal to 8; the correction module is used for dividing the dissimilar histogram vector into at least two sub dissimilar histogram vectors based on the gray value corresponding to each element in the dissimilar histogram vector and at least one adjustment threshold value; for each sub-dissimilar histogram vector, correcting the sub-dissimilar histogram vector based on the dissimilar mean value of the sub-dissimilar histogram vector to obtain a corrected sub-dissimilar histogram vector; the remapping module is used for remapping at least two modifier dissimilar histogram vectors based on the at least one adjustment threshold value to obtain a target image; the correction module is specifically configured to determine an dissimilarity mean value of each of the sub-dissimilarity histogram vectors, set a value of an element greater than the dissimilarity mean value in each of the sub-dissimilarity histogram vectors as the dissimilarity mean value, keep the value of an element not greater than the dissimilarity mean value in the sub-dissimilarity histogram vector unchanged, obtain a limited sub-dissimilarity histogram vector corresponding to the sub-dissimilarity histogram vector, average the values of elements greater than the dissimilarity mean value of the sub-dissimilarity histogram vectors in the sub-dissimilarity histogram vectors by adopting the number of non-0 elements in the sub-dissimilarity histogram vectors, and obtain a dissimilarity compensation value of the limited sub-dissimilarity histogram vector, set a value of an element B in the limited sub-dissimilarity histogram vector as a sum of dissimilarity compensation values corresponding to the limited sub-dissimilarity histogram vector, wherein the value of the element B in the limited dissimilarity histogram vector is equal to the dissimilarity mean value of the dissimilarity element corresponding to the dissimilarity mean value of the sub-dissimilarity histogram vector.
  10. 10. An electronic device is characterized by comprising a processor and a memory; The memory is used for storing a computer program or instructions; the processor being configured to execute part or all of the computer program or instructions in the memory, which, when executed, is configured to implement the method of any of claims 1-8.
  11. 11. A computer readable storage medium storing a computer program comprising instructions for implementing the method of any one of claims 1-8.

Description

Image processing method, device, equipment and medium Technical Field The present application relates to the field of network technologies and security technologies, and in particular, to an image processing method, apparatus, device, and medium. Background In the infrared imaging technology, users have the defects of low signal-to-noise ratio, blurred target edges, details and the like of infrared images due to the inherent resolution limitation of infrared sensors and the effect of atmospheric absorption and scattering of infrared rays in the transmission process. In order to be able to correctly identify the object, an enhanced preprocessing of the infrared image is necessary. Disclosure of Invention The application provides an image processing method, an image processing device, image processing equipment and a medium, which are used for improving the contrast ratio of an image. In a first aspect, there is provided an image processing method including: For each pixel in an original image, determining a dissimilarity factor of the pixel based on the pixel and pixel values of a plurality of pixels in the neighborhood of the pixel; Determining a dissimilar histogram vector corresponding to the original image, wherein the value of a kth element in the dissimilar histogram vector is the sum value of dissimilar factors of pixel points corresponding to a kth gray level in a gray value range corresponding to the original image, the gray value range corresponding to the original image is 0-2 L -1, the value of k is 0-2 L -1, and L is an integer greater than or equal to 8; dividing the dissimilar histogram vector into at least two sub-dissimilar histogram vectors based on the gray value and at least one adjustment threshold value corresponding to each element in the dissimilar histogram vector; For each sub-dissimilar histogram vector, correcting the sub-dissimilar histogram vector based on the dissimilar mean value of the sub-dissimilar histogram vector to obtain a corrected sub-dissimilar histogram vector; and remapping at least two dissimilar histogram vectors of the modifier based on the at least one adjustment threshold to obtain a target image. In one possible implementation, correcting the sub-dissimilar histogram vector based on the dissimilar mean value of the sub-dissimilar histogram vector to obtain a corrected sub-dissimilar histogram vector includes: Determining a dissimilar mean value of each of the sub-dissimilar histogram vectors; setting the value of an element larger than the dissimilar mean value in the sub-dissimilar histogram vector as the dissimilar mean value for each sub-dissimilar histogram vector, and keeping the value of an element not larger than the dissimilar mean value in the sub-dissimilar histogram vector unchanged to obtain a limited sub-dissimilar histogram vector corresponding to the sub-dissimilar histogram vector; averaging the values of the elements in the sub-dissimilar histogram vectors, which are larger than the dissimilar mean value of the sub-dissimilar histogram vectors, by adopting the number of non-0 elements in the sub-dissimilar histogram vectors to obtain the dissimilar compensation value of the limiting sub-dissimilar histogram vector; And setting the value of an element A in the limiter dissimilar histogram vector as the sum of the value of an element B and a dissimilar compensation value corresponding to the limiter dissimilar histogram vector to obtain a modifier dissimilar histogram vector, wherein the element A is an element which is larger than and equal to the dissimilar mean value corresponding to the limiter dissimilar histogram vector, and the element B is an element which is smaller than the dissimilar mean value corresponding to the limiter dissimilar histogram vector. In one possible implementation, determining the dissimilar mean value of each of the sub-dissimilar histogram vectors includes: And adding the values of the elements in the sub-dissimilar histogram vectors aiming at each sub-dissimilar histogram vector, and dividing the values by the number of non-0 elements in the sub-dissimilar histogram vector to obtain the dissimilar mean value of the sub-dissimilar histogram vector. In one possible implementation, dividing the dissimilar histogram vector into two sub-dissimilar histogram vectors based on the gray value and an adjustment threshold value corresponding to each element in the dissimilar histogram vector, includes: The value of a first element in the dissimilar histogram vector is kept unchanged, and the value of a second element in the dissimilar histogram vector is set to 0, so that a sub dissimilar histogram vector is obtained; setting the value of a first element in the dissimilar histogram vector to 0, and keeping the value of a second element in the dissimilar histogram vector unchanged to obtain another dissimilar histogram vector; The first element is an element corresponding to a gray value smaller than or equal to the adjustme