[go: up one dir, main page]

CN112446831B - Image enhancement method and computer equipment - Google Patents

Image enhancement method and computer equipment Download PDF

Info

Publication number
CN112446831B
CN112446831B CN201910817313.9A CN201910817313A CN112446831B CN 112446831 B CN112446831 B CN 112446831B CN 201910817313 A CN201910817313 A CN 201910817313A CN 112446831 B CN112446831 B CN 112446831B
Authority
CN
China
Prior art keywords
value
image
processed
gray scale
gray
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
CN201910817313.9A
Other languages
Chinese (zh)
Other versions
CN112446831A (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.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology 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 Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN201910817313.9A priority Critical patent/CN112446831B/en
Publication of CN112446831A publication Critical patent/CN112446831A/en
Application granted granted Critical
Publication of CN112446831B publication Critical patent/CN112446831B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques

Landscapes

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

Abstract

The invention discloses an image enhancement method and computer equipment. The method comprises the following steps: acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed; determining a compensation curve corresponding to the image to be processed according to the gray scale information; calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve; and generating an enhanced image according to the compensated pixel value of each pixel point. Compared with the image to be processed, the enhanced image obtained by the method is clearer, the contrast is increased, the color is more vivid, in addition, the method provided by the invention has low complexity, the method is easy to realize, has low requirements on hardware such as a memory, a processor and the like of the image display device, and can realize image enhancement on the image display device with low performance.

Description

Image enhancement method and computer equipment
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and a computer device for image enhancement.
Background
With the improvement of life quality of people and the development of display equipment technology, the requirements of people on the quality of images are higher and higher. In the related art, because of limitations on hardware such as a memory and a processor of the display device, complex image enhancement processing cannot be performed, so that problems of low image quality, unclear images, less image details and the like occur, and the requirements of users on high-quality images cannot be met.
Disclosure of Invention
The invention aims to solve the technical problem of providing an image enhancement method and computer equipment so as to ensure that the image quality is higher, the image is more true, the image color is more vivid, and the image contrast is higher, thereby bringing good visual experience to users.
In a first aspect, an embodiment of the present invention provides a method for image enhancement, including:
Acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed;
determining a compensation curve corresponding to the image to be processed according to the gray scale information;
Calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve;
and generating an enhanced image according to the compensated pixel value of each pixel point.
Further, the acquiring the gray-scale information of the image to be processed includes:
acquiring gray scales of all pixel points in the image to be processed;
and obtaining gray scale information of the image to be processed according to the gray scale of each pixel point.
Further, the obtaining the gray scale of each pixel point in the image to be processed includes:
acquiring R values, G values and B values of all pixel points in the image to be processed;
respectively determining the maximum value of the R value, the G value and the B value of each pixel point, and respectively taking the maximum value of the R value, the G value and the B value of each pixel point as the maximum RGB value of each pixel point;
and taking the maximum RGB value of each pixel point as the gray scale of each pixel point.
Further, the gray scale information further comprises the number of times of each gray scale and the percentage of the number of times of each gray scale to the total number of pixel points; the obtaining the gray level information of the image to be processed according to the gray level of each pixel point comprises the following steps:
Acquiring a first set comprising a plurality of first values according to the gray scales of each pixel point, wherein the first values are the occurrence times of each gray scale;
acquiring a second set comprising a plurality of second values according to the gray scales of each pixel point, wherein the second values are the percentage of the number of times of each gray scale to the total number of the pixel points;
and obtaining gray scale information according to the first set and the second set.
Further, the determining the compensation curve corresponding to the image to be processed according to the gray scale information includes:
Determining a plurality of control points of the Bessel function according to the gray level information;
And determining a compensation curve through a Bessel function according to the plurality of control points.
Further, the determining a plurality of control points of the bessel function according to the gray-scale information includes:
Obtaining a plurality of line pointer values corresponding to a plurality of preset values respectively according to the first set and the preset set, wherein the preset set comprises a plurality of preset values which are products of the resolution of the image to be processed and a plurality of preset percentages respectively;
And selecting a plurality of control points of the Bessel function from the second set according to a plurality of line pointer values corresponding to a plurality of preset values respectively.
Further, the obtaining, according to the first set and the preset set, a plurality of line pointer values corresponding to a plurality of preset values respectively includes:
For each first value in the first set, calculating an accumulated value corresponding to the first value according to the first value, wherein the accumulated value is the sum of at least one first value, and the at least one first value comprises the first value and all first values of which gray scales are smaller than the gray scales corresponding to the first value;
for each preset value, acquiring the absolute value of the difference value between the preset value and each accumulated value;
and selecting the minimum value from all the absolute values obtained through calculation, and taking the selected minimum value as the line number pointer value corresponding to the preset value.
Further, the acquiring the image to be processed and acquiring the gray level information of the image to be processed includes:
acquiring an image to be processed, and acquiring a histogram of the image to be processed; wherein the histogram includes the gray scale information.
Further, the determining the compensation curve corresponding to the image to be processed according to the gray scale information includes:
Determining control points of the Bessel function according to the histogram;
and determining a compensation curve through a Bessel function according to the control point.
Further, the obtaining the compensated pixel value of each pixel point according to the compensation curve includes:
performing interpolation processing on the compensation curve according to an interpolation method to obtain a compensated maximum RGB value of each pixel point;
And respectively obtaining the compensated pixel value of each pixel point according to the compensated maximum RGB value of each pixel point and the gray scale of each pixel point.
In a second aspect, an embodiment of the present invention further provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the following steps when executing the computer program:
Acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed;
determining a compensation curve corresponding to the image to be processed according to the gray scale information;
Calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve;
and generating an enhanced image according to the compensated pixel value of each pixel point.
In a third aspect, embodiments of the present invention also provide a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed;
determining a compensation curve corresponding to the image to be processed according to the gray scale information;
Calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve;
and generating an enhanced image according to the compensated pixel value of each pixel point.
Compared with the prior art, the embodiment of the invention has the following advantages:
According to the method provided by the embodiment of the invention, the image to be processed is obtained, and the gray scale information of the image to be processed is obtained, wherein the gray scale information comprises the gray scale of each pixel point in the image to be processed; determining a compensation curve corresponding to the image to be processed according to the gray scale information; calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve; and generating an enhanced image according to the compensated pixel value of each pixel point. Compared with the image to be processed, the enhanced image obtained by the method is clearer, the contrast is increased, the color is more vivid, in addition, the method provided by the invention has low complexity, the method is easy to realize, has low requirements on hardware such as a memory, a processor and the like of the image display device, and can realize image enhancement on the image display device with low performance.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present invention, and other drawings may be obtained according to the drawings without inventive effort to those skilled in the art.
FIG. 1 is a flowchart of a method for image enhancement according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of gray scale information and accumulated values of an image to be processed according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an image to be processed as a landscape photograph in an embodiment of the present invention;
FIG. 4 is a schematic diagram of the compensation curve corresponding to FIG. 3 according to an embodiment of the present invention;
FIG. 5 is a histogram corresponding to FIG. 3 in an embodiment of the present invention;
FIG. 6 is an enhanced image corresponding to FIG. 3 in an embodiment of the present invention;
FIG. 7 is a histogram of FIG. 6 in an embodiment of the invention;
Fig. 8 is an internal structural diagram of an image-enhanced computer device according to an embodiment of the present invention.
Detailed Description
In order to make the present invention better understood by those skilled in the art, the following description will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The inventor finds that the image enhancement effect is poor due to the limitation of the hardware performance of the memory, the processor and the like of the image display device, but with the popularization of various display devices such as mobile phones, televisions, computers and the like, the requirements of users on the definition of the images are higher and higher, and the images in the related technology cannot meet the requirements of the users on high-quality images.
In order to solve the above-mentioned problem, in the embodiment of the present invention, the original picture that is originally blurred or even indistinguishable at all can be processed into an enhanced image that is clear and rich in a large amount of useful information through enhancement processing.
Referring to fig. 1, fig. 1 illustrates a method for image enhancement in an embodiment of the present invention, in this embodiment, the method may include the following steps, for example:
s1: acquiring an image to be processed, and acquiring gray level information of the image to be processed, wherein the gray level information comprises gray levels of all pixel points in the image to be processed.
In the embodiment of the invention, the image to be processed can be an image or a frame in a video, and the image to be processed can be displayed on a device with a display screen such as a television, a computer and a mobile phone. Referring to fig. 2, the image to be processed may be a landscape photograph, each pixel point in the image to be processed has a corresponding gray level, and gray levels of the pixels in the image to be processed are counted, so that gray level information of the image to be processed may be obtained.
Specifically, step S1 includes:
s11, acquiring gray scales of all pixel points in the image to be processed.
The gray scale is the brightness change between the brightest and darkest, in the field of image processing, the gray scale can take the value of 0-255, 256 brightness levels are all used, each pixel point on the image to be processed is combined by red, green and blue with different level, different color points are finally formed, and the color change is brought by the gray scale change of the R value, the G value and the B value of the pixel point.
Specifically, step S11 includes:
s111, obtaining R values, G values and B values of all pixel points in the image to be processed.
In the embodiment of the invention, the R value, the G value and the B value of each pixel point in the image to be processed can be obtained through MATLAB. For example, the size of the image to be processed is m×n, and data describing M rows and N columns can be obtained by MATLAB, where the value of the first row and the first column represents the R value, G value, and B value of the pixel (1, 1), and it is assumed that the value of the first row and the first column is (195,212,228) and the R value is 195, the G value is 212, and the B value is 228.
S112, respectively determining the maximum value of the R value, the G value and the B value of each pixel point, and respectively taking the maximum value of the R value, the G value and the B value of each pixel point as the maximum RGB value of each pixel point.
In the embodiment of the present invention, the R value, the G value, and the B value of each pixel are compared, and the maximum value obtained by the comparison is used as the maximum RGB value, for example, the R value of the pixel (1, 1) is 195, the G value is 212, and the B value is 228, so that the maximum RGB value of the pixel (1, 1) can be determined to be 228.
S113, taking the maximum RGB value of each pixel point as the gray scale of each pixel point.
In the embodiment of the present invention, the gray level of a pixel, that is, the maximum RGB value of the pixel, is 228 in the above example.
And S12, obtaining gray scale information of the image to be processed according to the gray scale of each pixel point.
In the embodiment of the present invention, the gray-scale information includes gray scales of each pixel point in the image to be processed, for example, 400 pixels of the image to be processed, 80 pixels of the image to be processed with a gray scale of 100, 50 pixels of the image to be processed with a gray scale of 101, and 270 pixels of the image to be processed with a gray scale of 150, the gray scales of the image to be processed are 100,101 and 150, and the gray scales of the image to be processed can be vertically arranged from small to large, i.e. (100,101,150) T.
The gray scale information further includes: the number of occurrences of each gray level and the number of occurrences of each gray level are percentages of the total number of pixels.
Specifically, step S12 includes:
S121, acquiring a first set comprising a plurality of first numerical values according to the gray scale of each pixel point, wherein the first numerical values are the occurrence times of each gray scale.
In the embodiment of the invention, each pixel point of the image to be processed has a corresponding gray level, the total number of the gray levels of the image to be processed is the same as the number of the pixel points of the image to be processed, but the number of the gray levels may be different from the number of the pixel points, for an image with a resolution of more than 256, the gray levels of some pixel points may be the same, and for the same gray level, if the gray level appears for 3 times, the gray level of the pixel points is the same, so the number of the gray levels is smaller than the number of the pixel points. The number of times of each gray level is a first value, one image to be processed corresponds to a plurality of gray levels, the plurality of gray levels correspond to a plurality of first values, a first set is formed by the plurality of first values, and the sum of all the first values in the first set can be known to be the total number of pixels of the image to be processed.
For example, the image to be processed has 400 pixels, and it is assumed that the pixels having a gray level of 100 have 80 pixels, that is, the gray level having a value of 100 has occurred 80 times, the gray level having a value of 101 has occurred 50 times, and the gray level having a value of 150 has occurred 270 times, in this example, for the gray levels having values of 100,101 and 150, the first values are 80,50 and 270, respectively, the arrangement order of the first values in the first set is the same as the arrangement order of the gray levels, and in the above example, the arrangement of the gray levels is: (100,101,150) T, and correspondingly, the first set is: (80,50,270) T.
S122, obtaining a second set comprising a plurality of second values according to the gray scales of the pixel points, wherein the second values are the percentage of the number of times of each gray scale to the total number of the pixel points.
In the embodiment of the present invention, the first value is the number of occurrences of each gray scale, and for a gray scale, the percentage of the number of occurrences of the gray scale to the total number of pixels is the second value of the gray scale. For example, the image to be processed has 400 pixels, and the gray scale with the value of 100 appears 80 times, and the second value of the gray scale with the value of 100 is: 0.2; the gray level of 101 appears 50 times, and the second value of the gray level of 101 is: 0.125; 270 occurrences of a gray scale of 150, the second value of the gray scale of 150 is: 0.675, the set of second numbers of the plurality of gray levels being a set of second values. It is known that the sum of all second values in the set of second values is1, e.g. the second set (0.2,0.125,0.675) T.
S123, obtaining gray scale information according to the first set and the second set.
In the embodiment of the invention, the gray scale information comprises gray scales of each pixel point in the image to be processed, the occurrence frequency of each gray scale and the percentage of the occurrence frequency of each gray scale in the total number of the pixel points. In the above example, the image to be processed has 400 pixels, and the obtained gray-scale information may be in a matrix form as follows:
100 80 0.2
101 50 0.125
150 370 0.765
The first column is the gray scale appearing in the image to be processed in the previous example, the numerical value of a certain row in the second column is the number of times that the gray scale appears in the row where the numerical value exists, the numerical value of a certain row in the third column is the percentage of the gray scale of the row where the numerical value exists in the total number of pixels, and optionally, the gray scale information of the image to be processed in the form of a matrix can be directly obtained by adopting the tabulate function in MATLAB.
S2, determining a compensation curve corresponding to the image to be processed according to the gray level information.
In the embodiment of the present invention, according to gray level information, a compensation curve is drawn by using a bessel function, and specifically, step S2 includes:
S21, determining a plurality of control points of the Bessel function according to the gray level information.
In the embodiment of the invention, the Bezier curve can be drawn through the Bezier function, and the Bezier curve can be used as a compensation curve. The representation of the Bessel function is shown in formula (1):
Wherein p is a control point, there are a plurality of control points, and in the embodiment of the present invention, k may be 0 to 8, that is, there are 9 control points: p0, p1, … …, p8, N is equal to 8,t, which is the subdivision frequency, namely the reciprocal of the fine graduation, and t is more than or equal to 0 and less than or equal to 1; bezier curve describes the variation of B N with t from 0 to 1; the control point p may be calculated according to the gray-scale information and the preset set, and specifically, step S21 includes:
S211, obtaining a plurality of line pointer values corresponding to a plurality of preset values respectively according to the first set and the preset set, wherein the preset set comprises a plurality of preset values, and the preset values are products of the resolution of the image to be processed and a plurality of preset percentages respectively.
In the embodiment of the present invention, the plurality of preset percentages are 9 fixed percentages, for example, the plurality of preset percentages are: (1%, 5%,10%,25%,50%,75%,90%,95%, 99.99%), the preset value is the product of the resolution of the image to be processed and a plurality of preset percentages, respectively, and the preset set h= (1%, 5%,10%,25%,50%,75%,90%,95%, 99.99%) is x M x N, where M x N is the resolution.
Specifically, step S211 includes:
s211a, for each first value in the first set, calculating an accumulated value corresponding to the first value according to the first value, wherein the accumulated value is the sum of at least one first value, and the at least one first value comprises the first value and all first values of which gray scales are smaller than the gray scales corresponding to the first values.
In the embodiment of the present invention, the first value is the number of times of each gray level of the image to be processed, for example, the first several items of partial gray level information and each accumulated value of the image to be processed are listed as follows:
The first column is the gray scale arranged from small to large, the second column is the first value corresponding to each gray scale, and the third column is the accumulated value corresponding to each first value; the accumulated value corresponding to the gray level 1 is r1, in the above example, there is no gray level smaller than the gray level 1, so r1 is equal to the first value corresponding to r1, that is, r1=1; the accumulated value corresponding to the gray level 2 is r2, and the gray level smaller than 2 is 1, so that r2 is equal to the sum of the first value corresponding to the gray level 2 and the first value corresponding to the gray level 1, namely r2=8; the accumulated value corresponding to the gray level 3 is r3, and similarly, r3 should be equal to the sum of the first value corresponding to the gray level 3, the first value corresponding to the gray level 2 and the first value corresponding to the gray level, that is, r3=10; the accumulated value corresponding to the gray level 4 is r4, and similarly, r4 should be equal to the sum of the first value corresponding to the gray level 4, the first value corresponding to the gray level 3, the first value corresponding to the gray level 2 and the first value corresponding to the gray level, that is, r4=13; similarly, the gray level is 5, and the corresponding accumulated value r5=14. In this example, only 5 gray scales are listed, 14 pixel points are involved, the accumulated value r1=1 corresponding to the gray scale is 1, and the accumulated value r5=14 corresponding to the gray scale is 5, and it can be known that, for the image to be processed, the accumulated value corresponding to the gray scale with the smallest value is equal to the first value corresponding to the gray scale with the smallest value, and the accumulated value corresponding to the gray scale with the largest value is equal to the total number of pixel points of the image to be processed.
S211b, for each preset value, acquiring the absolute value of the difference value between the preset value and each accumulated value.
In the embodiment of the present invention, the preset value is the product of the image resolution and a plurality of preset percentages, in the above example, the resolution of the image to be processed is 20×20, and according to the preset score and the resolution of the image to be processed, the preset set may be calculated as h= (4,20,40,100,200,300,360,380,399.96), where in the present example, the preset value is: h0 =4, h1=20, h2=40, h3=100, h4=200, h5=300, h6=360, h7=380, h8=399.96; the method comprises the steps of providing 400 pixel points in total for an image to be processed, obtaining the difference value between each accumulated value and h0 respectively for a preset value h0=4, obtaining the absolute value of the difference value, providing the accumulated value corresponding to each gray scale of a fourth column of bits in the image to be processed according to the gray scale information of the image to be processed and the accumulated value shown in fig. 2, obtaining the difference value between each accumulated value and h0 respectively for the preset value h0, and obtaining the absolute value of the difference value: 6. 30, 48, 83, 107, 123, 153, 179, 201, 233, 251, 269, 291, 323, 343, 368, 383, 396; similarly, the absolute values of the differences between the preset values h1, … …, h8 and the respective accumulated values can be determined, which are not listed here.
S211c, selecting the minimum value from all the absolute values obtained through calculation, and taking the selected minimum value as the line number pointer value corresponding to the preset value.
In this embodiment, according to the gray-scale information, the minimum value of the absolute values obtained in step S211a is selected, that is, the number closest to the preset value in the accumulated values is found, and the difference between the accumulated value closest to the preset value and the preset value is calculated, and the minimum value is used as the line pointer value. In the first few items listed in the above example, for a preset value h0, the difference between the accumulated value closest to h0 and h0 is: 6, namely the number of the line pointers corresponding to h0 is 6, and the number of the line pointers corresponding to h1 is 10; the number of the line pointers corresponding to h2 is 6; the number of the line pointers corresponding to h3 is 11; the number of the line pointers corresponding to h4 is 5; the number of the line pointers corresponding to h5 is 5; the number of the line pointers corresponding to h6 is 12; the number of the line pointers corresponding to h7 is 7; the number of line pointers corresponding to h8 is 0.
S212, selecting a plurality of control points of the Bessel function from the second set according to a plurality of line pointer values corresponding to a plurality of preset values.
In the embodiment of the present invention, the control point p= (px, py), py is 9 preset values, for example, may be respectively: py0=0.01, py1=0.05, py2=0.1, py3=0.25, py4=0.5, py5=0.75, py6=0.9, py7=0.95, py8=0.999. According to the number of lines of pointers, px is obtained in the second set, where the second set includes all the values of the third column of the gray information, referring to fig. 2, in the above example, for the preset value h0, the number of lines of pointers is 6, and the value corresponding to the 6 th line in the second set is taken as px0 corresponding to h0, it can be known that px0 corresponding to h0 is 0.04, and the control point corresponding to h0 is: p0= (px 0, py 0) = (0.04,0.01); for the preset value h1, the line number pointer of h1 is 10, taking the value corresponding to the 10 th line in the second set as px1 corresponding to h1, where px1=0.08 can be obtained, and then the control point corresponding to h1 is: p1= (px 1, py 1) = (0.08,0.05) for a preset value h2=6, a control point corresponding to h2 may be obtained where px2=0.04: p2= (px 2, py 2) = (0.06,0.1); likewise, the control point h3 corresponding function pointer may be obtained as 11, p3= (px 3, py 3) = (0.25,0.045) according to the above method; the number of line pointers corresponding to h4 is 5, p4= (px 4, py 4) = (0.06,0.5); the number of line pointers corresponding to h5 is 5, p5= (px 5, py 5) = (0.06,0.75); the number of line pointers corresponding to h6 is 12, p6= (px 6, py 6) = (0.045,0.9); the number of line pointers corresponding to h7 is 7, p7= (px 7, py 7) = (0.075,0.95); the number of line pointers corresponding to h8 is 0, and when the number of line pointers is 0, the corresponding control point is p8= (0, 0), that is, px8 is 0 and py9 is also 0.
S22, determining a compensation curve through a Bessel function according to a plurality of control points.
In the embodiment of the invention, referring to fig. 4, a schematic diagram of a compensation curve corresponding to fig. 3 of a landscape photo is shown. After the 9 control points p0, p1, … … and p8 of the Bessel function are calculated, a compensation curve can be drawn through the Bessel function.
In one implementation, step S1 includes:
s1a, acquiring an image to be processed, and acquiring a histogram of the image to be processed; wherein the histogram includes the gray scale information.
In the embodiment of the invention, the histogram is a visual expression mode of the gray level information of the image to be processed, and can intuitively display the gray level information of the image to be processed, as shown in fig. 5, fig. 5 is a histogram corresponding to a landscape photo fig. 3, the abscissa of the histogram is the gray level appearing in the landscape image, and the ordinate is the number of times of the gray level appearing, and the histogram can reflect the image to be processed. The gray-scale information obtained in step S123 can also be counted by the histogram.
Step S2 further includes:
s2a, determining control points of the Bessel function according to the histogram.
In the embodiment of the invention, gray-scale information can be counted according to the histogram, control points of the Bessel function can be determined according to the gray-scale information, and the specific steps for determining the control points of the Bessel function according to the gray-scale information are the same as those in step S21.
And S2b, determining a compensation curve through a Bessel function according to the control point.
In the embodiment of the present invention, referring to fig. 4, after calculating 9 control points p0, p1, … …, p8 of the bessel function, a compensation curve can be drawn through the bessel function.
And S3, calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve.
In the embodiment of the present invention, each pixel point of the image to be processed has a corresponding gray-scale compensation value, and specifically, step S3 includes:
and S31, carrying out interpolation processing on the compensation curve according to an interpolation method to obtain a compensated maximum RGB value of each pixel point.
In the embodiment of the invention, interpolation can be performed through an interpolation 1 function in MATLAB, and the method is specific: maxRGB ' =inter 1 (x, y, maxRGB, ' pchip '); wherein x and y are x and y values of the Bezier curve respectively, the maximum RGB value of the pixel point is introduced in the previous step, namely the gray level of the pixel point, the gray level can be marked as maxRGB, the maximum RGB value after compensation is obtained as maxRGB 'through interpolation processing, and the gray level after compensation is obtained as maxRGB'.
In the embodiment of the invention, each maxRGB has its corresponding (x, y), and for one maxRGB, the method for determining the corresponding (x, y) of the maxRGB is as follows:
The gray scale is normalized by dividing the gray scale by 255, for example, for maxRGB1, the value obtained by dividing maxRGB1 by 255 is normalized by maxRGB1, assuming that maxRGB 1=0, that is, the gray scale is 0, the value obtained by normalizing the pixel point with the gray scale of 0 is 0, and assuming that maxRGB 1=128, that is, the pixel point with the gray scale of 128 is normalized to be 0.502.
The value after gray scale normalization is taken as x, and then y corresponding to x is found on the bezier curve, for example, the normalized pixel point with gray scale of 128 is 0.502, that is, the pixel point with gray scale of 128 corresponds to x of 0.502 in the interpolation function, and if the value that x=0.502 corresponds to y=0.271 is obtained through the bezier curve, for maxRGB 1=128, the interpolation formula is as follows: maxRGB1' =interp1 (0.502,0.271, 128, ' pchip '). The supplemented gray scale can be obtained by this function in MATLAB.
S32, respectively obtaining the compensated pixel value of each pixel point according to the compensated maximum RGB value of each pixel point and the gray scale of each pixel point.
In the embodiment of the present invention, the maximum RGB value after compensation of each pixel point is obtained by interpolation processing of the gray scale of each pixel point, specifically, for each pixel point, the gray scale compensation value of the pixel point may be calculated according to formula (2), where formula (2) is as follows:
Wherein, maxRGB 'is the gray level of the pixel after compensation, maxRGB is the gray level of the pixel before compensation, (r, g, b) represents three color components of the pixel, namely the pixel value of the pixel, and (r, g, b)' is the pixel value after compensation of the pixel.
S4, generating an enhanced image according to the compensated pixel value of each pixel point.
In the embodiment of the invention, the compensated pixel value of each pixel point is converted into common RGB format data, so as to obtain an enhanced image, and the enhanced image can be generated according to the compensated pixel value of each pixel point by using OpenCV and the existing program code.
Referring to fig. 6, fig. 6 is an enhanced image corresponding to the scenic image shown in fig. 3, and it can be observed that the contrast and brightness of the enhanced image corresponding to the scenic image are significantly enhanced and the color is more vivid than those of fig. 3. According to the enhanced image corresponding to the landscape image, a histogram of the enhanced image corresponding to the landscape image can be obtained, as shown in fig. 7, the histogram of the landscape image is shown in fig. 5, and compared with fig. 5, the pixels with large gray scale in fig. 7 are obviously increased, the pixels with small gray scale are obviously decreased, and the contrast and the brightness of the enhanced image are enhanced due to the change, and the color is more vivid.
The embodiment of the invention provides a computer device, which can be a terminal, and the internal structure is shown in fig. 8. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of image enhancement. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the block diagram of FIG. 8 is merely a partial structure associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements are applied, and that a particular computer device may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, performs the steps of:
Acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed;
determining a compensation curve corresponding to the image to be processed according to the gray scale information;
Calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve;
and generating an enhanced image according to the compensated pixel value of each pixel point.
An embodiment of the present invention provides a non-transitory computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor performs the steps of:
Acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed;
determining a compensation curve corresponding to the image to be processed according to the gray scale information;
Calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve;
and generating an enhanced image according to the compensated pixel value of each pixel point.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It is to be understood that the invention is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the invention is limited only by the appended claims
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (8)

1. A method of image enhancement, comprising:
Acquiring an image to be processed, and acquiring gray scale information of the image to be processed, wherein the gray scale information comprises gray scales of all pixel points in the image to be processed;
determining a compensation curve corresponding to the image to be processed according to the gray scale information;
Calculating the compensated pixel value of each pixel point in the image to be processed according to the compensation curve;
Generating an enhanced image according to the compensated pixel values of the pixel points;
the gray scale information also comprises the number of times of each gray scale and the percentage of the number of times of each gray scale in the total pixel point number;
according to the gray scale of each pixel point, obtaining the gray scale information of the image to be processed comprises the following steps:
Acquiring a first set comprising a plurality of first values according to the gray scales of each pixel point, wherein the first values are the occurrence times of each gray scale;
acquiring a second set comprising a plurality of second values according to the gray scales of each pixel point, wherein the second values are the percentage of the number of times of each gray scale to the total number of the pixel points;
obtaining gray scale information according to the first set and the second set;
The determining the compensation curve corresponding to the image to be processed according to the gray scale information comprises the following steps:
Determining a plurality of control points of the Bessel function according to the gray level information;
Determining a compensation curve through a Bessel function according to the plurality of control points;
the determining a plurality of control points of the Bessel function according to the gray level information comprises the following steps:
Obtaining a plurality of line pointer values corresponding to a plurality of preset values respectively according to the first set and the preset set, wherein the preset set comprises a plurality of preset values which are products of the resolution of the image to be processed and a plurality of preset percentages respectively;
Selecting a plurality of control points of the Bessel function from the second set according to a plurality of line number pointer values respectively corresponding to a plurality of preset values;
obtaining a plurality of line pointer values corresponding to a plurality of preset values respectively according to the first set and the preset set, including:
For each first value in the first set, calculating an accumulated value corresponding to the first value according to the first value, wherein the accumulated value is the sum of at least one first value, and the at least one first value comprises the first value and all first values of which gray scales are smaller than the gray scales corresponding to the first value;
for each preset value, acquiring the absolute value of the difference value between the preset value and each accumulated value;
and selecting the minimum value from all the absolute values obtained through calculation, and taking the selected minimum value as the line number pointer value corresponding to the preset value.
2. The method of claim 1, wherein the acquiring gray-scale information of the image to be processed comprises:
acquiring gray scales of all pixel points in the image to be processed;
and obtaining gray scale information of the image to be processed according to the gray scale of each pixel point.
3. The method according to claim 2, wherein the acquiring the gray scale of each pixel in the image to be processed includes:
acquiring R values, G values and B values of all pixel points in the image to be processed;
respectively determining the maximum value of the R value, the G value and the B value of each pixel point, and respectively taking the maximum value of the R value, the G value and the B value of each pixel point as the maximum RGB value of each pixel point;
and taking the maximum RGB value of each pixel point as the gray scale of each pixel point.
4. A method according to any one of claims 1-3, wherein the acquiring the image to be processed and acquiring gray-scale information of the image to be processed comprises:
acquiring an image to be processed, and acquiring a histogram of the image to be processed; wherein the histogram includes the gray scale information.
5. The method of claim 4, wherein determining a compensation curve corresponding to the image to be processed according to the gray scale information comprises:
Determining control points of the Bessel function according to the histogram;
and determining a compensation curve through a Bessel function according to the control point.
6. A method according to claim 3, wherein said obtaining the compensated pixel value of each pixel according to the compensation curve comprises:
performing interpolation processing on the compensation curve according to an interpolation method to obtain a compensated maximum RGB value of each pixel point;
And respectively obtaining the compensated pixel value of each pixel point according to the compensated maximum RGB value of each pixel point and the gray scale of each pixel point.
7. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN201910817313.9A 2019-08-30 2019-08-30 Image enhancement method and computer equipment Active CN112446831B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910817313.9A CN112446831B (en) 2019-08-30 2019-08-30 Image enhancement method and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910817313.9A CN112446831B (en) 2019-08-30 2019-08-30 Image enhancement method and computer equipment

Publications (2)

Publication Number Publication Date
CN112446831A CN112446831A (en) 2021-03-05
CN112446831B true CN112446831B (en) 2024-09-20

Family

ID=74734493

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910817313.9A Active CN112446831B (en) 2019-08-30 2019-08-30 Image enhancement method and computer equipment

Country Status (1)

Country Link
CN (1) CN112446831B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107045863A (en) * 2017-06-26 2017-08-15 惠科股份有限公司 Gray scale adjusting method and device of display panel

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100539659C (en) * 2006-07-07 2009-09-09 帆宣系统科技股份有限公司 Contrast stretching and overflow compensation system and method for image signal
KR101329782B1 (en) * 2007-02-27 2013-11-15 삼성디스플레이 주식회사 Display apparatus
US20090010339A1 (en) * 2007-07-05 2009-01-08 Faraday Technology Corp. Image compensation circuit, method thereof, and lcd device using the same
US20100278423A1 (en) * 2009-04-30 2010-11-04 Yuji Itoh Methods and systems for contrast enhancement
US8577141B2 (en) * 2010-11-05 2013-11-05 Lg Innotek Co., Ltd. Method of enhancing contrast using bezier curve
CN108257580B (en) * 2016-12-28 2020-08-28 中科创达软件股份有限公司 Display picture adjusting method and device based on backlight brightness
CN107274364B (en) * 2017-06-06 2020-01-31 中科创达软件股份有限公司 image enhancement method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107045863A (en) * 2017-06-26 2017-08-15 惠科股份有限公司 Gray scale adjusting method and device of display panel

Also Published As

Publication number Publication date
CN112446831A (en) 2021-03-05

Similar Documents

Publication Publication Date Title
CN112530347B (en) Method, device and equipment for determining compensation gray scale
CN108766372B (en) Method for improving mura phenomenon of display panel
CN113380170B (en) Display compensation method and device of display panel, display device and medium
CN110996174B (en) A video image quality enhancement method and related equipment
CN105930464B (en) Web rich media cross-screen adaptation method and device
CN109194878B (en) Video image anti-shake method, device, equipment and storage medium
CN114495812B (en) Display panel brightness compensation method and device, electronic equipment and readable storage medium
EP3905672B1 (en) Color space mapping method and device, computer readable storage medium and apparatus
JP2014140160A (en) Image processor and image processing method
CN110858470A (en) Display control method and device of OLED screen and terminal equipment
CN111276089A (en) Gray scale compensation calculation method and device and display device
WO2019090580A1 (en) System and method for image dynamic range adjusting
CN112446831B (en) Image enhancement method and computer equipment
CN111930461B (en) Mobile terminal APP full page graying method and device based on Android
US20240257710A1 (en) Foveated display burn-in statistics and burn-in compensation systems and methods
CN115170413B (en) Image processing method, device, electronic equipment and computer readable storage medium
CN111462008B (en) Low-illumination image enhancement method, low-illumination image enhancement device and electronic equipment
CN116112652A (en) Projection image processing method, apparatus, computer device and storage medium
CN109064441A (en) Based on the adaptively selected Mura method for detecting of independent element
CN108628715B (en) Display effect correction method and device of display equipment
CN113194267B (en) Image processing method and device and photographing method and device
CN100521728C (en) Method and apparatus for vertically scaling pixel data
CN107591142B (en) Method and device for regulating and controlling picture display quality and storage medium
US12260592B2 (en) Image processing device, image processing method, and non-transitory computer-readable storage medium
JP2012019315A (en) Image processor and image processing method

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