CN112634148A - Image correction method, apparatus and storage medium - Google Patents

Image correction method, apparatus and storage medium Download PDF

Info

Publication number
CN112634148A
CN112634148A CN202011446157.9A CN202011446157A CN112634148A CN 112634148 A CN112634148 A CN 112634148A CN 202011446157 A CN202011446157 A CN 202011446157A CN 112634148 A CN112634148 A CN 112634148A
Authority
CN
China
Prior art keywords
pixel
value
image
adjustment parameter
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011446157.9A
Other languages
Chinese (zh)
Other versions
CN112634148B (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.)
Realme Mobile Telecommunications Shenzhen Co Ltd
Original Assignee
Realme Mobile Telecommunications Shenzhen 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 Realme Mobile Telecommunications Shenzhen Co Ltd filed Critical Realme Mobile Telecommunications Shenzhen Co Ltd
Priority to CN202011446157.9A priority Critical patent/CN112634148B/en
Publication of CN112634148A publication Critical patent/CN112634148A/en
Application granted granted Critical
Publication of CN112634148B publication Critical patent/CN112634148B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/40Analysis of texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

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

Abstract

The embodiment of the application provides a method and equipment for correcting an image and a storage medium. The method comprises the following steps: the method comprises the steps of obtaining the smoothing rate of an image to be processed, wherein the smoothing rate is used for representing the proportion of a smoothing area of the image to the whole area of the image, adjusting a preset gamma curve based on the smoothing rate of the image, and performing gamma correction on the image through the adjusted gamma curve, so that the corresponding gamma correction on the image according to the characteristics of the image is realized, and the corrected image has a better presentation effect.

Description

