Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
FIG. 1 is a flow diagram of a method of image processing in one embodiment. As shown in fig. 1, an image processing method includes:
step 102, acquiring a plurality of frames of preview images, wherein the preview images are acquired after the computer equipment starts a shooting application program.
After the shooting application program is started, the computer equipment can capture the current scene through the camera and image the current scene on the display interface of the computer equipment, namely, the preview image is displayed on the display interface of the computer equipment. A computer device may acquire multiple frames of preview images. Taking a computer device as a mobile terminal as an example, the preview image may be an image obtained by a front camera of the mobile terminal, or an image obtained by a rear camera of the mobile terminal.
And step 104, determining the image to be processed according to the shooting instruction if the shooting instruction is received.
After receiving the shooting instruction, the computer device can take the preview image displayed on the display interface of the computer device at the moment of receiving the shooting instruction as the image to be processed. After the computer device obtains the image to be processed, the image to be processed may be subjected to image processing, such as performing a beautifying process on the image to be processed, performing a white balance process on the image to be processed, and the like.
And 106, if the reference color does not exist in the image to be processed, respectively matching the image to be processed with the multi-frame preview image, acquiring a preview image with an overlapping region with the image to be processed, and acquiring a target image from the preview image with the overlapping region with the image to be processed.
When the computer device performs white balance processing on the image to be processed by adopting a white balance algorithm, whether a reference color exists in the image to be processed can be detected firstly. The reference color is a color having a color difference value with a standard color within a preset range, that is, a color close to the standard color. In general, the standard color may be set to white, and the reference color is a color close to white. In one embodiment, the standard color may also be set to other colors, such as skin tone.
If the reference color exists in the image to be processed, the white balance processing can be carried out on the image to be processed according to the reference color. Each pixel point in the image to be processed is formed by a plurality of color channels, for example, three channels of RGB (three colors of red, green, and blue), or three channels of HSV (hue, saturation, and lightness), or three channels of CMY (three colors of cyan, magenta, or magenta and yellow). The white balance algorithm for the image may include: a gray world algorithm, a perfect reflection algorithm, a white point method, etc. Taking the white point method as an example, the white balance processing of the image to be processed in the RGB three channels may include: taking the standard color as white as an example, if R/G is 1.0 and B/G is 1.0 in a pixel point corresponding to white in an RGB three-color channel, the color range of the reference color close to white is {0.8< R/G <1.2, 0.8< B/G <1.2}, and if the computer device detects that the pixel point in the image to be processed satisfies {0.8< R/G <1.2, 0.8< B/G <1.2}, the pixel point is taken as the reference color point. The R/G _ average and the B/G _ average, namely the average of R/G and the average of B/G in the pixel, can be obtained by averaging the pixel color points in the image to be processed. And multiplying the R channel of each pixel point in the image to be processed by R/G _ average and multiplying the B channel by B/G _ average to finish the white balance processing of the image to be processed.
And if the reference color does not exist in the image to be processed, and the white balance processing directly performed on the image to be processed is inaccurate, respectively matching the acquired image to be processed with the multi-frame preview image, and detecting whether the image to be processed and the preview image have an overlapping area. The computer equipment can respectively extract the characteristic points in the image to be processed and the preview image and then carry out image registration according to the characteristic points. If the image to be processed and the preview image have an overlapping area, the target image can be obtained from the preview image having the overlapping area with the image to be processed.
In one embodiment, acquiring the target image from the preview image having the overlapping area with the image to be processed includes: and if the preview image with the overlapping area with the image to be processed has the reference color, taking the preview image with the overlapping area with the image to be processed and the reference color as the target image.
The computer device can detect whether the reference color exists in the preview image which has the overlapped area with the image to be processed. If the preview image with the overlapping area with the image to be processed has the reference color, the preview image with the overlapping area with the image to be processed is taken as the target image.
According to the method in the embodiment of the application, the computer equipment can select the preview image with the reference color from the preview image with the overlapped area with the image to be processed as the target image, the white balance parameter can be determined according to the reference color in the preview image, the obtained white balance parameter is more accurate, and the white balance processing effect is improved.
And step 108, carrying out white balance processing on the target image to obtain a target white balance gain value.
The computer device can perform white balance processing on the target image to obtain a target white balance gain value. The target white balance gain value is the gain value of the computer device for each color channel in the target image. Taking the RGB three channels as an example, when the standard color is white, the white balance algorithm using the white point as the reference point is the same as the algorithm of the white balance processing of the image to be processed in step 106, where R/G _ average is the gain value of the R channel, and B/G _ average is the gain value of the B channel.
In one embodiment, when a reference color exists in the target image, the target image may be subjected to white balance processing with reference to the reference color point to obtain a target white balance gain value.
And step 110, performing white balance processing on the image to be processed according to the target white balance gain value.
After the target white balance gain value is obtained, the white balance processing can be performed on the image to be processed according to the target white balance gain value. The computer device can perform white balance processing on the image to be processed according to the white balance gain value of each channel in the acquired target white balance gain value.
In general, when a user takes a picture with a computer device (e.g., a mobile terminal), a series of operations such as adjusting a photographing angle, a distance, and focusing are required. That is, before the user takes a picture, the computer device may acquire a plurality of preview images of the current scene, and display the preview images on the display interface of the computer device. And when the computer equipment receives the shooting instruction, shooting the current scene again to acquire the image to be processed. Because the computer device can continuously and uninterruptedly acquire the images between the time of starting the shooting application program and the time of receiving the shooting instruction, the multi-frame preview image acquired by the computer device and the image to be processed are images corresponding to the same scene, most of the multi-frame preview image and the image to be processed have an overlapping area, and the white balance processing parameters can be the same.
As shown in fig. 2, if the image to be processed 204 has an overlapping area with the preview image 202 and the preview image 206, the computer device may perform white balance processing on the preview image 202 and the preview image 206 respectively, obtain a white balance gain value for the preview image 202 and a white balance gain value for the preview image 206, and select one of the white balance gain values for the preview image 202 and the preview image 206 to perform white balance processing on the image to be processed. Selecting one of the white balance gain values for the preview image 202 and the preview image 206 may include obtaining a color difference between a reference color and a standard color in the preview image 202 and the preview image 206, selecting the preview image 206 where the reference color with the smallest color difference is located, and performing white balance processing on the image to be processed according to the white balance gain value of the preview image 206.
According to the method, when the white balance processing is not accurately directly performed on the image to be processed, the preview image with the overlapped area with the image to be processed is obtained, and then the white balance processing is performed on the image to be processed according to the white balance processing parameters of the preview image, so that the accuracy of the white balance processing on the image to be processed is improved, and the color restoration of the image is more accurate.
In one embodiment, the white balance processing on the target image in step 108, and acquiring the target white balance gain value includes: if a plurality of frames of target images exist, respectively obtaining the color difference value between the reference color and the standard color in the plurality of frames of target images; and if the target image with the minimum color difference value exists, performing white balance processing on the target image with the minimum color difference value to obtain a target white balance gain value.
If a plurality of frames of preview images with overlapped areas with the images to be processed, namely a plurality of frames of target images, are obtained by the computer equipment, the reference color in each frame of target image can be respectively obtained, and then the color difference value between the reference color and the standard color is calculated. Wherein, the color difference value can represent the difference between two colors, and in Lab color space, the color difference value can be
The computer device may obtain a color difference value of the reference color and the standard color in each frame of the target image. Taking the standard color as white as an example, the color range of the reference color close to white is {0.8< R/G <1.2, 0.8< B/G <1.2}, the computer device can obtain the reference color points of each frame of the target image whose pixel points satisfy the color range of the reference color, calculate the color difference value between the color of each reference color point and white, obtain the target image where the reference color point with the minimum color difference value is located, i.e., select the target image where the reference color point closest to white is located, and perform white balance processing on the target image where the reference color point with the minimum color difference value is located, thereby obtaining the target white balance gain value.
In general, the preview image and the image to be processed are images captured by a computer device in the same scene and the same light source, and the white balance gain value obtained by performing white balance processing on the preview image is also used for performing white balance processing on the image to be processed. According to the method, the reference color with the minimum color difference value with the standard color, namely the reference color closest to the standard color, is selected, so that the white balance gain value obtained by performing white balance processing on the target image is more accurate.
In one embodiment, the white balance processing on the target image in step 108, and acquiring the target white balance gain value includes: if multiple frames of target images exist, respectively carrying out white balance processing on the multiple frames of target images to obtain a first white balance gain value corresponding to each frame of target image; and acquiring the average value of the first white balance gain values as a target white balance gain value.
When a plurality of frames of preview images with overlapped areas with the images to be processed are obtained, namely when a plurality of frames of target images are obtained, the computer equipment can respectively perform white balance processing on each frame of target image, and respectively obtain a first white balance gain value obtained by performing white balance processing on each frame of target image. After the computer device obtains the first white balance gain value of the multi-frame target image, the average value of the first white balance gain value can be obtained as the target white balance gain value. The first white balance gain value may include a white balance gain value for each color channel in the target image.
According to the method in the embodiment of the application, the computer equipment can respectively perform white balance processing on the multi-frame target images, and then perform white balance processing on the images to be processed according to the average value of the white balance processing on the multi-frame target images, so that the target white balance gain value obtained by the computer equipment is more accurate, and the method is favorable for better restoring the real color in the scene.
In one embodiment, after acquiring a preview image having an overlapping area with the image to be processed at step 106, the method further comprises:
(1) and respectively splicing the preview image with the overlapping area with the image to be processed to obtain a complete image.
(2) And carrying out white balance processing on the complete image to obtain a target white balance gain value.
(3) And carrying out white balance processing on the image to be processed according to the target white balance gain value.
After the computer equipment acquires the preview image with the overlapping area with the image to be processed, the preview image with the overlapping area with the image to be processed and the image to be processed can be subjected to image splicing. Wherein, the step of stitching the images comprises: determining the same characteristic points in the two images, and overlapping the same characteristic points in the two images to ensure that the same areas in the two images are overlapped to obtain a complete image. After the computer equipment obtains the complete image, the white balance processing can be carried out on the complete image, and the target white balance gain value is calculated. Wherein, the white balance processing of the complete image by the computer device can comprise: and acquiring a reference color point in the complete image, and calculating a white balance gain value according to the reference color point, wherein a white balance processing algorithm of the computer equipment on the complete image is the same as the algorithm in the step 106, and details are not repeated here. After the computer equipment acquires the white balance gain value for the white balance processing of the complete image, the white balance processing can be carried out on the image to be processed by using the white balance gain value for the white balance processing of the complete image.
As shown in fig. 3, the image to be processed 306 has an overlapping area with the preview image 302, the preview image 304, the preview image 308, and the preview image 310, and then the computer device may perform image stitching on the preview image 302, the preview image 304, the preview image 308, the preview image 310, and the image to be processed 306 to obtain a complete image 312. The computer device may perform white balance processing on the complete image 312 to obtain a white balance gain value, and then perform white balance processing on the image to be processed 306 according to the obtained white balance gain value.
According to the method, the computer equipment can splice the multi-frame preview image and the image to be processed into a complete image, then white balance processing is carried out on the complete image, the white balance gain value is obtained, the computer equipment can carry out white balance processing on the image to be processed according to the white balance gain value of the complete image, the obtained white balance gain value is obtained through the white balance processing on the complete image, and the white balance processing on the image to be processed is more accurate.
In one embodiment, after step 106, further comprising:
and step 112, if no preview image with an overlapped area with the image to be processed exists, acquiring an environmental color temperature value according to the color temperature sensor.
And step 114, determining a second white balance gain value according to the environmental color temperature value.
And step 116, performing white balance processing on the image to be processed according to the second white balance gain value.
If the computer device detects that no preview image with an overlapped area with the image to be processed exists, the computer device can acquire the current environmental color temperature value according to the color temperature sensor. Color temperature is a unit of measure representing the color components contained in light, and light sources of different colors have different color temperatures in an actual image scene. The computer equipment can acquire the current environmental color temperature value through the color temperature sensor. The computer device may pre-store a corresponding relationship between the color temperature and the white balance gain value, after the current environment color temperature value is obtained, the computer device may search for a corresponding white balance gain value according to the current environment color temperature value, and perform white balance processing on the image to be processed according to the searched white balance gain value, that is, the computer device may determine a second white balance gain value according to the current environment color temperature value, and perform white balance processing on the image to be processed according to the second white balance gain value.
According to the method in the embodiment of the application, when other images with overlapping areas with the image to be processed do not exist, the computer equipment can perform white balance processing on the image to be processed according to the color temperature value obtained by the color temperature sensor, namely when no reference color exists in the image to be processed and the preview image cannot provide a white balance gain value for the image to be processed, the white balance processing is performed on the image to be processed according to the obtained color temperature, so that the white balance processing of the image by the computer equipment is more accurate.
In one embodiment, after step 106, further comprising:
and step 118, if no preview image with an overlapping area with the image to be processed exists, detecting whether a stored image with a shooting time interval with the image to be processed within a preset time length exists.
And step 120, if a stored image which has a preset time interval with the shooting time of the image to be processed exists, performing white balance processing on the image to be processed according to the third white balance gain value of the stored image.
If there is no preview image having an overlapping area with the image to be processed in the computer device, it is possible to detect whether there is a stored image having a shooting time interval with the image to be processed within a preset time period in the computer device. The shooting time interval is the time difference between the shooting time of the stored image and the shooting time of the image to be processed. The preset time length can be a value set by computer equipment or a value set by a user. For example 5 minutes, 10 minutes. In the preset time period, it can be assumed that the change of the environmental information is small, that is, the change of the light source angle, the light source color temperature and the like is small, the computer device can acquire the stored image within the preset time period at the shooting time interval, and perform white balance processing on the image to be processed according to the white balance gain value of the stored image, that is, perform white balance processing on the image to be processed according to the third white balance gain value of the stored image. When a plurality of stored images with the shooting time interval between the to-be-processed image and the to-be-processed image within the preset time length exist in the computer equipment, the computer equipment can select the stored image with the shooting time closest to the shooting time of the to-be-processed image, and perform white balance processing on the to-be-processed image according to the white balance gain value of the stored image with the shooting time closest to the shooting time of the to-be-processed image.
According to the method, the white balance gain value of the stored image is selected to process the image to be processed, the problem that the image effect of directly performing white balance processing on the image to be processed is poor when no reference color point exists in the image to be processed can be solved, and the effect of performing white balance processing on the image to be processed is improved.
FIG. 6 is a block diagram showing an example of the structure of an image processing apparatus. As shown in fig. 6, an image processing apparatus includes:
the obtaining module 602 is configured to obtain a plurality of frames of preview images, where the preview images are obtained after the computer device starts the shooting application.
The shooting module 604 is configured to determine, if a shooting instruction is received, an image to be processed according to the shooting instruction.
The matching module 606 is configured to match the image to be processed with the multiple frames of preview images, respectively, if the reference color does not exist in the image to be processed, obtain a preview image having an overlapping region with the image to be processed, and obtain a target image from the preview image having an overlapping region with the image to be processed.
The processing module 608 is configured to perform white balance processing on the target image to obtain a target white balance gain value. And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, the matching module 606 acquires the target image from the preview image having the overlapping region with the image to be processed includes: and if the preview image with the overlapping area with the image to be processed has the reference color, taking the preview image with the overlapping area with the image to be processed and the reference color as the target image.
In one embodiment, the reference color refers to a color difference value from a standard color and a color within a preset range. The processing module 608 performs white balance processing on the target image, and acquiring a target white balance gain value includes: and if the multi-frame target image exists, respectively obtaining the color difference value between the reference color and the standard color in the multi-frame target image. And if the target image with the minimum color difference value exists, performing white balance processing on the target image with the minimum color difference value to obtain a target white balance gain value.
In one embodiment, the processing module 608 performs white balance processing on the target image, and obtaining the target white balance gain value includes: and if multiple frames of target images exist, respectively carrying out white balance processing on the multiple frames of target images to obtain a first white balance gain value corresponding to each frame of target image. And acquiring the average value of the first white balance gain values as a target white balance gain value.
In an embodiment, the matching module 606 is further configured to, after acquiring the preview image having an overlapping area with the image to be processed, respectively stitch the preview image having an overlapping area with the image to be processed to obtain a complete image. The processing module 608 is configured to perform white balance processing on the complete image to obtain a target white balance gain value. And carrying out white balance processing on the image to be processed according to the target white balance gain value.
Fig. 7 is a block diagram showing the configuration of an image processing apparatus according to another embodiment. As shown in fig. 7, an image processing apparatus includes: an acquisition module 702, a shooting module 704, a matching module 706, a processing module 708, and a color temperature acquisition module 710. The acquiring module 702, the shooting module 704, the matching module 706 and the processing module 708 have the same functions as the corresponding modules in fig. 6.
And a color temperature obtaining module 710, configured to obtain an ambient color temperature value according to a color temperature sensor if there is no preview image having an overlapping region with the image to be processed.
And a processing module 708 configured to determine a second white balance gain value according to the ambient color temperature value. And performing white balance processing on the image to be processed according to the second white balance gain value.
Fig. 8 is a block diagram showing the configuration of an image processing apparatus according to another embodiment. As shown in fig. 8, an image processing apparatus includes: the device comprises an acquisition module 802, a shooting module 804, a matching module 806, a processing module 808 and a detection module 810. The acquiring module 802, the shooting module 804, the matching module 806, and the processing module 808 have the same functions as those of the corresponding modules in fig. 6.
The detecting module 810 is configured to detect whether there is a stored image within a preset time interval from a shooting time of the image to be processed if there is no preview image having an overlapping area with the image to be processed.
And the processing module 808 is configured to, if there is a stored image which is within a preset time period from the shooting time interval of the image to be processed, perform white balance processing on the image to be processed according to the third white balance gain value of the stored image.
The division of the modules in the image processing apparatus is only for illustration, and in other embodiments, the image processing apparatus may be divided into different modules as needed to complete all or part of the functions of the image processing apparatus.
The embodiment of the application also provides a computer readable storage medium. One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform the steps of:
(1) acquiring a plurality of frames of preview images, wherein the preview images are acquired after the computer equipment starts a shooting application program.
(2) And if the shooting instruction is received, determining the image to be processed according to the shooting instruction.
(3) And if the reference color does not exist in the image to be processed, respectively matching the image to be processed with the multi-frame preview image, acquiring the preview image with an overlapping region with the image to be processed, and acquiring the target image from the preview image with the overlapping region with the image to be processed.
(4) And carrying out white balance processing on the target image to obtain a target white balance gain value.
(5) And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, acquiring the target image from the preview image having the overlapping area with the image to be processed includes: and if the preview image with the overlapping area with the image to be processed has the reference color, taking the preview image with the overlapping area with the image to be processed and the reference color as the target image.
In one embodiment, the reference color refers to a color difference value from a standard color and a color within a preset range. Performing white balance processing on the target image, and acquiring a target white balance gain value comprises: and if the multi-frame target image exists, respectively obtaining the color difference value between the reference color and the standard color in the multi-frame target image. And if the target image with the minimum color difference value exists, performing white balance processing on the target image with the minimum color difference value to obtain a target white balance gain value.
In one embodiment, the white balance processing on the target image, and the obtaining the target white balance gain value includes: and if multiple frames of target images exist, respectively carrying out white balance processing on the multiple frames of target images to obtain a first white balance gain value corresponding to each frame of target image. And acquiring the average value of the first white balance gain values as a target white balance gain value.
In one embodiment, after the preview image having the overlapping area with the image to be processed is acquired, further performing: and respectively splicing the preview image with the overlapping area with the image to be processed to obtain a complete image. And carrying out white balance processing on the complete image to obtain a target white balance gain value. And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, further performing: and if the preview image with the overlapped area with the image to be processed does not exist, acquiring an environmental color temperature value according to the color temperature sensor. And determining a second white balance gain value according to the environment color temperature value. And performing white balance processing on the image to be processed according to the second white balance gain value.
In one embodiment, further performing: and if the preview image with the overlapped area with the image to be processed does not exist, detecting whether a stored image with the shooting time interval of the image to be processed within a preset time length exists or not. And if the stored image with the shooting time interval of the image to be processed within the preset time length exists, performing white balance processing on the image to be processed according to the third white balance gain value of the stored image.
A computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of:
(1) acquiring a plurality of frames of preview images, wherein the preview images are acquired after the computer equipment starts a shooting application program.
(2) And if the shooting instruction is received, determining the image to be processed according to the shooting instruction.
(3) And if the reference color does not exist in the image to be processed, respectively matching the image to be processed with the multi-frame preview image, acquiring the preview image with an overlapping region with the image to be processed, and acquiring the target image from the preview image with the overlapping region with the image to be processed.
(4) And carrying out white balance processing on the target image to obtain a target white balance gain value.
(5) And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, acquiring the target image from the preview image having the overlapping area with the image to be processed includes: and if the preview image with the overlapping area with the image to be processed has the reference color, taking the preview image with the overlapping area with the image to be processed and the reference color as the target image.
In one embodiment, the reference color refers to a color difference value from a standard color and a color within a preset range. Performing white balance processing on the target image, and acquiring a target white balance gain value comprises: and if the multi-frame target image exists, respectively obtaining the color difference value between the reference color and the standard color in the multi-frame target image. And if the target image with the minimum color difference value exists, performing white balance processing on the target image with the minimum color difference value to obtain a target white balance gain value.
In one embodiment, the white balance processing on the target image, and the obtaining the target white balance gain value includes: and if multiple frames of target images exist, respectively carrying out white balance processing on the multiple frames of target images to obtain a first white balance gain value corresponding to each frame of target image. And acquiring the average value of the first white balance gain values as a target white balance gain value.
In one embodiment, after the preview image having the overlapping area with the image to be processed is acquired, further performing: and respectively splicing the preview image with the overlapping area with the image to be processed to obtain a complete image. And carrying out white balance processing on the complete image to obtain a target white balance gain value. And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, further performing: and if the preview image with the overlapped area with the image to be processed does not exist, acquiring an environmental color temperature value according to the color temperature sensor. And determining a second white balance gain value according to the environment color temperature value. And performing white balance processing on the image to be processed according to the second white balance gain value.
In one embodiment, further performing: and if the preview image with the overlapped area with the image to be processed does not exist, detecting whether a stored image with the shooting time interval of the image to be processed within a preset time length exists or not. And if the stored image with the shooting time interval of the image to be processed within the preset time length exists, performing white balance processing on the image to be processed according to the third white balance gain value of the stored image.
The embodiment of the application also provides computer equipment. The computer apparatus includes therein an Image Processing circuit, which may be implemented using hardware and/or software components, and may include various Processing units defining an ISP (Image Signal Processing) pipeline. FIG. 9 is a schematic diagram of an image processing circuit in one embodiment. As shown in fig. 9, for convenience of explanation, only aspects of the image processing technique related to the embodiments of the present application are shown.
As shown in fig. 9, the image processing circuit includes an ISP processor 940 and a control logic 950. The image data captured by the imaging device 910 is first processed by the ISP processor 940, and the ISP processor 940 analyzes the image data to capture image statistics that may be used to determine and/or control one or more parameters of the imaging device 910. The imaging device 910 may include a camera having one or more lenses 912 and an image sensor 914. Image sensor 914 may include an array of color filters (e.g., Bayer filters), and image sensor 914 may acquire light intensity and wavelength information captured with each imaging pixel of image sensor 914 and provide a set of raw image data that may be processed by ISP processor 940. The sensor 920 (e.g., a gyroscope) may provide parameters of the acquired image processing (e.g., anti-shake parameters) to the ISP processor 940 based on the type of interface of the sensor 920. The sensor 920 interface may utilize an SMIA (Standard Mobile Imaging Architecture) interface, other serial or parallel camera interfaces, or a combination of the above.
In addition, image sensor 914 may also send raw image data to sensor 920, sensor 920 may provide raw image data to ISP processor 940 based on the type of interface of sensor 920, or sensor 920 may store raw image data in image memory 930.
The ISP processor 940 processes the raw image data pixel by pixel in a variety of formats. For example, each image pixel may have a bit depth of 8, 10, 12, or 14 bits, and the ISP processor 940 may perform one or more image processing operations on the raw image data, collecting statistical information about the image data. Wherein the image processing operations may be performed with the same or different bit depth precision.
ISP processor 940 may also receive image data from image memory 930. For example, the sensor 920 interface sends raw image data to the image memory 930, and the raw image data in the image memory 930 is then provided to the ISP processor 940 for processing. The image Memory 930 may be a part of a Memory device, a storage device, or a separate dedicated Memory within an electronic device, and may include a DMA (Direct Memory Access) feature.
Upon receiving raw image data from image sensor 914 interface or from sensor 920 interface or from image memory 930, ISP processor 940 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to image memory 930 for additional processing before being displayed. ISP processor 940 receives the processed data from image memory 930 and performs image data processing on the processed data in the raw domain and in the RGB and YCbCr color spaces. The image data processed by ISP processor 940 may be output to display 970 for viewing by a user and/or further processed by a Graphics Processing Unit (GPU). Further, the output of ISP processor 940 may also be sent to image memory 930 and display 970 may read image data from image memory 930. In one embodiment, image memory 930 may be configured to implement one or more frame buffers. In addition, the output of the ISP processor 940 may be transmitted to an encoder/decoder 960 for encoding/decoding the image data. The encoded image data may be saved and decompressed before being displayed on a display 970 device. The encoder/decoder 960 may be implemented by a CPU or GPU or coprocessor.
The statistical data determined by the ISP processor 940 may be transmitted to the control logic 950 unit. For example, the statistical data may include image sensor 914 statistics such as auto-exposure, auto-white balance, auto-focus, flicker detection, black level compensation, lens 912 shading correction, and the like. The control logic 950 may include a processor and/or microcontroller that executes one or more routines (e.g., firmware) that may determine control parameters of the imaging device 910 and control parameters of the ISP processor 940 based on the received statistical data. For example, the control parameters of imaging device 910 may include sensor 920 control parameters (e.g., gain, integration time for exposure control, anti-shake parameters, etc.), camera flash control parameters, lens 912 control parameters (e.g., focal length for focusing or zooming), or a combination of these parameters. The ISP control parameters may include gain levels and color correction matrices for automatic white balance and color adjustment (e.g., during RGB processing), as well as lens 912 shading correction parameters.
The following steps are performed to implement the image processing method using the image processing technique in fig. 9:
(1) acquiring a plurality of frames of preview images, wherein the preview images are acquired after the computer equipment starts a shooting application program.
(2) And if the shooting instruction is received, determining the image to be processed according to the shooting instruction.
(3) And if the reference color does not exist in the image to be processed, respectively matching the image to be processed with the multi-frame preview image, acquiring the preview image with an overlapping region with the image to be processed, and acquiring the target image from the preview image with the overlapping region with the image to be processed.
(4) And carrying out white balance processing on the target image to obtain a target white balance gain value.
(5) And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, acquiring the target image from the preview image having the overlapping area with the image to be processed includes: and if the preview image with the overlapping area with the image to be processed has the reference color, taking the preview image with the overlapping area with the image to be processed and the reference color as the target image.
In one embodiment, the reference color refers to a color difference value from a standard color and a color within a preset range. Performing white balance processing on the target image, and acquiring a target white balance gain value comprises: and if the multi-frame target image exists, respectively obtaining the color difference value between the reference color and the standard color in the multi-frame target image. And if the target image with the minimum color difference value exists, performing white balance processing on the target image with the minimum color difference value to obtain a target white balance gain value.
In one embodiment, the white balance processing on the target image, and the obtaining the target white balance gain value includes: and if multiple frames of target images exist, respectively carrying out white balance processing on the multiple frames of target images to obtain a first white balance gain value corresponding to each frame of target image. And acquiring the average value of the first white balance gain values as a target white balance gain value.
In one embodiment, after the preview image having the overlapping area with the image to be processed is acquired, further performing: and respectively splicing the preview image with the overlapping area with the image to be processed to obtain a complete image. And carrying out white balance processing on the complete image to obtain a target white balance gain value. And carrying out white balance processing on the image to be processed according to the target white balance gain value.
In one embodiment, further performing: and if the preview image with the overlapped area with the image to be processed does not exist, acquiring an environmental color temperature value according to the color temperature sensor. And determining a second white balance gain value according to the environment color temperature value. And performing white balance processing on the image to be processed according to the second white balance gain value.
In one embodiment, further performing: and if the preview image with the overlapped area with the image to be processed does not exist, detecting whether a stored image with the shooting time interval of the image to be processed within a preset time length exists or not. And if the stored image with the shooting time interval of the image to be processed within the preset time length exists, performing white balance processing on the image to be processed according to the third white balance gain value of the stored image.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. Suitable non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.