Disclosure of Invention
The embodiment of the invention provides a method for adjusting image noise, a storage medium and an electronic device, which are used for at least solving the problem of image noise increase caused by brightness adjustment of an image in the related art.
According to one embodiment of the invention, a method for adjusting image noise is provided, which comprises the steps of obtaining a target brightness value of each area of a target image, wherein the target image is divided into a plurality of areas, the areas comprise at least one pixel point, the target image is an image for performing brightness adjustment on an original image, obtaining a noise size of each area obtained by performing ith noise adjustment on the target image, wherein i is an integer greater than or equal to 0, the noise size of each area obtained by performing the 0 th noise adjustment is the noise size of the target image which is not subjected to the noise adjustment, determining an adjustment state parameter of each area according to the target brightness value and the noise size, wherein the adjustment state parameter is used for indicating whether the area needs the ith+1st noise adjustment, and performing the adjustment on the target area according to the adjustment state parameter of the target area and the noise size of the target area when the adjustment state parameter of the target area indicates the ith+1st noise adjustment, wherein the plurality of the target areas are included.
In an exemplary embodiment, determining the adjustment state parameters for each of the regions based on the luminance values and the noise magnitudes includes obtaining an original luminance value for each of the regions of the original image, and determining the adjustment state parameters for each of the regions based on the original luminance value and the target luminance value, and/or the noise magnitudes for each of the regions.
In an exemplary embodiment, determining the adjustment state parameter of each region according to the original brightness value and the target brightness value and/or the noise size of each region includes determining a difference value between the target brightness value and the original brightness value of each region to obtain a brightness difference value of each region, and determining the adjustment state parameter of each region according to a relation between the brightness difference value and a preset brightness threshold range and/or a relation between the noise size and a preset noise threshold range.
In an exemplary embodiment, determining the adjustment state parameter of each region according to the relationship between the brightness difference value and the preset brightness threshold range and/or the relationship between the noise size and the preset noise threshold range includes performing an operation on each region as a current region, wherein the adjustment state parameter of the current region is determined to be a first parameter when the brightness difference value of the current region is greater than or equal to a preset maximum brightness threshold and the noise size of the current region is greater than or equal to a preset maximum noise threshold, wherein the first parameter is used for indicating that the current region needs the i+1st time of noise adjustment, the preset maximum brightness threshold is the maximum value in the preset brightness threshold range, the preset maximum noise threshold is the maximum value in the preset noise threshold range, determining the adjustment state parameter of the current region is a second parameter when the noise size of the current region is within the preset noise threshold range, wherein the second parameter is used for indicating that the current region does not need the i+1st time of noise adjustment, the preset brightness difference value is the minimum brightness threshold or less than the preset noise threshold, and the current brightness threshold is the minimum brightness threshold is the maximum value in the preset noise threshold or less than the preset noise threshold, and the current threshold is the current threshold or less than the preset brightness threshold is the maximum brightness threshold.
In one exemplary embodiment, adjusting the noise level of the target region according to the adjustment state parameter and the target luminance value of the target region includes determining a target adjustment value for the target region according to the adjustment state parameter and the target luminance value, and adjusting the noise level of the target region according to the target adjustment value.
In an exemplary embodiment, determining the target adjustment value of the target area according to the adjustment state parameter and the target brightness value comprises determining target parameter intensity matched with the target brightness value in a first preset relation table, wherein the first preset relation table records the corresponding relation between the brightness value and the parameter intensity, determining target parameter intensity adjustment step length matched with the adjustment state parameter of the target area in a second preset relation table, wherein the second preset relation table records the corresponding relation between the adjustment state parameter and the parameter intensity adjustment step length, and determining the target adjustment value according to the target parameter intensity and the target parameter intensity adjustment step length.
In one exemplary embodiment, determining the target adjustment value according to the target parameter intensity and the target parameter intensity adjustment step size comprises determining a luminance difference value of the target region as a target luminance difference value, wherein the target luminance difference value is a difference value between an original luminance value of the target region and a target luminance value of the target region, determining a maximum value of luminance values of the respective regions of the target image as a target luminance value, wherein the luminance difference value of the regions is a difference value between the target luminance value of the regions and the original luminance value, and determining the target adjustment value according to the target luminance difference value, the target luminance value, the target parameter intensity and the target parameter intensity adjustment step size.
In one exemplary embodiment, determining the target adjustment value based on the target luminance difference value, the target luminance value, the target parameter intensity, and the target parameter intensity adjustment step comprises determining a ratio of the target luminance difference value to the target luminance value as a target ratio, determining a product of the target parameter intensity adjustment step and the target ratio as a target product value, and determining a sum of the target parameter intensity and the target product value as a target adjustment value.
According to another embodiment of the invention, an apparatus for adjusting image noise is provided, which comprises a first acquisition module for acquiring a target brightness value of each region of a target image, wherein the target image is divided into a plurality of regions, the regions comprise at least one pixel point, the target image is an image for performing brightness adjustment on an original image, a second acquisition module for acquiring a noise size of each region obtained by performing i-th noise adjustment on the target image, wherein i is an integer greater than or equal to 0, the noise size of each region obtained by performing 0-th noise adjustment is the noise size of the target image which is not subjected to the noise adjustment, a determination module for determining an adjustment state parameter of each region according to the target brightness value and the noise size, wherein the adjustment state parameter is used for indicating whether the i+1th noise adjustment is required for each region, and an adjustment module for performing the adjustment on the target region according to the adjustment state parameter of the target region and the target brightness value, wherein the adjustment state parameter of the target region comprises the target region is smaller than the target region.
According to yet another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program when executed by a processor implements the steps of the method as described in any of the above.
According to a further embodiment of the invention, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to yet another embodiment of the present invention, there is also provided a computer program product comprising computer instructions which, when executed by a processor, implement the steps of the method as described in any of the preceding claims.
According to the invention, the brightness value of each region of the target image and the noise size of each region of the image after noise adjustment of the target image are obtained, so that the adjustment state parameters of each region of the target image are determined, the noise size of each region of the target image is adjusted according to the adjustment state parameters and the brightness value, the image with the improved dynamic range is evaluated through the increment of the dynamic range and the multiple dimensionalities of the noise level, and meanwhile, the intensity of the sharpness noise reduction parameters of brightness linkage in the image processing system is regulated and controlled according to the evaluation state, so that self-adaptive feedback is formed, and the sharpness noise reduction adaptability of a scene with severe variation of the high dynamic range of the camera is improved. Therefore, the problem of image noise increase caused by brightness adjustment of the image in the related art can be solved, and the effect of reducing the image noise is achieved.
Detailed Description
For a better understanding of the present invention, some of the terms used in the specific examples are explained below:
And (3) brightening the dark place, namely stretching the brightness of the place where the original picture is too dark by an image processing means.
And (3) the bright part is darkened, namely, the original picture is subjected to brightness compression in the overexposed part by an image processing means.
Noise refers to unnecessary or redundant interference information present in the image data.
Signal to noise ratio refers to the ratio of signal to noise in an electronic device or electronic system.
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of a mobile terminal according to a method for adjusting image noise according to an embodiment of the present application. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a method for adjusting image noise in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, implement the above-mentioned method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as a NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, a method for operating on the mobile terminal or the network architecture is provided, fig. 2 is a flowchart of a method for adjusting image noise according to an embodiment of the present invention, as shown in fig. 2, where the flowchart includes the following steps:
Step S202, obtaining target brightness values of all areas of a target image, wherein the target image is divided into a plurality of areas, the areas comprise at least one pixel point, and the target image is an image for brightness adjustment of an original image;
The original image can be an image acquired by a mobile terminal, the mobile terminal can be a mobile phone, a tablet, a video camera, a camera and the like, the target image can be an image obtained by adjusting the brightness of the original image such as brightness increase, brightness decrease, contrast improvement and the like, the region can be a part of the target image, each region comprises one or more pixel points in the target image, the size of each region can be the same or different, each region of the target image can be spliced to obtain a complete target image, the target brightness value is a brightness value of each region of the target image, the brightness value can be directly read by using functions provided in an image processing library such as OpenCV and PIL, or the brightness value of each region of the target image (namely the pixel point value) can be read after normalization, the brightness of different regions can be kept consistent through normalization processing, the whole image can be more uniform and balanced, brightness difference in the image can be eliminated, and subsequent processing and analysis are convenient.
Step S204, obtaining the noise size of each region obtained by carrying out ith noise adjustment on the target image, wherein i is an integer greater than or equal to 0, and the noise size of each region obtained by carrying out 0 th noise adjustment is the noise size of the target image which is not subjected to the noise adjustment;
the noise level may be represented by a ratio of a noise portion to a signal portion in the image, where the noise portion refers to a portion in the image representing interference or random variation, the signal portion refers to a portion in the image representing main information, the higher the ratio is, the greater the noise in the image is, the worse the image quality is, the noise level of the image may be determined by the ratio of the noise portion to the signal portion in the image, or the noise level of the image may be estimated by a neighborhood variance estimation method, i.e., a neighborhood window of a fixed size, such as 3x3 or 5x5, is selected, the variance of pixels in the neighborhood window around the pixel is calculated for each pixel in the image, and the neighborhood variance of all pixels is averaged to obtain an average neighborhood variance of the whole image, and the noise level of the image is estimated according to the size of the average neighborhood variance, where the larger the average neighborhood variance is, the higher the noise level in the image is represented, and the worse the image quality is. And carrying out noise adjustment on the target image, and acquiring the noise size of the image after each adjustment, wherein the target image is an image obtained after the 0 th noise adjustment, namely an image without noise adjustment.
Step S206, determining adjustment state parameters of the areas according to the target brightness value and the noise size, wherein the adjustment state parameters are used for indicating whether the i+1st noise adjustment is needed in the areas;
The adjustment status parameter may be any type of parameter, such as a letter, a number, or a letter, for indicating whether noise adjustment is required again, alternatively, 0 may be used to indicate an enhanced status, 1 indicates an unadjusted status, 2 indicates an adjusted status, etc. And determining whether to perform next noise adjustment on the target image according to the acquired target brightness value and the noise size.
The method comprises the steps of obtaining original brightness values of all areas of an original image, and determining adjustment state parameters of all the areas according to the original brightness values and the target brightness values and/or the noise sizes of all the areas.
The original brightness value is the brightness value of each area of the original image, and the brightness value can be directly read by using functions provided in an image processing library such as OpenCV and PIL, or can be read after normalizing the pixel value (namely the value of a pixel point) of each area of the target image, and the brightness of different areas can be kept consistent by normalizing the brightness in the image, so that the whole image looks more uniform and balanced, the brightness difference in the image is eliminated, and the subsequent processing and analysis are convenient.
The brightness value of the original image and the brightness value of the image processed by the dynamic range can be calculated to express the dynamic range increment condition of a certain point or a certain area, meanwhile, the image with the improved dynamic range is evaluated by combining the noise level of the image, and the intensity of the definition noise reduction parameter of brightness linkage in the image processing system is regulated and controlled according to the evaluation state, so that self-adaptive feedback is formed, a clearer and more informative image is obtained, the quality and the visual effect of the image are effectively improved, and the image can better convey information and expression intention.
Step S208, when the adjustment status parameter of the target area indicates that the target area needs the (i+1) -th noise adjustment, adjusting the noise size of the target area according to the adjustment status parameter of the target area and the target brightness value, where the plurality of areas include the target area.
The target area can be any area in a target image, the target area comprises one or more pixel points, noise adjustment is carried out on the target area according to the adjustment state parameters of the target area and the brightness value of the target area, the dynamic range increment and the noise level can be combined, the definition noise reduction adjustment state can be guided from multi-dimensional combination, the noise information in the image can be reduced according to specific image characteristics and requirements, the definition of the image is increased, the best effect of the image is achieved, and meanwhile, the definition noise reduction adaptability of a scene with a high dynamic range of a camera is improved.
Specifically, a target adjustment value of the target area is determined according to the adjustment state parameter and the target brightness value, and the noise size of the target area is adjusted according to the target adjustment value.
Alternatively, the main body of execution of the above steps may be a background processor, or other devices with similar processing capability, and may also be a machine integrated with at least an image acquisition device and a data processing device, where the image acquisition device may include a graphics acquisition module such as a camera, and the data processing device may include a terminal such as a computer, a mobile phone, and the like, but is not limited thereto.
Through the steps, the brightness value of each region of the target image and the noise size of each region of the image after noise adjustment of the target image are obtained, and the adjustment state parameters of each region of the target image are determined, so that the noise size of each region of the target image is adjusted according to the adjustment state parameters and the brightness value, the image with the improved dynamic range is evaluated through the increment of the dynamic range and the multiple dimensions of the noise level, and meanwhile, the intensity of the brightness linked definition noise reduction parameters in the image processing system is regulated and controlled according to the evaluation state, so that self-adaptive feedback is formed, and the definition noise reduction adaptability of a scene with the severe change of the high dynamic range of the camera is improved. The problem of image noise increase caused by brightness adjustment of the image in the related technology is solved, and the signal-to-noise ratio of the image is improved.
The execution order of step S202 and step S204 may be interchanged, i.e. step S204 may be executed first and then step S202 may be executed.
As an alternative implementation manner, the adjustment state parameters of the areas are determined according to the original brightness value and the target brightness value and/or the noise size of the areas, and the adjustment state parameters of the areas are determined according to the relation between the brightness difference and a preset brightness threshold range and/or the relation between the noise size and a preset noise threshold range.
The brightness difference value may be a difference value between brightness of an original image and brightness of an image after brightness adjustment, the preset brightness threshold value range may be an optimal brightness adjustment range, the brightness threshold value range may be set according to practical situations, the preset noise threshold value range may be a range of noise size allowed to exist in the image, the preset noise range may be set according to practical application requirements, and the adjustment state parameter may be determined through a relationship between the brightness difference value and the preset brightness threshold value range and/or a relationship between the noise size and the preset noise threshold value range, wherein the brightness difference value may be determined through the following formula:
In the formula, Is the difference in the brightness of the light,Is the value of the target luminance and,Is the original luminance value.
As an optional implementation manner, according to the relation between the brightness difference value and a preset brightness threshold range and/or the relation between the noise size and a preset noise threshold range, determining the adjustment state parameter of each region comprises the steps of executing the following operation on each region to obtain a current region, wherein when the brightness difference value of the current region is larger than or equal to a preset maximum brightness threshold and the noise size of the current region is larger than or equal to a preset maximum noise threshold, determining the adjustment state parameter of the current region to be a first parameter, wherein the first parameter is used for indicating that the current region needs the i+1st noise adjustment, the preset maximum brightness threshold is the maximum value in the preset brightness threshold range, the preset maximum noise threshold is the maximum value in the preset noise threshold range, determining the adjustment state parameter of the current region to be a second parameter when the noise size of the current region is smaller than the preset noise threshold range, wherein the second parameter is used for indicating that the current region does not need the i+1st noise adjustment, the preset brightness difference value is smaller than or equal to the minimum brightness threshold, and the current brightness difference value is smaller than or equal to the minimum brightness threshold is the maximum brightness threshold in the preset brightness threshold range, and the current brightness threshold is smaller than the preset brightness threshold is smaller than the maximum brightness threshold or equal to the threshold.
The first parameter, the second parameter, and the third parameter are any type of parameter, such as text, number, or letter, where the first parameter is used to indicate that the next noise adjustment is needed, the second parameter is used to indicate that the next noise adjustment is not needed, and the third parameter is used to indicate that the brightness adjustment is needed, and optionally, the adjustment status parameter may be determined by the following formula:
Wherein, Is the adjustment state parameter, 2 is the first parameter, 1 is the second parameter, 0 is the third parameter,Is the difference in the brightness of the light,Is the preset maximum brightness threshold value,Is the preset minimum luminance threshold value,Is the magnitude of the noise that is to be mentioned,Is the preset maximum noise threshold value,Is the preset minimum noise threshold.
As an optional implementation manner, determining the target adjustment value of the target area according to the adjustment state parameter and the target brightness value comprises determining target parameter intensity matched with the target brightness value in a first preset relation table, wherein the first preset relation table records the corresponding relation between the brightness value and the parameter intensity, determining target parameter intensity adjustment step length matched with the adjustment state parameter of the target area in a second preset relation table, wherein the second preset relation table records the corresponding relation between the adjustment state parameter and the parameter intensity adjustment step length, and determining the target adjustment value according to the target parameter intensity and the target parameter intensity adjustment step length.
The parameter intensity may be a variation degree or intensity of an adjustment parameter, that is, an influence degree of the adjustment parameter on the image brightness, the adjustment parameter may be a parameter used for adjusting the image brightness, such as contrast, exposure, etc., the image brightness may be accurately controlled and adjusted by the parameter intensity, the first preset relation table may record a relation between a brightness value and the parameter intensity, the parameter intensity adjustment step may be an amplitude of each adjustment parameter intensity, the parameter intensity adjustment step may be adjusted according to an experiment requirement, the step may be selected to be gradually increased or decreased by the parameter intensity adjustment step to more finely adjust the parameter, and the second preset relation table may record a relation between an adjustment state parameter and the parameter intensity adjustment step. And finding out the target parameter intensity corresponding to the target brightness value through a first preset relation table, finding out a target parameter intensity adjustment step length matched with the adjustment state parameter of the target area through a second preset relation table, and determining an adjustment proportion according to the target parameter intensity and the target parameter intensity adjustment step length so as to adjust the target area. By designing the debugging step sizes of different gradients, the image processing system carries out parameter debugging of different magnitude degrees with reference, and the effects of rapid convergence of the parameters of the problem area and retention of the effects of the normal area are achieved.
As an alternative implementation mode, the target adjustment value is determined according to the target parameter intensity and the target parameter intensity adjustment step size, the target adjustment value is determined according to the target brightness difference value, the target brightness difference value is the difference value between an original brightness value of the target area and a target brightness value of the target area, the maximum value of brightness values of all the areas of the target image is determined according to the brightness difference value of the areas, the difference value between the target brightness value of the areas and the original brightness value, and the target adjustment value is determined according to the target brightness difference value, the target brightness value, the target parameter intensity and the target parameter intensity adjustment step size.
The target brightness difference may be a brightness difference of a target area, that is, a difference between brightness of the target area in the original image and brightness of the target area in the target image, the target brightness value may be a maximum brightness value, that is, a value of a pixel having the maximum brightness, in the target area in the target image, and the target adjustment value of the target area may be determined according to the target brightness difference, the target brightness value, the target parameter intensity, and the target parameter intensity adjustment step length.
Specifically, the ratio of the target brightness difference value to the target brightness value is determined as a target ratio, the product of the target parameter intensity adjustment step length and the target ratio is determined as a target product value, and the sum of the target parameter intensity and the target product value is determined as a target adjustment value.
As an alternative embodiment, the target adjustment value may be determined by the following formula:
Wherein, Is the ratio of the target value to the target value,Is the difference in the brightness of the object,Is the value of the target luminance and,Is the target adjustment value of the present invention,Is the intensity of the parameter of the object,Is the target parameter intensity adjustment step size.
As an alternative embodiment, the upper limit of the parameter intensity can be setAnd lower limit ofAnd performing parameter overshoot protection on noise adjustment to ensure that the system operates in a set range. When the parameter exceeds the set upper or lower limit, the system automatically adjusts or alarms to avoid overload or damage to the equipment. Effectively protecting the system from unnecessary damage, prolonging the service life of the equipment and improving the stability and reliability of the system.
As an alternative implementation, fig. 3 is a flowchart of noise reduction adaptive adjustment according to an embodiment of the present invention, and as shown in fig. 3, a specific flow includes:
s1, dynamic range increment (brightness) and noise estimation, namely calculating the change quantity of an original image and an image (namely a target image) subjected to dynamic range processing in a brightness dimension through data processing, and expressing the dynamic range stretching condition of a certain point or a certain area;
S2, judging a multidimensional adjustment state, namely setting a preset brightness threshold range and a preset noise threshold range, distinguishing the increment of the dynamic range and the noise level calculated in the S1 into high, medium and low states, corresponding to a region with high increment of the dynamic range and high noise level, outputting an adjustment state parameter 2, corresponding to a region with middle noise level, outputting an adjustment state parameter 1, corresponding to a region with low increment of the dynamic range and low noise level, and outputting an adjustment state parameter 0, wherein the steps are as follows:
Wherein, Is the adjustment state parameter, 2 is the first parameter, 1 is the second parameter, 0 is the third parameter,Is the difference in the brightness of the light,Is the preset maximum brightness threshold value,Is the preset minimum luminance threshold value,Is the magnitude of the noise that is to be mentioned,Is the preset maximum noise threshold value,Is the preset minimum noise threshold;
S3, multistage parameter adjustment is divided into two operations of parameter generation and parameter limitation, wherein,
The parameter generation is used for linking corresponding target parameter intensity according to the brightness (namely target brightness value) after dynamic range adjustment, and simultaneously, the target brightness difference value is normalized through the dynamic range increment maximum value (namely target brightness value) according to the target parameter intensity adjustment step length corresponding to the adjustment state parameter index output in the step S2, so as to obtain an adjustment proportion (namely target ratio), and a target adjustment value is determined according to the target ratio, the target parameter intensity and the target parameter intensity adjustment step length, so that the target image is adjusted;
The parameter limit is used for setting the upper limit and the lower limit of the parameter intensity, and performing parameter overshoot protection;
And meanwhile, the generated parameters are issued to an image processing system through the S3, the image effect is adjusted, and the dynamic range increment and the noise level of the statistical picture are continuously performed S1 after the adjustment is finished, so that a feedback closed loop is formed.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiment also provides a device for adjusting image noise, which is used for implementing the above embodiment and the preferred implementation, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 4 is a block diagram of an apparatus for adjusting image noise according to an embodiment of the present invention, as shown in fig. 4, where the apparatus includes a first obtaining module 402 configured to obtain a target brightness value of each region of a target image, where the target image is divided into a plurality of regions, the region includes at least one pixel point, the target image is an image for performing brightness adjustment on an original image, a second obtaining module 404 configured to obtain a noise size of each region obtained by performing ith noise adjustment on the target image, where i is an integer greater than or equal to 0, the noise size of each region obtained by performing the 0 th noise adjustment is a noise size of the target image that is not subjected to the noise adjustment, a determining module 406 configured to determine an adjustment state parameter of each region according to the target brightness value and the noise size, where the adjustment state parameter is used to indicate whether the i+1st noise adjustment is required for each region, and an adjustment state parameter of a target region includes the target brightness value and the target region.
In an exemplary embodiment, the device is further configured to obtain an original luminance value of each of the regions of the original image, and determine an adjustment status parameter of each of the regions according to the original luminance value and the target luminance value, and/or a noise level of each of the regions.
In an exemplary embodiment, the device is further configured to determine a difference between the target brightness value and the original brightness value of each region, to obtain a brightness difference of each region, and determine an adjustment status parameter of each region according to a relationship between the brightness difference and a preset brightness threshold range and/or a relationship between the noise level and a preset noise threshold range.
In an exemplary embodiment, the device is further configured to perform, for each of the regions, an operation that, when a luminance difference value of the current region is greater than or equal to a preset maximum luminance threshold and a noise size of the current region is greater than or equal to a preset maximum noise threshold, determine that an adjustment state parameter of the current region is a first parameter, where the first parameter is used to indicate that the current region requires an i+1st noise adjustment, the preset maximum luminance threshold is a maximum value in the preset luminance threshold range, the preset maximum noise threshold is a maximum value in the preset noise threshold range, determine that an adjustment state parameter of the current region is a second parameter when a noise size of the current region is within the preset noise threshold range, wherein the second parameter is used to indicate that the current region does not require an i+1st noise adjustment, and when the luminance difference value of the current region is less than or equal to a preset minimum luminance threshold and the noise size of the current region is less than or equal to a preset maximum noise threshold, determine that the adjustment state parameter of the current region is a third parameter in the preset luminance threshold, and the adjustment state parameter is less than the threshold.
In an exemplary embodiment, the apparatus is further configured to determine a target adjustment value for the target area according to the adjustment status parameter and the target luminance value, and adjust a noise level of the target area according to the target adjustment value.
In an exemplary embodiment, the device is further configured to determine a target parameter intensity matching the target brightness value in a first preset relation table, where a correspondence between the brightness value and the parameter intensity is recorded in the first preset relation table, determine a target parameter intensity adjustment step size matching an adjustment status parameter of the target area in a second preset relation table, where a correspondence between the adjustment status parameter and the parameter intensity adjustment step size is recorded in the second preset relation table, and determine the target adjustment value according to the target parameter intensity and the target parameter intensity adjustment step size.
In an exemplary embodiment, the apparatus is further configured to determine a luminance difference value of the target area as a target luminance difference value, wherein the target luminance difference value is a difference value between an original luminance value of the target area and a target luminance value of the target area, determine a maximum value of luminance values of the respective areas of the target image as a target luminance value, wherein the luminance difference value of the areas differs from the original luminance value, and determine the target adjustment value according to the target luminance difference value, the target luminance value, the target parameter intensity, and the target parameter intensity adjustment step.
In an exemplary embodiment, the apparatus is further configured to determine a ratio of the target luminance difference value to the target luminance value as a target ratio value, determine a product of the target parameter intensity adjustment step size and the target ratio value as a target product value, and determine a sum of the target parameter intensity and the target product value as a target adjustment value.
It should be noted that each of the above modules may be implemented by software or hardware, and the latter may be implemented by, but not limited to, the above modules all being located in the same processor, or each of the above modules being located in different processors in any combination.
Embodiments of the present invention also provide a computer readable storage medium having a computer program stored therein, wherein the computer program when executed by a processor implements the steps of the method described in any of the above.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to, a U disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, etc. various media in which a computer program may be stored.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Embodiments of the application also provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described in the various embodiments of the application.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention should be included in the protection scope of the present invention.