Image correction method, apparatus and storage medium
Technical Field
The embodiments of the present application relate to the field of image processing technology, and more particularly, to a method and an apparatus for correcting an image, and a storage medium.
Background
The human eye has an exponential relation with the light intensity of the input light rather than a linear relation with the light value of the external light source, but the light value of the image acquisition device has a linear relation with the light intensity of the input light. In order to facilitate the human eye to recognize the image, the image collected by the camera needs to be gamma-corrected.
At present, gamma correction is often performed on an image through a set fixed gamma curve so that the processed image can conform to the visual characteristics of a human.
However, images acquired under different scenes are corrected by a fixed gamma curve, and a good correction effect cannot be obtained.
Disclosure of Invention
The embodiment of the application provides a method and equipment for correcting an image and a storage medium.
In a first aspect, a method for correcting an image is provided, including:
obtaining the smoothing rate of an image to be processed; the smoothing rate is used for representing the proportion of a smoothing area of the image to the whole area of the image;
adjusting a preset gamma curve based on the smoothing rate of the image;
and carrying out gamma correction on the image through the adjusted gamma curve.
In a second aspect, an electronic device is provided, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the smoothing rate of an image to be processed; the smoothing rate is used for representing the proportion of a smoothing area of the image to the whole area of the image;
the processing unit is used for adjusting a preset gamma curve based on the smoothing rate of the image;
the processing unit is also used for carrying out gamma correction on the image through the adjusted gamma curve.
In a third aspect, an electronic device is provided, including: a processor and a memory, the memory being configured to store a computer program, the processor being configured to invoke and execute the computer program stored in the memory to perform a method as in the first aspect or its implementations.
In a fourth aspect, there is provided a computer readable storage medium for storing a computer program for causing a computer to perform the method as in the first aspect or its implementations.
In a fifth aspect, there is provided a computer program product comprising computer program instructions to cause a computer to perform the method as in the first aspect or its implementations.
A sixth aspect provides a computer program for causing a computer to perform a method as in the first aspect or implementations thereof.
Through the technical scheme of the first aspect, the smoothing rate of the image to be processed is obtained, the preset gamma curve is adjusted based on the smoothing rate, and then the gamma correction is performed on the image through the gamma curve, so that the corresponding gamma correction is performed on the image according to the characteristics of the image, and the corrected image has a better presentation effect.
Drawings
FIG. 1 is a diagram illustrating a gamma curve 100 according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an image processing flow 200 according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating an image correction method 300 according to an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating an image correction method 400 according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of an image segmentation area 500 according to an embodiment of the present disclosure;
fig. 6 is a flowchart illustrating an image correction method 600 according to an embodiment of the present disclosure;
fig. 7 is a flowchart illustrating an image correction method 700 according to an embodiment of the present disclosure;
FIG. 8a is a schematic diagram of a preset gamma curve according to an embodiment of the present disclosure;
FIG. 8b is a schematic diagram of an adjusted gamma curve according to an embodiment of the present application;
fig. 9 is a schematic block diagram of an electronic device 900 provided in an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device 1000 according to an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art without making any creative effort with respect to the embodiments in the present application belong to the protection scope of the present application.
The human eye has a linear relationship between the light sensitivity value of an external light source and the input light intensity, and has an exponential relationship. Under low illumination, human eyes can more easily distinguish the change of the brightness, and the change of the brightness is not easily distinguished by the human eyes along with the increase of the illumination. In devices with image capturing devices, such as cameras, video cameras, mobile phones, etc., the light sensitivity value and the input light intensity are in a linear relationship, and in order to facilitate human eyes to recognize images, the captured images need to be gamma-corrected. Gamma correction is a nonlinear operation performed on a pixel value (input pixel value) of an image to be processed, so that the pixel value of the output image (i.e., the output pixel value) has an exponential relationship with the input pixel value, the exponent is Gamma (Gamma), as shown in fig. 1, the abscissa is the pixel value of the image to be processed, the ordinate is the pixel value of the output image, and the output pixel value is often expressed by a formula, i.e., the input pixel valueGammaAnd calculating to obtain the output pixel value of the image.
In electronic devices, the complexity of the power function calculation is considered, and the above calculation formula is usually replaced by a table look-up method, so as to improve the operation speed. Assuming that an image to be processed is represented by 8 bits, the maximum pixel value is 255, the minimum pixel value is 0, and the Input pixel value is incremented by 8, there are inputs of Input [ n ], [0,8,16,24,32,40,48,56,64,.. times, 255], n ═ 33, and gamma ═ 1/2.2, and according to the above formula, the Output pixel value is Output [ n ], [0,0,1,1,3,4,6,9,12,... times, 255], and n ═ 33. Since the data of the actual image are distributed on 0-255, when the data of a certain pixel in the image can be calculated by adopting a difference mode, which section of the input the pixel data is in is found first, and then a linear difference is made according to the section and the corresponding output section. In fact, of course, the size of Input can be expanded more, and the image data can be represented by 10 bits, 16 bits, etc., according to the specific hardware computing power.
In summary, it can be seen that the gamma correction is performed on the image based on a fixed gamma curve. For the image to be processed with a relatively large smooth area or the image to be processed with a relatively large edge area, the targeted gamma correction cannot be provided, so that the image after the gamma correction has unsatisfactory presentation effects on contrast and definition.
It is to be understood that a smooth region is also referred to as a flat region, i.e., there is no protruding texture and edges or there is less texture or edges in the region, and there is abundant texture and edges in the edge region.
In order to solve the above problem, in the embodiment of the present application, a preset gamma curve is adjusted based on a smoothing rate of an image to be processed, that is, a ratio of a smoothing region in the image to an entire region, and then gamma correction is performed on the image through the adjusted gamma curve, so that the corrected image has a strong contrast and a high definition, and is suitable for characteristics of human eyes to have a good presentation effect.
The technical scheme of the embodiment of the application can be applied to various electronic devices. The electronic device may be a terminal device, such as a Mobile Phone (Mobile Phone), a tablet computer (Pad), a computer, a Virtual Reality (VR) terminal device, an Augmented Reality (AR) terminal device, a terminal device in industrial control (industrial control), a terminal device in unmanned driving (self driving), a terminal device in remote medical treatment (remote medical), a terminal device in smart city (smart city), a terminal device in smart home (smart home), and the like. The terminal equipment in this application embodiment can also be wearable equipment, and wearable equipment also can be called as wearing formula smart machine, is the general term of using wearing formula technique to carry out intelligent design, develop the equipment that can dress to daily wearing, like glasses, gloves, wrist-watch, dress and shoes etc.. A wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The terminal device may be fixed or mobile.
For example, the electronic device in the embodiment of the present application may also be a server, and when the electronic device is the server, the electronic device may receive an image acquired by a terminal device, and determine to perform gamma correction on the image based on a smoothing rate of the image.
Fig. 2 is a schematic diagram of an image processing flow 200 according to an embodiment of the present disclosure. Fig. 2 is only an example and not a limitation, and the electronic device performs image acquisition on a target object through an image sensor, where the target object may be a person, a landscape, an article, and the like, which is not limited in this application; the Image sensor transmits the captured Image to an Image processor (ISP), and the Image processor performs one or more of dark current calibration (BLC), Lens optical calibration (Lens shading correction), dead pixel calibration (BPC), Demosaic (Demosaic), Bayer noise reduction (Bayer noise), Auto White Balance (AWB), brightness Gamma (Ygamma), Auto Exposure Control (AEC), Color correction (Color correction), Gamma correction (Gamma correction), Color space conversion (e.g., RGB Color space to YUV Color space), Color noise reduction (Color noise), Histogram equalization (Histogram equalization), format coding (format), and input/output control (I/O control) on the Image.
The embodiment of the application is mainly optimized for the gamma correction process. The image to be processed mentioned below may be an image directly captured by an image sensor, or may be an image input to the gamma correction unit after being processed by any of the above-mentioned image processing processes.
The present application is specifically illustrated by the following examples.
Fig. 3 is a flowchart illustrating an image correction method 300 according to an embodiment of the present disclosure.
In order to improve the correction effect of the gamma curve after the gamma correction is performed on the image, the embodiment of the application analyzes the image to be processed, adjusts the gamma curve according to the analysis result, and performs the gamma correction on the image through the adjusted gamma curve.
As shown in fig. 3, the method includes:
s301: and acquiring the smoothing rate of the image to be processed.
In this step, the smoothing rate of the image to be processed, that is, the proportion of the smooth area of the image to the whole area of the image is obtained.
Illustratively, the image to be processed is divided into regions, for example, 64 × 48 blocks (grid), also called pixel regions, and each pixel region includes a plurality of pixel points.
And analyzing each pixel region to identify whether each pixel region is a smooth region, and calculating the proportion of the number of the smooth regions to the total number of the pixel regions.
S302: and adjusting the preset gamma curve based on the smooth rate of the image.
S303: and carrying out gamma correction on the image through the adjusted gamma curve.
It should be understood that, the smoothness of the images is different, and the gamma curve is dynamically adjusted, so that the gamma curve can correspondingly correct the images in contrast and/or brightness, and the images have better presentation effects in contrast and definition. For example, the higher the smoothing rate is, the less textures and edges are in the image, and the pixel difference values of most pixel points are smaller than a preset value, at this time, the contrast and brightness of the image should be improved to enhance the contrast and definition of the image.
According to the embodiment of the application, the smoothness rate of the image to be processed is obtained, the preset gamma curve is adjusted based on the smoothness rate, and then the gamma correction is carried out on the image through the gamma curve, so that the corresponding gamma correction is carried out on the image according to the characteristics of the image, and the corrected image has a better presentation effect.
Fig. 4 is a flowchart illustrating an image correction method 400 according to an embodiment of the present disclosure. In a specific implementation manner, obtaining a smoothing rate of an image to be processed includes the steps as shown in fig. 4:
s401: and identifying a plurality of pixel regions in the image to obtain an identification result of each pixel region.
Referring to fig. 5, an image 500 to be processed is divided into a plurality of pixel regions, for example, 64 × 48 pixel regions, and a pixel region 501 and a pixel region 502 are shown; illustratively, each pixel region includes a plurality of pixel sub-regions, for example, the pixel region 501 and the pixel region 502 are respectively divided into 9 pixel sub-regions, where each pixel sub-region includes a plurality of pixel points.
It should be understood that the recognition result is used to characterize whether the corresponding pixel region is a smooth region. As shown in fig. 5, if the pixel area 501 does not include texture or edges, or the included texture or edges are not obvious, the pixel area 501 is a smooth area, for example, a tile surface with dark texture, and the pixel area 502 includes edges, the pixel area 502 is an edge area, i.e., a non-smooth area.
For example, for each pixel region, a first numerical value corresponding to the pixel region is determined based on a first pixel value and a second pixel value, where the first pixel value is a pixel mean value or a pixel value sum of all pixel points in the first pixel sub-region, the second pixel value is a mean value of pixel values of a plurality of second pixel sub-regions, the pixel value of the second pixel sub-region is a pixel mean value or a pixel value sum of all pixel points in the second pixel sub-region, the first pixel sub-region is a pixel sub-region at a central position of the pixel region, and the second pixel sub-region is any pixel sub-region except for the first pixel sub-region in the pixel region.
The first value is a difference between the first pixel value and the second pixel value, and generally, an average value should be taken after the difference between the first pixel value and the second pixel value is obtained.
For example, for the pixel region 501, the first pixel value thereof is the pixel mean or the sum of the pixel values of the first pixel sub-region 5011 located at the center position, which is denoted as grid1, where grid1 is assumed to be the mean of the pixel values of all the pixel points in the first pixel sub-region 5011; correspondingly, the pixel mean value or the pixel value sum of each second pixel sub-region 5012 is obtained, when the first pixel value is the pixel mean value of the first pixel sub-region, the pixel mean value of the second pixel sub-region 5012 is obtained, when the first pixel value is the pixel value sum of the first pixel sub-region, the pixel value sum of the second pixel sub-region 5012 is obtained, grid2 is used to represent the mean value of the pixel values of all the pixels in each second pixel sub-region 5012, then the second pixel value can be represented as avg (grid2), that is, the mean value of the pixel values of a plurality of second pixel sub-regions, by a programming language; the first numerical value corresponding to the pixel region 501 is Delta _ k ═ abs (grid1-avg (grid2)), and abs represents an absolute value.
For another example, for the pixel region 502, assuming that the sum of the pixel values of the first pixel value of the first pixel sub-region 5021 is grid1 and the second pixel value is avg (grid2), the first value Delta _ i of the pixel region 502 is abs (grid1-avg (grid 2)).
Further, whether the pixel region is a smooth region is determined based on the first numerical value and a preset interval.
For example, if the first value is in the preset interval, the pixel region is a smooth region; and if the first numerical value is not in the preset interval, the pixel area is not the smooth area.
It should be understood that there is no obvious texture or edge in the pixel region 501, the difference between the first pixel value and the second pixel value is small, that is, the value of Delta _ k is small, based on the preset interval, it is determined that Delta _ k is smaller than the upper threshold of the preset interval, and Delta _ k is larger than the lower threshold of the preset interval, then the pixel region 501 is a smooth region; if an obvious edge exists in the pixel region 502, the difference between the first pixel value and the second pixel value is large, that is, the value of Delta _ i is large, and based on the preset interval, it is determined that Delta _ i is larger than the upper threshold of the preset interval, so that the pixel region 502 is an edge region or is referred to as a non-smooth region.
Optionally, the lower threshold is greater than or equal to zero. When the lower threshold is equal to zero, the non-smooth region includes an edge region; the non-smooth region includes an edge region and a completely flat region when the lower threshold is greater than zero.
It should be understood that the upper threshold is used to distinguish a smooth region from an edge region, and the lower threshold is used to distinguish a smooth region from a completely flat region, where the completely flat region is a pixel region with a first value equal to zero or affected by noise and there is no texture or edge in the completely flat region, generally speaking, for a smooth region, contrast or brightness needs to be increased, and for an image with more completely flat regions, if the same gamma correction manner is used as for the smooth region, noise in the image will be increased. Therefore, the lower threshold is generally greater than 0.
S402: based on the recognition result of each pixel region, a smoothing rate is calculated.
In this step, based on whether the corresponding pixel region indicated by the identification result of each pixel region is a smooth region, the number of smooth regions is determined, and the ratio of the number of smooth regions to the number of all pixel regions is calculated to obtain the smoothing rate of the image.
For example, the image is divided into 64 × 48 pixel regions, where the number of smoothing regions is 1536, and the smoothing rate is 1536/(64 × 48) ═ 0.5.
Fig. 6 is a flowchart illustrating an image correction method 600 according to an embodiment of the present disclosure. On the basis of any of the above embodiments, the adjusting the preset gamma curve based on the smoothing rate of the image in step S302 shown in fig. 3 includes the following possible implementations:
s601: based on the smoothing rate, an adjustment parameter is determined.
S602: and adjusting the preset gamma curve based on the smoothing rate and the adjusting parameters.
As described in any of the above embodiments, the smoothness table indicates the ratio of smooth areas to non-smooth areas in the image, and when the ratio of smooth areas to non-smooth areas is different, the required adjustment effect is necessarily different, so that the adjustment parameter and the smoothness ratio should correspond to different gamma curves, and the gamma curve is adjusted.
Illustratively, the adjustment parameter includes a first adjustment parameter and a second adjustment parameter, and in this embodiment, as shown in fig. 7, the first adjustment parameter may be determined based on the smoothing rate, the first preset value, and the second preset value. For example, the first preset value is subtracted from the second preset value, and then multiplied by the smoothing rate to obtain a product, and then the product is summed with the first preset value to obtain the first adjustment parameter.
Which can be expressed as statements by a programming language: (Adjust _ ratio _ end-Adjust _ ratio _ start) flat _ ratio + Adjust _ ratio _ start; the adjustment parameter comprises a first adjustment parameter, an.
Optionally, the first preset value is 0.5, and the second preset value is 2.4.
As shown in connection with fig. 7, the second adjustment parameter is determined based on the intermediate value of the smoothing rate, the first adjustment parameter, and the color depth of the image. For example, the first adjustment parameter is subtracted from 1 to obtain a second adjustment parameter by performing a power operation as an index of the intermediate value of the color depth.
Which can be expressed as statements by a programming language: multiplier ═ mid _ pt(1-Adjust_ratio)(ii) a Wherein, multiplier is the second adjustment parameter, mid _ pt is the middle value of the color depth, and Adjust _ ratio is the first adjustment parameter. Here, mid _ pt is 2nN is the number of bits of the image minus 1, for example, when the image to be processed is an 8-bit image, n is 7, and when the image to be processed is 10-bit, n is 9.
The embodiment of the application provides the following possible implementation ways for adjusting the preset gamma curve based on the smoothing rate and the adjustment parameters: and correspondingly adjusting the output pixel value of each coordinate point of the preset gamma curve based on whether the output pixel value of the coordinate point is smaller than the second adjustment parameter. It should be noted that the gamma curve includes a plurality of two-dimensional coordinate points, each having an abscissa and an ordinate, and illustratively, the output pixel value is the ordinate of the coordinate point, and the input pixel value is the abscissa of the coordinate point.
Referring to fig. 7, for a coordinate point on the gamma curve having an output pixel value smaller than the second adjustment parameter, the output pixel value of the coordinate point is adjusted based on the second adjustment parameter and the first adjustment parameter. Illustratively, a first adjustment parameter is used as an index of the output pixel value to perform a power operation to obtain a first power result, and the first power result is multiplied by a second adjustment parameter.
As shown in fig. 7, for a coordinate point on the gamma curve whose output pixel is greater than or equal to the second adjustment parameter, the output pixel value of the coordinate point is adjusted based on the second adjustment parameter, the intermediate value of the color depth of the image, and the first adjustment parameter. Illustratively, a power operation is performed on the difference between the color depth of the image and the output pixel value by taking the first adjustment parameter as an index to obtain a second power result, and the product of the second power result and the second adjustment parameter is subtracted from the color depth of the image.
Each adjusted coordinate point constitutes a new adjusted gamma curve.
Based on the above embodiment, the process of adjusting the gamma curve can be expressed as a statement by a programming language:
Figure BDA0002824595240000081
for example, fig. 8a is a schematic diagram of a preset gamma curve provided in the embodiment of the present application, and fig. 8b is a schematic diagram of an adjusted gamma curve provided in the embodiment of the present application. After the gamma correction is performed on the image to be processed by the gamma curve shown in fig. 8b, the image has a better presentation effect on contrast and/or brightness, so that the image is clearer.
The method embodiment of the present application is described in detail above with reference to fig. 1 to 8b, and the electronic device embodiment of the present application is described in detail below with reference to fig. 9, it being understood that the electronic device embodiment corresponds to the method embodiment, and similar descriptions may refer to the method embodiment.
Fig. 9 is a schematic block diagram of an electronic device 900 according to an embodiment of the present application. As shown in fig. 9, the apparatus 900 includes:
an obtaining unit 910, configured to obtain a smoothing rate of an image to be processed; the smoothing rate is used for representing the proportion of a smoothing area of the image to the whole area of the image;
a processing unit 920, configured to adjust a preset gamma curve based on a smoothing rate of the image;
the processing unit 920 is further configured to perform gamma correction on the image according to the adjusted gamma curve.
The electronic device 900 in this embodiment of the application includes an obtaining unit 910 and a processing unit 920, and based on the smoothness of the image to be processed, that is, the smooth area in the image occupies the proportion of the whole area, the preset gamma curve is adjusted, and then the gamma correction is performed on the image through the adjusted gamma curve, so that the corrected image has stronger contrast and definition, so as to adapt to the characteristics of human eyes and have better presentation effect.
Optionally, the obtaining unit 910 is specifically configured to:
identifying a plurality of pixel regions in the image to obtain an identification result of each pixel region; the pixel region comprises a plurality of pixel subregions, the pixel subregions comprise a plurality of pixel points, and the identification result is used for representing whether the pixel region is a smooth region;
and calculating the smoothing rate based on the identification result of each pixel region.
Optionally, the obtaining unit 910 is specifically configured to:
for each pixel region, determining a first numerical value corresponding to the pixel region based on a first pixel value and a second pixel value; the first pixel value is the pixel mean value or the pixel value sum of all pixel points in a first pixel sub-area, the second pixel value is the mean value of the pixel values of a plurality of second pixel sub-areas, the pixel value of each second pixel sub-area is the pixel mean value or the pixel value sum of all pixel points in the second pixel sub-area, the first pixel sub-area is the pixel sub-area at the central position of the pixel area, and the second pixel sub-area is any pixel sub-area except the first pixel sub-area in the pixel area;
and determining whether the pixel region is a smooth region or not based on the first numerical value and a preset interval.
Optionally, the obtaining unit 910 is specifically configured to:
and subtracting the second pixel value from the first pixel value to obtain the first numerical value.
Optionally, the obtaining unit 910 is specifically configured to:
if the first numerical value is in the preset interval, the pixel area is the smooth area;
and if the first numerical value is not in the preset interval, the pixel area is not the smooth area.
Optionally, the processing unit 920 is specifically configured to:
determining an adjustment parameter based on the smoothing rate;
and adjusting the preset gamma curve based on the smoothing rate and the adjusting parameter.
Optionally, the processing unit 920 is specifically configured to:
determining the first adjusting parameter based on the smoothing rate, a first preset value and a second preset value; the second preset value is larger than the first preset value;
determining the second adjustment parameter based on an intermediate value of the smoothing rate, the first adjustment parameter, and a color depth of the image.
Optionally, the processing unit 920 is specifically configured to:
subtracting the first preset value from the second preset value, and multiplying the second preset value by the smoothing rate to obtain a product;
and summing the product and the first preset value to obtain the first adjusting parameter.
Optionally, the processing unit 920 is specifically configured to:
and subtracting the first adjusting parameter from 1 to obtain an index of the intermediate value of the color depth, and performing power operation to obtain the second adjusting parameter.
Optionally, the processing unit 920 is specifically configured to:
and correspondingly adjusting the output pixel value of the coordinate point based on whether the output pixel value of the coordinate point is smaller than the second adjustment parameter or not aiming at each coordinate point of the preset gamma curve.
Optionally, the processing unit 920 is specifically configured to:
if the output pixel value of the coordinate point is smaller than the second adjustment parameter, adjusting the output pixel value of the coordinate point based on the second adjustment parameter and the first adjustment parameter;
and if the output pixel value of the coordinate point is greater than or equal to the second adjustment parameter, adjusting the output pixel value of the coordinate point based on the second adjustment parameter, the intermediate value of the color depth of the image and the first adjustment parameter.
Optionally, the processing unit 920 is specifically configured to:
taking the first adjusting parameter as an index of the output pixel value to carry out power operation to obtain a first power result;
multiplying the first power result by the second adjustment parameter.
Optionally, the processing unit 920 is specifically configured to:
taking the first adjustment parameter as an index to perform power operation on the difference value between the color depth of the image and the output pixel value to obtain a second power result;
subtracting the product of the second power result and the second adjustment parameter from the color depth of the image.
The electronic device provided by the above embodiment may execute the technical solution of the above method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 10 is a schematic structural diagram of an electronic device 1000 according to an embodiment of the present application. The electronic device shown in fig. 10 includes a processor 1010, and the processor 1010 may call and execute a computer program from a memory to implement the method in the embodiment of the present application.
Optionally, as shown in fig. 10, the electronic device 1000 may further include a memory 1020. From the memory 1020, the processor 1010 may call and execute a computer program to implement the method in the embodiment of the present application.
The memory 1020 may be a separate device from the processor 1010 or may be integrated into the processor 1010.
Optionally, as shown in fig. 10, the electronic device 1000 may further include a transceiver 1030, and the processor 1010 may control the transceiver 1030 to communicate with other devices, and specifically, may transmit information or data to the other devices or receive information or data transmitted by the other devices.
The transceiver 1030 may include a transmitter and a receiver, among others. The transceiver 1030 may further include an antenna, and the number of antennas may be one or more.
Optionally, the electronic device 1000 may implement corresponding processes in the methods of the embodiments of the present application, and for brevity, details are not described here again.
It should be understood that the processor of the embodiments of the present application may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It will be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of example, but not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (DDR SDRAM), Enhanced Synchronous SDRAM (ESDRAM), Synchronous link SDRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
It should be understood that the above memories are exemplary but not limiting illustrations, for example, the memories in the embodiments of the present application may also be Static Random Access Memory (SRAM), dynamic random access memory (dynamic RAM, DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (enhanced SDRAM, ESDRAM), Synchronous Link DRAM (SLDRAM), Direct Rambus RAM (DR RAM), and the like. That is, the memory in the embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
The embodiment of the application also provides a computer readable storage medium for storing the computer program.
Optionally, the computer-readable storage medium may be applied to the electronic device in the embodiment of the present application, and the computer program enables a computer to execute corresponding processes of the methods in the embodiment of the present application, which is not described herein again for brevity.
Embodiments of the present application also provide a computer program product comprising computer program instructions.
Optionally, the computer program product may be applied to the electronic device in the embodiment of the present application, and the computer program instructions enable the computer to execute corresponding processes in each method in the embodiment of the present application, which is not described herein again for brevity.
The embodiment of the application also provides a computer program.
Optionally, the computer program may be applied to the electronic device in the embodiment of the present application, and when the computer program runs on a computer, the computer is enabled to execute corresponding processes in each method in the embodiment of the present application, and for brevity, details are not described here again.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the units is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. With regard to such understanding, the technical solutions of the present application may be essentially implemented or contributed to by the prior art, or may be implemented in a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A method for correcting an image, comprising:
obtaining the smoothing rate of an image to be processed; the smoothing rate is used for representing the proportion of a smoothing area of the image to the whole area of the image;
adjusting a preset gamma curve based on the smoothing rate of the image;
and carrying out gamma correction on the image through the adjusted gamma curve.
2. The method of claim 1, wherein obtaining a smoothing rate of the image to be processed comprises:
identifying a plurality of pixel regions in the image to obtain an identification result of each pixel region; the pixel region comprises a plurality of pixel subregions, the pixel subregions comprise a plurality of pixel points, and the identification result is used for representing whether the pixel region is a smooth region;
and calculating the smoothing rate based on the identification result of each pixel region.
3. The method according to claim 2, wherein the identifying a plurality of pixel regions in the image to obtain an identification result of each pixel region comprises:
for each pixel region, determining a first numerical value corresponding to the pixel region based on a first pixel value and a second pixel value; the first pixel value is the pixel mean value or the pixel value sum of all pixel points in a first pixel sub-area, the second pixel value is the mean value of the pixel values of a plurality of second pixel sub-areas, the pixel value of each second pixel sub-area is the pixel mean value or the pixel value sum of all pixel points in the second pixel sub-area, the first pixel sub-area is the pixel sub-area at the central position of the pixel area, and the second pixel sub-area is any pixel sub-area except the first pixel sub-area in the pixel area;
and determining whether the pixel region is a smooth region or not based on the first numerical value and a preset interval.
4. The method of claim 3, wherein determining, for each pixel region, a corresponding first value of the pixel region based on the first pixel value and the second pixel value comprises:
and subtracting the second pixel value from the first pixel value to obtain the first numerical value.
5. The method according to claim 3 or 4, wherein the determining whether the pixel region is a smooth region based on the first value and a preset interval comprises:
if the first numerical value is in the preset interval, the pixel area is the smooth area;
and if the first numerical value is not in the preset interval, the pixel area is not the smooth area.
6. The method according to any one of claims 1 to 4, wherein the adjusting the preset gamma curve based on the smoothing rate of the image comprises:
determining an adjustment parameter based on the smoothing rate;
and adjusting the preset gamma curve based on the smoothing rate and the adjusting parameter.
7. The method of claim 6, wherein the adjustment parameters comprise a first adjustment parameter and a second adjustment parameter, and wherein determining the adjustment parameters based on the smoothing rate comprises:
determining the first adjusting parameter based on the smoothing rate, a first preset value and a second preset value; the second preset value is larger than the first preset value;
determining the second adjustment parameter based on an intermediate value of the smoothing rate, the first adjustment parameter, and a color depth of the image.
8. The method of claim 7, wherein determining the first adjustment parameter based on the smoothing rate, a first preset value, and a second preset value comprises:
subtracting the first preset value from the second preset value, and multiplying the second preset value by the smoothing rate to obtain a product;
and summing the product and the first preset value to obtain the first adjusting parameter.
9. The method of claim 7, wherein determining the second adjustment parameter based on the intermediate values of the smoothing rate, the first adjustment parameter, and the color depth of the image comprises:
and subtracting the first adjusting parameter from 1 to obtain an index of the intermediate value of the color depth, and performing power operation to obtain the second adjusting parameter.
10. The method of claim 7, wherein the adjusting the preset gamma curve based on the smoothing rate and the adjustment parameter comprises:
and correspondingly adjusting the output pixel value of the coordinate point based on whether the output pixel value of the coordinate point is smaller than the second adjustment parameter or not aiming at each coordinate point of the preset gamma curve.
11. The method of claim 10, wherein the performing, for the output pixel value of each coordinate point of the preset gamma curve, a corresponding adjustment on the output pixel value of the coordinate point based on whether the output pixel value of the coordinate point is smaller than the second adjustment parameter comprises:
if the output pixel value of the coordinate point is smaller than the second adjustment parameter, adjusting the output pixel value of the coordinate point based on the second adjustment parameter and the first adjustment parameter;
and if the output pixel value of the coordinate point is greater than or equal to the second adjustment parameter, adjusting the output pixel value of the coordinate point based on the second adjustment parameter, the intermediate value of the color depth of the image and the first adjustment parameter.
12. The method of claim 11, wherein the adjusting the output pixel value based on the second adjustment parameter and the first adjustment parameter comprises:
taking the first adjusting parameter as an index of the output pixel value to carry out power operation to obtain a first power result;
multiplying the first power result by the second adjustment parameter.
13. The method of claim 11, wherein the adjusting the output pixel value based on the second adjustment parameter, the intermediate value of the color depth of the image, and the first adjustment parameter comprises:
taking the first adjustment parameter as an index to perform power operation on the difference value between the color depth of the image and the output pixel value to obtain a second power result;
subtracting the product of the second power result and the second adjustment parameter from the color depth of the image.
14. An electronic device, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the smoothing rate of an image to be processed; the smoothing rate is used for representing the proportion of a smoothing area of the image to the whole area of the image;
the processing unit is used for adjusting a preset gamma curve based on the smoothing rate of the image;
the processing unit is also used for carrying out gamma correction on the image through the adjusted gamma curve.
15. An electronic device, comprising: a processor and a memory for storing a computer program, the processor being configured to invoke and execute the computer program stored in the memory to perform the method of any of claims 1 to 13.
16. A computer-readable storage medium for storing a computer program which causes a computer to perform the method of any one of claims 1 to 13.
CN202011446157.9A 2020-12-08 2020-12-08 Image correction method, device and storage medium Active CN112634148B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011446157.9A CN112634148B (en) 2020-12-08 2020-12-08 Image correction method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011446157.9A CN112634148B (en) 2020-12-08 2020-12-08 Image correction method, device and storage medium

Publications (2)

Publication Number Publication Date
CN112634148A true CN112634148A (en) 2021-04-09
CN112634148B CN112634148B (en) 2023-10-03

Family

ID=75309324

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011446157.9A Active CN112634148B (en) 2020-12-08 2020-12-08 Image correction method, device and storage medium

Country Status (1)

Country Link
CN (1) CN112634148B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763281A (en) * 2021-09-17 2021-12-07 无锡睿勤科技有限公司 Gamma curve adjusting method and device
CN115731139A (en) * 2022-12-08 2023-03-03 深圳明锐理想科技有限公司 Image correction method and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105827898A (en) * 2016-03-28 2016-08-03 深圳英飞拓科技股份有限公司 Gama curve regulation method and device applied to camera
CN109192174A (en) * 2018-11-05 2019-01-11 惠科股份有限公司 Driving method and driving device of display panel and display device
CN109712075A (en) * 2018-12-24 2019-05-03 广东理致技术有限公司 A kind of digital image data original image recognition methods and device
JP2020057039A (en) * 2018-09-28 2020-04-09 キヤノン株式会社 Image processing apparatus, control method thereof, and program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105827898A (en) * 2016-03-28 2016-08-03 深圳英飞拓科技股份有限公司 Gama curve regulation method and device applied to camera
JP2020057039A (en) * 2018-09-28 2020-04-09 キヤノン株式会社 Image processing apparatus, control method thereof, and program
CN109192174A (en) * 2018-11-05 2019-01-11 惠科股份有限公司 Driving method and driving device of display panel and display device
CN109712075A (en) * 2018-12-24 2019-05-03 广东理致技术有限公司 A kind of digital image data original image recognition methods and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763281A (en) * 2021-09-17 2021-12-07 无锡睿勤科技有限公司 Gamma curve adjusting method and device
CN113763281B (en) * 2021-09-17 2023-12-12 无锡睿勤科技有限公司 Gamma curve adjustment method and device
CN115731139A (en) * 2022-12-08 2023-03-03 深圳明锐理想科技有限公司 Image correction method and electronic equipment
CN115731139B (en) * 2022-12-08 2023-09-01 深圳明锐理想科技有限公司 Image correction method and electronic device

Also Published As

Publication number Publication date
CN112634148B (en) 2023-10-03

Similar Documents

Publication Publication Date Title
CN109767467B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN108668093B (en) HDR image generation method and device
US11431915B2 (en) Image acquisition method, electronic device, and non-transitory computer readable storage medium
EP3039864B1 (en) Automatic white balancing with skin tone correction for image processing
CN110033418B (en) Image processing method, image processing device, storage medium and electronic equipment
CN108734676B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN108989699B (en) Image synthesis method, image synthesis device, imaging apparatus, electronic apparatus, and computer-readable storage medium
CN106570909B (en) Skin color detection method, device and terminal
WO2016065053A2 (en) Automatic display image enhancement based on user's visual perception model
CN112950499B (en) Image processing method, device, electronic equipment and storage medium
CN108616700B (en) Image processing method and device, electronic equipment and computer readable storage medium
KR102581679B1 (en) An elelctronic device and method for processing an image in the same
US20150373235A1 (en) De-noising method and image system
WO2023030139A1 (en) Image fusion method, electronic device, and storage medium
KR20190010322A (en) Electronic device and method for compressing image thereof
CN107945106B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN110047060B (en) Image processing method, image processing device, storage medium and electronic equipment
CN112634148A (en) Image correction method, apparatus and storage medium
CN106803920B (en) Image processing method and device and intelligent conference terminal
CN115239570A (en) Image processing method, image processing apparatus, and storage medium
CN116668838B (en) Image processing method and electronic equipment
CN113538462B (en) Image processing method and device, computer readable storage medium and electronic equipment
CN112911161B (en) Image processing apparatus, image processing method, image capturing apparatus, and storage medium
US12081879B2 (en) Method for generating image and electronic device therefor
CN107317968A (en) Image defogging method, device, computer storage medium and mobile terminal

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