WO2022087982A1 - 图像处理方法、装置、拍摄设备及计算机可读存储介质 - Google Patents
图像处理方法、装置、拍摄设备及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2022087982A1 WO2022087982A1 PCT/CN2020/124934 CN2020124934W WO2022087982A1 WO 2022087982 A1 WO2022087982 A1 WO 2022087982A1 CN 2020124934 W CN2020124934 W CN 2020124934W WO 2022087982 A1 WO2022087982 A1 WO 2022087982A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- white balance
- image
- frame
- balance parameter
- current frame
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 18
- 238000000034 method Methods 0.000 claims abstract description 46
- 238000004590 computer program Methods 0.000 claims description 20
- 230000004927 fusion Effects 0.000 claims description 10
- 238000006243 chemical reaction Methods 0.000 claims description 4
- 230000007704 transition Effects 0.000 abstract description 8
- 230000000875 corresponding effect Effects 0.000 description 45
- 238000004422 calculation algorithm Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 3
- 238000001914 filtration Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 230000002596 correlated effect Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000001028 reflection method Methods 0.000 description 1
- 230000011514 reflex Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/80—Camera processing pipelines; Components thereof
- H04N23/84—Camera processing pipelines; Components thereof for processing colour signals
- H04N23/88—Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
Definitions
- the present application relates to the technical field of image processing, and in particular, to an image processing method, an apparatus, a photographing device, and a computer-readable storage medium.
- Time-lapse photography is a shooting technique that compresses a long time in reality into a short video.
- the color temperature of the ambient light usually changes greatly throughout the process, such as day to night, noon to dusk, etc.
- the shooting interval between frames during time-lapse shooting is also relatively large. Therefore, the color temperature of ambient light corresponding to different frames may be different when shooting, resulting in a large color difference between the shooting frames, which is reflected in the delay. On the video, it will give users a sense of abrupt color transition.
- embodiments of the present application provide an image processing method, apparatus, photographing device, and computer-readable storage medium, one of which is to solve the technical problem of abrupt color transitions in time-lapse video caused by changes in ambient light color temperature.
- a first aspect of the embodiments of the present application provides an image processing method, including:
- white balance correction is performed on the current frame to obtain a target frame for generating a time-lapse video.
- a second aspect of an embodiment of the present application provides an image processing apparatus, including: a processor and a memory storing a computer program, where the processor implements the following steps when executing the computer program:
- white balance correction is performed on the current frame to obtain a target frame for generating a time-lapse video.
- a third aspect of the embodiments of the present application provides a photographing device, including:
- a processor and a memory in which a computer program is stored the processor implementing the following steps when executing the computer program:
- white balance correction is performed on the current frame to obtain a target frame for generating a time-lapse video.
- a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the image processing method provided by the embodiments of the present application.
- the white balance parameter of the current frame when determining the white balance parameter of the current frame, it is not based only on the white balance statistical data of the current frame, but is based on the statistical data set formed by the white balance statistical data of the current frame and the historical frame , that is, a large grayscale world is formed by using the white balance statistics of the current frame and the historical frame, and the first white balance parameter is determined based on the large grayscale world. Since the first white balance parameter used to correct the current frame incorporates the white balance statistics of the historical frame, the color correction of the current frame can also consider the color of the historical frame in addition to the color of the current frame itself. The color difference between the target frame and the historical frame can be within a reasonable range, reducing the abrupt feeling of the color change in the time-lapse video.
- FIG. 1 is a flowchart of an image processing method provided by an embodiment of the present application.
- FIG. 2 is a schematic diagram of a white balance statistical region provided by an embodiment of the present application.
- FIG. 3 is another flowchart of the image processing method provided by the embodiment of the present application.
- FIG. 4 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
- FIG. 5 is a schematic structural diagram of a photographing device provided by an embodiment of the present application.
- Time-lapse photography is a shooting technology that can compress a long time in reality into a short-time video.
- the short-time video can be called a time-lapse video.
- the time-lapse video can be obtained in various ways.
- a video can be obtained by shooting at a normal frame rate, and then frame extraction is performed on the video, and a time-lapse video is generated by using the image group obtained by extracting the frames.
- images may be captured at a set capture interval, and the captured image group may be used to generate a time-lapse video.
- time-lapse photography usually has a long shooting time.
- the color temperature of the ambient light usually changes greatly, such as from day to night, from noon to dusk, etc.
- the shooting interval of time-lapse photography is also relatively large, for example, the interval between frames can be tens of seconds or tens of minutes. Therefore, the color temperature of the ambient light corresponding to different frames will also be quite different.
- the white balance algorithm can correct the color of the image according to the color temperature of the ambient light to make the color of the image more realistic. For example, in a sunset scene, a white T-shirt is reflected red by the sunset light, but the T-shirt is still white in the human eye (color constancy), but the shooting device is not as intelligent as the human eye, and the image captured by the T-shirt is still white (color constancy).
- the actual white T-shirt may appear red due to the influence of the red light of the sunset, resulting in color distortion. Therefore, the photographing device usually needs to be configured with a white balance algorithm, and the color correction of the photographed image is performed through the white balance algorithm, so that the photographed image presents the real color that is consistent with what the human eye sees.
- the white balance parameters determined by the white balance algorithm for different frames will also be quite different. After the balance correction, there will be obvious color differences between these frames.
- the time-lapse video generated by these frames is played, the user can obviously feel that the color of the video screen changes suddenly, and the viewing quality of the time-lapse video is greatly reduced.
- an embodiment of the present application provides an image processing method, which can be applied to a photographing device, and the photographing device may at least include a lens, a sensor, a processor (eg, an image processing chip ISP) and a memory.
- the shooting device When the shooting device is shooting, the light of the scene can reach the sensor through the lens, and the photoelectric conversion is completed at the sensor to generate the original raw image. video frame.
- the shooting device may specifically be any of the following electronic devices: a single-lens reflex camera, an action camera, a gimbal camera, a mobile platform (such as a drone) equipped with a camera, a mobile phone, a smart tablet, a notebook computer, a driving recorder, and the like.
- FIG. 1 is a flowchart of an image processing method provided by an embodiment of the present application.
- the image processing method provided in the embodiment of the present application may include the following steps:
- both the current frame and the historical frame may be frames captured in time-lapse photography, that is, images used to generate time-lapse video.
- the current frame and the historical frame may be video frames that are not far apart in timing.
- the current frame and the historical frame may be consecutive frames. For example, if the number of acquired historical frames is 2, the current frame can be recorded as the nth frame, and the two historical frames can be recorded as the n-1th frame and the n-2th frame respectively.
- the white balance statistics of a frame of images can be used by the white balance algorithm to calculate the white balance parameters of the frame of images.
- the white balance statistics may include gain values corresponding to multiple image blocks in a frame of image. For example, a frame of image may be divided into 30*30 image blocks, and the white balance statistics of the frame of image may include the gain value of the color channel corresponding to each of the 900 image blocks.
- the gain value of the color channel may include the gain value of three channels, and may also include the gain value of four channels.
- the gain value of three channels it may be Rgain, Bgain, and Ggain
- the gain value of four channels it may be Rgain, Bgain, Grgain, and Gbgain.
- the gain value of the color channel of an image block can be calculated according to the gray value of each color channel of the image block. Taking an image block with three channels of RBG as an example, the gray value of R channel of each pixel in the image block can be accumulated and averaged to obtain Ravg, and the gray value of channel G of each pixel in the image block can be accumulated and averaged. To obtain Gavg, the B channel gray value of each pixel in the image block is accumulated and averaged to obtain Bavg.
- S104 Determine a first white balance parameter based on the statistical data set formed by the white balance statistical data of the current frame and the historical frame.
- the white balance statistics of a frame of images can be used to calculate the white balance parameters of the frame of images.
- the work of calculating white balance parameters can usually be done by the automatic white balance (AWB, Automatic white balance) algorithm module in the ISP chip.
- the calculated white balance parameter may specifically be the gain value of the color channel used to perform color correction on the entire image.
- the gain value of the color channel may be the three-channel gain values Rgain, Bgain and Ggain, or four. Channel gain values Rgain, Bgain, Grgain and Gbgain.
- the image may be first subjected to block processing, that is, the image is divided into multiple image blocks.
- the gain value of the color channel of the image block such as Rgain and Bgain, may be determined (how to determine the gain value has been described in the previous section, and will not be repeated here).
- the white balance statistical data of the image is obtained.
- the white balance algorithm determines the applicable white balance parameters of the image according to the color temperature reflected by the image, and the color temperature corresponding to the image has a corresponding relationship with the gain value of the white point or white block of the image, it can be determined first.
- White image blocks in the image Since the white balance algorithm determines the applicable white balance parameters of the image according to the color temperature reflected by the image, and the color temperature corresponding to the image has a corresponding relationship with the gain value of the white point or white block of the image, it can be determined first.
- White image blocks in the image Since the white balance algorithm determines the applicable white balance parameters of the image according to the color temperature reflected by the image, and the color temperature corresponding to the image has a corresponding relationship with the gain value of the white point or white block of the image, it can be determined first.
- White image blocks in the image Since the white balance algorithm determines the applicable white balance parameters of the image according to the color temperature reflected by the image, and the color temperature corresponding to the image has a corresponding relationship with the gain value
- FIG. 2 is a schematic diagram of a white balance statistical area provided by an embodiment of the present application.
- the abscissa represents Rgain
- the ordinate represents Bgain
- the gray part represents the statistical area.
- the white balance statistics are the gain values Rgain and Bgain of each image block of the image. Therefore, each image block can be mapped (printed) to the coordinate system shown in Figure 2 according to the gain value of each image block. , where the image blocks located in the statistical area can be determined to be white image blocks.
- the Rgain of these white image blocks can be accumulated and averaged to obtain the Rgain gain value used for correcting the entire image
- the Bgain of these white image blocks can be accumulated and averaged to obtain the value used for the entire image.
- the corrected Bgain gain value so far, the white balance parameters Rgain and Bgain used to act on the entire image are obtained.
- the white image blocks in the image can be determined according to the white balance statistics of the image, and the white image blocks corresponding to the image can be determined according to the white image blocks in the image. parameter.
- the first white balance parameter in this embodiment of the present application may be used to correct the white balance of the current frame, but the first white balance parameter is not determined only based on the white balance statistical data of the current frame, but is based on the current frame and historical A statistical dataset consisting of white balance statistics for the frame is determined.
- the white balance statistical data of the current frame may include the gain values corresponding to each image block of the current frame
- the white balance statistical data of the historical frame may include the gain values corresponding to each image block of the historical frame.
- the statistical data set constituted by the white balance statistical data of may include the gain value of each image block of the current frame and the historical frame.
- the white image blocks in the statistical data set can be determined first, that is, for all image blocks in the statistical data set, it is determined whether the image blocks are located in the white color according to the respective gain values of the image blocks. within the balance statistics area.
- the first white balance parameter can be calculated according to the gain value of the white image block, so that the white balance correction of the current frame can be performed according to the first white balance parameter to obtain the target frame.
- the white balance parameter of the current frame when determining the white balance parameter of the current frame, it is not based only on the white balance statistical data of the current frame, but is based on the statistical data set formed by the white balance statistical data of the current frame and the historical frame , that is, a large grayscale world is formed by using the white balance statistics of the current frame and the historical frame, and the first white balance parameter is determined based on the large grayscale world. Since the first white balance parameter used to correct the current frame incorporates the white balance statistics of the historical frame, the color correction of the current frame can also consider the color of the historical frame in addition to the color of the current frame itself. The color difference between the target frame and the historical frame can be within a reasonable range, reducing the abrupt feeling of the color change in the time-lapse video.
- the gain values of the white image blocks may be weighted and averaged to calculate the first white balance parameter . Before weighted averaging, the corresponding weights of image blocks need to be determined first.
- the weight corresponding to the image block may be determined at least according to the proximity of the frame to which the image block belongs to the current moment. Since the statistical data set includes the gain values of the image blocks of the current frame and the historical frame, different image blocks may belong to different frames. For example, for example, the statistical data set includes the gain values of image blocks of the current frame and two historical frames. If an image is divided into 30*30 image blocks, the statistical data set includes 2700 image blocks. Gain value, for any image block, the image block can belong to either the current frame or the two historical frames.
- the weight corresponding to the more relevant image block of the current frame may be larger, for example, if the image block belongs to The closer the frame of the image block is to the current moment, or in other words, if the time interval between the frame to which the image block belongs and the current frame is smaller, the weight corresponding to the image block may be larger.
- the current frame can be the third frame
- the historical frame can include the first frame and the second frame
- the maximum weight can be set for the image block belonging to the third frame
- the image block belonging to the second frame can be set with the largest weight. Set a smaller weight, and set the smallest weight for the image block belonging to the first frame.
- the weight corresponding to the image block may also be determined according to the difference between the gain values of the image block and other image blocks at the same position. Considering that if the difference between the gain value of an image block and the gain value of the image block at the same position in other frames is larger, the reliability of the gain value of the image block for the calculation of the first white balance parameter is lower, Therefore, in one embodiment, the weight corresponding to the image block may be negatively correlated with the difference in gain value between the image block and other image blocks at the same position.
- the gain value difference between the image block and other image blocks at the same position is greater than the preset threshold, it can be determined that the weight corresponding to the image block is zero, so that the gain value corresponding to the image block does not participate in the first white balance parameter. calculate.
- the first white balance parameter can be determined based on the statistical data set, and the statistical data set includes not only the image block gain value of the current frame, but also the image block gain value of the historical frame. Therefore, if the first white balance parameter is directly used for the current frame Perform white balance correction, and the target frame obtained after correction may have large distortion in color, that is, there is a large gap with the color of the real scene. Considering this problem, in an embodiment, the second white balance parameter corresponding to the preview image of the current frame can also be fused with the first white balance parameter to obtain the target white balance parameter, and the target white balance parameter can be used to adjust the current frame for white balance correction.
- the preview image of the current frame can also be called the liveview image of the current frame.
- the liveview image is different from the image captured by time-lapse photography such as the current frame.
- the image captured by time-lapse photography is an image used to generate a time-lapse video, which is shot one by one according to the shooting interval of time-lapse photography.
- For the previewed image it is an image captured at a normal shooting frame rate (eg, 24 frames per second, 30 frames per second, 60 frames per second, etc.).
- a normal shooting frame rate eg, 24 frames per second, 30 frames per second, 60 frames per second, etc.
- the preview image since the preview image is only used for preview, its image quality may be lower than that of the image captured by time-lapse photography, for example, the resolution may be lower than that of the image captured by time-lapse photography.
- the second white balance parameter is the white balance parameter corresponding to the preview image of the current frame, and its specific determination method can be the same as the white balance parameter determination method described above, that is, the white balance statistics of the preview image of the current frame can be obtained.
- the white balance statistical data determines the white image block in the preview image, and the second white balance parameter can be calculated according to the gain value of the white image block.
- the manner of determining the second white balance parameter may also be different from the manner of determining the white balance parameter described above.
- the second white balance parameter corresponds to the ambient light color temperature corresponding to the preview image of the current frame, and the preview image of the current frame and the current frame are images collected under the same ambient light color temperature, the preview image of the current frame
- the second white balance parameter applicable to the image is also applicable to the current frame, that is, the second white balance parameter can be considered as a white balance parameter capable of obtaining correct color correction for the current frame.
- the first white balance parameter that may not be able to correct the image to the true color considering the historical frame is fused with the second white balance parameter, and the target white balance parameter obtained by fusion is used to correct the current frame, so that the The color of the target frame will not deviate too much from the real color of the scene, but also can have a smooth transition with the color of the historical frame, which further improves the viewing experience of the time-lapse video.
- the target white balance parameter in an implementation manner, it can be obtained by weighted fusion of the first white balance parameter and the second white balance parameter.
- the weights of the first white balance parameter and the second white balance parameter may be determined in multiple ways.
- the weights of the first white balance parameter and the second white balance parameter can be pre-specified.
- appropriate weights of the first white balance parameter and the second white balance parameter can be obtained through debugging, so as to calculate the target This weight can be used by default when the white balance parameter is used.
- the weights of the first white balance parameter and the second white balance parameter may be dynamically adjusted. For example, the weights of the first white balance parameter and the second white balance parameter may be adjusted according to the weights in the preview image of the current frame.
- the number of white image blocks is determined. Since the role of the second white balance parameter is biased towards the correction of real colors, and the role of the first white balance parameter is biased towards limiting the color difference between the current frame and the historical frame, therefore, when the white image block in the preview image of the current frame is When the number is large, the second white balance parameter may be biased to be trusted, that is, the weight of the second white balance parameter may be greater than the weight of the first white balance parameter. In other words, the weight of the second white balance parameter may be positively related to the number of white image blocks in the preview image of the current frame.
- filtering processing may also be performed on the target white balance parameter.
- the filter used for the filtering process may be an FIR filter or an IIR filter.
- FIG. 3 shows a relatively specific example provided by the embodiment of the present application.
- the shooting interval of time-lapse photography can be i, the current time is t, the current frame shot at the current time is recorded as the nth frame, and the historical frame can include two frames, namely the n-1th frame and the nth frame. -2 frames, wherein the n-1th frame may be shot at time t-i, and the n-2th frame may be shot at time t-2i.
- the image processing method shown in FIG. 3 may include the following steps:
- the method may include determining the weight corresponding to each image block in the statistical data set. Specifically, the closer the frame to which the image block belongs is to the current moment, the larger the weight corresponding to the image block may be. After the weights corresponding to each image block are determined, the white image blocks in the statistical data set can be determined, and the first white balance parameter is calculated by performing weighted average of the color channel gain values of the white image blocks.
- the weights of the first white balance parameter and the second white balance parameter may be determined according to the number of white image blocks of the preview image collected at time t.
- the second white balance parameter is the white balance parameter calculated by the automatic white balance algorithm of the preview image collected at time t, and the preview image collected at time t is the preview image corresponding to the current frame.
- the second white balance parameter is the white balance parameter calculated by the automatic white balance algorithm of the preview image collected at time t
- the preview image collected at time t is the preview image corresponding to the current frame.
- the image processing method provided by the embodiment of the present application can use the white balance statistical data of the current frame and the historical frame captured in time-lapse photography to form a statistical data set, and determine the first white balance parameter based on the statistical data set, so that the first white balance
- the parameters can take into account the color transition between the current frame and the historical frame, so that the color transition of the time-lapse video is smooth. Further, it is also possible to fuse the first white balance parameter with the second white balance parameter of the preview image of the current frame, and correct the current frame through the target white balance parameter obtained by fusion.
- the target frame obtained after the correction can be It achieves a good balance between the true color and the color transition with the historical frame, so that users will not feel that the color transition of the screen is abrupt or distorted when watching the time-lapse video, which greatly improves the viewing of time-lapse video. sex.
- FIG. 4 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
- the apparatus may include: a processor 410 and a memory 420 storing a computer program, the processor implements the following steps when executing the computer program:
- white balance correction is performed on the current frame to obtain a target frame for generating a time-lapse video.
- the processor when performing white balance correction on the current frame according to the first white balance parameter, is configured to: according to the first white balance parameter and the first white balance parameter corresponding to the preview image of the current frame; Two white balance parameters, determining a target white balance parameter; performing white balance correction on the current frame according to the target white balance parameter.
- the target white balance parameter is obtained by weighted fusion of the first white balance parameter and the second white balance parameter.
- the weights respectively corresponding to the first white balance parameter and the second white balance parameter are determined according to the number of white image blocks in the preview image of the current frame.
- the second white balance parameter is determined according to white balance statistics of the preview image of the current frame.
- the target white balance parameter is filtered before being used for the white balance correction.
- the white balance statistical data of a frame of image includes gain values corresponding to multiple image blocks in the image, and the statistical data set includes gain values corresponding to image blocks in the current frame and the historical frame.
- the first white balance parameter is obtained by performing a weighted average of the gain values corresponding to the white image blocks in the statistical data set.
- the weight corresponding to the image block is determined at least according to the proximity of the frame to which the image block belongs and the current moment.
- the weight corresponding to the image block is also determined according to the difference between the gain values of the image block and other image blocks at the same position.
- the processor is further configured to, if the difference between the gain values of the image block and other image blocks at the same position is greater than a preset threshold, determine that the weight corresponding to the image block is zero.
- the processor is further configured to remove the image blocks in the statistical data set before determining the white image blocks in the statistical data set.
- the excluded image blocks in the statistical data set include image blocks whose gain value difference from other image blocks at the same position is greater than a preset threshold.
- the white image blocks in the statistical data set include image blocks whose gain values are located in the white balance statistical region in the statistical data set.
- the historical frame and the current frame are consecutive frames.
- the first white balance parameter includes a gain value of a color channel.
- the image processing apparatus When determining the white balance parameter of the current frame, the image processing apparatus provided by the embodiment of the present application is not based only on the white balance statistical data of the current frame, but is based on a statistical data set formed by the white balance statistical data of the current frame and the historical frame. , that is, a large grayscale world is formed by using the white balance statistics of the current frame and the historical frame, and the first white balance parameter is determined based on the large grayscale world. Since the first white balance parameter used to correct the current frame incorporates the white balance statistics of the historical frame, the color correction of the current frame can also consider the color of the historical frame in addition to the color of the current frame itself. The color difference between the target frame and the historical frame can be within a reasonable range, reducing the abrupt feeling of the color change in the time-lapse video.
- FIG. 5 is a schematic structural diagram of a photographing device provided by an embodiment of the present application.
- the photographing equipment may include:
- a sensor 520 used for collecting images through the photoelectric conversion element
- white balance correction is performed on the current frame to obtain a target frame for generating a time-lapse video.
- the processor when performing white balance correction on the current frame according to the first white balance parameter, is configured to: according to the first white balance parameter and the first white balance parameter corresponding to the preview image of the current frame; Two white balance parameters, determining target white balance parameters; performing white balance correction on the current frame according to the target white balance parameters.
- the target white balance parameter is obtained by weighted fusion of the first white balance parameter and the second white balance parameter.
- the weights respectively corresponding to the first white balance parameter and the second white balance parameter are determined according to the number of white image blocks in the preview image of the current frame.
- the second white balance parameter is determined according to white balance statistics of the preview image of the current frame.
- the target white balance parameter is filtered before being used for the white balance correction.
- the white balance statistical data of a frame of image includes gain values corresponding to multiple image blocks in the image, and the statistical data set includes gain values corresponding to image blocks in the current frame and the historical frame.
- the first white balance parameter is obtained by performing a weighted average of the gain values corresponding to the white image blocks in the statistical data set.
- the weight corresponding to the image block is determined at least according to the proximity of the frame to which the image block belongs and the current moment.
- the weight corresponding to the image block is also determined according to the difference between the gain values of the image block and other image blocks at the same position.
- the processor is further configured to, if the difference between the gain values of the image block and other image blocks at the same position is greater than a preset threshold, determine that the weight corresponding to the image block is zero.
- the processor is further configured to remove the image blocks in the statistical data set before determining the white image blocks in the statistical data set.
- the excluded image blocks in the statistical data set include image blocks whose gain value difference from other image blocks at the same position is greater than a preset threshold.
- the white image blocks in the statistical data set include image blocks whose gain values are located in the white balance statistical region in the statistical data set.
- the historical frame and the current frame are consecutive frames.
- the first white balance parameter includes a gain value of a color channel.
- the shooting device When determining the white balance parameter of the current frame, the shooting device provided by the embodiment of the present application is not based only on the white balance statistical data of the current frame, but is based on the statistical data set formed by the white balance statistical data of the current frame and the historical frame, That is, a large grayscale world is formed by using the white balance statistics of the current frame and the historical frame, and the first white balance parameter is determined based on the large grayscale world. Since the first white balance parameter used to correct the current frame incorporates the white balance statistics of the historical frame, the color correction of the current frame can also consider the color of the historical frame in addition to the color of the current frame itself. The color difference between the target frame and the historical frame can be within a reasonable range, reducing the abrupt feeling of the color change in the time-lapse video.
- the embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program implements the image processing method provided by the embodiment of the present application when the computer program is executed by the processor.
- Embodiments of the present application may take the form of a computer program product implemented on one or more storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having program code embodied therein.
- Computer-usable storage media includes permanent and non-permanent, removable and non-removable media, and storage of information can be accomplished by any method or technology.
- Information may be computer readable instructions, data structures, modules of programs, or other data.
- Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
- PRAM phase-change memory
- SRAM static random access memory
- DRAM dynamic random access memory
- RAM random access memory
- ROM read only memory
- EEPROM Electrically Erasable Programmable Read Only Memory
- Flash Memory or other memory technology
- CD-ROM Compact Disc Read Only Memory
- CD-ROM Compact Disc Read Only Memory
- DVD Digital Versatile Disc
- Magnetic tape cartridges magnetic tape magnetic disk storage or other magnetic storage devices or any other non-
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Color Television Image Signal Generators (AREA)
- Processing Of Color Television Signals (AREA)
Abstract
一种图像处理方法,包括:获取当前帧及至少一帧历史帧的白平衡统计数据(S102),所述历史帧与所述当前帧为延时摄影中拍摄的帧;基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数(S104);根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧(S106)。所述方法解决了环境光色温变化导致的延时视频颜色过渡突兀的技术问题。
Description
本申请涉及图像处理技术领域,尤其涉及一种图像处理方法、装置、拍摄设备及计算机可读存储介质。
延时摄影是一种可以将现实中的长时间压缩到一个短时间的视频中的拍摄技术。在延时摄影过程中,由于拍摄通常会持续较长的时间,因此环境光的色温在整个过程中通常会有较大的变化,比如白天到晚上,正午到黄昏等。并且,延时拍摄时帧与帧之间的拍摄间隔也较大,从而,不同帧在拍摄时所对应的环境光色温可能不同,导致拍摄的帧之间有较大的颜色差异,体现到延时视频上,将会给用户一种颜色过渡突兀的感觉。
发明内容
有鉴于此,本申请实施例提供了一种图像处理方法、装置、拍摄设备及计算机可读存储介质,目的之一是解决环境光色温变化导致的延时视频颜色过渡突兀的技术问题。
本申请实施例第一方面提供了一种图像处理方法,包括:
获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;
基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;
根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
本申请实施例第二方面提供了一种图像处理装置,包括:处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:
获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延 时摄影中拍摄的帧;
基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;
根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
本申请实施例第三方面提供了一种拍摄设备,包括:
镜头;
传感器,用于通过光电转换元件采集图像;
处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:
获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;
基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;
根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
本申请实施例第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例提供的图像处理方法。
本申请实施例提供的图像处理方法,在确定当前帧的白平衡参数时,并不是仅基于当前帧的白平衡统计数据,而是基于当前帧与历史帧的白平衡统计数据构成的统计数据集,即相当于利用当前帧与历史帧的白平衡统计数据构成一个大的灰度世界,基于该大的灰度世界确定出第一白平衡参数。由于用于校正当前帧的第一白平衡参数融合了历史帧的白平衡统计数据,因此,对当前帧的颜色校正除了考虑当前帧本身的颜色以外还可以考虑历史帧的颜色,从而校正后得到的目标帧与历史帧的颜色差异可以在合理范围内,减少了延时视频中画面颜色变化的突兀感。
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例, 对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的图像处理方法的流程图。
图2是本申请实施例提供的一种白平衡统计区域的示意图。
图3是本申请实施例提供的图像处理方法的另一流程图。
图4是本申请实施例提供的图像处理装置的结构示意图。
图5是本申请实施例提供的一种拍摄设备的结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
延时摄影是一种可以将现实中的长时间压缩到一个短时间的视频中的拍摄技术,这里,可以将该短时间的视频称为延时视频。延时视频可以有多种获取方式,在一种实施方式中,可以先以正常的帧率拍摄得到一段视频,再对该视频进行抽帧,利用抽帧得到的图像组生成延时视频。在一种实施方式中,可以以设定的拍摄间隔拍摄图像,拍摄得到的图像组可以用于生成延时视频。
与普通的摄影不同,延时摄影通常有较长的拍摄时长,在这较长的拍摄时长内,环境光的色温通常会有较大的变化,比如从白天到黑夜,从正午到黄昏等。并且,延时摄影的拍摄间隔也比较大,比如帧与帧之间可以间隔几十秒或几十分钟,因此,不同帧所对应的环境光色温也会有较大的差异。
白平衡算法可以根据环境光色温对图像的颜色进行校正,以使图像的颜色更加真实。举个例子,比如在夕阳场景下,白色T恤被夕阳光映成红色,但在人眼中该T恤仍然是白色(颜色恒常性),但拍摄设备并没有人眼那么智能,其拍摄的图像中实际白色的T恤可能由于夕阳红光的影响呈现为红色,出现了颜色的失真。因此,拍摄设备通常需要配置白平衡算法,通过白平衡算法对所拍摄的图像进行颜色校正,使所拍摄的图像呈现与人眼所见相符的真实颜色。
当不同帧在拍摄时所对应的环境光色温差异较大时,白平衡算法为不同帧确定的白平衡参数也会有较大的差异,从而,在利用各自的白平衡参数对各帧进行白平衡校 正之后,这些帧之间会有比较明显的颜色差异,当利用这些帧生成的延时视频被播放时,用户可以明显感觉到视频画面的颜色变化突兀,延时视频的观赏性大大降低。
为此,本申请实施例提供了一种图像处理方法,该方法可以应用于拍摄设备,拍摄设备可以至少包括镜头、传感器、处理器(如图像处理芯片ISP)和存储器。在拍摄设备进行拍摄时,场景的光线可以通过镜头到达传感器,在传感器处完成光电转换生成原始的raw图像,原始的raw图像可以经处理器进行多种图像处理,从而得到可输出显示的图像或视频帧。拍摄设备具体可以是以下任一种电子设备:单反相机、运动相机、云台相机、搭载相机的可移动平台(如无人机)、手机、智能平板、笔记本电脑、行车记录仪等等。
可以参见图1,图1是本申请实施例提供的图像处理方法的流程图。本申请实施例提供的图像处理方法可以包括以下步骤:
S102、获取当前帧及至少一帧历史帧的白平衡统计数据。
需要注意的是,当前帧与历史帧均可以是延时摄影中拍摄的帧,即可以是用于生成延时视频的图像。当前帧与历史帧可以是在时序上相差不远的视频帧,在一种实施方式中,当前帧与历史帧可以是连续的帧。举个例子,若获取的历史帧数量为2,则当前帧可以记为第n帧,两帧历史帧可以分别记为第n-1帧与第n-2帧。
一帧图像的白平衡统计数据可以用于白平衡算法计算该帧图像的白平衡参数。在一种实施方式中,白平衡统计数据可以包括一帧图像中多个图像块对应的增益值。比如一帧图像可以划分为30*30个图像块,则该帧图像的白平衡统计数据可以包括该900个图像块中的每一个图像块对应的色彩通道的增益值。
色彩通道的增益值可以包括三通道的增益值,也可以包括四通道的增益值。对于三通道的增益值,具体可以是Rgain、Bgain与Ggain,对于四通道的增益值,具体可以是Rgain、Bgain、Grgain与Gbgain。
一个图像块的色彩通道的增益值可以根据该图像块各颜色通道的灰度值计算得到。以RBG三通道的图像块为例,可以对图像块中各像素的R通道灰度值进行累加求平均值,得到Ravg,对图像块中各像素的G通道灰度值进行累加求平均值,得到Gavg,对图像块中各像素的B通道灰度值进行累加求平均值,得到Bavg。接着,可以将G通道的平均值Gavg除以R通道的平均值Ravg,得到R通道的增益值Rgain,用G通道的平均值Gavg除以B通道的平均值Bavg,得到B通道的增益值Bgain,G通道的增益值为1,由此便得到了该图像块三通道的增益值。
S104、基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定 第一白平衡参数。
S106、根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
在前文已提及,一帧图像的白平衡统计数据可以用于计算该帧图像的白平衡参数。对于拍摄设备而言,计算白平衡参数的工作通常可以由ISP芯片中的自动白平衡(AWB,Automatic white balance)算法模块负责。计算出的白平衡参数具体可以是用于对整张图像进行颜色校正的颜色通道的增益值,同样的,颜色通道的增益值可以是三通道的增益值Rgain、Bgain与Ggain,也可以是四通道的增益值Rgain、Bgain、Grgain与Gbgain。
为便于理解,下面提供一种基于灰度世界法的白平衡参数确定方式。
在确定一张图像适用的白平衡参数时,出于计算效率的考虑,在一种实施方式中,可以先对该图像进行分块处理,即将该图像划分为多个图像块。针对每一个图像块,可以确定图像块的颜色通道的增益值,如Rgain和Bgain(具体如何确定在前文中已有说明,在此不再赘述)。在得到该图像的各个图像块对应的增益值Rgain和Bgain后,即得到了该图像的白平衡统计数据。
由于白平衡算法是根据图像所反映出的色温来确定该图像适用的白平衡参数的,而图像所对应的色温与该图像白点或白块的增益值具有对应关系,因此,可以先确定该图像中的白色图像块。
在确定图像中的白色图像块时,在一种实施方式中,可以基于该图像的白平衡统计数据,根据设定的白平衡统计区域来确定。如图2所示,图2是本申请实施例提供的一种白平衡统计区域的示意图,在该示意图中,横坐标表示Rgain,纵坐标表示Bgain,灰色部分表示统计区域。而白平衡统计数据,即为该图像的各图像块的增益值Rgain和Bgain,因此,可以将根据各图像块的增益值,将各图像块映射(打印)到图2所示的坐标系中,其中,位于统计区域内的图像块,可以确定其为白色图像块。
进一步的,可以对这些白色图像块的Rgain进行累加求平均,得到用于对整张图像进行校正的Rgain增益值,对这些白色图像块的Bgain进行累加求平均,得到用于对整张图像进行校正的Bgain增益值,至此,即得到了用于作用到整张图像上的白平衡参数Rgain与Bgain。
可见,在确定一张图像的白平衡参数时,可以根据该图像的白平衡统计数据,确定出该图像中的白色图像块,根据该图像中的白色图像块,可以确定该图像对应的白平衡参数。
本申请实施例中的第一白平衡参数可以用于对当前帧进行白平衡校正,但第一白平衡参数并不是仅基于当前帧的白平衡统计数据确定得到的,而是基于当前帧与历史帧的白平衡统计数据构成的统计数据集确定得到。具体的,当前帧的白平衡统计数据可以包括当前帧的各图像块对应的增益值,历史帧的白平衡统计数据可以包括历史帧的各图像块对应的增益值,则由当前帧与历史帧的白平衡统计数据构成的统计数据集,可以包括当前帧与历史帧的各个图像块的增益值。
在基于统计数据集确定第一白平衡参数时,同样的,可以先确定统计数据集中的白色图像块,即对统计数据集中的所有图像块,根据图像块各自对应的增益值确定其是否位于白平衡统计区域内。在确定出白色图像块后,则可以根据白色图像块的增益值计算出第一白平衡参数,从而可以根据第一白平衡参数对当前帧进行白平衡校正,得到目标帧。
本申请实施例提供的图像处理方法,在确定当前帧的白平衡参数时,并不是仅基于当前帧的白平衡统计数据,而是基于当前帧与历史帧的白平衡统计数据构成的统计数据集,即相当于利用当前帧与历史帧的白平衡统计数据构成一个大的灰度世界,基于该大的灰度世界确定出第一白平衡参数。由于用于校正当前帧的第一白平衡参数融合了历史帧的白平衡统计数据,因此,对当前帧的颜色校正除了考虑当前帧本身的颜色以外还可以考虑历史帧的颜色,从而校正后得到的目标帧与历史帧的颜色差异可以在合理范围内,减少了延时视频中画面颜色变化的突兀感。
在基于统计数据集确定第一白平衡参数时,在确定统计数据集中的白色图像块后,在一种实施方式中,可以对白色图像块的增益值进行加权平均,计算出第一白平衡参数。而在加权平均之前,需要先确定图像块对应的权重。
在一种实施方式中,图像块对应的权重至少可以根据该图像块所属的帧与当前时刻的接近程度确定。由于统计数据集中包括了当前帧与历史帧的图像块的增益值,因此不同的图像块可以属于不同的帧。可以举个例子,比如统计数据集中包括了当前帧与两帧历史帧的图像块的增益值,若一帧图像被划分为30*30个图像块,则统计数据集中包括了2700个图像块的增益值,对于其中的任一图像块而言,该图像块可以属于当前帧或两帧历史帧中的任一帧。
由于第一白平衡参数是用于对当前帧进行白平衡校正的,因此,在确定第一白平衡参数时,与当前帧越相关的图像块所对应权重可以越大,例如,若图像块所属的帧越接近当前时刻,或者说,若图像块所属的帧与当前帧之间的时间间隔越小,则该图像块对应的权重可以越大。可以举个例子,比如当前帧可以是第3帧,历史帧可以包 括第1帧与第2帧,则可以对属于第3帧的图像块设定最大的权重,对属于第2帧的图像块设定小一些的权重,对属于第1帧的图像块设定最小的权重。
在一种实施方式中,图像块所对应的权重还可以根据所述图像块与其他相同位置的图像块的增益值差距确定。考虑到若一个图像块的增益值与其他帧的相同位置的图像块的增益值差距越大,则该图像块的增益值对于第一白平衡参数的计算而言的可信度就越低,因此,在一种实施方式中,图像块所对应的权重可以与该图像块与其他相同位置的图像块的增益值差距负相关。进一步的,若图像块与其他相同位置的图像块的增益值差距大于预设阈值,则可以确定该图像块对应的权重为零,使该图像块对应的增益值不参与第一白平衡参数的计算。
对于与其他相同位置的图像块的增益值差距大于预设阈值的图像块,除了可以确定其权重为零外,在另一种实施方式中,还可以在确定统计数据集中的白色图像块之前对这些图像块进行剔除。
第一白平衡参数可以基于统计数据集确定,而统计数据集中除了包括当前帧的图像块增益值外,还包括历史帧的图像块增益值,因此,若直接使用第一白平衡参数对当前帧进行白平衡校正,校正后得到的目标帧可能在颜色上有较大的失真,即与真实场景的颜色有较大的差距。考虑到该问题,在一种实施方式中,还可以将当前帧的预览图像对应的第二白平衡参数与第一白平衡参数进行融合,得到目标白平衡参数,利用该目标白平衡参数对当前帧进行白平衡校正。
当前帧的预览图像也可以称为当前帧的liveview图像。liveview图像与当前帧等延时摄影拍摄的图像不同,延时摄影拍摄的图像是用于生成延时视频的图像,其是根据延时摄影的拍摄间隔逐张拍摄得到的,而liveview图像是用于预览的图像,其是按照正常的拍摄帧率(如1秒24帧、1秒30帧、1秒60帧等)采集的图像。并且,从图像质量上,由于预览图像仅用于预览,其图像质量可以低于延时摄影拍摄的图像,比如分辨率可以低于延时摄影拍摄的图像。
第二白平衡参数是当前帧的预览图像对应的白平衡参数,其具体的确定方式可以与前文中描述的白平衡参数确定方式相同,即可以获取当前帧的预览图像的白平衡统计数据,根据该白平衡统计数据确定预览图像中的白色图像块,根据白色图像块的增益值可以计算得到第二白平衡参数。当然,第二白平衡参数的确定方式也可以与前文中描述的白平衡参数确定方式不同。白平衡参数的计算方式有多种,除了前文所提供的基于灰度世界法的计算方式以外,还包括最大亮度法、色域界限法、光源预测法、完美反射法、动态阈值法、模糊逻辑法等等,因此,第二白平衡参数的确定方式也可 以采用这些其他的方式。
由于第二白平衡参数是与当前帧的预览图像所对应的环境光色温相对应的,而当前帧的预览图像与当前帧是在相同的环境光色温下采集的图像,因此,当前帧的预览图像适用的第二白平衡参数也适用于当前帧,即第二白平衡参数可以认为是能够使当前帧得到正确的颜色校正的白平衡参数。那么,将考虑了历史帧的、可能无法将图像校正为真实颜色的第一白平衡参数与该第二白平衡参数融合,并利用融合得到的目标白平衡参数对当前帧进行校正,则可以使得到的目标帧的颜色既不会与场景的真实颜色偏差太大,又能够与历史帧的颜色之间具有平滑的过渡,使延时视频的观赏性进一步提升。
对于目标白平衡参数,在一种实施方式中,可以通过第一白平衡参数与第二白平衡参数进行加权融合得到。而第一白平衡参数与第二白平衡参数的权重可以有多种确定方式。在一种实施方式中,第一白平衡参数与第二白平衡参数的权重可以预先指定,比如可以通过调试得出第一白平衡参数与第二白平衡参数各自合适的权重,从而在计算目标白平衡参数时可以默认使用该权重。在一种实施方式中,第一白平衡参数与第二白平衡参数的权重可以是动态调整的,例如,第一白平衡参数与第二白平衡参数的权重可以根据当前帧的预览图像中的白色图像块数量确定。由于第二白平衡参数的作用偏向于真实颜色的校正,而第一白平衡参数的作用偏向于限制当前帧与历史帧之间的颜色差异,因此,当当前帧的预览图像中的白色图像块数量较多时,可以偏向于置信第二白平衡参数,即第二白平衡参数的权重可以大于第一白平衡参数的权重。换言之,第二白平衡参数的权重可以与当前帧的预览图像中的白色图像块数量正相关。
进一步的,在利用目标白平衡参数对当前帧进行白平衡校正之前,还可以对目标白平衡参数进行滤波处理。进行滤波处理所使用的滤波器可以的FIR滤波器,也可以IIR滤波器。
下面可以参考图3,图3示出本申请实施例提供的一个相对具体的例子。
如图3所示,延时摄影的拍摄间隔可以为i,当前时刻为t,当前时刻拍摄的当前帧记为第n帧,历史帧可以包括两帧,分别为第n-1帧与第n-2帧,其中,第n-1帧可以是t-i时刻拍摄的,第n-2帧可以是t-2i时刻拍摄的。
图3所示的图像处理方法可以包括以下步骤:
S301、获取当前帧与历史帧的白平衡统计数据,即获取第n帧、第n-1帧与第n-2帧各自对应的白平衡统计数据n、白平衡统计数据n-1、白平衡统计数据n-2。
S302、基于白平衡统计数据n、白平衡统计数据n-1、白平衡统计数据n-2构成的 统计数据集,确定第一白平衡参数。其中,可以包括对统计数据集中各图像块对应的权重进行确定,具体的,图像块所属的帧与当前时刻越接近,该图像块对应的权重可以越大。在确定各图像块对应的权重后,可以确定统计数据集中的白色图像块,利用白色图像块的颜色通道增益值进行加权平均,计算得出第一白平衡参数。
S303、将第一白平衡参数与第二白平衡参数进行加权融合。其中,第一白平衡参数与第二白平衡参数的权重可以根据t时刻采集的预览图像的白色图像块数量确定。
可以理解的,第二白平衡参数是t时刻采集的预览图像通过自动白平衡算法计算得到的白平衡参数,而t时刻采集的预览图像即为当前帧对应的预览图像。关于第二白平衡参数的具体计算方式,可以参考前文中的相关说明。
S304、融合后的结果经过滤波处理,得到目标白平衡参数。
S305、根据目标白平衡参数对当前帧第n帧进行白平衡矫正,得到用于生成延时视频的目标帧。
本申请实施例提供的图像处理方法,可以利用延时摄影中拍摄的当前帧与历史帧的白平衡统计数据构成统计数据集,基于该统计数据集确定第一白平衡参数,使第一白平衡参数可以兼顾当前帧与历史帧之间的颜色过渡,使延时视频的画面颜色过渡平滑。进一步的,还可以将第一白平衡参数与当前帧的预览图像的第二白平衡参数进行融合,并通过融合得到的目标白平衡参数对当前帧进行校正,如此,校正后得到的目标帧可以在颜色真实和与历史帧的颜色过渡之间取得很好的平衡,使用户观看延时视频时既不会觉得画面颜色过渡突兀,也不会觉得画面颜色失真,大大提高了延时视频的观赏性。
下面可以参考图4,图4是本申请实施例提供的图像处理装置的结构示意图。该装置可以包括:处理器410和存储有计算机程序的存储器420,所述处理器在执行所述计算机程序时实现以下步骤:
获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;
基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;
根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
可选的,所述处理器在根据所述第一白平衡参数,对所述当前帧进行白平衡校正时用于,根据所述第一白平衡参数与所述当前帧的预览图像对应的第二白平衡参数, 确定目标白平衡参数;根据所述目标白平衡参数对所述当前帧进行白平衡校正。
可选的,所述目标白平衡参数是所述第一白平衡参数与第二白平衡参数进行加权融合得到的。
可选的,所述第一白平衡参数与所述第二白平衡参数分别对应的权重是根据所述当前帧的预览图像中的白色图像块数量确定的。
可选的,所述第二白平衡参数是根据所述当前帧的预览图像的白平衡统计数据确定的。
可选的,所述目标白平衡参数在用于进行所述白平衡校正前经过了滤波处理。
可选的,一帧图像的白平衡统计数据包括所述图像中多个图像块对应的增益值,所述统计数据集包括所述当前帧与所述历史帧中图像块对应的增益值。
可选的,所述第一白平衡参数是利用所述统计数据集中白色图像块对应的增益值进行加权平均得到的。
可选的,针对所述统计数据集中的任一图像块,所述图像块对应的权重至少根据所述图像块所属的帧与当前时刻的接近程度确定。
可选的,所述图像块所属的帧越接近当前时刻,所述图像块对应的权重越大。
可选的,所述图像块对应的权重还根据所述图像块与其他相同位置的图像块的增益值差距确定。
可选的,所述处理器还用于,若所述图像块与其他相同位置的图像块的增益值差距大于预设阈值,确定所述图像块对应的权重为零。
可选的,所述处理器还用于,在确定所述统计数据集中的白色图像块之前,对所述统计数据集中的图像块进行剔除。
可选的,所述统计数据集中被剔除的图像块包括与其他相同位置的图像块的增益值差距大于预设阈值的图像块。
可选的,所述统计数据集中的白色图像块包括所述统计数据集中增益值位于白平衡统计区域内的图像块。
可选的,所述历史帧与所述当前帧为连续的帧。
可选的,所述第一白平衡参数包括颜色通道的增益值。
以上所提供的图像处理装置的各种实施方式,其具体实现可以参考前文中的相关说明,在此不再赘述。
本申请实施例提供的图像处理装置,在确定当前帧的白平衡参数时,并不是仅基于当前帧的白平衡统计数据,而是基于当前帧与历史帧的白平衡统计数据构成的统计 数据集,即相当于利用当前帧与历史帧的白平衡统计数据构成一个大的灰度世界,基于该大的灰度世界确定出第一白平衡参数。由于用于校正当前帧的第一白平衡参数融合了历史帧的白平衡统计数据,因此,对当前帧的颜色校正除了考虑当前帧本身的颜色以外还可以考虑历史帧的颜色,从而校正后得到的目标帧与历史帧的颜色差异可以在合理范围内,减少了延时视频中画面颜色变化的突兀感。
下面可以参考图5,图5是本申请实施例提供的一种拍摄设备的结构示意图。该拍摄设备可以包括:
镜头510;
传感器520,用于通过光电转换元件采集图像;
处理器530和存储有计算机程序的存储器540,所述处理器在执行所述计算机程序时实现以下步骤:
获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;
基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;
根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
可选的,所述处理器在根据所述第一白平衡参数,对所述当前帧进行白平衡校正时用于,根据所述第一白平衡参数与所述当前帧的预览图像对应的第二白平衡参数,确定目标白平衡参数;根据所述目标白平衡参数对所述当前帧进行白平衡校正。
可选的,所述目标白平衡参数是所述第一白平衡参数与第二白平衡参数进行加权融合得到的。
可选的,所述第一白平衡参数与所述第二白平衡参数分别对应的权重是根据所述当前帧的预览图像中的白色图像块数量确定的。
可选的,所述第二白平衡参数是根据所述当前帧的预览图像的白平衡统计数据确定的。
可选的,所述目标白平衡参数在用于进行所述白平衡校正前经过了滤波处理。
可选的,一帧图像的白平衡统计数据包括所述图像中多个图像块对应的增益值,所述统计数据集包括所述当前帧与所述历史帧中图像块对应的增益值。
可选的,所述第一白平衡参数是利用所述统计数据集中白色图像块对应的增益值进行加权平均得到的。
可选的,针对所述统计数据集中的任一图像块,所述图像块对应的权重至少根据所述图像块所属的帧与当前时刻的接近程度确定。
可选的,所述图像块所属的帧越接近当前时刻,所述图像块对应的权重越大。
可选的,所述图像块对应的权重还根据所述图像块与其他相同位置的图像块的增益值差距确定。
可选的,所述处理器还用于,若所述图像块与其他相同位置的图像块的增益值差距大于预设阈值,确定所述图像块对应的权重为零。
可选的,所述处理器还用于,在确定所述统计数据集中的白色图像块之前,对所述统计数据集中的图像块进行剔除。
可选的,所述统计数据集中被剔除的图像块包括与其他相同位置的图像块的增益值差距大于预设阈值的图像块。
可选的,所述统计数据集中的白色图像块包括所述统计数据集中增益值位于白平衡统计区域内的图像块。
可选的,所述历史帧与所述当前帧为连续的帧。
可选的,所述第一白平衡参数包括颜色通道的增益值。
以上所提供的拍摄设备的各种实施方式,其具体实现可以参考前文中的相关说明,在此不再赘述。
本申请实施例提供的拍摄设备,在确定当前帧的白平衡参数时,并不是仅基于当前帧的白平衡统计数据,而是基于当前帧与历史帧的白平衡统计数据构成的统计数据集,即相当于利用当前帧与历史帧的白平衡统计数据构成一个大的灰度世界,基于该大的灰度世界确定出第一白平衡参数。由于用于校正当前帧的第一白平衡参数融合了历史帧的白平衡统计数据,因此,对当前帧的颜色校正除了考虑当前帧本身的颜色以外还可以考虑历史帧的颜色,从而校正后得到的目标帧与历史帧的颜色差异可以在合理范围内,减少了延时视频中画面颜色变化的突兀感。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例提供的图像处理方法。
以上针对每个保护主题均提供了多种实施方式,在不存在冲突或矛盾的基础上,本领域技术人员可以根据实际情况自由对各种实施方式进行组合,由此构成各种不同的技术方案。而本申请文件限于篇幅,未能对所有组合而得的技术方案展开说明,但可以理解的是,这些未能展开的技术方案也属于本申请实施例公开的范围。
本申请实施例可采用在一个或多个其中包含有程序代码的存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机可用存储介质包括永久性和非永久性、可移动和非可移动媒体,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括但不限于:相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上对本发明实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。
Claims (52)
- 一种图像处理方法,其特征在于,包括:获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
- 根据权利要求1所述的方法,其特征在于,所述根据所述第一白平衡参数,对所述当前帧进行白平衡校正,包括:根据所述第一白平衡参数与所述当前帧的预览图像对应的第二白平衡参数,确定目标白平衡参数;根据所述目标白平衡参数对所述当前帧进行白平衡校正。
- 根据权利要求2所述的方法,其特征在于,所述目标白平衡参数是所述第一白平衡参数与第二白平衡参数进行加权融合得到的。
- 根据权利要求3所述的方法,其特征在于,所述第一白平衡参数与所述第二白平衡参数分别对应的权重是根据所述当前帧的预览图像中的白色图像块数量确定的。
- 根据权利要求2所述的方法,其特征在于,所述第二白平衡参数是根据所述当前帧的预览图像的白平衡统计数据确定的。
- 根据权利要求2所述的方法,其特征在于,所述目标白平衡参数在用于进行所述白平衡校正前经过了滤波处理。
- 根据权利要求1所述的方法,其特征在于,一帧图像的白平衡统计数据包括所述图像中多个图像块对应的增益值,所述统计数据集包括所述当前帧与所述历史帧中图像块对应的增益值。
- 根据权利要求7所述的方法,其特征在于,所述第一白平衡参数是利用所述统计数据集中白色图像块对应的增益值进行加权平均得到的。
- 根据权利要求8所述的方法,其特征在于,针对所述统计数据集中的任一图像块,所述图像块对应的权重至少根据所述图像块所属的帧与当前时刻的接近程度确定。
- 根据权利要求9所述的方法,其特征在于,所述图像块所属的帧越接近当前时刻,所述图像块对应的权重越大。
- 根据权利要求9所述的方法,其特征在于,所述图像块对应的权重还根据所 述图像块与其他相同位置的图像块的增益值差距确定。
- 根据权利要求11所述的方法,其特征在于,所述方法还包括:若所述图像块与其他相同位置的图像块的增益值差距大于预设阈值,确定所述图像块对应的权重为零。
- 根据权利要求8所述的方法,其特征在于,在确定所述统计数据集中的白色图像块之前,所述方法还包括:对所述统计数据集中的图像块进行剔除。
- 根据权利要求13所述的方法,其特征在于,所述统计数据集中被剔除的图像块包括与其他相同位置的图像块的增益值差距大于预设阈值的图像块。
- 根据权利要求8所述的方法,其特征在于,所述统计数据集中的白色图像块包括所述统计数据集中增益值位于白平衡统计区域内的图像块。
- 根据权利要求1所述的方法,其特征在于,所述历史帧与所述当前帧为连续的帧。
- 根据权利要求1所述的方法,其特征在于,所述第一白平衡参数包括颜色通道的增益值。
- 一种图像处理装置,其特征在于,包括:处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
- 根据权利要求18所述的装置,其特征在于,所述处理器在根据所述第一白平衡参数,对所述当前帧进行白平衡校正时用于,根据所述第一白平衡参数与所述当前帧的预览图像对应的第二白平衡参数,确定目标白平衡参数;根据所述目标白平衡参数对所述当前帧进行白平衡校正。
- 根据权利要求19所述的装置,其特征在于,所述目标白平衡参数是所述第一白平衡参数与第二白平衡参数进行加权融合得到的。
- 根据权利要求20所述的装置,其特征在于,所述第一白平衡参数与所述第二 白平衡参数分别对应的权重是根据所述当前帧的预览图像中的白色图像块数量确定的。
- 根据权利要求19所述的装置,其特征在于,所述第二白平衡参数是根据所述当前帧的预览图像的白平衡统计数据确定的。
- 根据权利要求19所述的装置,其特征在于,所述目标白平衡参数在用于进行所述白平衡校正前经过了滤波处理。
- 根据权利要求18所述的装置,其特征在于,一帧图像的白平衡统计数据包括所述图像中多个图像块对应的增益值,所述统计数据集包括所述当前帧与所述历史帧中图像块对应的增益值。
- 根据权利要求24所述的装置,其特征在于,所述第一白平衡参数是利用所述统计数据集中白色图像块对应的增益值进行加权平均得到的。
- 根据权利要求25所述的装置,其特征在于,针对所述统计数据集中的任一图像块,所述图像块对应的权重至少根据所述图像块所属的帧与当前时刻的接近程度确定。
- 根据权利要求26所述的装置,其特征在于,所述图像块所属的帧越接近当前时刻,所述图像块对应的权重越大。
- 根据权利要求26所述的装置,其特征在于,所述图像块对应的权重还根据所述图像块与其他相同位置的图像块的增益值差距确定。
- 根据权利要求28所述的装置,其特征在于,所述处理器还用于,若所述图像块与其他相同位置的图像块的增益值差距大于预设阈值,确定所述图像块对应的权重为零。
- 根据权利要求25所述的装置,其特征在于,所述处理器还用于,在确定所述统计数据集中的白色图像块之前,对所述统计数据集中的图像块进行剔除。
- 根据权利要求30所述的装置,其特征在于,所述统计数据集中被剔除的图像块包括与其他相同位置的图像块的增益值差距大于预设阈值的图像块。
- 根据权利要求25所述的装置,其特征在于,所述统计数据集中的白色图像块包括所述统计数据集中增益值位于白平衡统计区域内的图像块。
- 根据权利要求18所述的装置,其特征在于,所述历史帧与所述当前帧为连续的帧。
- 根据权利要求18所述的装置,其特征在于,所述第一白平衡参数包括颜色通道的增益值。
- 一种拍摄设备,其特征在于,包括:镜头;传感器,用于通过光电转换元件采集图像;处理器和存储有计算机程序的存储器,所述处理器在执行所述计算机程序时实现以下步骤:获取当前帧及至少一帧历史帧的白平衡统计数据,所述历史帧与所述当前帧为延时摄影中拍摄的帧;基于所述当前帧与所述历史帧的白平衡统计数据构成的统计数据集,确定第一白平衡参数;根据所述第一白平衡参数,对所述当前帧进行白平衡校正,得到用于生成延时视频的目标帧。
- 根据权利要求35所述的设备,其特征在于,所述处理器在根据所述第一白平衡参数,对所述当前帧进行白平衡校正时用于,根据所述第一白平衡参数与所述当前帧的预览图像对应的第二白平衡参数,确定目标白平衡参数;根据所述目标白平衡参数对所述当前帧进行白平衡校正。
- 根据权利要求36所述的设备,其特征在于,所述目标白平衡参数是所述第一白平衡参数与第二白平衡参数进行加权融合得到的。
- 根据权利要求37所述的设备,其特征在于,所述第一白平衡参数与所述第二白平衡参数分别对应的权重是根据所述当前帧的预览图像中的白色图像块数量确定的。
- 根据权利要求36所述的设备,其特征在于,所述第二白平衡参数是根据所述当前帧的预览图像的白平衡统计数据确定的。
- 根据权利要求36所述的设备,其特征在于,所述目标白平衡参数在用于进行所述白平衡校正前经过了滤波处理。
- 根据权利要求35所述的设备,其特征在于,一帧图像的白平衡统计数据包括所述图像中多个图像块对应的增益值,所述统计数据集包括所述当前帧与所述历史帧中图像块对应的增益值。
- 根据权利要求41所述的设备,其特征在于,所述第一白平衡参数是利用所述统计数据集中白色图像块对应的增益值进行加权平均得到的。
- 根据权利要求42所述的设备,其特征在于,针对所述统计数据集中的任一图 像块,所述图像块对应的权重至少根据所述图像块所属的帧与当前时刻的接近程度确定。
- 根据权利要求43所述的设备,其特征在于,所述图像块所属的帧越接近当前时刻,所述图像块对应的权重越大。
- 根据权利要求43所述的设备,其特征在于,所述图像块对应的权重还根据所述图像块与其他相同位置的图像块的增益值差距确定。
- 根据权利要求45所述的设备,其特征在于,所述处理器还用于,若所述图像块与其他相同位置的图像块的增益值差距大于预设阈值,确定所述图像块对应的权重为零。
- 根据权利要求42所述的设备,其特征在于,所述处理器还用于,在确定所述统计数据集中的白色图像块之前,对所述统计数据集中的图像块进行剔除。
- 根据权利要求47所述的设备,其特征在于,所述统计数据集中被剔除的图像块包括与其他相同位置的图像块的增益值差距大于预设阈值的图像块。
- 根据权利要求42所述的设备,其特征在于,所述统计数据集中的白色图像块包括所述统计数据集中增益值位于白平衡统计区域内的图像块。
- 根据权利要求35所述的设备,其特征在于,所述历史帧与所述当前帧为连续的帧。
- 根据权利要求35所述的设备,其特征在于,所述第一白平衡参数包括颜色通道的增益值。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-17任一项所述的图像处理方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/124934 WO2022087982A1 (zh) | 2020-10-29 | 2020-10-29 | 图像处理方法、装置、拍摄设备及计算机可读存储介质 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2020/124934 WO2022087982A1 (zh) | 2020-10-29 | 2020-10-29 | 图像处理方法、装置、拍摄设备及计算机可读存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022087982A1 true WO2022087982A1 (zh) | 2022-05-05 |
Family
ID=81381728
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/124934 WO2022087982A1 (zh) | 2020-10-29 | 2020-10-29 | 图像处理方法、装置、拍摄设备及计算机可读存储介质 |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2022087982A1 (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105282530A (zh) * | 2014-05-28 | 2016-01-27 | 深圳中兴力维技术有限公司 | 基于背景建模的自动白平衡实现方法及装置 |
CN106570909A (zh) * | 2016-11-02 | 2017-04-19 | 华为技术有限公司 | 一种肤色检测方法、装置及终端 |
CN107959839A (zh) * | 2017-11-27 | 2018-04-24 | 努比亚技术有限公司 | 一种白平衡调整的方法、终端及计算机可读存储介质 |
US20180352132A1 (en) * | 2017-05-31 | 2018-12-06 | Guangdong Oppo Mobile Telecommunications Corp., Lt D. | Image processing method and related products |
-
2020
- 2020-10-29 WO PCT/CN2020/124934 patent/WO2022087982A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105282530A (zh) * | 2014-05-28 | 2016-01-27 | 深圳中兴力维技术有限公司 | 基于背景建模的自动白平衡实现方法及装置 |
CN106570909A (zh) * | 2016-11-02 | 2017-04-19 | 华为技术有限公司 | 一种肤色检测方法、装置及终端 |
US20180352132A1 (en) * | 2017-05-31 | 2018-12-06 | Guangdong Oppo Mobile Telecommunications Corp., Lt D. | Image processing method and related products |
CN107959839A (zh) * | 2017-11-27 | 2018-04-24 | 努比亚技术有限公司 | 一种白平衡调整的方法、终端及计算机可读存储介质 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5321163B2 (ja) | 撮像装置及び撮像方法 | |
JP6717858B2 (ja) | 欠陥イメージセンサ素子の較正 | |
WO2021047345A1 (zh) | 图像降噪方法、装置、存储介质及电子设备 | |
US7916181B2 (en) | Method and device for creating high dynamic range pictures from multiple exposures | |
JP5187241B2 (ja) | 撮像装置及び撮像方法 | |
CN111028190A (zh) | 图像处理方法、装置、存储介质及电子设备 | |
CN104954771B (zh) | 进行色阶校正的图像处理设备和图像处理方法 | |
CN111327824B (zh) | 拍摄参数的选择方法、装置、存储介质及电子设备 | |
JP6355454B2 (ja) | 撮像装置及びその制御方法、プログラム、記憶媒体 | |
US20140218550A1 (en) | Image capturing device and image processing method thereof | |
US8493464B2 (en) | Resolution adjusting method | |
JP2008294785A (ja) | 画像処理装置、撮像装置、画像ファイル及び画像処理方法 | |
CN102244731A (zh) | 电子机器 | |
CN103888661A (zh) | 摄像设备、摄像系统和摄像设备的控制方法 | |
JP2007060449A (ja) | 撮像装置 | |
WO2017080348A2 (zh) | 一种基于场景的拍照装置、方法、计算机存储介质 | |
US10600170B2 (en) | Method and device for producing a digital image | |
JP4067033B2 (ja) | 画像処理装置及び方法 | |
CN105144697A (zh) | 摄像装置、照相机系统以及图像处理方法 | |
WO2022087982A1 (zh) | 图像处理方法、装置、拍摄设备及计算机可读存储介质 | |
JP7246894B2 (ja) | 撮像装置およびその制御方法 | |
EP2446414B1 (en) | Lens roll-off correction operation using values corrected based on brightness information | |
JP6541835B2 (ja) | 画像処理装置及びその制御方法、プログラム、記憶媒体 | |
WO2023077431A1 (zh) | 图像处理方法、装置、图像采集设备及存储介质 | |
JP4026516B2 (ja) | 画像処理装置及び方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20959145 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20959145 Country of ref document: EP Kind code of ref document: A1 |