CN115278191B - Image white balance method and device, computer readable medium and electronic equipment - Google Patents
Image white balance method and device, computer readable medium and electronic equipment Download PDFInfo
- Publication number
- CN115278191B CN115278191B CN202210899545.5A CN202210899545A CN115278191B CN 115278191 B CN115278191 B CN 115278191B CN 202210899545 A CN202210899545 A CN 202210899545A CN 115278191 B CN115278191 B CN 115278191B
- Authority
- CN
- China
- Prior art keywords
- white balance
- target
- original image
- result
- spectrum sensing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000001228 spectrum Methods 0.000 claims abstract description 154
- 238000012545 processing Methods 0.000 claims abstract description 38
- 238000001514 detection method Methods 0.000 claims description 40
- 230000000903 blocking effect Effects 0.000 claims description 26
- 238000004364 calculation method Methods 0.000 claims description 20
- 238000009499 grossing Methods 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 3
- 238000001914 filtration Methods 0.000 claims description 3
- 230000008569 process Effects 0.000 description 20
- 238000010586 diagram Methods 0.000 description 13
- 230000000694 effects Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 230000003287 optical effect Effects 0.000 description 8
- 239000003086 colorant Substances 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 230000003595 spectral effect Effects 0.000 description 5
- 238000010295 mobile communication Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000005192 partition Methods 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- WFKWXMTUELFFGS-UHFFFAOYSA-N tungsten Chemical compound [W] WFKWXMTUELFFGS-UHFFFAOYSA-N 0.000 description 2
- 229910052721 tungsten Inorganic materials 0.000 description 2
- 239000010937 tungsten Substances 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 229910044991 metal oxide Inorganic materials 0.000 description 1
- 150000004706 metal oxides Chemical class 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/73—Colour balance circuits, e.g. white balance circuits or colour temperature control
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Color Television Image Signal Generators (AREA)
- Processing Of Color Television Signals (AREA)
Abstract
The disclosure provides an image white balance method and device, a computer readable medium and electronic equipment, and relates to the technical field of image processing. The method comprises the following steps: acquiring an original image, and determining an initial white balance result obtained by the original image through first white balance processing; acquiring spectrum sensing data corresponding to the original image; performing second white balance processing based on the spectrum sensing data and the initial white balance result to determine a target white balance result; and carrying out local white balance on the original image according to the target white balance result to obtain a target image. The method and the device can combine spectrum sensing data to realize local white balance processing of the original image acquired by the Bayer sensor, improve the accuracy of an automatic white balance processing result, enrich color information contained in the spectrum sensing data, improve the accuracy of color restoration of the original image, and realize enhancement of the color of the original image.
Description
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an image white balancing method, an image white balancing device, a computer readable medium, and an electronic apparatus.
Background
With the continuous improvement of the living standard of people, the quality of the photographed image is getting more attention. White Balance (White Balance) refers to a process of reducing a White object to White under different types of light sources, and is used for describing an index of White accuracy after three primary colors of red, green and blue are mixed in a display, for example, an image shot in a room of a fluorescent lamp appears green, an image shot under the light of an indoor tungsten filament is yellow, and an image shot at a shade of sunlight is subtly blue, which is because of the setting of White Balance, and the effect of White Balance is to restore the normal color of the image under the scenes. Automatic white balance (Auto White Balance, AWB) refers to a process of automatically adjusting the white balance of a camera by extracting the color temperature of an image.
Currently, in the related art, an automatic white balance of an image is achieved by performing global statistics on pixel values of the image and outputting a global white balance gain (White Balance Gain) acting on the global image. However, in this scheme, the calculated white balance gain acts on the global image, and the adaptive white balance gain of the local image cannot be calculated, so that the color reproduction of the local area of the image after the white balance processing is inaccurate, and the output image quality is poor.
Disclosure of Invention
The disclosure aims to provide an image white balance method, an image white balance device, a computer readable medium and electronic equipment, so as to at least avoid the problem of poor white balance effect of local areas of an image caused by global white balance of the image in the related art to a certain extent, improve the accuracy of an image white balance result and improve the image quality.
According to a first aspect of the present disclosure, there is provided an image white balancing method, comprising:
acquiring an original image, and determining an initial white balance result obtained by the original image through first white balance processing;
Acquiring spectrum sensing data corresponding to the original image;
performing second white balance processing based on the spectrum sensing data and the initial white balance result to determine a target white balance result;
and carrying out local white balance on the original image according to the target white balance result to obtain a target image.
According to a second aspect of the present disclosure, there is provided an image white balancing apparatus comprising:
The first white balance processing module is used for acquiring an original image and determining an initial white balance result obtained by the original image through first white balance processing;
the spectrum sensing data acquisition module is used for acquiring spectrum sensing data corresponding to the original image;
The white balance result determining module is used for performing second white balance processing based on the spectrum color data and the initial white balance result to determine a target white balance result;
And the image white balance module is used for carrying out local white balance on the original image according to the target white balance result to obtain a target image.
According to a third aspect of the present disclosure, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the method described above.
According to a fourth aspect of the present disclosure, there is provided an electronic apparatus, comprising:
A processor; and
And a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the methods described above.
According to the image white balance method provided by the embodiment of the disclosure, an initial white balance result obtained by performing first white balance processing on an original image can be determined, spectrum sensing data corresponding to the original image is obtained, then second white balance processing can be performed on the basis of the spectrum sensing data and the initial white balance result, a target white balance result is determined, and finally local white balance is performed on the original image according to the target white balance result, so that a target image is obtained. On one hand, accurate color data corresponding to an original image is obtained through spectrum sensing data, and a target white balance result which is finally acted on the original image is determined by combining with an initial white balance result, so that the white balance accuracy of the original image can be effectively improved, the color restoration effect of the original image is improved, and the image quality of the target image is ensured; on the other hand, the spectrum sensing data can embody the real color of the local area in the original image, the spectrum sensing data and the initial white balance result are combined, the self-adaptive white balance gain of different local areas of the original image can be obtained, the effect that different areas adopt different white balance gains is realized, the problem that the white balance effect of the local area of the image is poor due to the fact that the global white balance is carried out on the image in the related technology is avoided, the accuracy of the target image on color restoration in the real scene is further improved, and the image quality of the target image is ensured.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort. In the drawings:
Fig. 1 shows a flowchart of an image white balancing method in the present exemplary embodiment;
FIG. 2 schematically illustrates a system architecture diagram of an image processing system that may perform an image white balancing method in an exemplary embodiment of the present disclosure;
FIG. 3 schematically illustrates a schematic diagram of a spectrum sensing device and an electronic device arrangement in an exemplary embodiment of the disclosure;
FIG. 4 schematically illustrates a schematic diagram of a spectral sensor array acquiring spectral color data in an exemplary embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart for determining a target white balance result in an exemplary embodiment of the present disclosure;
FIG. 6 schematically illustrates another flow chart for determining a target white balance result in an exemplary embodiment of the present disclosure;
FIG. 7 schematically illustrates a schematic diagram of a differential weight curve in an exemplary embodiment of the present disclosure;
fig. 8 schematically illustrates a schematic diagram of a calculation of a target white balance result in an exemplary embodiment of the present disclosure;
Fig. 9 schematically illustrates a composition diagram of an image white balancing apparatus in an exemplary embodiment of the present disclosure;
fig. 10 shows a schematic diagram of an electronic device to which embodiments of the present disclosure may be applied.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
In the related art, channel pixel value statistics is performed on an image, matching calculation is performed by using actual statistical data and light source calibration data, a white balance gain result is output, and then the global white balance gain is acted on red, green and blue (RGB) three-channel data acquired by a system to obtain colors matched with real scene perception. However, in the scheme, a global white balance gain value is output through global pixel value statistics, and the white balance gain value of local self-adaptive correction cannot be achieved; moreover, by calibrating the light source in advance, interpolation calculation is carried out on different color temperatures, so that deviation is easy to occur in a scene with inaccurate actual color temperature calculation, and finally, the image color is not matched with the actual scene, and the output image quality is poor.
Based on one or more problems in the related art, the present disclosure first provides an image white balancing method, and an image white balancing method of an exemplary embodiment of the present disclosure will be specifically described below by taking an electronic device to perform the method as an example.
Fig. 1 shows a flowchart of an image white balancing method in the present exemplary embodiment, which may include the following steps S110 to S140:
in step S110, an original image is acquired, and an initial white balance result obtained by subjecting the original image to a first white balance process is determined.
In an exemplary embodiment, the original image refers to an image generated by the image sensor collecting the optical signal and not processed by the image signal processor (IMAGE SIGNAL Processing unit, ISP).
In the image signal processing process, different white balance templates can be preset to perform white balance processing on the image, for example, the preset white balance templates can include tungsten filament lamp white balance, fluorescent lamp white balance, solar white balance, cloudy white balance and shadow white balance, but in the actual use process, the scene changes are various, and the white balance templates cannot cover all scenes, so that the white balance which should be set at present can also be automatically judged by self-defining white balance parameters or an image signal processor.
The first white balance process refers to a process of automatically white balancing an original image based on pixel values in the original image, and may be, for example, statistical calculation of the collected original image by a hardware white balance statistics (WBM) module in an image signal processor, and transmission of the output statistical data to a white balance algorithm (AWB algo) module. The white balance algorithm module can perform white balance calculation according to the statistical data, and output a white balance gain value corresponding to the original image, wherein the white balance gain value is an initial white balance result, and the image signal processor can act the initial white balance result on the original image, so that pixel data after the white balance calculation is obtained.
In step S120, spectrum sensing data corresponding to the original image is acquired.
In an exemplary embodiment, the spectrum sensing data refers to data obtained by sensing real colors in a shooting scene by a spectrum sensing device when an original image is shot, for example, the spectrum sensing device may be a multispectral sensor or a CCD direct-reading spectrometer; the spectrum sensing device is used for acquiring spectrum sensing data in the shooting scene corresponding to the original image, compared with color data acquired by the image sensor based on RGB three channels, the spectrum sensing device can contain spectrum colors of visible light in a wider range, the color information is richer, and the color information in the real shooting scene is restored more.
The spectrum sensing device can be started while the image sensor acquires the original image, spectrum sensing data in a shooting scene corresponding to the original image is acquired, and the original image and the spectrum sensing data are used as input data of the image signal processor together.
In step S130, a second white balance process is performed based on the spectrum sensing data and the initial white balance result, and a target white balance result is determined.
In an exemplary embodiment, the second white balance processing refers to a processing procedure of fusing spectrum sensing data and an initial white balance result to determine a new white balance result, for example, the initial white balance result may be applied to an original image to obtain a new pixel value, the new pixel value may be compared with the spectrum sensing data, a most suitable color value at a current position of the original image may be determined, and it is assumed that the most suitable color value may be the spectrum sensing data, at this time, the new white balance result may be determined according to the spectrum sensing data, and the initial white balance result at the position may be replaced by the new white balance result to obtain a target white balance result; of course, the region of interest (such as a portrait region) in the original image can also be determined, a new white balance result corresponding to the region of interest is determined according to the spectrum sensing data corresponding to the region of interest, and the initial white balance result is still adopted by other original image regions to obtain a target white balance result; the manner in which the target white balance result is obtained by fusing the spectrum sensing data and the initial white balance result in this exemplary embodiment is not limited in any way.
Optionally, the spectrum sensing data and the initial white balance result can be divided into areas, the spectrum sensing data and the initial white balance result in the same area are compared, and according to the difference value between the two, the spectrum sensing data, the initial white balance result or the weighted fusion of the spectrum sensing data and the initial white balance result is adopted to calculate the target white balance result, so that the target white balance result is obtained.
In step S140, local white balance is performed on the original image according to the target white balance result, so as to obtain a target image.
In an exemplary embodiment, a target white balance result may be obtained according to the spectrum sensing data and the initial white balance result, where the target white balance result includes adaptive white balance gains of different areas in the original image, instead of global white balance gains for the original image, local white balance of the original image may be implemented through the target white balance result, so as to obtain a target image, so that white in the target image is closer to white in a real scene, and color reduction of the target image is implemented.
The following describes step S110 to step S140 in detail.
In an exemplary embodiment, the image white balancing method may be performed by an electronic device provided with an image processing system, and in particular, the image processing system may include at least one set of spectrum sensing devices and at least one set of camera modules, and fig. 2 schematically illustrates a system architecture diagram of an image processing system that may perform the image white balancing method in an exemplary embodiment of the disclosure.
Referring to fig. 2, the image processing system 200 may include: the spectrum sensing device 210 may be used to obtain spectrum sensing data in a photographed scene; the camera module 220 may include an image sensor 221 and an image signal processor 222, wherein: the image sensor 221 may be used to acquire an original image; the image signal processor 222 may be electrically connected to the image sensor 221 and the spectrum sensing device 210, and may be configured to determine an initial white balance result obtained by performing a first white balance process on an original image, perform a second white balance process based on the spectrum sensing data and the initial white balance result, determine a target white balance result, and finally perform local white balance on the original image according to the target white balance result to obtain a target image.
The spectrum sensing device 210 refers to a sensing unit for sensing a real color in a photographed scene when an original image is photographed, for example, the spectrum sensing device 210 may be a multispectral sensor (Multispectral sensor), and the multispectral sensor may include an imaging optical element and an optical element for dividing a spectrum, so that all spectrum color information in a current scene can be accurately identified; of course, the spectrum sensing device 210 may be a CCD direct-reading spectrometer, and the type of the spectrum sensing device is not particularly limited in this exemplary embodiment. The spectrum color data refers to color data in a real scene synchronously collected by the spectrum sensing device 210 when the camera module 220 captures an original image.
The image sensor 221 is a sensor that performs optical signal collection based on a bayer filter pattern template and converts an optical signal into an electrical signal, for example, the image sensor 221 may be a complementary metal oxide semiconductor CMOS or a charge coupled detection element CCD, and the sensor type of the image sensor 221 is not limited in any way in this exemplary embodiment.
The image processing system 200 may be provided in an electronic device having a certain computing power, for example, the electronic device may be a desktop computer, a portable computer, a smart phone, a smart robot, a wearable device, a tablet computer, or the like, to which the present exemplary embodiment is not limited in particular.
In an exemplary embodiment, the spectrum sensing data corresponding to the original image may be acquired through a preset spectrum sensing device, where the spectrum sensing device may include a spectrum sensor array formed by at least two spectrum sensors, and the spectrum sensor array may generate spectrum sensing data corresponding to at least two detection areas.
Fig. 3 schematically illustrates a schematic diagram of a spectrum sensing device and an electronic device setting manner in an exemplary embodiment of the disclosure.
Referring to fig. 3, taking the example that the spectrum sensing device 210 is a multispectral sensor 310, the multispectral sensor 310 may be integrated into the camera module 220, or may be provided in an electronic device independently of the camera module 220, for example, may be provided on a housing 320 of the electronic device, and the distance from the camera module 220 is within a distance threshold; of course, the spectrum sensing device 210 may also be used as an external device to be in communication connection with an electronic device corresponding to the camera module 220, for example, the external spectrum sensing device 330 may be in communication connection with the camera module 220 through a wired or wireless manner 340, and the connection manner of the spectrum sensing device 210 is not limited in this example embodiment.
Fig. 4 schematically illustrates a schematic diagram of a spectral sensor array acquiring spectral color data in an exemplary embodiment of the present disclosure.
Referring to fig. 4, the spectrum sensing device may include a plurality of spectrum sensors 410, where the spectrum sensors 410 are spatially arranged according to a preset column number and a preset row number, so as to obtain a spectrum sensor array, specifically, the plurality of spectrum sensors 410 may be arranged according to an array of m×n to form a spectrum sensor array 420, for example, M may be preset to be 10, and N may be preset to be 10, so that the spectrum sensing device may include 100 spectrum sensors 410, and the 100 spectrum sensors 410 are spatially arranged, so as to obtain a spectrum sensor array of 10×10. Of course, specific M and N may be set in a customized manner according to the actual application scenario, which is not limited in this exemplary embodiment.
When an original image is shot, the spectrum sensing device with the structure of the M x N spectrum sensor array 420 in space collects real color information in a shot scene, spectrum color data 440 with M x N detection areas 430 are obtained, the spectrum color data in each detection area 430 can collect the spectrum color data in the corresponding real scene area, compared with an image sensor based on RGB channels, richer color information in the real scene can be obtained, the spectrum information in a larger range is sensed, the color information of the image sensor is effectively supplemented, the self-adaptive white balance adjustment of the original image can be realized through the spectrum color data in each detection area, the white balance effect of a target image is ensured, and the color restoration accuracy of the target image is improved.
In an exemplary embodiment, the initial white balance result obtained by subjecting the original image to the first white balance process may be determined by:
The segmented region array corresponding to the original image may be determined, the segmented regions in the segmented region array may be consistent with the size and the position of the detection regions in the spectrum sensing device, specifically, the segmented regions in the segmented region array may be consistent with the number, the size and the position of the detection regions in the spectrum sensing device, and of course, the number of the segmented regions in the segmented region array may also be greater than the number of the detection regions in the spectrum sensing device, which is not particularly limited in this example embodiment.
The pixel information corresponding to the block area of the original image can be counted, for example, the pixel information can be a pixel channel value, or can be the ratio of different pixel channels, such as R, GR, GB, B, etc., in the original image, and of course, the pixel information can also be other pixel data for calculating the white balance result, which is not limited thereto.
A white balance gain may be determined from the pixel information and an initial white balance result of the original image may be determined based on the white balance gain. After the white balance gain is obtained through statistics, the white balance gain can be applied to the input pixel value in the original image, the output pixel value is obtained through estimation, and the output pixel value is used as an initial white balance result obtained through the first white balance processing of the original image.
In an exemplary embodiment, the second white balance processing based on the spectrum sensing data and the initial white balance result may be implemented to determine the target white balance result by:
The initial white balance result in each block area corresponding to the original image can be compared with the spectrum sensing data in the detection area corresponding to the block area, the comparison result is determined, and the target white balance result is determined according to the comparison result.
Alternatively, the determining the target white balance result according to the comparison result may be implemented through the steps in fig. 5, and referring to fig. 5, the method may specifically include:
Step S510, a preset first difference threshold value and a preset second difference threshold value are obtained;
step S520, determining an initial white balance result in a target block area, and difference data of spectrum sensing data in a target detection area corresponding to the target block area;
In step S530, if it is determined that the difference data is less than or equal to the first difference threshold, the initial white balance result in the target block area is used as the target white balance result of the target block area.
The target blocking area refers to a currently processed division area in all blocking areas of the original image, and the target detection area refers to a detection area of the target blocking area corresponding to the spectrum sensing data.
The difference data refers to the difference between the initial white balance result and the spectrum sensing data, for example, the pixel channel value of each pixel characteristic color in the spectrum sensing data of the target detection area and the pixel channel value of each pixel characteristic color in the initial white balance result of the target block area can be subjected to difference to obtain difference data; of course, a first average value of pixel channel values of the characteristic colors of all pixels in the spectrum sensing data of the target detection area can be calculated, a second average value of pixel channel values of the characteristic colors of all pixels in the initial white balance result of the target block area is calculated, and a difference value between the first average value and the second average value is calculated and used as difference data; the method for calculating the difference data between the initial white balance result in the target block area and the spectrum sensing data in the target detection area is not particularly limited, and specifically may be set in a self-defined manner according to the actual use condition.
If the difference data is the difference between the initial white balance result in the target block area and the pixel channel value of the spectrum sensing data in the target detection area, the corresponding first difference threshold and second difference threshold may be thresholds for judging the pixel channel value; if the difference data is the difference between the initial white balance result in the target block area and the average value of the pixel channels of the spectrum sensing data in the target detection area, the corresponding first difference threshold and second difference threshold may be thresholds for judging the average value of the pixel channels in the detection area and the block area, and the specific difference threshold may be set by user definition according to the requirement, which is not limited in this example embodiment.
When the difference data is determined to be smaller than or equal to the first difference threshold, the initial white balance result obtained through the first white balance processing is considered to be not much different from the color represented by the spectrum sensing data, and the initial white balance result is relatively accurate, so that the initial white balance result in the target block area can be directly used as the target white balance result of the target block area.
Alternatively, the determining the target white balance result according to the comparison result may be implemented through the steps in fig. 6, and referring to fig. 6, may specifically include:
step S610, if it is determined that the difference data is greater than the first difference threshold and less than or equal to the second difference threshold, acquiring a difference weight curve;
Step S620, determining target weight data based on the difference data and the difference weight curve;
Step S630, performing interpolation calculation on the initial white balance result in the target block area and the spectrum sensing data in the target detection area according to the target weight data, and determining a target white balance result of the target block area.
The difference weight curve is a preset curve for determining the weight data of interpolation calculation between the initial white balance result and the spectrum sensing data. The target weight data refers to weight data determined in a difference weight curve based on difference data.
When the difference data is determined to be larger than the first difference threshold and smaller than or equal to the second difference threshold, interpolation calculation can be performed on the initial white balance result in the target blocking area and the spectrum sensing data in the target detection area according to the target weight data, so that the target white balance result of the target blocking area is determined. For example, upon determining that the difference data is greater than the first difference threshold and less than or equal to the second difference threshold, the target white balance result may be calculated by the relation (1):
Pout=w*PAWB+(1-w)*PColor (1)
Wherein, P out may represent a target white balance result, P AWB may represent an initial white balance result within a target block region, P Color may represent spectrum sensing data in a target detection region, and w may represent target weight data, i.e., weight data determined in a difference weight curve according to difference data between the initial white balance result and the spectrum sensing data.
When the difference data is determined to be larger than the first difference threshold and smaller than or equal to the second difference threshold, the initial white balance result can be inaccurate, but the deviation degree of the accurate value is low, in order to ensure the continuity and smoothness of the white balance of the image, target weight data can be determined in a difference weight curve according to the difference data, and further interpolation calculation is performed on the initial white balance result and spectrum sensing data through the target weight data and the relational expression (1), so that the target white balance result in the partitioned area is determined.
Optionally, the determining the target white balance result according to the comparison result may be further implemented by: the spectrum sensing data in the target detection area may be taken as a target white balance result of the target blocking area when the difference data is determined to be greater than the second difference threshold.
When the difference data is determined to be larger than the second difference threshold, the initial white balance result obtained by the first white balance processing calculation of the original image can be considered to be inaccurate and the inaccuracy degree is larger, at the moment, the initial white balance result in the target block area can be abandoned, and then the spectrum sensing data in the target detection area can be directly used as the target white balance result in the target block area, so that the accuracy of the white balance result of the original image is improved.
Fig. 7 schematically illustrates a schematic diagram of a differential weight curve in an exemplary embodiment of the present disclosure.
Referring to fig. 7, the difference weight curve may be represented by a curve coordinate system in the figure, the vertical axis may represent weight data 710, and the horizontal axis may represent difference data 720 between an initial white balance result in the target block region and spectrum sensing data in the target detection region.
When it is determined that the difference data is less than or equal to the first difference threshold 730, the weight data may be 1 at this time, and the calculation is performed by substituting the relational expression (1), that is, the initial white balance result in the target block area is directly used as the target white balance result of the target block area. When the difference data is determined to be greater than the first difference threshold 730 and less than or equal to the second difference threshold 740, the target weight data can be determined according to the curve between the first difference threshold 730 and the second difference threshold 740, and then the initial white balance result in the target block area and the spectrum sensing data in the target detection area can be subjected to interpolation calculation by the target weight data, so that the target white balance result of the target block area can be determined. When the difference data is determined to be greater than the second difference threshold 740, the weight data may be 0 at this time, and the calculation is performed by substituting the relation (1), that is, the spectrum sensing data in the target detection area is regarded as the target white balance result in the target block area.
Fig. 8 schematically illustrates a schematic diagram of calculating a target white balance result in an exemplary embodiment of the present disclosure.
Referring to fig. 8, a first white balance process is performed on an original image to obtain an initial white balance result 810, spectrum sensing data 820 corresponding to the original image is determined by a spectrum sensing device, and a second white balance process is performed based on the initial white balance result 810 and the spectrum sensing data 820 to obtain a target white balance result 830.
For example, when it is determined that the difference data between the initial white balance result in the 1 st row and 1 st column partition area and the spectrum sensing data of the 1 st row and 1 st column is greater than the first difference threshold and less than or equal to the second difference threshold, the target weight data may be determined, and then the interpolation calculation may be performed on the initial white balance result in the 1 st row and 1 st column partition area and the spectrum sensing data of the 1 st row and 1 st column by the target weight data to determine the target white balance result 831 of the 1 st row and 1 st column.
When it is determined that the difference data between the initial white balance result in the 1 st row and 5 th column partitioned area and the spectrum sensing data of the 1 st row and 5 th column is less than or equal to the first difference threshold, the initial white balance result in the 1 st row and 5 th column partitioned area may be directly used as the 1 st row and 5 th column target white balance result 832.
When it is determined that the difference data between the initial white balance result in the partition area of the 2 nd row and the 5 th column and the spectrum sensing data of the 2 nd row and the 5 th column is greater than the second difference threshold, the spectrum sensing data of the 2 nd row and the 5 th column may be used as the target white balance result 833 of the 2 nd row and the 5 th column.
It can be understood that, for the target white balance result in the other partitioned area, the calculation modes of the target white balance result 831 of the 1 st row and the 1 st column, the target white balance result 832 of the 1 st row and the 5 th column, and the target white balance result 833 of the 2 nd row and the 5 th column are identical, and are not described herein. Based on this, a target white balance result in each block area can be obtained. Of course, fig. 8 is merely a schematic illustration, and should not be construed as causing any particular limitation to the present exemplary embodiment.
In an exemplary embodiment, the target white balance results for each segmented region in the original image may be low-pass filtered and smoothed. The initial white balance result or the spectrum sensing data or the interpolation calculation result between the initial white balance result and the spectrum sensing data is selected as the target white balance result, so that the target white balance result in each finally obtained segmented region is possibly discontinuous, the target white balance result of each segmented region can be subjected to low-pass filtering smoothing, the continuity and smoothness of the target white balance result among different segmented regions are effectively improved, the continuity of the target image color is ensured, and the image quality of the target image is improved.
In summary, in this exemplary embodiment, an initial white balance result obtained by performing a first white balance process on an original image may be determined, spectrum sensing data corresponding to the original image may be obtained, then a second white balance process may be performed based on the spectrum sensing data and the initial white balance result, a target white balance result may be determined, and finally, local white balance may be performed on the original image according to the target white balance result, so as to obtain the target image. On one hand, accurate color data corresponding to an original image is obtained through spectrum sensing data, and a target white balance result which is finally acted on the original image is determined by combining with an initial white balance result, so that the white balance accuracy of the original image can be effectively improved, the color restoration effect of the original image is improved, and the image quality of the target image is ensured; on the other hand, the spectrum sensing data can embody the real color of the local area in the original image, the spectrum sensing data and the initial white balance result are combined, the self-adaptive white balance gain of different local areas of the original image can be obtained, the effect that different areas adopt different white balance gains is realized, the problem that the white balance effect of the local area of the image is poor due to the fact that the global white balance is carried out on the image in the related technology is avoided, the accuracy of the target image on color restoration in the real scene is further improved, and the image quality of the target image is ensured.
It is noted that the above-described figures are merely schematic illustrations of processes involved in a method according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Further, referring to fig. 9, in this exemplary embodiment, there is further provided an image white balance device 900, including a first white balance processing module 910, a spectrum sensing data obtaining module 920, a white balance result determining module 930, and an image white balance module 940. Wherein:
the first white balance processing module 910 is configured to obtain an original image, and determine an initial white balance result obtained by performing a first white balance processing on the original image;
The spectrum sensing data obtaining module 920 is configured to obtain spectrum sensing data corresponding to the original image;
The white balance result determining module 930 is configured to perform a second white balance process based on the spectral color data and the initial white balance result, and determine a target white balance result;
the image white balance module 940 is configured to perform local white balance on the original image according to the target white balance result, so as to obtain a target image.
In an exemplary embodiment, the spectrum sensing data acquisition module 920 may be configured to:
Acquiring spectrum sensing data corresponding to the original image through a preset spectrum sensing device;
The spectrum sensing device comprises a spectrum sensor array formed by at least two spectrum sensors, and the spectrum sensor array generates spectrum sensing data corresponding to at least two detection areas.
In an exemplary embodiment, the first white balance processing module 910 may be configured to:
Determining a blocking area array corresponding to the original image, wherein the size and the position of a blocking area in the blocking area array are consistent with those of a detection area in a spectrum sensing device;
counting pixel information corresponding to the blocking areas of the original image;
and determining a white balance gain according to the pixel information, and determining an initial white balance result of the original image based on the white balance gain.
In an exemplary embodiment, the white balance result determination module 930 may be configured to:
comparing an initial white balance result in each block area corresponding to the original image with spectrum sensing data in a detection area corresponding to the block area to determine a comparison result;
and determining a target white balance result according to the comparison result.
In an exemplary embodiment, the white balance result determination module 930 may be configured to:
acquiring a preset first difference threshold and a preset second difference threshold;
Determining an initial white balance result in a target blocking area, and determining difference data of spectrum sensing data in a target detection area corresponding to the target blocking area;
And if the difference data is smaller than or equal to the first difference threshold value, taking the initial white balance result in the target block area as the target white balance result of the target block area.
In an exemplary embodiment, the white balance result determination module 930 may also be configured to:
if the difference data is determined to be larger than the first difference threshold and smaller than or equal to the second difference threshold, a difference weight curve is obtained;
Determining target weight data based on the difference data and the difference weight curve;
and carrying out interpolation calculation on the initial white balance result in the target block area and the spectrum sensing data in the target detection area according to the target weight data, and determining the target white balance result of the target block area.
In an exemplary embodiment, the white balance result determination module 930 may also be configured to:
And if the difference data is determined to be larger than the second difference threshold value, taking the spectrum sensing data in the target detection area as a target white balance result of the target blocking area.
In an exemplary embodiment, the image white balancing apparatus 900 further includes a smoothing module that may be used to:
And performing low-pass filtering smoothing on the target white balance result of each blocking area in the original image.
The specific details of each module in the above apparatus are already described in the method section, and the details that are not disclosed can be referred to the embodiment of the method section, so that they will not be described in detail.
Those skilled in the art will appreciate that the various aspects of the present disclosure may be implemented as a system, method, or program product. Accordingly, various aspects of the disclosure may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
Exemplary embodiments of the present disclosure also provide an electronic device, which may generally include a processor and a memory for storing executable instructions of the processor, the processor configured to perform the above-described image white balancing method via execution of the executable instructions.
The configuration of the electronic device will be exemplarily described below using the mobile terminal 1000 in fig. 10 as an example. It will be appreciated by those skilled in the art that the configuration of fig. 10 can be applied to stationary type devices in addition to components specifically for mobile purposes.
As shown in fig. 10, the mobile terminal 1000 may specifically include: processor 1001, memory 1002, bus 1003, mobile communication module 1004, antenna 1, wireless communication module 1005, antenna 2, display 1006, camera module 1007, audio module 1008, power module 1009, and sensor module 1010.
The processor 1001 may include one or more processing units, such as: the processor 1001 may include an AP (Application Processor ), modem processor, GPU (Graphics Processing Unit, graphics processor), ISP (IMAGE SIGNAL processor ), controller, encoder, decoder, DSP (DIGITAL SIGNAL processor ), baseband processor and/or NPU (Neural-Network Processing Unit, neural network processor), and the like.
An encoder may encode (i.e., compress) an image or video to reduce the data size for storage or transmission. The decoder may decode (i.e., decompress) the encoded data of the image or video to recover the image or video data. Mobile terminal 1000 can support one or more encoders and decoders, for example: image formats such as JPEG (Joint Photographic Experts Group ), PNG (Portable Network Graphics, portable network graphics), BMP (bitmap), and video formats such as MPEG (Moving Picture Experts Group ) 1, MPEG10, h.1063, h.1064, HEVC (HIGH EFFICIENCY video coding).
The processor 1001 may form a connection with the memory 1002 or other components through a bus 1003.
Memory 1002 may be used to store computer-executable program code that includes instructions. The processor 1001 performs various functional applications and data processing of the mobile terminal 1000 by executing instructions stored in the memory 1002. The memory 1002 may also store application data, such as files that store images, videos, and the like.
The communication functions of the mobile terminal 1000 can be implemented by a mobile communication module 1004, an antenna 1, a wireless communication module 1005, an antenna 2, a modem processor, a baseband processor, and the like. The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. The mobile communication module 1004 may provide a mobile communication solution of 3G, 4G, 5G, etc. applied on the mobile terminal 1000. The wireless communication module 1005 may provide wireless communication solutions for wireless local area networks, bluetooth, near field communications, etc. that are employed on the mobile terminal 1000.
The display 1006 is used to implement display functions such as displaying user interfaces, images, video, and the like. The camera module 1007 is used to implement a photographing function, such as photographing an image, video, and the like. The audio module 1008 is configured to implement audio functions, such as playing audio, capturing speech, and the like. The power module 1009 is configured to perform power management functions, such as charging a battery, powering a device, monitoring a battery status, and the like.
The sensor module 1010 may include one or more sensors for implementing corresponding sensing functions. For example, sensor module 1010 may include an inertial sensor for detecting a motion pose of mobile terminal 1000 and outputting inertial sensing data.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon a program product capable of implementing the method described above in the present specification. In some possible implementations, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the disclosure as described in the "exemplary methods" section of this specification, when the program product is run on the terminal device.
It should be noted that the computer readable medium shown in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Furthermore, the program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (9)
1. An image white balancing method, comprising:
Acquiring an original image, determining a blocking area array corresponding to the original image, wherein the size and the position of a blocking area in the blocking area array are consistent with those of a detection area in a spectrum sensing device, counting pixel information corresponding to the blocking area of the original image, determining a white balance gain according to the pixel information, and determining an initial white balance result of the original image based on the white balance gain;
Acquiring spectrum sensing data corresponding to the original image;
Comparing the initial white balance result in each block area corresponding to the original image with spectrum sensing data in a detection area corresponding to the block area, determining a comparison result, and determining a target white balance result according to the comparison result;
and carrying out local white balance on the original image according to the target white balance result to obtain a target image.
2. The method according to claim 1, wherein the acquiring the spectrum sensing data corresponding to the original image includes:
Acquiring spectrum sensing data corresponding to the original image through a preset spectrum sensing device;
The spectrum sensing device comprises a spectrum sensor array formed by at least two spectrum sensors, and the spectrum sensor array generates spectrum sensing data corresponding to at least two detection areas.
3. The method of claim 1, wherein said determining a target white balance result from said comparison result comprises:
acquiring a preset first difference threshold and a preset second difference threshold, wherein the first difference threshold is smaller than the second difference threshold;
Determining an initial white balance result in a target blocking area, and determining difference data of spectrum sensing data in a target detection area corresponding to the target blocking area;
And if the difference data is smaller than or equal to the first difference threshold value, taking the initial white balance result in the target block area as the target white balance result of the target block area.
4. The method of claim 3, wherein said determining a target white balance result from said comparison result further comprises:
if the difference data is determined to be larger than the first difference threshold and smaller than or equal to the second difference threshold, a difference weight curve is obtained;
Determining target weight data based on the difference data and the difference weight curve;
and carrying out interpolation calculation on the initial white balance result in the target block area and the spectrum sensing data in the target detection area according to the target weight data, and determining the target white balance result of the target block area.
5. The method of claim 4, wherein determining a target white balance result based on the comparison result, further comprises:
And if the difference data is determined to be larger than the second difference threshold value, taking the spectrum sensing data in the target detection area as a target white balance result of the target blocking area.
6. The method according to any one of claims 1 to 5, further comprising:
And performing low-pass filtering smoothing on the target white balance result of each blocking area in the original image.
7. An image white balance device, comprising:
The first white balance processing module is used for acquiring an original image, determining a blocking area array corresponding to the original image, wherein the size and the position of a blocking area in the blocking area array are consistent with those of a detection area in the spectrum sensing device, counting pixel information corresponding to the blocking area of the original image, determining a white balance gain according to the pixel information, and determining an initial white balance result of the original image based on the white balance gain;
the spectrum sensing data acquisition module is used for acquiring spectrum sensing data corresponding to the original image;
The white balance result determining module is used for comparing the initial white balance result in each block area corresponding to the original image with spectrum sensing data in the detection area corresponding to the block area, determining a comparison result and determining a target white balance result according to the comparison result;
And the image white balance module is used for carrying out local white balance on the original image according to the target white balance result to obtain a target image.
8. A computer readable medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the method according to any one of claims 1 to 6.
9. An electronic device, comprising:
A processor; and
A memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any one of claims 1 to 6 via execution of the executable instructions.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210899545.5A CN115278191B (en) | 2022-07-28 | 2022-07-28 | Image white balance method and device, computer readable medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210899545.5A CN115278191B (en) | 2022-07-28 | 2022-07-28 | Image white balance method and device, computer readable medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115278191A CN115278191A (en) | 2022-11-01 |
CN115278191B true CN115278191B (en) | 2024-04-16 |
Family
ID=83771209
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210899545.5A Active CN115278191B (en) | 2022-07-28 | 2022-07-28 | Image white balance method and device, computer readable medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115278191B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101983510A (en) * | 2008-04-08 | 2011-03-02 | 美商豪威科技股份有限公司 | System and method for adaptive local white balance adjustment |
JP2020120204A (en) * | 2019-01-22 | 2020-08-06 | キヤノン株式会社 | Image processing device, image processing method, and program |
CN113194303A (en) * | 2021-06-29 | 2021-07-30 | 深圳小米通讯技术有限公司 | Image white balance method, device, electronic equipment and computer readable storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8717459B2 (en) * | 2008-12-11 | 2014-05-06 | Texas Instruments Incorporated | Method and apparatus for improving automatic white balance with scene information |
-
2022
- 2022-07-28 CN CN202210899545.5A patent/CN115278191B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101983510A (en) * | 2008-04-08 | 2011-03-02 | 美商豪威科技股份有限公司 | System and method for adaptive local white balance adjustment |
JP2020120204A (en) * | 2019-01-22 | 2020-08-06 | キヤノン株式会社 | Image processing device, image processing method, and program |
CN113194303A (en) * | 2021-06-29 | 2021-07-30 | 深圳小米通讯技术有限公司 | Image white balance method, device, electronic equipment and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115278191A (en) | 2022-11-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107948519B (en) | Image processing method, device and equipment | |
CN110022469B (en) | Image processing method, image processing device, storage medium and electronic equipment | |
CN108111749B (en) | Image processing method and device | |
US8363131B2 (en) | Apparatus and method for local contrast enhanced tone mapping | |
CN111698434A (en) | Image processing apparatus, control method thereof, and computer-readable storage medium | |
WO2024027287A9 (en) | Image processing system and method, and computer-readable medium and electronic device | |
CN107704798B (en) | Image blurring method and device, computer readable storage medium and computer device | |
CN107194901B (en) | Image processing method, image processing device, computer equipment and computer readable storage medium | |
US20180197282A1 (en) | Method and device for producing a digital image | |
WO2022151813A1 (en) | Electronic device, front image signal processor, and image processing method | |
CN115471435A (en) | Image fusion method and device, computer readable medium and electronic equipment | |
CN107464225B (en) | Image processing method, image processing device, computer-readable storage medium and mobile terminal | |
CN110929615B (en) | Image processing method, image processing apparatus, storage medium, and terminal device | |
CN107341782B (en) | Image processing method, image processing device, computer equipment and computer readable storage medium | |
CN112348738A (en) | Image optimization method, image optimization device, storage medium, and electronic apparatus | |
CN110930340B (en) | Image processing method and device | |
CN115278189A (en) | Image tone mapping method and apparatus, computer readable medium and electronic device | |
CN115278191B (en) | Image white balance method and device, computer readable medium and electronic equipment | |
CN116614716A (en) | Image processing method, image processing device, storage medium, and electronic apparatus | |
CN115187487A (en) | Image processing method and device, electronic device and storage medium | |
CN114945087B (en) | Image processing method, device, equipment and storage medium based on face characteristics | |
CN116309224A (en) | Image fusion method, device, terminal and computer readable storage medium | |
CN115205159A (en) | Image processing method and device, electronic device and storage medium | |
CN115379128A (en) | Exposure control method and device, computer readable medium and electronic equipment | |
CN115239739A (en) | Image processing method and device, electronic equipment and computer readable medium |
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 |