CN107959841B - Image processing method, image processing apparatus, storage medium, and electronic device - Google Patents

Image processing method, image processing apparatus, storage medium, and electronic device Download PDF

Info

Publication number
CN107959841B
CN107959841B CN201711287892.8A CN201711287892A CN107959841B CN 107959841 B CN107959841 B CN 107959841B CN 201711287892 A CN201711287892 A CN 201711287892A CN 107959841 B CN107959841 B CN 107959841B
Authority
CN
China
Prior art keywords
white balance
image
balance parameter
camera
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201711287892.8A
Other languages
Chinese (zh)
Other versions
CN107959841A (en
Inventor
杜成鹏
孙剑波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201711287892.8A priority Critical patent/CN107959841B/en
Publication of CN107959841A publication Critical patent/CN107959841A/en
Application granted granted Critical
Publication of CN107959841B publication Critical patent/CN107959841B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/10Cameras or camera modules comprising electronic image sensors; Control thereof for generating image signals from different wavelengths

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Processing Of Color Television Signals (AREA)

Abstract

The application relates to an image processing method, an image processing device, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring a preview image in the moving process of the camera; dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image; acquiring a target white balance parameter according to the white balance parameter; and performing white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image. The image processing method, the image processing device, the storage medium and the electronic equipment can provide accuracy of image processing.

Description

Image processing method, image processing apparatus, storage medium, and electronic device
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image processing method and apparatus, a storage medium, and an electronic device.
Background
When the photographing device photographs an object with the same color, the object is photographed in different colors in different lighting environments. White Balance is an index for describing the accuracy of White color generated by mixing red, green and blue three primary colors in a display, and the color of a shot image can be restored to the original color by performing Automatic White Balance (AWB) processing on the shot image so as to solve the problem of color distortion of a shot object in the image.
Disclosure of Invention
The embodiment of the application provides an image processing method, an image processing device, a storage medium and an electronic device, which can improve the accuracy of image processing.
An image processing method comprising:
acquiring a preview image in the moving process of the camera;
dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image;
acquiring a target white balance parameter according to the white balance parameter;
and performing white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
An image processing apparatus comprising:
the image acquisition module is used for acquiring a preview image in the moving process of the camera;
the parameter acquisition module is used for dividing each preview image into a preset number of image blocks and calculating corresponding white balance parameters according to each image block corresponding to each preview image; acquiring a target white balance parameter according to the white balance parameter;
and the image processing module is used for carrying out white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a preview image in the moving process of the camera;
dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image;
acquiring a target white balance parameter according to the white balance parameter;
and performing white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring a preview image in the moving process of the camera;
dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image;
acquiring a target white balance parameter according to the white balance parameter;
and performing white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
The image processing method, the image processing device, the storage medium and the electronic equipment can acquire a plurality of preview images in the moving process of the camera. And then dividing the preview image into image blocks, and calculating a corresponding white balance parameter according to each image block. And finally, acquiring target white balance parameters according to the white balance parameters, and then carrying out white balance processing on the shot image according to the target white balance parameters. The white balance processing process not only takes the current shot image as a basis, but also considers the preview image shot in the moving process of the camera, so that the information collected in the white balance processing process is more comprehensive, and the white balance processing is more accurate.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of an exemplary embodiment of an image processing method;
FIG. 2 is a flow diagram of a method of image processing in one embodiment;
FIG. 3 is a diagram of an image block in one embodiment;
FIG. 4 is a flowchart of an image processing method in another embodiment;
FIG. 5 is a schematic illustration of an embodiment in a first orientation and a second orientation;
FIG. 6 is a schematic view of another embodiment in a first direction and a second direction;
FIG. 7 is a diagram showing a configuration of an image processing apparatus according to an embodiment;
FIG. 8 is a schematic diagram of an image processing circuit in one embodiment.
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.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first client may be referred to as a second client, and similarly, a second client may be referred to as a first client, without departing from the scope of the present application. Both the first client and the second client are clients, but they are not the same client.
FIG. 1 is a diagram of an embodiment of an application environment of an image processing method. Referring to fig. 1, a camera is mounted on the electronic device 110, and the electronic device 110 may control the camera to rotate, or may move the camera by the movement of the electronic device 110. In the moving process of the camera, the camera may scan the object 120 to generate a preview image, then the electronic device 110 divides each preview image generated by the camera into a preset number of image blocks, and calculates corresponding white balance parameters according to each image block corresponding to each preview image; acquiring a target white balance parameter according to the white balance parameter; and carrying out white balance processing on the shot image according to the target white balance parameter.
FIG. 2 is a flow diagram of a method of image processing in one embodiment. As shown in fig. 2, the image processing method includes steps 202 to 208. Wherein:
step 202, acquiring a preview image in the moving process of the camera.
In one embodiment, cameras can be installed on the electronic equipment, and the number of installed cameras is not limited. For example, one, two, or more than two cameras may be mounted on the electronic device. When the electronic equipment receives an instruction for starting the camera, the camera can be called to enter a shooting state. The instruction for starting the camera may be a shooting instruction triggered by a detected related touch operation, a pressing operation of a physical key, a voice control operation, or the like. The touch operation may be a touch click operation, a touch long press operation, a touch slide operation, a multi-point touch operation, and the like. The electronic equipment can provide a shooting button for triggering shooting, and when the clicking operation of the button is detected, an instruction for starting the camera is triggered. The electronic device may also preset a shooting voice message for triggering the instruction to turn on the camera. The corresponding voice information is received by calling the voice receiving device, and the instruction for starting the camera can be triggered by analyzing the voice information when the matching of the voice information and the shooting voice information is detected.
After the electronic equipment enters a shooting state, the camera can acquire a shooting picture at regular time and generate a preview image, and the generated preview image is generally not stored but displayed on a display interface of the electronic equipment for a user to check. The user can adjust the current shot picture and the shooting parameters according to the preview image to generate the final shot image. For example, the camera acquires one frame of preview image every 0.5 seconds in the shooting process, and displays each generated frame of preview image on the display interface. In the preview process, the generated preview images form a continuous preview image sequence for the user to view.
Specifically, when a camera on the electronic device is started, the camera can acquire a current shooting picture in real time to form a preview image. But the field of view of the camera is fixed or can only be varied within a certain range. Therefore, in order to enable the camera to collect more comprehensive shooting pictures, the camera can be moved, and the preview image is obtained in the moving process of the camera. It can be understood that the camera may be controlled by the electronic device to rotate, or may be moved by moving the electronic device to drive the camera, which is not specifically limited in this embodiment.
The electronic equipment can also display prompt information of the mobile camera on the display screen in the shooting mode so as to prompt a user to move the camera. And then acquiring a preview image in the moving process of the camera. It is understood that the display mode of the prompt message and the data format of the prompt message can comprise various modes. For example, a text prompt message such as "please move the camera left and right" may be displayed, or a mark indicating a left and right movement of a graphic or a symbol may be displayed, such as an arrow indicating the left and right movement may be displayed. The electronic device can buffer the frame image obtained by real-time scanning in the shooting mode. Alternatively, the camera may move to any position, such as left and right, up and down, front and back, etc., and in the process of moving the electronic device, the preview image is generated, for example, the preview image may rotate left and right at a certain fixed position. The larger the moving range of the camera is, the richer the corresponding shot pictures can be collected, so that the accuracy of subsequent white balance processing is higher. For example, before capturing an image, a user may hold the electronic device and perform an environmental scan on a scene to be captured, such as a 360 ° horizontal turn of the electronic device to obtain a preview image of the entire space.
In one embodiment, in the moving process of the camera, a motion detection element can be called, and the moving speed of the camera is detected; and then acquiring a preview image according to the moving speed. The motion detection element is an element suitable for detecting the motion state of the device, and may include, but is not limited to, a gyroscope or a gravity sensing device, an acceleration sensor, and the like. The electronic equipment can call a built-in motion detection element to calculate the moving speed of the camera in the moving process. And when the moving speed of the camera is smaller than the speed threshold value, acquiring a preview image generated by the camera.
Step 204, dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image.
A plurality of preview images can be acquired in the moving process of the camera, and then each preview image is divided into a preset number of image blocks. It can be understood that the preview image collected by the camera is composed of a plurality of pixel points, the plurality of pixel points form a two-dimensional matrix, each pixel point has a corresponding pixel value, and then the pixel points with different pixel values are arranged according to a certain rule to form different preview images. The width and the height of the preview image can be represented by the number of the pixel points, and the size of the preview image can be represented by the width and the height. For example, the size of the preview image may be represented as 640 × 320, which means that there are 640 pixels in the width direction and 320 pixels in the height direction of the preview image.
Specifically, the two-dimensional matrix pixel points of the preview image can be divided into different regions, each region includes a part of the pixel points in the preview image, and one region is an image block. The image blocks may be the same size, and the preview image may be divided into a number of image blocks of the same size. FIG. 3 is a diagram of an image block in one embodiment. As shown in fig. 3, the size of the image 30 is 24 × 16, that is, 24 pixels are arranged in the width direction and 16 pixels are arranged in the height direction of the image 30. The image 30 may be divided into 24 image patches 302 on average, each image patch including 4 x 4 pixels.
The white balance parameter is a parameter that needs to be used when performing white balance processing on an image, and may be, for example, a gain of an image color channel. The electronic device can calculate a corresponding white balance parameter according to the pixel value corresponding to the pixel point in each image block. Specifically, the electronic device may be preset with a white balance algorithm, which may include one or more of a gray world algorithm, a perfect reflection algorithm, a global white balance algorithm, a local white balance method, and the like. The electronic device can select one algorithm, take the image block as the input of the white balance algorithm, and operate the white balance algorithm to obtain the corresponding white balance parameter.
And step 206, acquiring target white balance parameters according to the white balance parameters.
Dividing each preview image into a plurality of image blocks, acquiring a corresponding white balance parameter for each image block, and acquiring a target white balance parameter according to the white balance parameters. For example, the acquired white balance parameters may be compared, and the smallest white balance parameter may be set as the target white balance parameter. Or a standard value of the white balance parameter is set, and then the white balance parameter closest to the standard value is set as the target white balance parameter.
In step 208, the captured image is subjected to white balance processing according to the target white balance parameter, wherein the captured image is acquired from the preview image.
And after the target white balance parameters are obtained, carrying out white balance processing on the shot image according to the target white balance parameters. The captured image is acquired from the preview image, and may be any one of the preview images. Specifically, each pixel point of the captured image may be formed by a plurality of color channels, each color channel representing one color component. For example, the image may be composed of three channels of RGB (three colors of red, green, and blue), HSV (hue, saturation, and lightness), and CMY (three colors of cyan, magenta, or magenta, and yellow). And correcting each color channel on each pixel point according to the corresponding target white balance parameter. Therefore, the white balance processing of the shot image is realized, and the corrected color channel can reflect the real color of the corresponding shot object.
The image processing method can acquire a plurality of preview images in the moving process of the camera. And then dividing the preview image into image blocks, and calculating a corresponding white balance parameter according to each image block. And finally, acquiring target white balance parameters according to the white balance parameters, and then carrying out white balance processing on the shot image according to the target white balance parameters. The white balance processing process not only takes the current shot image as a basis, but also considers the preview image shot in the moving process of the camera, so that the information collected in the white balance processing process is more comprehensive, and the white balance processing is more accurate.
Fig. 4 is a flowchart of an image processing method in another embodiment. As shown in fig. 4, the image processing method includes steps 402 to 414. Wherein:
and 402, controlling the camera to rotate along a preset direction, and acquiring a preview image generated by the camera in the rotating process.
The steerable camera of electronic equipment rotates along predetermineeing the direction, obtains the preview image at the camera rotation in-process. Specifically, the camera can be controlled to rotate in a preset direction by a preset angle. For example, the mobile phone can control the camera to rotate 180 ° in the horizontal direction, or control the camera to rotate 360 ° in the vertical direction, and so on. The electronic device may include one or more cameras, and the one or more cameras may be controlled to rotate to obtain more shooting scenes. For example, a front camera and a rear camera can be installed on the mobile phone, and a plurality of front cameras or rear cameras can also be installed on the mobile phone. If the electronic equipment is provided with more than two cameras, the cameras can be controlled to rotate towards different directions respectively, so that the efficiency of acquiring preview images can be improved, and more shooting scenes can be acquired.
Specifically, the first camera can be controlled to rotate along a first direction, and a first preview image generated by the first camera is acquired in the rotating process; and controlling the second camera to rotate along the second direction, and acquiring a second preview image generated by the second camera in the rotating process. And obtaining a preview image according to the obtained first preview image and the second preview image, and then obtaining a white balance parameter according to the preview image. The angle of rotation of the camera can also be preset, for example, the camera is controlled to rotate 90 degrees, or the camera is controlled to rotate 180 degrees, and the like. Step 402 may specifically include: controlling a first camera to rotate by a first angle along a first direction, and acquiring a first preview image generated by the first camera in the rotating process; and controlling the second camera to rotate by a second angle along a second direction, and acquiring a second preview image generated by the second camera in the rotating process. It is understood that the first and second directions may be the same or different. The first angle and the second angle may be the same or different, and are not limited herein.
Fig. 5 and 6 show an embodiment in a first and a second orientation, respectively. As shown in fig. 5, the first camera 502 may be controlled to rotate in a first direction 506, the second camera 504 may be controlled to rotate in a second direction 508, and a preview image may be acquired during the rotation of the cameras. As shown in fig. 6, the first camera 602 may be controlled to rotate in a first direction 606, the second camera 604 may be controlled to rotate in a second direction 608, and a preview image may be obtained during the rotation of the cameras.
In step 404, each preview image is divided into a preset number of image blocks.
And 406, calculating a matching value of each image block corresponding to each preview image, and acquiring the image block of the matching value in the matching value interval.
In one embodiment, the image block includes a plurality of pixels, and each pixel has three corresponding RGB channel values. Each color channel of the pixel point can be represented by a numerical value, and the value range of the numerical value is 0-255. In the white balance processing, the whitest point in the image needs to be found as a standard reference value, and then color correction is performed according to the standard reference value. When the pixel is white, the RGB channel values of the pixel are 255, and 255, respectively. The matching value is a value used for screening the image block, when the matching value is in the matching value interval, the image block is considered to be used for calculating the white balance parameter, otherwise, the image block is discarded. Therefore, the matching value corresponding to the image block can be calculated according to the RGB channel values of the pixel points in the image block, and then the image block is screened according to the matching value.
Specifically, pixel points in the image block may be traversed, and an average value may be calculated according to RGB channel values of the pixel points to obtain an R channel average value and a B channel average value, respectively. And then obtaining a matching value corresponding to the image block according to the ratio of the R channel mean value to the B channel mean value. For example, assuming that the matching value interval is 0.8 to 1.2, and the R-channel average value and the B-channel average value of the image block are calculated to be 245 and 251, respectively, the obtained matching value of the image block is 245/251-0.97. If the matching value of the image block is within the matching value interval, the image block is retained.
Step 408, calculating white balance parameters corresponding to each of the obtained image blocks, where the white balance parameters include a first white balance parameter and a second white balance parameter.
And calculating corresponding white balance parameters according to each acquired image block. Specifically, each acquired image block is traversed, and each channel value of each pixel point in the image block is acquired; and calculating a white balance parameter according to the acquired channel value. Specifically, the white balance parameters include a first white balance parameter and a second white balance parameter. The first white balance parameter and the second white balance parameter may be white balance gains of two different color channels, respectively, and the two color channels may be color-corrected according to the first white balance parameter and the second white balance parameter, respectively.
In an embodiment, the method for obtaining the white balance parameter may specifically include: and counting the average value of each channel value corresponding to the image block, and acquiring a first white balance parameter and a second white balance parameter according to the average value. Specifically, the pixels in the image block may be traversed, and an average value may be calculated according to RGB channel values of the pixels, so as to obtain an R channel average value, a G channel average value, and a B channel average value, respectively. Then, taking the ratio of the R channel mean value to the G channel mean value as a first white balance parameter corresponding to the image block; and taking the ratio of the B channel mean value to the G channel mean value as a second white balance parameter corresponding to the image block.
Step 410, acquiring a target image block from the acquired image block according to the first white balance parameter, taking the first white balance parameter corresponding to the target image block as a first target white balance parameter, and taking the second white balance parameter corresponding to the target image block as a second target white balance parameter.
In the obtained image blocks, each image block has a corresponding first white balance parameter and a corresponding second white balance parameter. And acquiring a target image block from the acquired image block according to the first white balance parameter, taking the first white balance parameter corresponding to the target image block as a first target white balance parameter, and taking the second white balance parameter corresponding to the target image block as a second target white balance parameter. Specifically, the image block corresponding to the minimum first white balance parameter may be used as the target image block, the first white balance parameter corresponding to the target image block is used as the first target white balance parameter, the second white balance parameter corresponding to the target image block is used as the second target white balance parameter, and then the white balance processing is performed on the captured image according to the first target white balance parameter and the second target white balance parameter. For example, the first white balance parameter is Rave/Gave, and the second white balance parameter is Bave/Gave, where Rave, Gave, and Bave respectively represent RGB three-channel mean values. And comparing the Rave/Gave of each image block, taking the image block with the minimum Rave/Gave as a target image block, and respectively taking the Rave/Gave and Bave/Gave corresponding to the target image block as a first target white balance parameter and a second target white balance parameter.
Step 412, performing white balance correction on the first channel value of each pixel point in the shot image according to the first target white balance parameter.
And 414, performing white balance correction on the second channel value of each pixel point in the image to be processed according to the second target white balance parameter.
It can be understood that the obtained target white balance parameters include a first target white balance parameter and a second target white balance parameter, and then the white balance correction is performed on the first channel value of each pixel point in the shot image according to the first target white balance parameter, and the white balance correction is performed on the second channel value of each pixel point in the shot image according to the second target white balance parameter. For example, if the obtained first target white balance parameter and the second target white balance parameter are Rave/Gave and Bave/Gave respectively, pixel points in the shot image can be traversed, then the R channel value of each pixel point is multiplied by the reciprocal of Rave/Gave, and then the B channel value of each pixel point is multiplied by the reciprocal of Bave/Gave, so that white balance correction of the R color channel and the B color channel of the shot image is completed, and white balance processing of the shot image is realized.
The image processing method provided by the embodiment can acquire a plurality of preview images in the moving process of the camera. And then dividing the preview image into image blocks, and calculating a corresponding white balance parameter according to each image block. And finally, acquiring target white balance parameters according to the white balance parameters, and then carrying out white balance processing on the shot image according to the target white balance parameters. The white balance processing process not only takes the current shot image as a basis, but also considers the preview image shot in the moving process of the camera, so that the information collected in the white balance processing process is more comprehensive, and the white balance processing is more accurate.
It should be understood that although the steps in the flowcharts of fig. 2 and 4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 and 4 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the sub-steps or stages of other steps.
Fig. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment. As shown in fig. 7, the image processing apparatus 700 includes an image acquisition module 702, a parameter acquisition module 704, and an image processing module 706. Wherein:
an image obtaining module 702, configured to obtain a preview image during a moving process of the camera.
A parameter obtaining module 704, configured to divide each preview image into a preset number of image blocks, and calculate a corresponding white balance parameter according to each image block corresponding to each preview image; and acquiring target white balance parameters according to the white balance parameters.
An image processing module 706, configured to perform white balance processing on the captured image according to the target white balance parameter, where the captured image is obtained from the preview image.
The image processing apparatus provided in the above embodiment may acquire a plurality of preview images in the moving process of the camera. And then dividing the preview image into image blocks, and calculating a corresponding white balance parameter according to each image block. And finally, acquiring target white balance parameters according to the white balance parameters, and then carrying out white balance processing on the shot image according to the target white balance parameters. The white balance processing process not only takes the current shot image as a basis, but also considers the preview image shot in the moving process of the camera, so that the information collected in the white balance processing process is more comprehensive, and the white balance processing is more accurate.
In one embodiment, the image obtaining module 702 is further configured to control the camera to rotate along a preset direction, and obtain a preview image generated by the camera during the rotation.
In one embodiment, the image obtaining module 702 is further configured to control the first camera to rotate along a first direction, and obtain a first preview image generated by the first camera during the rotation; and controlling the second camera to rotate along a second direction, and acquiring a second preview image generated by the second camera in the rotating process.
In an embodiment, the parameter obtaining module 704 is further configured to calculate a matching value of each image block corresponding to each preview image, and obtain an image block with the matching value within a matching value interval; and calculating the white balance parameter corresponding to each acquired image block.
In an embodiment, the parameter obtaining module 704 is further configured to traverse each obtained image block, and obtain each channel value of each pixel point in the image block; and calculating a white balance parameter according to the acquired channel value.
In an embodiment, the parameter obtaining module 704 is further configured to count an average value of each channel value corresponding to the image block, and obtain the first white balance parameter and the second white balance parameter according to the average value.
In an embodiment, the parameter obtaining module 704 is further configured to obtain a target image block from the obtained image block according to the first white balance parameter, use a first white balance parameter corresponding to the target image block as a first target white balance parameter, and use a second white balance parameter corresponding to the target image block as a second target white balance parameter.
In an embodiment, the image processing module 706 is further configured to perform white balance correction on the first channel value of each pixel point in the captured image according to the first target white balance parameter; and performing white balance correction on the second channel value of each pixel point in the image to be processed according to the second target white balance parameter.
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 embodying computer-executable instructions that, when executed by one or more processors, cause the processors to perform the steps of:
acquiring a preview image in the moving process of the camera;
dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image;
acquiring a target white balance parameter according to the white balance parameter;
and performing white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
In one embodiment, the acquiring a preview image during the camera moving performed by the processor comprises:
and controlling the camera to rotate along a preset direction, and acquiring a preview image generated by the camera in the rotating process.
In one embodiment, the acquiring a preview image during the camera moving performed by the processor comprises:
controlling a first camera to rotate along a first direction, and acquiring a first preview image generated by the first camera in the rotating process;
and controlling the second camera to rotate along a second direction, and acquiring a second preview image generated by the second camera in the rotating process.
In one embodiment, the calculating, by the processor, corresponding white balance parameters according to the image blocks corresponding to each preview image includes:
calculating the matching value of each image block corresponding to each preview image, and acquiring the image blocks of the matching values in the matching value interval;
and calculating the white balance parameter corresponding to each acquired image block.
In one embodiment, the calculating, performed by the processor, the obtained white balance parameter for each of the image blocks includes:
traversing each obtained image block, and obtaining each channel value of each pixel point in the image block;
and calculating a white balance parameter according to the acquired channel value.
In one embodiment, the processor performs the calculating of the white balance parameter according to the acquired channel value including:
and counting the average value of each channel value corresponding to the image block, and acquiring a first white balance parameter and a second white balance parameter according to the average value.
In one embodiment, the white balance parameters executed by the processor include a first white balance parameter and a second white balance parameter;
the acquiring of the target white balance parameter according to the white balance parameter includes:
acquiring a target image block from an acquired image block according to the first white balance parameter, taking a first white balance parameter corresponding to the target image block as a first target white balance parameter, and taking a second white balance parameter corresponding to the target image block as a second target white balance parameter;
the white balance processing of the shot image according to the target white balance parameter includes:
performing white balance correction on the first channel value of each pixel point in the shot image according to the first target white balance parameter;
and performing white balance correction on the second channel value of each pixel point in the image to be processed according to the second target white balance parameter.
A computer program product comprising instructions which, when run on a computer, cause the computer to perform the image processing method provided by the above embodiments.
The embodiment of the application also provides computer equipment. The computer device 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. 8 is a schematic diagram of an image processing circuit in one embodiment. As shown in fig. 8, for convenience of explanation, only aspects of the image processing technology related to the embodiments of the present application are shown.
As shown in fig. 8, the image processing circuit includes an ISP processor 840 and control logic 850. Image data captured by imaging device 810 is first processed by ISP processor 840, and ISP processor 840 analyzes the image data to capture image statistics that may be used to determine and/or control one or more parameters of imaging device 810. Imaging device 810 may include a camera having one or more lenses 812 and an image sensor 814. Image sensor 814 may include an array of color filters (e.g., Bayer filters), and image sensor 814 may acquire light intensity and wavelength information captured with each imaging pixel of image sensor 814 and provide a set of raw image data that may be processed by ISP processor 840. The sensor 820 (e.g., a gyroscope) may provide parameters of the acquired image processing (e.g., anti-shake parameters) to the ISP processor 840 based on the type of sensor 820 interface. The sensor 820 interface may utilize an SMIA (Standard Mobile Imaging Architecture) interface, other serial or parallel camera interfaces, or a combination of the above.
In addition, the image sensor 814 may also send raw image data to the sensor 820, the sensor 820 may provide raw image data to the ISP processor 840 based on the sensor 820 interface type, or the sensor 820 may store raw image data in the image memory 830.
The ISP processor 840 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 ISP processor 840 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 840 may also receive image data from image memory 830. For example, the sensor 820 interface sends raw image data to the image memory 830, and the raw image data in the image memory 830 is then provided to the ISP processor 840 for processing. The image Memory 830 may be a portion 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 814 interface or from sensor 820 interface or from image memory 830, ISP processor 840 may perform one or more image processing operations, such as temporal filtering. The processed image data may be sent to image memory 830 for additional processing before being displayed. ISP processor 840 receives processed data from image memory 830 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 840 may be output to display 870 for viewing by a user and/or further processed by a Graphics Processing Unit (GPU). Further, the output of ISP processor 840 may also be sent to image memory 830 and display 870 may read image data from image memory 830. In one embodiment, image memory 830 may be configured to implement one or more frame buffers. In addition, the output of ISP processor 840 may be transmitted to encoder/decoder 860 for encoding/decoding image data. The encoded image data may be saved and decompressed before being displayed on the display 870 device. The encoder/decoder 860 may be implemented by a CPU or GPU or coprocessor.
The statistics determined by ISP processor 840 may be sent to control logic 850 unit. For example, the statistical data may include image sensor 814 statistical information such as auto-exposure, auto-white balance, auto-focus, flicker detection, black level compensation, lens 812 shading correction, and the like. Control logic 850 may include a processor and/or microcontroller that executes one or more routines (e.g., firmware) that may determine control parameters of imaging device 810 and ISP processor 840 based on the received statistical data. For example, the control parameters of imaging device 810 may include sensor 820 control parameters (e.g., gain, integration time for exposure control, anti-shake parameters, etc.), camera flash control parameters, lens 812 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 812 shading correction parameters.
The following steps are steps for implementing the image processing method provided in the above embodiment by using the image processing technology in fig. 8.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. 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-mentioned embodiments 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.

Claims (10)

1. An image processing method, comprising:
in the moving process of the camera, acquiring a preview image according to the moving speed of the camera;
dividing each preview image into a preset number of image blocks, and calculating corresponding white balance parameters according to each image block corresponding to each preview image;
acquiring a white balance parameter which is closest to a standard value or the minimum from the white balance parameters corresponding to each image block as a target white balance parameter, wherein the standard value is a preset white balance parameter;
and performing white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
2. The method of claim 1, wherein acquiring the preview image during the camera movement comprises:
and controlling the camera to rotate along a preset direction, and acquiring a preview image generated by the camera in the rotating process.
3. The method of claim 1, wherein acquiring the preview image during the camera movement comprises:
controlling a first camera to rotate along a first direction, and acquiring a first preview image generated by the first camera in the rotating process;
and controlling the second camera to rotate along a second direction, and acquiring a second preview image generated by the second camera in the rotating process.
4. The method according to claim 1, wherein said calculating the corresponding white balance parameters according to the respective image blocks corresponding to each of the preview images comprises:
calculating the matching value of each image block corresponding to each preview image, and acquiring the image blocks of the matching values in the matching value interval;
and calculating the white balance parameter corresponding to each acquired image block.
5. The method according to claim 4, wherein the calculating the white balance parameter corresponding to each of the obtained image blocks comprises:
traversing each obtained image block, and obtaining each channel value of each pixel point in the image block;
and calculating a white balance parameter according to the acquired channel value.
6. The method of claim 5, wherein the calculating a white balance parameter according to the obtained channel value comprises:
and counting the average value of each channel value corresponding to the image block, and acquiring a first white balance parameter and a second white balance parameter according to the average value.
7. The method according to any one of claims 4 to 6, wherein the white balance parameters include a first white balance parameter and a second white balance parameter;
the acquiring, from the white balance parameters corresponding to each of the image blocks, a white balance parameter closest to a standard value or the smallest as a target white balance parameter includes:
taking an image block corresponding to the minimum first white balance parameter as a target image block, taking a first white balance parameter corresponding to the target image block as a first target white balance parameter, and taking a second white balance parameter corresponding to the target image block as a second target white balance parameter;
the white balance processing of the shot image according to the target white balance parameter includes:
performing white balance correction on the first channel value of each pixel point in the shot image according to the first target white balance parameter;
and carrying out white balance correction on the second channel value of each pixel point in the shot image according to the second target white balance parameter.
8. An image processing apparatus characterized by comprising:
the image acquisition module is used for acquiring a preview image according to the moving speed of the camera in the moving process of the camera;
the parameter acquisition module is used for dividing each preview image into a preset number of image blocks and calculating corresponding white balance parameters according to each image block corresponding to each preview image; acquiring a white balance parameter which is closest to a standard value or the minimum from the white balance parameters corresponding to each image block as a target white balance parameter, wherein the standard value is a preset white balance parameter;
and the image processing module is used for carrying out white balance processing on the shot image according to the target white balance parameter, wherein the shot image is obtained from the preview image.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
CN201711287892.8A 2017-12-07 2017-12-07 Image processing method, image processing apparatus, storage medium, and electronic device Expired - Fee Related CN107959841B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711287892.8A CN107959841B (en) 2017-12-07 2017-12-07 Image processing method, image processing apparatus, storage medium, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711287892.8A CN107959841B (en) 2017-12-07 2017-12-07 Image processing method, image processing apparatus, storage medium, and electronic device

Publications (2)

Publication Number Publication Date
CN107959841A CN107959841A (en) 2018-04-24
CN107959841B true CN107959841B (en) 2020-03-27

Family

ID=61958244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711287892.8A Expired - Fee Related CN107959841B (en) 2017-12-07 2017-12-07 Image processing method, image processing apparatus, storage medium, and electronic device

Country Status (1)

Country Link
CN (1) CN107959841B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002787B (en) * 2018-07-09 2021-02-23 Oppo广东移动通信有限公司 Image processing method and device, storage medium and electronic equipment
CN112055191B (en) * 2020-08-25 2022-08-09 浙江大华技术股份有限公司 White balance adjustment method, image acquisition device and storage medium
CN112584110B (en) * 2020-12-01 2022-08-02 维沃移动通信有限公司 White balance adjusting method and device, electronic equipment and storage medium
CN114143447B (en) * 2021-11-08 2024-03-05 维沃移动通信有限公司 Image processing method and device and electronic equipment
CN114390266B (en) * 2021-12-28 2024-05-21 杭州涂鸦信息技术有限公司 Image white balance processing method, device and computer readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101442679B (en) * 2007-11-23 2010-12-01 佛山市顺德区顺达电脑厂有限公司 Automatic white balance control system and method thereof
CN102892010B (en) * 2012-10-22 2015-05-06 浙江宇视科技有限公司 White balance processing method and device under multiple light sources
CN105872500A (en) * 2015-12-08 2016-08-17 乐视移动智能信息技术(北京)有限公司 Adjusting method and device for white balance of image
CN106713887B (en) * 2017-01-03 2018-11-20 Tcl通讯科技(成都)有限公司 Mobile terminal and white balance adjusting method
CN107277228B (en) * 2017-05-23 2020-08-21 捷开通讯(深圳)有限公司 Storage device, mobile terminal and image processing method thereof

Also Published As

Publication number Publication date
CN107959841A (en) 2018-04-24

Similar Documents

Publication Publication Date Title
CN107959841B (en) Image processing method, image processing apparatus, storage medium, and electronic device
EP3477931B1 (en) Image processing method and device, readable storage medium and electronic device
CN109089047B (en) Method and device for controlling focusing, storage medium and electronic equipment
CN107911682B (en) Image white balance processing method, device, storage medium and electronic equipment
CN108921823B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN110166695B (en) Camera anti-shake method and device, electronic equipment and computer readable storage medium
CN108012078B (en) Image brightness processing method and device, storage medium and electronic equipment
CN112102386A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN110290323B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN108198152B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN110475067B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN108717530B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
CN109685853B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
KR102229811B1 (en) Filming method and terminal for terminal
KR101441786B1 (en) Subject determination apparatus, subject determination method and recording medium storing program thereof
CN107395991B (en) Image synthesis method, image synthesis device, computer-readable storage medium and computer equipment
US8310553B2 (en) Image capturing device, image capturing method, and storage medium having stored therein image capturing program
CN107704798B (en) Image blurring method and device, computer readable storage medium and computer device
CN107948617B (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
CN109963080B (en) Image acquisition method and device, electronic equipment and computer storage medium
CN110035206B (en) Image processing method and device, electronic equipment and computer readable storage medium
WO2019105304A1 (en) Image white balance processing method, computer readable storage medium, and electronic device
CN112004029B (en) Exposure processing method, exposure processing device, electronic apparatus, and computer-readable storage medium
CN109559352B (en) Camera calibration method, device, electronic equipment and computer-readable storage medium
KR101178777B1 (en) Image processing apparatus, image processing method and computer readable-medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200327

CF01 Termination of patent right due to non-payment of annual fee