WO2020097802A1 - 图像色彩校正方法及装置、存储介质 - Google Patents

图像色彩校正方法及装置、存储介质 Download PDF

Info

Publication number
WO2020097802A1
WO2020097802A1 PCT/CN2018/115273 CN2018115273W WO2020097802A1 WO 2020097802 A1 WO2020097802 A1 WO 2020097802A1 CN 2018115273 W CN2018115273 W CN 2018115273W WO 2020097802 A1 WO2020097802 A1 WO 2020097802A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
color
standard
hue
matrix
Prior art date
Application number
PCT/CN2018/115273
Other languages
English (en)
French (fr)
Inventor
林威丞
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2018/115273 priority Critical patent/WO2020097802A1/zh
Priority to CN201880088242.7A priority patent/CN111656759A/zh
Publication of WO2020097802A1 publication Critical patent/WO2020097802A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control

Definitions

  • the present invention relates to the field of image processing technology, and in particular, to an image color correction method and device, and a storage medium.
  • the product of the predetermined color correction matrix and the matrix for characterizing the original image may be determined as the matrix for characterizing the corrected image to obtain the corrected image.
  • the color correction matrix is determined according to a preset number of standard color patches.
  • the color correction matrices used when performing image color correction on different original images are all color correction matrices determined according to a preset number of standard color patches, the accuracy of image color correction is low. How to improve the color correction accuracy of an image becomes a problem.
  • This application provides an image color correction method and device, and a storage medium, which can improve the accuracy of image color correction.
  • the technical solutions provided by this application are as follows:
  • an embodiment of the present application provides an image color correction method.
  • the method includes: determining at least one standard color in an image to be corrected, each standard color being a color defined by a standard color block, and the image to be corrected being taken The resulting image; based on the standard pixel values and image pixel values of at least one standard color, determine the color correction information, the image pixel value of each standard color is the pixel value obtained by shooting the standard color block; based on the color correction information Correct the image for image color correction.
  • the image color correction method provided by the embodiments of the present application, because the color correction information is determined according to at least one standard color in the image to be corrected, makes the color correction information more reflect the image pixel value of the image to be corrected.
  • the difference from the standard pixel value increases the probability of effectively correcting each standard color in the image to be corrected according to the color correction information, and improves the color accuracy of the image corrected according to the color correction information.
  • the color correction information includes a color correction matrix, at least one standard color pixel value is used to form a standard pixel matrix, and at least one standard color image pixel value is used to form an image pixel matrix.
  • Each column of elements in the standard pixel matrix represents a standard For standard pixel values of colors, each column of elements in the image pixel matrix represents an image pixel value of a standard color, and elements in different rows of each column of elements correspond to different color components.
  • determining the implementation process of the color correction information based on the standard pixel values and image pixel values of at least one standard color may include: determining the product of the standard pixel matrix, the transposition of the image pixel matrix and the target inverse matrix as the color correction Matrix, the target inverse matrix is the inverse matrix of the product of the image pixel matrix and the transpose matrix of the image pixel matrix.
  • the implementation process of determining at least one standard color carried by the image to be corrected may include: converting the image to be corrected into a first hue map including at least one first hue; determining each first hue Corresponding standard colors to obtain at least one standard color.
  • the implementation process of determining a standard color corresponding to each first color may include: acquiring at least one second hue corresponding to at least one preset standard color, and each second hue is based on a pre-color corresponding to the second color The image pixel value of the standard color is determined, and each preset standard color is a color defined by a standard color block; for each first hue, when the first hue is the same as the target second hue in at least one second hue, The preset standard color corresponding to the target second color is determined as the standard color corresponding to the first color.
  • the second hue determined based on the image pixel value of the corresponding preset standard color can more reflect the color difference of the image, and because the first hue is based on the uncorrected The image pixel value in the image is determined. Therefore, when the standard color in the image to be corrected is subsequently determined according to the first hue and the second hue determined based on the image pixel value of the corresponding preset standard color, the determined Standard color accuracy.
  • determine at least one standard color carried by the image to be corrected determine the implementation process of the at least one standard color carried by the image to be corrected It may also include: counting the total number of image blocks carrying the same first hue in the first hue map, each image block including at least one image pixel.
  • the implementation process of determining the standard color corresponding to each first color may include: when the total number of image blocks carrying the same first hue is greater than a preset number threshold, determining the standard color corresponding to the first color.
  • the hue of the image block is determined based on the average pixel value of the image block
  • the average pixel value of the image block is determined based on the pixel value of the pixel included in the image block, and since the pixel value is being acquired, the average pixel value and the hue are determined
  • the implementation process of converting the image to be corrected into a first hue map including at least one first hue may include: obtaining the average value of pixels of each image block in the image to be corrected, each image block including at least one image Pixels; based on the average pixel value of each image block, determine the first hue of the image block to obtain a first hue map.
  • the size of each image block in the image to be corrected may be the same or different, and the size of each image block may be determined according to actual needs. Moreover, when the image block includes multiple image pixels, the total number of image pixels included in the first hue map acquired from all image blocks in the image to be corrected is less than the total number of image pixels in the image to be corrected, which is equivalent to reducing the total number of image pixels in the image , Can reduce the amount of calculation in the subsequent calculation process, speed up the image color correction speed.
  • the process of performing image color correction on the image to be corrected based on the color correction information may include: multiplying the color correction matrix with the image matrix of the image to be corrected, the image matrix including image pixels of the pixels in the image to be corrected value.
  • an embodiment of the present application provides an image color correction device.
  • the device includes: a first determination module for determining at least one standard color in an image to be corrected, each standard color being defined by a standard color block Color, the image to be corrected is the image obtained by shooting; the second determination module is used to determine color correction information based on the standard pixel value of at least one standard color and the image pixel value, the image pixel value of each standard color is the standard The pixel value obtained by shooting the color patch; the correction module is used to perform image color correction on the image to be corrected based on the color correction information.
  • the color correction information includes a color correction matrix, at least one standard color pixel value is used to form a standard pixel matrix, and at least one standard color image pixel value is used to form an image pixel matrix, each column of elements in the standard pixel matrix represents A standard pixel value of a standard color. Each column of elements in the image pixel matrix represents a standard color image pixel value. Elements in different rows of each column of elements correspond to different color components.
  • the second determining module is configured to: determine the product of the transposition of the standard pixel matrix, the image pixel matrix and the target inverse matrix as the color correction matrix, and the target inverse matrix be the transpose matrix of the image pixel matrix and the image pixel matrix The inverse matrix of the product.
  • the first determination module includes: a conversion sub-module for converting the image to be corrected into a first hue map including at least one first hue; a determination sub-module for determining the corresponding to each first color Standard colors to obtain at least one standard color.
  • the determination submodule is configured to: acquire at least one second hue corresponding to at least one preset standard color, and each second hue is determined based on the image pixel value of the preset standard color corresponding to the second color, each The preset standard colors are the colors defined by a standard color block; for each first hue, when the first hue is the same as the target second hue in at least one second hue, the preset standard corresponding to the target second hue The color is determined as the standard color corresponding to the first color.
  • the first determining module further includes a statistics sub-module for counting the total number of image blocks carrying the same first hue in the first hue map, and each image block includes at least one image pixel.
  • the determination submodule is used to: when the total number of image blocks carrying the same first hue is greater than a preset number threshold, determine the standard color corresponding to the first color.
  • the conversion sub-module is used to: obtain the average pixel value of each image block in the image to be corrected, each image block includes at least one image pixel; based on the average pixel value of each image block, determine the first of the image block Hue to get the first hue diagram.
  • the correction module is used to: multiply the color correction matrix with the image matrix of the image to be corrected, the image matrix including the image pixel values of the pixels in the image to be corrected.
  • an embodiment of the present application provides an image color correction device, including a processor and a memory; when the processor executes a computer program stored in the memory, the image color correction device executes the image color correction method of any of the first aspect.
  • an embodiment of the present application provides a storage medium in which a computer program is stored, and the computer program instructs an image color correction device to perform any of the image color correction methods of the first aspect.
  • an embodiment of the present application provides a computer program product containing instructions, which, when the computer program product runs on a computer, causes the computer to perform any of the image color correction methods of the first aspect.
  • the image color correction method and device and storage medium provided by the embodiments of the present application, because the color correction information is determined according to at least one standard color in the image to be corrected, makes the color correction information more reflect the to-be-corrected
  • the difference between the image pixel value of the image and the standard pixel value increases the probability of effectively correcting each standard color in the image to be corrected according to the color correction information, and improves the color accuracy of the image corrected according to the color correction information.
  • the advantage of improving color accuracy will be particularly evident when performing image color correction according to the image color correction method.
  • images to be corrected including blue sky and white clouds (no red and green) images to be corrected including green mountains and green water (no blue), or images to be corrected including red flowers and green leaves (no blue), etc.
  • using this image color correction method can obtain more accurate correction effects.
  • FIG. 1 is a schematic structural diagram of an electronic imaging device provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of an image signal processor provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of an image color correction device provided by an embodiment of the present application.
  • FIG. 4 is a method flowchart of an image color correction method provided by an embodiment of the present application.
  • FIG. 5 is a flowchart of a method for converting an image to be corrected into a first hue diagram including at least one first hue provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram illustrating the principle of determining the first hue of an image block according to the pixel value of the image block provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of an image to be corrected provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a histogram of the total number of image blocks carrying the same first hue in the first hue map obtained by statistics according to the first hue map of the image to be corrected shown in FIG. 7 provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a hue range determined according to a first hue, a negative hue threshold, and a positive hue threshold provided by an embodiment of the present application.
  • FIG. 10 is a flowchart of a method for determining a standard color corresponding to each first color provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of a standard color card including standard color patches for 24 standard colors provided by an embodiment of the present application.
  • FIG. 12 is a schematic diagram of a captured image obtained by shooting the standard color card shown in FIG. 11 according to an embodiment of the present application.
  • the original image obtained In the process of collecting images using electronic imaging equipment, due to the influence of factors such as the color of the light source in the shooting environment, the original image obtained usually has an overall color cast. For example, the original image collected may have a blue and Yellow or greenish.
  • AVB automatic white balance
  • CC color correction
  • the automatic white balance correction can calculate the color of the light source in the shooting environment, and correct the color shift of the image according to the color of the light source, so that the white object being photographed appears white in the corrected image.
  • Color correction is used to adjust various colors in the image after white balance correction to the true colors of the color object being photographed.
  • a product of a predetermined color correction matrix and an image matrix for characterizing the white balance correction can be determined as a matrix characterizing the corrected image to obtain a corrected image.
  • the color correction matrix is determined based on the standard pixel values and image pixel values of the fixed 24 standard color blocks, and because the color correction matrix is used for image color correction of the image pixel values corresponding to the 24 standard color blocks.
  • the color correction matrix only the image pixel values corresponding to the 24 standard color patches can be corrected as much as possible, resulting in a low probability of effective correction of the image pixel values of each standard color patch, resulting in subsequent image color correction Accuracy is low.
  • the pixel value of the image is the pixel value of the captured image obtained by capturing the standard color patch defining the standard color.
  • the embodiments of the present application provide an image color correction method and device, which can determine color correction information according to the standard color contained in the image to be corrected, and then perform image color correction on the image to be corrected according to the color correction information. Improve the accuracy of image color correction.
  • FIG. 1 shows a schematic structural diagram of an electronic imaging device 100 involved in the image color correction method.
  • the electronic imaging device may be, but not limited to, a camera or a video camera, an electronic device including the camera or a video camera, such as a laptop computer, a desktop computer, a mobile phone, a smartphone, a tablet computer, a multimedia player, an e-reader, or a wearable Equipment, etc., can be used to collect and process image data.
  • the electronic imaging device 100 may include: one or more processors 01, an input / output interface 02, a user interface 03, a display screen 04, a memory 05, an image signal processor 06, one or more imaging Device 07, expansion card 08, power supply 09, network equipment 10 and at least one communication bus 11.
  • the communication bus 11 is used to implement connection communication between these components.
  • various components in the electronic imaging device 100 may also be coupled through other connectors, which may include various interfaces, transmission lines, or buses. In various embodiments of the present application, coupling refers to being electrically connected or communicated with each other, including directly connected or indirectly connected through other devices.
  • Image signal processor (ISP) 06 used to process the image data collected by the imaging device 07, such as but not limited to: detecting and correcting defective pixels; sharpening the image; and processing the image Automatic white balance (AWB) processing is performed; color correction (CC) processing is performed on the image.
  • the image data processed by the image signal processor 06 may be acquired from the memory 05 or the imaging device 07.
  • the image signal processor 06 can complete the processing of the image data by calling computer program instructions in the memory.
  • the image signal processor 06 can also complete the processing of the image data through the internal hardware logic processing circuit of the image.
  • the signal processor 06 may include a general-purpose processor that executes software, such as a microprocessor or a processing unit, or may include a hardware logic circuit that executes processing, or a combination of both.
  • the image color correction method provided by the embodiment of the present application may be executed by the image signal processor 06.
  • Input / output interface 02 An interface used to connect various external devices, such as power supplies, audio output devices (such as headphones) or other electronic devices (such as handheld devices and / or computers), printers, projectors, external displays, and so on.
  • Input / output interface 02 can support interface types such as, but not limited to, universal serial bus (USB) interface, Ethernet or modem interface, alternating current / direct current (AC / DC) power interface .
  • User interface 03 used to receive instructions input by the user, which may include a keyboard, physical buttons (press buttons, rocker buttons, etc.), dial pads, click wheels, etc.
  • the user interface 03 and the display screen 04 may be combined.
  • the display screen 04 is a touch screen
  • the electronic imaging device 100 may display an image through the touch screen, and may also receive an instruction input by the user through the touch screen.
  • the processor 01 may include at least one of the following types: a general-purpose central processing unit (central processing unit, CPU), one or more microprocessors, a digital signal processor (DSP), a microcontroller (microcontroller unit, MCU), or
  • the artificial intelligence processor may further include necessary hardware accelerators, such as application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or integrated circuits for implementing logic operations .
  • the processor 01 is coupled to one or more data buses for transferring data and instructions between the various components of the electronic imaging device 100.
  • the memory 05 may include a non-volatile volatile memory, such as an embedded multimedia card (embedded multimedia card (EMMC), universal flash memory (UFS) or read-only memory (ROM).
  • EMMC embedded multimedia card
  • UFS universal flash memory
  • ROM read-only memory
  • the memory 05 may also include a volatile memory (volatile memory), such as a random access memory (random access memory, RAM) or other types of dynamic storage devices that can store information and instructions, or may be Erasable programmable read-only memory (electrically erasable programmable-read-only memory (EEPROM), disk storage media or other magnetic storage devices, or can be used to carry or store program code in the form of instructions or data structures and can be accessed by a computer Any other computer-readable storage medium, but not limited to this.
  • RAM random access memory
  • EEPROM electrically erasable programmable-read-only memory
  • the memory 05 may also be at least one storage system located away from the aforementioned processor 01.
  • the memory 05 which is a computer storage medium, may include necessary software programs such as an operating system, a network communication module, a user interface module, and program instructions.
  • the electronic imaging device 100 may also include one or more expansion cards 08.
  • the expansion card 08 can be used to add functions to the electronic imaging device 100.
  • the expansion card 08 may be a flash memory card for providing a storage medium for the electronic imaging device 100.
  • the expansion card 08 may be a subscriber identification module (SIM) card, which is used to provide a mobile calling function for the electronic imaging device 100.
  • SIM subscriber identification module
  • the electronic imaging device 100 may further include a network device 10, which may be a network controller or a network interface card, and the electronic imaging device 100 may be connected to the network through the network device 10.
  • the network device 10 may be a modem or radio frequency unit for wireless communication connection.
  • the electronic imaging device 100 may also include a power supply 09 for powering the operation of various components of the electronic imaging device 100.
  • the power supply 09 can provide portable power supply and non-portable power supply for the electronic imaging device 100.
  • the power source 09 may be one or more batteries, such as a lithium ion battery, or a power management unit that receives power from the battery and further supplies power to the network device 10.
  • the battery can be recharged by connecting to an external power source (such as an outlet).
  • Display screen 04 used to display various images generated by the electronic imaging device 100, such as a graphical user interface (GUI) of the operating system, or image data (including still images and video) processed by the image signal processor 06 data).
  • the image data may include image data acquired using the imaging device 07 or image data acquired from the memory 05.
  • the display 04 may include any suitable type of display. For example, liquid crystal display (LCD), plasma display or organic light-emitting diode (OLED) display.
  • LCD liquid crystal display
  • plasma display organic light-emitting diode
  • the imaging device 07 may acquire still images and moving images (for example, video), and the imaging device 07 may be a camera or the like.
  • the imaging device 07 may include a lens and one or more image sensors for capturing optical signals and converting the optical signals into electrical signals.
  • FIG. 2 is a schematic structural diagram of an image signal processor 06 provided by an embodiment of the present application.
  • the image signal processor 06 may include at least: an automatic white balance device 061 and an image color correction device 062.
  • the automatic white balance device 061 is used for receiving the image to be corrected, and performing automatic white balance processing on the image to be corrected, so that the white object being photographed displays white in the image.
  • the image color correction device 062 is used to determine at least one standard color in the image to be corrected, determine color correction information based on the standard pixel value and image pixel value of the at least one standard color, and perform image color correction on the image to be corrected based on the color correction information Correction.
  • the image signal processor 06 in the embodiment of the present application may further include other modules (not shown in FIG. 2), for example, a linear correction module, a noise removal module, a dead point removal module, an interpolation module, and the like.
  • a linear correction module for example, a linear correction module, a noise removal module, a dead point removal module, an interpolation module, and the like.
  • one or all of the automatic white balance device 061 and the image color correction device 062 may be implemented in software, hardware, or a combination of software and hardware, and the implementation manner of the embodiments of the present application does not specifically limit it.
  • the image color correction device 062 may include: a first determination module 062a, a second determination module 062b, and a correction module 062c. among them:
  • the first determining module 062a is configured to determine at least one standard color in the image to be corrected, each standard color being a color defined by a standard color block, and the image to be corrected is an image obtained by shooting.
  • the second determination module 062b is configured to determine color correction information based on the standard pixel value and image pixel value of at least one standard color, and the image pixel value of each standard color is the pixel value obtained by shooting the standard color block.
  • the correction module 062c is used to perform image color correction on the image to be corrected based on the color correction information.
  • the color correction information may include a color correction matrix, and the color correction matrix may be determined based on the standard pixel matrix and the image pixel matrix.
  • the standard pixel matrix includes standard pixel values of at least one standard color.
  • the image pixel matrix includes at least one standard color image pixel value.
  • the second determining module 062b is specifically configured to determine the product of the transposition of the standard pixel matrix and the image pixel matrix and the target inverse matrix as the color correction matrix.
  • the target inverse matrix is the inverse matrix of the product of the image pixel matrix and the transpose matrix of the image pixel matrix.
  • Each column element in the standard pixel matrix represents a standard pixel value of a standard color
  • each column element in the image pixel matrix represents a standard color.
  • Image pixel values. Elements in different rows in each column of elements correspond to different color components.
  • the first determination module 062a may include: a conversion submodule 062a1 and a determination submodule 062a2, in which:
  • the conversion submodule 062a1 is configured to convert the image to be corrected into a first hue map that may include at least one first hue.
  • the determination submodule 062a2 is used to determine a standard color corresponding to each first color to obtain at least one standard color.
  • the determination submodule 062a2 is specifically configured to: obtain at least one second hue corresponding to at least one preset standard color, and each second hue is determined based on the image pixel value of the preset standard color corresponding to the second color ,
  • Each preset standard color is a color defined by a standard color block. For each first hue, when the first hue is the same as the target second hue in at least one second hue, the preset standard color corresponding to the target second color is determined as the standard color corresponding to the first color.
  • the first determining module 062a may further include: a statistics submodule 062a3, configured to count the total number of image blocks carrying the same first hue in the first hue map, and each image block may include At least one image pixel.
  • the determination submodule 062a2 is configured to: when the total number of image blocks carrying the same first hue is greater than a preset number threshold, determine the standard color corresponding to the first color.
  • the conversion submodule 062a1 is configured to: obtain an average value of pixels of each image block in the image to be corrected, and each image block may include at least one image pixel. Based on the average pixel value of each image block, the first hue of the image block is determined to obtain a first hue map.
  • the correction module 062c is used to: multiply the color correction matrix with the image matrix of the image to be corrected, and the image matrix includes the image pixel values of the pixels in the image to be corrected.
  • the first determination module determines at least one standard color in the image to be corrected
  • the second determination module determines color correction information based on the standard pixel value and the image pixel value of the at least one standard color
  • the correction module based on the color correction information Perform image color correction.
  • the color correction information is determined according to at least one standard color in the image to be corrected, so that the color correction information can better reflect the difference between the image pixel value of the image to be corrected and the standard pixel value.
  • the probability of effectively correcting each standard color in the image to be corrected according to the color correction information is increased, and the color accuracy of the image corrected according to the color correction information is improved.
  • each module in the above device can be implemented by software or hardware or a combination of hardware and software.
  • the hardware may be a logic integrated circuit module, which may specifically include a transistor, a logic gate array, or an arithmetic logic circuit.
  • the software exists in the form of a computer program product and is stored in a computer-readable storage medium. The software can be executed by a processor. Therefore, alternatively, the image color correction device may be implemented by a processor executing a software program, which is not limited in this embodiment.
  • the image color correction method may be executed by the image color correction device 602 shown in FIG. 2 or FIG. 3. As shown in FIG. 4, the image color correction method may include at least the following steps:
  • Step 101 Convert the image to be corrected into a first hue map including at least one first hue.
  • the hue is the external appearance of the color presented by the color.
  • the first hue diagram includes the at least one first hue, which is used to characterize the color characteristics of the image to be corrected.
  • the value range of the hue can be [0, 359], and the unit is degree.
  • the hue with the value 0 is connected with the hue with the value 359, so that the hue in the full value range takes the form of a ring.
  • the implementation process of step 101 may include: step 1011, obtaining the average value of pixels of each image block in the image to be corrected, each image block including at least one image pixel.
  • the average pixel value of each image block may be the quotient of the sum of the pixel values of all image pixels included in the image block and the total number of image pixels included in the image block.
  • the average value of pixels of the image block under each color component can be calculated according to each color component. For example, suppose an image block includes M ⁇ N image pixels, and each image pixel is represented by three color components of red (R), green (G), and blue (B).
  • the red component of the image block may be determined according to the red component of the M ⁇ N image pixels
  • the green component of the image block may be determined according to the green component of the M ⁇ N image pixels
  • the green component of the image block The blue component determines the blue component of the image block to obtain the average pixel value of the image block represented by the red component, green component, and blue component.
  • the size of each image block in the image to be corrected may be the same or different, and the size of each image block may be determined according to actual needs. Moreover, when the image block includes multiple image pixels, the total number of image pixels included in the first hue map acquired from all image blocks in the image to be corrected is less than the total number of image pixels in the image to be corrected, which is equivalent to reducing the total number of image pixels in the image , Can reduce the amount of calculation in the subsequent calculation process, speed up the speed of image color correction.
  • the image pixels can also be represented by other types of color components, for example, they can also be represented by the cyan color component, the magenta color component, the yellow color component, and the black color in the CMYK color model
  • the component indicates that the embodiment of the present application does not specifically limit the number and type of color components.
  • Step 1012 Determine the first hue of each image block based on the average pixel value of each image block to obtain a first hue map.
  • W1 is the hue of the color component with the maximum value
  • W2 is the color component with the intermediate value
  • W3 is the color component with the minimum value
  • W4 has the color component with the maximum value, plus (+) and minus in the transformation formula
  • the selection rule for the number (-) is: from the hue (ie W1) of the color component with the maximum value to the hue of the color component (ie W2) at the intermediate value without passing through the color component with the minimum value
  • the hue of W3 if the rotation direction of the rotation process is clockwise, the minus sign is selected, and if the rotation direction of the rotation process is counterclockwise, the plus sign is selected.
  • an image pixel is composed of a red component of 150, a green component of 40, a blue component of 80, and a hue of red component of 0 ° (or 360 °), a hue of green component of 120 °, and a blue component of The hue is 240 °.
  • a hue of the red component with the maximum value is rotated to the hue of the blue component with the intermediate value, and the hue of the green component with the minimum value is not passed during the rotation,
  • the direction of rotation is shown by the dotted arrow in FIG. 6.
  • Step 102 Count the total number of image blocks carrying the same first hue in the first hue map, and each image block includes at least one image pixel.
  • a two-dimensional histogram can be used to count the total number of image blocks carrying the same first hue in the first hue diagram.
  • the horizontal axis of the two-dimensional histogram represents different hues carried in the first hue diagram, and the vertical axis of the two-dimensional histogram represents the total number of image blocks carrying the corresponding hue.
  • FIG. 7 is a schematic diagram of an image to be corrected
  • FIG. 8 is a histogram of the total number of image blocks carrying the same first hue according to the first hue map of the image to be corrected.
  • the total number of image blocks in the hue range of 200 ° to 300 ° carried by the image to be corrected is 0, and the standard color corresponding to the hue range of 200 ° to 300 ° is blue. Therefore, it can be determined that there is no blue in the image to be corrected.
  • a hue range threshold can be set. For example, as shown in FIG. 9, for a first hue to be counted (the hue is 237 ° in FIG. 9), a negative hue threshold and a positive hue threshold can be set for the first hue. When the hue is within the hue range defined by the negative hue threshold and the positive hue threshold (as shown by the hatching in FIG. 9), it is determined that the image block carries the first hue.
  • the negative hue threshold is used to define a range extending along the direction in which the hue decreases based on the current first hue to be counted.
  • the positive hue threshold is used to define a range extending along the direction of increasing hue based on the first hue to be counted currently. For details, see the shaded part of 237 ° hue in FIG. 9.
  • the hue range can be extended to a hue value of 359 °.
  • the range of hue defined by the negative hue threshold and the first hue to be counted should include hue value 5 Hue range enclosed by °, 4 °, 3 °, 2 °, 1 °, 0 °, 359 ° and 358 °.
  • the hue range can be extended to a hue value of 0 °.
  • the average pixel value of the image block is determined based on the pixel values of multiple pixels included in the image block, and since the pixel value is being acquired, the average pixel value and There may be errors in the process of determining the hue, and there may be other interference factors in the process of shooting the image. Therefore, in the statistical process, by setting the negative hue threshold and the positive hue threshold, you can statistically carry each within the error range The total number of image blocks of the first hue can improve the accuracy of statistics.
  • Step 103 When the total number of image blocks carrying the same first hue is greater than a preset number threshold, determine a standard color corresponding to the corresponding first color to obtain at least one standard color.
  • Each standard color is a color defined by a standard color block.
  • the implementation process of determining the standard color corresponding to each first color may include: Step 1031, acquiring at least one second hue corresponding to at least one preset standard color.
  • each second hue can be determined based on the image pixel value of the preset standard color corresponding to the second color.
  • each second hue may be determined based on the standard pixel value of the preset standard color corresponding to the second color.
  • the second hue is determined based on the image pixel value of the corresponding preset standard color
  • the second hue determined based on the image pixel value of the corresponding preset standard color It can better reflect the color difference of the image, and because the first hue is determined according to the image pixel value in the uncorrected image, it is subsequently determined according to the first hue and the image pixel value based on the corresponding preset standard color
  • the second hue determines the standard color in the image to be corrected, the accuracy of the determined standard color can be improved.
  • the image signal processor may store a preset number of standard pixel values of a preset standard color, image pixel values of the preset standard color, and a second hue determined according to each image pixel value.
  • this step 1031 is performed, at least one second hue corresponding to the at least one preset standard color can be extracted in a storage location corresponding to the image signal processor for subsequent use.
  • the at least one second hue may include multiple groups of hues, and each group of hues may include: a second hue determined according to image pixel values obtained by shooting standard color patches under the same light source condition. And the number of the second hue included in each group of hue may be the same or different.
  • the storage location corresponding to the image signal processor may store three groups of hues, each group of hues includes 24 second hues, and the three groups of hues include: shooting under a standard laser light source, a standard fluorescent light source, and a standard natural light source.
  • the second hue is determined by the pixel value of the image obtained by the standard color patch.
  • the standard light source is an artificial light source under various ambient light obtained by simulation. The standard light source can enable a production plant or a laboratory to obtain a lighting effect that is basically consistent with the light source under the corresponding environment.
  • the target light source condition when acquiring the image to be corrected can be determined first, and then the corresponding pixel value of the image obtained by shooting the corresponding standard color patch under the target light source condition can be used to determine the corresponding The second hue.
  • the image signal processor determines that the target light source condition of the image to be corrected is 50% standard natural light source and 50% standard fluorescent light source.
  • the standard color patches used to define multiple preset standard colors may be located in the same standard color card, and the number below each standard color in FIG. 11 is used to identify the corresponding standard color patch.
  • the pixel value of the image corresponding to the block According to FIGS. 11 and 12, since the image pixel values of the standard color block shown in FIG. 12 are affected by factors in the shooting environment, the image pixel values of the standard color block shown in FIG. 12 are the same as those shown in FIG. 11.
  • the standard pixel values of the standard color blocks shown are somewhat different.
  • Step 1032 For each first hue, when the first hue is the same as the target second hue in the at least one second hue, determine the preset standard color corresponding to the target second color as the standard color corresponding to the first color.
  • the first hue diagram includes multiple first hues
  • the multiple first hues are 60 °, 156 °, 260 °, and 300 °, respectively
  • 24 second hues are stored in the storage location of the image signal processor
  • the 24 second hues are: 0 °, 15 °, 30 °, 45 °, 60 °, 75 °, 90 °, 105 °, 120 °, 135 °, 150 °, 165 °, 180 °, 195 °, 210 °, 225 °, 240 °, 255 °, 270 °, 285 °, 290 °, 305 °, 320 ° and 335 °, for the first hue 60 °, since the first hue is equal to the second hue 60 ° ,
  • the average pixel value of the image block is determined based on the pixel value of the pixel included in the image block, and since the pixel value is being acquired, the average pixel value and the hue are determined.
  • the standard color corresponding to the first color according to the statistical results, by setting a preset number threshold, you can correct the error within the scope, the total number of image blocks carrying each first hue is counted, and the accuracy of the standard color can be determined.
  • the hue area may also be divided according to the second hue, negative hue threshold, and positive hue threshold, and then each image The first hue of the block is compared with each hue area to determine whether the first hue is in the corresponding hue area, and then the total number of image blocks carried by the first hue in each hue area is counted, and in each hue area When the total number of image blocks carrying the same first hue is greater than the preset number threshold, determine the standard color corresponding to the corresponding first color to obtain at least one standard color.
  • Step 104 Determine color correction information based on standard pixel values and image pixel values of at least one standard color.
  • the implementation process of this step 104 may include: determining a color correction matrix for characterizing color correction information based on the standard pixel matrix and the image pixel matrix.
  • the standard pixel values of at least one standard color are used to form a standard pixel matrix
  • the image pixel values of at least one standard color are used to form an image pixel matrix.
  • the standard pixel matrix may be a matrix composed of at least one standard color standard pixel value
  • the image pixel matrix may be a matrix composed of at least one standard color image pixel value.
  • Each column of elements in the standard pixel matrix represents a standard color standard pixel Value
  • each column of elements in the image pixel matrix represents an image pixel value of a standard color
  • elements in different rows of each column of elements correspond to different color components.
  • the product of the transposition of the standard pixel matrix and the image pixel matrix and the target inverse matrix can be determined as the color correction matrix.
  • the target inverse matrix is the inverse matrix of the product of the image pixel matrix and the transpose matrix of the image pixel matrix.
  • the standard pixel values of the 5 standard colors are: (R11, G11, B11), (R12, G12, B12), (R13, G13, B13), (R14, G14, B14) and (R15, G15, B15)
  • the image pixel values of the five standard colors are: (R21, G21, B21), (R22, G22, B22), (R23, G23, B23 ), (R24, G24, B24) and (R25, G25, B25)
  • the standard pixel matrix can be expressed as:
  • the image pixel matrix can be expressed as:
  • the color correction matrix M used to characterize the color correction information can be expressed as:
  • [X] T represents the transposed matrix of the matrix [X]
  • [X] -1 represents the inverse matrix of the matrix [X].
  • the standard color blocks labeled 19 to 24 are used to define the standard color required to maintain the automatic white balance effect, and the label is 19 to 24.
  • the standard color block is an off-white block with no color.
  • Step 105 Perform image color correction on the image to be corrected based on the color correction information.
  • the color correction matrix used to characterize the color correction information may be multiplied with the image matrix of the image to be corrected, and the image characterized by the product may be determined as the corrected image.
  • the image matrix includes the image pixel value of each pixel in the image to be corrected, each column element in the image matrix represents the image pixel value of one pixel, and the elements located in different rows in each column element respectively represent different color components of the corresponding pixel value .
  • the image color correction method provided by the embodiments of the present application may be executed during the entire process when the electronic imaging device is in a working state. For example, after turning on the camera, when the image enters the camera of the camera, the image signal processor in the camera can perform automatic white balance correction on the image entering the camera, and the image color correction method provided by the embodiment of the present application Automatic white balance corrected images are color corrected until the camera is turned off.
  • step 101 may be performed by the conversion submodule 062a1 in the first determination module 062a
  • step 102 may be performed by the statistics submodule 062a3 in the first determination module 062a
  • step 103 may be performed by the determiner in the first determination module 062a Module 062a2 is executed
  • step 104 may be executed by the second determination module 062b
  • step 105 may be executed by the correction module 062c.
  • the image color correction method determines the color correction information based on the standard pixel value and the image pixel value of the at least one standard color by determining at least one standard color in the image to be corrected, and based on The color correction information performs image color correction on the image to be corrected.
  • the color correction information since the color correction information is determined according to at least one standard color in the image to be corrected, the color correction information can better reflect the image pixels of the image to be corrected.
  • the difference between the value and the standard pixel value increases the probability of effectively correcting each standard color in the image to be corrected according to the color correction information, and improves the color accuracy of the image corrected according to the color correction information.
  • the advantage of improving color accuracy will be particularly evident when performing image color correction according to the image color correction method.
  • images to be corrected including blue sky and white clouds (no red and green) images to be corrected including green mountains and green water (no blue), or images to be corrected including red flowers and green leaves (no blue), etc.
  • using this image color correction method can obtain more accurate correction effects.
  • An embodiment of the present application further provides an image color correction device, including a processor and a memory; when the processor executes a computer program stored in the memory, the image color correction device executes the image color correction method provided by the embodiment of the present application.
  • the image color correction device may be deployed in an electronic imaging device.
  • An embodiment of the present application also provides a storage medium.
  • the storage medium may be a non-volatile computer-readable storage medium, and a computer program is stored in the storage medium, and the computer program instructs the image color correction apparatus to perform the method provided in the embodiment of the present application. Any image color correction method.
  • the storage medium may include: a read-only memory (read-only memory, ROM) or a random access memory (random access memory, RAM), a magnetic disk or an optical disk, and other media that can store program codes.
  • An embodiment of the present application also provides a computer program product containing instructions, which, when the computer program product runs on the computer, causes the computer to execute the image color correction method provided by the embodiment of the present application.
  • the computer program product may include one or more computer instructions. When the computer program instructions are loaded and executed on the computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device that includes one or more available medium integrated servers, data centers, and the like.
  • the usable medium may be a magnetic medium (eg, floppy disk, hard disk, magnetic tape), optical medium (eg, DVD), or semiconductor medium (eg, solid state disk (SSD)), or the like.
  • the program may be stored in a computer-readable storage medium.
  • the mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

本申请公开了一种图像色彩校正方法及装置、存储介质,属于图像处理技术领域。该方法包括:确定待校正图像中的至少一个标准色,每个所述标准色为一个由标准色块定义的颜色,待校正图像是拍摄所得到的图像;基于该至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,每个标准色的图像像素值为对标准色块进行拍摄所得到的像素值;基于所述色彩校正信息对该待校正图像进行图像色彩校正。本申请提高了图像色彩校正的准确性。

Description

图像色彩校正方法及装置、存储介质 技术领域
本发明涉及图像处理技术领域,尤其涉及一种图像色彩校正方法及装置、存储介质。
背景技术
随着智能终端技术的发展,拍照技术正在变得越来越重要。采用用于拍照的电子成像设备采集图像时,由于环境中光源颜色等因素的影响,采集到的原始图像通常存在整体色偏的情况。为了向用户提供具有较高色彩准确度的图像,在获取该原始图像之后,通常需要对该原始图像进行色彩校正,并向用户提供校正后的图像作为照片。
相关技术中,可以将预先确定的色彩校正矩阵与用于表征原始图像的矩阵的乘积确定为表征校正后的图像的矩阵,以得到校正后的图像。且该色彩校正矩阵是根据预设数量个标准色块确定的。
但是,由于对不同原始图像进行图像色彩校正时所采用的色彩校正矩阵均为该根据预设数量个标准色块确定的色彩校正矩阵,导致图像色彩校正的准确性较低。如何提高图像的色彩校正准确性就成为一个问题。
发明内容
本申请提供了一种图像色彩校正方法及装置、存储介质,可以提高图像色彩校正的准确性,本申请提供的技术方案如下:
第一方面,本申请实施例提供了一种图像色彩校正方法,方法包括:确定待校正图像中的至少一个标准色,每个标准色为一个由标准色块定义的颜色,待校正图像是拍摄所得到的图像;基于至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,每个标准色的图像像素值为对标准色块进行拍摄所得到的像素值;基于色彩校正信息对待校正图像进行图像色彩校正。
本申请实施例提供的图像色彩校正方法,相较于相关技术,由于色彩校正信息是根据待校正图像中的至少一个标准色确定的,使得该色彩校正信息更能体现待校正图像的图像像素值与标准像素值的差异,增大了根据该色彩校正信息对待校正图像中每个标准色进行有效校正的概率,提高了根据该色彩校正信息校正后的图像的色彩准确性。
其中,色彩校正信息包括色彩校正矩阵,至少一个标准色的标准像素值用于形成标准像素矩阵,至少一个标准色的图像像素值用于形成图像像素矩阵,标准像素矩阵中每列元素表示一个标准色的标准像素值,图像像素矩阵中每列元素表示一个标准色的图像像素值,每列元素中位于不同行的元素分别对应不同颜色分量。
可选地,基于至少一个标准色的标准像素值和图像像素值,确定色彩校正信息的实现过程,可以包括:将标准像素矩阵、图像像素矩阵的转置与目标逆矩阵的乘积确定为色彩校正矩阵,目标逆矩阵为图像像素矩阵与图像像素矩阵的转置矩阵的乘积的逆矩阵。
作为一种可实现方式,确定待校正图像所携带的至少一个标准色的实现过程,可以包括:将待校正图像转换为包括至少一个第一色相的第一色相图;确定与每个第一色相对应的标准 色,以得到至少一个标准色。
可选地,确定与每个第一色相对应的标准色的实现过程,可以包括:获取与至少一个预设标准色对应的至少一个第二色相,每个第二色相基于第二色相对应的预设标准色的图像像素值确定,每个预设标准色为一个标准色块定义的颜色;对每个第一色相,当第一色相与至少一个第二色相中的目标第二色相相同时,将目标第二色相对应的预设标准色确定为第一色相对应的标准色。
由于该图像像素为未校正的图像中的像素值,使得该基于对应的预设标准色的图像像素值确定的第二色相更能反映图像的色彩差异,且由于第一色相是根据未校正的图像中的图像像素值确定的,因此,在后续根据第一色相和该基于对应的预设标准色的图像像素值确定的第二色相确定待校正图像中的标准色时,能够提高该确定的标准色的准确性。
可选地,在确定与每个第一色相对应的标准色,得到至少一个标准色之前,确定待校正图像所携带的至少一个标准色,确定待校正图像所携带的至少一个标准色的实现过程还可以包括:统计第一色相图中携带同一第一色相的图像块的总数,每个图像块包括至少一个图像像素。
相应的,确定与每个第一色相对应的标准色的实现过程,可以包括:当携带同一第一色相的图像块的总数大于预设个数阈值时,确定第一色相对应的标准色。
由于图像块的色相是根据图像块的像素平均值确定的,图像块的像素平均值是根据图像块中包括的像素的像素值确定的,且由于在获取像素值,确定像素平均值和确定色相的过程中均可能存在误差,且拍摄图像的过程中可能还会存在其他干扰因素,因此,在根据统计结果确定第一色相对应的标准色时,通过设置预设个数阈值,可以在误差范围内统计携带每个第一色相的图像块的总数,能够确定的标准色的准确性。
可选地,将待校正图像转换为包括至少一个第一色相的第一色相图的实现过程,可以包括:获取待校正图像中每个图像块的像素平均值,每个图像块包括至少一个图像像素;基于每个图像块的像素平均值,确定图像块的第一色相,得到第一色相图。
其中,待校正图像中每个图像块的大小可以相同或者不同,该每个图像块的大小可以根据实际需要确定。并且,当图像块包括多个图像像素时,根据待校正图像中所有图像块获取的第一色相图包括的图像像素总数小于待校正图像的图像像素总数,相当于减少了图像中的图像像素总数,可以减小后续计算过程中的运算量,加速图像色彩校正速度。
作为一种可实现方式,基于色彩校正信息对待校正图像进行图像色彩校正的实现过程,可以包括:将色彩校正矩阵与待校正图像的图像矩阵相乘,图像矩阵包括待校正图像中像素的图像像素值。
第二方面,本申请实施例提供了一种图像色彩校正装置,该装置包括:第一确定模块,用于确定待校正图像中的至少一个标准色,每个标准色为一个由标准色块定义的颜色,待校正图像是拍摄所得到的图像;第二确定模块,用于基于至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,每个标准色的图像像素值为对标准色块进行拍摄所得到的像素值;校正模块,用于基于色彩校正信息对待校正图像进行图像色彩校正。
可选地,色彩校正信息包括色彩校正矩阵,至少一个标准色的标准像素值用于形成标准像素矩阵,至少一个标准色的图像像素值用于形成图像像素矩阵,标准像素矩阵中每列元素表示一个标准色的标准像素值,图像像素矩阵中每列元素表示一个标准色的图像像素值,每 列元素中位于不同行的元素分别对应不同颜色分量。
可选地,第二确定模块,用于:将标准像素矩阵、图像像素矩阵的转置与目标逆矩阵的乘积确定为色彩校正矩阵,目标逆矩阵为图像像素矩阵与图像像素矩阵的转置矩阵的乘积的逆矩阵。
可选地,第一确定模块,包括:转换子模块,用于将待校正图像转换为包括至少一个第一色相的第一色相图;确定子模块,用于确定与每个第一色相对应的标准色,以得到至少一个标准色。
可选地,确定子模块,用于:获取与至少一个预设标准色对应的至少一个第二色相,每个第二色相基于该第二色相对应的预设标准色的图像像素值确定,每个预设标准色为一个标准色块定义的颜色;对每个第一色相,当第一色相与至少一个第二色相中的目标第二色相相同时,将目标第二色相对应的预设标准色确定为第一色相对应的标准色。
可选地,第一确定模块,还包括:统计子模块,用于统计第一色相图中携带同一第一色相的图像块的总数,每个图像块包括至少一个图像像素。
相应的,确定子模块用于:当携带同一第一色相的图像块的总数大于预设个数阈值时,确定第一色相对应的标准色。
可选地,转换子模块用于:获取待校正图像中每个图像块的像素平均值,每个图像块包括至少一个图像像素;基于每个图像块的像素平均值,确定图像块的第一色相,得到第一色相图。
可选地,校正模块用于:将色彩校正矩阵与待校正图像的图像矩阵相乘,图像矩阵包括待校正图像中像素的图像像素值。
第三方面,本申请实施例提供了一种图像色彩校正装置,包括处理器和存储器;在处理器执行存储器存储的计算机程序时,图像色彩校正装置执行第一方面任一的图像色彩校正方法。
第四方面,本申请实施例提供了一种存储介质,存储介质内存储有计算机程序,计算机程序指示图像色彩校正装置执行第一方面任一的图像色彩校正方法。
第五方面,本申请实施例提供了一种包含指令的计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行第一方面任一的图像色彩校正方法。
本申请实施例提供的图像色彩校正方法及装置、存储介质,相较于相关技术,由于色彩校正信息是根据待校正图像中的至少一个标准色确定的,使得该色彩校正信息更能体现待校正图像的图像像素值与标准像素值的差异,增大了根据该色彩校正信息对待校正图像中每个标准色进行有效校正的概率,提高了根据该色彩校正信息校正后的图像的色彩准确性。
并且,由于大自然场景包括的标准色的总数通常较少,根据该图像色彩校正方法进行图像色彩校正时,该提高色彩准确性的优点会表现得尤其明显。例如,对于包括蓝天白云(没有红色与绿色)的待校正图像,对于包括青山绿水(没有蓝色)的待校正图像,或者,对于包括红花绿叶(没有蓝色)的待校正图像等大自然场景中的图像,采用该图像色彩校正方法能够得到更精准的校正效果。
附图说明
图1是本申请实施例提供的一种电子成像设备的结构示意图。
图2是本申请实施例提供的一种图像信号处理器的结构示意图。
图3是本申请实施例提供的一种图像色彩校正装置的结构示意图。
图4是本申请实施例提供的一种图像色彩校正方法的方法流程图。
图5是本申请实施例提供的一种将待校正图像转换为包括至少一个第一色相的第一色相图的方法流程图。
图6是本申请实施例提供的一种根据图像块的像素值确定该图像块的第一色相的原理示意图。
图7是本申请实施例提供的一种待校正图像的示意图。
图8是本申请实施例提供的一种根据图7所示的待校正图像的第一色相图,统计得到的第一色相图中携带同一第一色相的图像块的总数的直方图的示意图。
图9是本申请实施例提供的一种根据第一色相、负向色相阈值与正向色相阈值确定的色相范围的示意图。
图10是本申请实施例提供的一种确定与每个第一色相对应的标准色的方法流程图。
图11是本申请实施例提供的一种包括用于24个标准色的标准色块的标准色卡的示意图。
图12是本申请实施例提供的一种对图11所示的标准色卡进行拍摄得到的拍摄图像的示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
采用电子成像设备对图像进行采集的过程中,由于拍摄环境中光源颜色等因素的影响,采集得到的原始图像通常存在整体色偏的情况,例如,采集得到的原始图像可能存在整体偏蓝、偏黄或偏绿的情况。为了向用户提供具有较高色彩准确度的图像,通常需要对该原始图像进行自动白平衡校正(auto white balance,AWB),并对经过自动白平衡校正后的图像进行色彩校正(color correction,CC)。该自动白平衡校正能够计算出拍摄环境下的光源颜色,并根据该光源颜色修正图像色偏,使被拍摄的白色对象在修正后的图像中呈现为白色。色彩校正用于将经过白平衡校正后的图像中的各种颜色调整为被拍摄的彩色对象真正的颜色。
在相关技术中,在对图像进行色彩校正时,可以将预先确定的色彩校正矩阵与用于表征白平衡校正后图像矩阵的乘积确定为表征校正后的图像的矩阵,以得到校正后的图像。但是,该色彩校正矩阵是根据固定的24个标准色块的标准像素值和图像像素值确定的,且由于该色彩校正矩阵为对该24个标准色块对应的图像像素值进行图像色彩校正时的共同解,根据该色彩校正矩阵仅能够尽量对24个标准色块对应的图像像素值进行校正,导致对每个标准色块的图像像素值进行有效校正的概率较低,导致后续图像色彩校正的准确性较低。其中,图像像素值为对定义标准色的标准色块进行拍摄所得到的拍摄图像的像素值。
为了解决以上问题,本申请实施例提供了一种图像色彩校正方法及装置,可以根据待校正图像中包含的标准色确定色彩校正信息,然后根据该色彩校正信息对待校正图像进行图像色彩校正,能够提高图像色彩校正的准确性。
图1示出了该图像色彩校正方法涉及的电子成像设备100的结构示意图。该电子成像设备可以但不限于是相机或摄像机、包括相机或摄像机的电子设备,如膝上型计算机、台式计 算机、移动电话、智能手机、平板电脑、多媒体播放器、电子阅读器或可穿戴式设备等,可以用于采集和处理图像数据。
如图1所示,该电子成像设备100可以包括:一个或多个处理器01、输入/输出接口02、用户接口03、显示屏04、存储器05、图像信号处理器06、一个或多个成像装置07、扩展卡08、电源09、网络设备10及至少一个通信总线11。其中,通信总线11用于实现这些组件之间的连接通信。应当理解,电子成像设备100中的各个组件还可以通过其他连接器相耦合,其他连接器可包括各类接口、传输线或总线等。在本申请的各个实施例中,耦合是指通过相互电连接或连通,包括直接相连或通过其他设备间接相连。
图像信号处理器(image signal processor,ISP)06:用于对成像装置07采集的图像数据进行处理,例如但不限于是:对缺陷像素进行检测、校正处理;对图像进行锐化处理;对图像进行自动白平衡校正(auto white balance,AWB)处理;对图像进行色彩校正(color correction,CC)处理。图像信号处理器06处理的图像数据可以从存储器05中获取,也可以从成像装置07中获取。可选地,图像信号处理器06可以通过调用存储器中的计算机程序指令完成对图像数据的处理。可选地,图像信号处理器06还可以通过图像内部硬件逻辑处理电路完成对图像数据的处理。也即是说,像信号处理器06可以包括执行软件的通用处理器,如微处理器或处理单元,或者可以包括执行处理的硬件逻辑电路,或者可以是两者的结合。其中,本申请实施例提供的图像色彩校正方法可以由该图像信号处理器06执行。
输入/输出接口02:用于连接各种外部设备的接口,例如电源、音频输出设备(如耳机)或其他电子设备(如手持设备和/或计算机)、打印机、投影仪、外部显示器等等。输入/输出接口02可支持的接口类型例如但不限于是通用串行总线(universal serial bus,USB)接口、以太网或调制解调器接口、交流/直流(alternating current/direct current,AC/DC)电源接口。
用户接口03:用于接收用户输入的指令,可以包括键盘、物理按钮(按压按钮、摇臂按钮等)、拨号盘、点击滚轮等等。在一些可能的实施例中,用户接口03与显示屏04可以结合在一起。例如在显示屏04为触摸屏的情况下,电子成像设备100可以通过触摸屏显示图像,还可以通过触摸屏接收用户输入的指令。
处理器01可以包括以下至少一种类型:通用中央处理器(central processing unit,CPU)、一个或多个微处理器、数字信号处理器(DSP)、微控制器(microcontroller unit,MCU)、或人工智能处理器,还可进一步包括必要的硬件加速器,如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)、或者用于实现逻辑运算的集成电路。处理器01被耦合到一个或多个数据总线,用于在电子成像设备100的各个组件之间传输数据和指令。
存储器05可以包括非掉电易失性存储器,例如是嵌入式多媒体卡(embedded multi media card,EMMC)、通用闪存存储(universal flash storage,UFS)或只读存储器(read-only memory,ROM)。可选的,存储器05还可以包括掉电易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的程序代码并能够由计算机存取的任何其他计算机可读存储介质,但不限于此。可选的,存储器05还可以是至少一个位于远离前述处理器01的存储系统。作为一种计算机存 储介质的存储器05中可以包括操作系统、网络通信模块、用户接口模块以及程序指令等必要的软件程序。
电子成像设备100还可以包括一个或多个扩展卡08。扩展卡08可用于为电子成像设备100添加功能。在一个实施例中,扩展卡08可以是闪存卡,用于为电子成像设备100提供存储介质。在另外一个实施例中,扩展卡08可以是用户身份模块(subscriber identification module,SIM)卡,用于为电子成像设备100提供移动通话功能。
电子成像设备100还可以包括网络设备10,网络设备10可以是网络控制器或网络接口卡,电子成像设备100可以通过网络设备10连接网络。或者网络设备10可以是用于进行无线通信连接的调制解调器或射频单元。
电子成像设备100还可以包括电源09,用于为电子成像设备100各个组件的运行供电。电源09可以为电子成像设备100进行便携式供电以及非便携式供电。在便携式供电中,电源09可以是一个或多个电池,例如锂离子电池,还可以是从电池接收电能并进一步向网络设备10供电的供电管理单元。电池可以通过连接到外部电源(例如插座)来重新充电。
显示屏04:用于显示由电子成像设备100生成的各种图像,例如操作系统的图形用户界面(graphical user interface,GUI)、或由图像信号处理器06处理的图像数据(包括静止图像和视频数据)。图像数据可以包括使用成像装置07获取的图像数据或从存储器05获取的图像数据。显示屏04可以包括任何合适类型的显示屏。例如液晶显示器(liquid crystal display,LCD)、等离子显示器或有机发光二极管(organic light-emitting diode,OLED)显示器。
成像装置07可以获取静止图像和运动图像(例如视频),成像装置07可以是摄像头等。成像装置07可以包括透镜和一个或多个图像传感器,用于捕捉光信号,并将光信号转换为电信号。
示例地,图2为本申请实施例提供的一种图像信号处理器06的结构示意图。如图2所示,图像信号处理器06至少可以包括:自动白平衡装置061及图像色彩校正装置062。其中,自动白平衡装置061用于接收待校正图像,并对待校正图像进行自动白平衡处理,使被拍摄的白色对象在图像中显示白色。图像色彩校正装置062用于确定待校正图像中的至少一个标准色,基于该至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,并基于该色彩校正信息对待校正图像进行图像色彩校正。可选地,本申请实施例中的图像信号处理器06还可以包括其他模块(图2中未示出),例如线性纠正模块、噪声去除模块、坏点去除模块、内插模块等。其中,自动白平衡装置061及图像色彩校正装置062的一个或全部可以以软件、硬件或软件和硬件结合的方式实现,本申请实施例对其实现方式不做具体限定。
示例地,如图3所示,图像色彩校正装置062可以包括:第一确定模块062a、第二确定模块062b和校正模块062c。其中:
第一确定模块062a,用于确定待校正图像中的至少一个标准色,每个标准色为一个由标准色块定义的颜色,该待校正图像是拍摄所得到的图像。
第二确定模块062b,用于基于至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,每个标准色的图像像素值为对标准色块进行拍摄所得到的像素值。
校正模块062c,用于基于色彩校正信息对待校正图像进行图像色彩校正。
可选地,色彩校正信息可以包括色彩校正矩阵,色彩校正矩阵可以基于标准像素矩阵和图像像素矩阵确定。该标准像素矩阵包括至少一个标准色的标准像素值。该图像像素矩阵包 括至少一个标准色的图像像素值。
可选地,第二确定模块062b,具体用于:将标准像素矩阵、图像像素矩阵的转置与目标逆矩阵的乘积确定为色彩校正矩阵。该目标逆矩阵为图像像素矩阵与图像像素矩阵的转置矩阵的乘积的逆矩阵,标准像素矩阵中每列元素表示一个标准色的标准像素值,图像像素矩阵中每列元素表示一个标准色的图像像素值,每列元素中位于不同行的元素分别对应不同颜色分量。
可选地,请继续参考图3,第一确定模块062a,可以包括:转换子模块062a1和确定子模块062a2,其中:
转换子模块062a1,用于将待校正图像转换为可以包括至少一个第一色相的第一色相图。
确定子模块062a2,用于确定与每个第一色相对应的标准色,以得到至少一个标准色。
可选地,确定子模块062a2,具体用于:获取与至少一个预设标准色对应的至少一个第二色相,每个第二色相基于该第二色相对应的预设标准色的图像像素值确定,每个预设标准色为一个标准色块定义的颜色。对每个第一色相,当第一色相与至少一个第二色相中的目标第二色相相同时,将目标第二色相对应的预设标准色确定为第一色相对应的标准色。
可选地,请继续参考图3,第一确定模块062a,还可以包括:统计子模块062a3,用于统计第一色相图中携带同一第一色相的图像块的总数,每个图像块可以包括至少一个图像像素。
相应的,确定子模块062a2,用于:当携带同一第一色相的图像块的总数大于预设个数阈值时,确定第一色相对应的标准色。
可选地,转换子模块062a1,用于:获取待校正图像中每个图像块的像素平均值,每个图像块可以包括至少一个图像像素。基于每个图像块的像素平均值,确定图像块的第一色相,得到第一色相图。
可选地,校正模块062c用于:将色彩校正矩阵与待校正图像的图像矩阵相乘,图像矩阵包括待校正图像中像素的图像像素值。
通过第一确定模块确定待校正图像中的至少一个标准色,第二确定模块基于该至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,校正模块基于该色彩校正信息对待校正图像进行图像色彩校正,相较于相关技术,由于色彩校正信息是根据待校正图像中的至少一个标准色确定的,使得该色彩校正信息更能体现待校正图像的图像像素值与标准像素值的差异,增大了根据该色彩校正信息对待校正图像中每个标准色进行有效校正的概率,提高了根据该色彩校正信息校正后的图像的色彩准确性。
并且,以上装置中的各个模块可以通过软件或硬件或软硬件结合的方式来实现。当至少一个模块是硬件的时候,该硬件可以是逻辑集成电路模块,可具体包括晶体管、逻辑门阵列或算法逻辑电路等。至少一个模块是软件的时候,该软件以计算机程序产品形式存在,并被存储于计算机可读存储介质中。该软件可以被一个处理器执行。因此可替换地,图像色彩校正装置,可以由一个处理器执行软件程序来实现,本实施例对此不限定。
接下来结合图1至图3,介绍本申请实施例提供的一种图像色彩校正方法。该图像色彩校正方法可以由图2或图3所示的图像色彩校正装置602执行。如图4所示,该图像色彩校正方法至少可以包括以下几个步骤:
步骤101、将待校正图像转换为包括至少一个第一色相的第一色相图。其中,色相为色 彩所呈现出来的色彩外相面貌。第一色相图包括所述至少一个第一色相,用于表征待校正图像的色彩特性。色相的数值范围可以为[0,359],单位是度,该数值为0的色相与数值为359的色相相接,使得该全数值范围内的色相呈圆环形态。
可选地,如图5所示,该步骤101的实现过程可以包括:步骤1011、获取待校正图像中每个图像块的像素平均值,每个图像块包括至少一个图像像素。例如,每个图像块的像素平均值可以为该图像块包括的所有图像像素的像素值总和与该图像块包括的图像像素的总数的商。并且,当每个图像像素由多个颜色分量表示时,在获取每个图像块的像素平均值时,可以根据每个颜色分量,分别计算该图像块在每个颜色分量下的像素平均值。示例地,假设图像块包括M×N个图像像素,且每个图像像素由红色(R)、绿色(G)和蓝色(B)三种颜色分量表示,在获取该图像块的像素平均值时,可以根据该M×N个图像像素的红色分量确定该图像块的红色分量,根据该M×N个图像像素的绿色分量确定该图像块的绿色分量,根据该M×N个图像像素的蓝色分量确定该图像块的蓝色分量,以得到由该红色分量、绿色分量和蓝色分量表示的该图像块的像素平均值。
其中,待校正图像中每个图像块的大小可以相同或者不同,该每个图像块的大小可以根据实际需要确定。并且,当图像块包括多个图像像素时,根据待校正图像中所有图像块获取的第一色相图包括的图像像素总数小于待校正图像的图像像素总数,相当于减少了图像中的图像像素总数,可以减小后续计算过程中的运算量,加快图像色彩校正的速度。同时,图像像素也可以采用其他类型的颜色分量表示,例如,也可以由CMYK颜色模式中的青(cyan)色分量、洋红(magenta)色分量、黄(yellow)色分量、黑(black)色分量表示,本申请实施例对其颜色分量的数量和类型不做具体限定。
步骤1012、基于每个图像块的像素平均值,确定每个图像块的第一色相,得到第一色相图。可选地,可以根据像素值与色相的变换公式,确定每个图像块的第一色相,该像素值与色相的变换公式为:色相(单位为度)=W1+(或-)(W2-W3)×60/(W4-W3)。其中,W1为具有最大值的颜色分量的色相,W2为处于中间值的颜色分量,W3为具有最小值的颜色分量,W4具有最大值的颜色分量,该变换公式中加号(+)和减号(-)的选取规则为:从具有最大值的颜色分量的色相(即W1),向处于中间值的颜色分量(即W2)的色相旋转,且旋转过程中不经过具有最小值的颜色分量(即W3)的色相时,若该旋转过程的旋转方向为顺时针,则选取减号,若该旋转过程的旋转方向为逆时针,则选取加号。
示例地,假设图像像素由红色分量为150,绿色分量为40,蓝色分量为80,且红色分量的色相为0°度(或360°),绿色分量的色相为120°,蓝色分量的色相为240°,如图6所示,当从具有最大值的红色分量的色相,向处于中间值的蓝色分量的色相旋转,且旋转过程中不经过具有最小值的绿色分量的色相时,其旋转方向如图6中虚线箭头所示,由于该旋转过程的旋转方向为顺时针,此时像素值与色相的变换公式中取加减号,则可得该图像像素的色相=0°-(80-40)×60/(150-40)=-338°
步骤102、统计第一色相图中携带同一第一色相的图像块的总数,每个图像块包括至少一个图像像素。可选地,可以采用二维直方图统计第一色相图中携带同一第一色相的图像块的总数。其中,该二维直方图的横轴表示第一色相图中携带的不同色相,该二维直方图的纵轴表示携带对应色相的图像块的总数。
示例地,假设图7为待校正图像的示意图,图8为根据该待校正图像的第一色相图,统 计得到的第一色相图中携带同一第一色相的图像块的总数的直方图,根据该图8可以看出,该待校正图像携带色相在200°至300°的色相范围内的图像块的总数均为0,且该200°至300°的色相范围对应的标准色为蓝色,因此,可以确定该待校正图像中不存在蓝色。
并且,在统计第一色相图中携带的同一第一色相的图像块的总数时,可以设置色相范围阈值。例如,如图9所示,对于某一待统计的第一色相(图9中为色相237°),可以为该第一色相设置负向色相阈值和正向色相阈值,若待统计的图像块的色相在负向色相阈值与正向色相阈值限定的色相范围(如图9中阴影所示的区域)内时,确定该图像块携带了该第一色相。其中,负向色相阈值用于限定以当前待统计的第一色相为基准,沿色相减小的方向延伸的范围。正向色相阈值用于限定以当前待统计的第一色相为基准,沿色相增大的方向延伸的范围,具体见图9中包括237°色相的阴影部分。
其中,由于全数值范围内的色相呈圆环形态,若待统计的第一色相减去负向色相阈值后为负值,则该色相范围可向359°的色相数值延伸。例如,当待统计的第一色相为5°,负向色相阈值为7,沿色相减小的方向延伸后,负向色相阈值与该待统计的第一色相限定的色相范围应包括色相值5°、4°、3°、2°、1°、0°、359°与358°所围成的色相范围。类似的,当待统计的第一色相加上正向色相阈值后若大于359°,则该色相范围可向0°的色相数值延伸。
由于图像块的色相是根据图像块的像素平均值确定的,图像块的像素平均值是根据图像块中包括的多个像素的像素值确定的,且由于在获取像素值,确定像素平均值和确定色相的过程中均可能存在误差,且拍摄图像的过程中可能还会存在其他干扰因素,因此,在统计过程中,通过设置负向色相阈值和正向色相阈值,可以在误差范围内统计携带每个第一色相的图像块的总数,能够提高统计的准确性。
步骤103、当携带同一第一色相的图像块的总数大于预设个数阈值时,确定与对应第一色相对应的标准色,得到至少一个标准色。其中,每个标准色为一个标准色块定义的颜色。可选地,如图10所示,确定与每个第一色相对应的标准色的实现过程可以包括:步骤1031、获取与至少一个预设标准色对应的至少一个第二色相。其中,每个第二色相可以基于该第二色相对应的预设标准色的图像像素值确定。或者,该每个第二色相可以基于该第二色相对应的预设标准色的标准像素值确定。当第二色相基于对应的预设标准色的图像像素值确定时,由于该图像像素为未校正的图像中的像素值,使得该基于对应的预设标准色的图像像素值确定的第二色相更能反映图像的色彩差异,且由于第一色相是根据未校正的图像中的图像像素值确定的,因此,在后续根据第一色相和该基于对应的预设标准色的图像像素值确定的第二色相确定待校正图像中的标准色时,能够提高该确定的标准色的准确性。
可选地,图像信号处理器中可以存储有预设数量的预设标准色的标准像素值,预设标准色的图像像素值,以及根据每个图像像素值确定的第二色相。在执行该步骤1031时,可以在图像信号处理器对应的存储位置中,根据该至少一个预设标准色提取对应的至少一个第二色相,以备后续使用。
并且,该至少一个第二色相可以包括多组色相,每组色相可以包括:根据在同一种光源条件下拍摄标准色块得到的图像像素值确定的第二色相。且每组色相包括的第二色相的数目可以相同或者不同。例如,图像信号处理器对应的存储位置中可以存储有三组色相,每组色相包括24个第二色相,且该三组色相分别包括:在标准激光光源、标准荧光光源和标准自然 光源下拍摄对应的标准色块得到的图像像素值确定的第二色相。其中,标准光源为模拟得到的各种环境光线下的人造光源,该标准光源能够使生产工厂或实验室等非现场获得与对应环境下的光源基本一致的照明效果。
需要说明的是,在执行该步骤1031时,也可以先判断采集待校正图像时的目标光源条件,然后根据在目标光源条件下对对应的标准色块进行拍摄所得到的图像像素值确定对应的第二色相。示例地,假设在图像信号处理器对待校正图像进行校正时,该图像信号处理器确定该待校正图像的目标光源条件为50%的标准自然光源和50%的标准荧光光源,此时,可以分别获取根据每个标准色块在标准自然光源和标准荧光光源下对应的第二色相,并按照两者加权值分别为0.5和0.5,获取该标准自然光源下对应的第二色相和标准荧光光源下对应的第二色相的加权和,以得到该至少一个第二色相。
通过根据待校正图像的目标光源条件获取对应的第二色相,使得根据该第二色相确定待校正图像中的标准色时,能够减小拍摄环境中的光源条件对确定的标准色的准确性的影响,提高该确定的标准色的准确性。
其中,如图11所示,用于定义多个预设标准色的标准色块可以位于同一标准色卡中,图11中位于每个标准色下方的数字用于标识对应的标准色块。在对定义对应预设标准色的标准色块进行拍摄时,可以在标准光源下对该标准色卡进行拍照,以得到如图12所示的拍摄图像,并在拍摄图像中获取每个标准色块对应的图像像素值。根据该图11和图12可以看出,由于图12所示的标准色块的图像像素值受到了拍摄环境中因素的影响,该图12所示的标准色块的图像像素值与图11所示的标准色块的标准像素值存在一定的差异。
步骤1032、对每个第一色相,当第一色相与至少一个第二色相中的目标第二色相相同时,将目标第二色相对应的预设标准色确定为第一色相对应的标准色。示例地,假设第一色相图包括多个第一色相,该多个第一色相分别为60°、156°、260°和300°,图像信号处理器的存储位置中存储有24个第二色相,该24个第二色相分别为:0°、15°、30°、45°、60°、75°、90°、105°、120°、135°、150°、165°、180°、195°、210°、225°、240°、255°、270°、285°、290°、305°、320°和335°,对于第一色相60°,由于该第一色相等于第二色相60°,则可将该第二色相60°对应的预设标准色确定为该第一色相对应的标准色。
由于图像块的色相是根据图像块的像素平均值确定的,图像块的像素平均值是根据图像块中包括的像素的像素值确定的,且由于在获取像素值,确定像素平均值和确定色相的过程中均可能存在误差,以及,拍摄图像的过程中可能还会存在其他干扰因素,因此,在根据统计结果确定第一色相对应的标准色时,通过设置预设个数阈值,可以在误差范围内统计携带每个第一色相的图像块的总数,能够确定的标准色的准确性。
在另一种可实现方式中,在确定与对应第一色相对应的标准色的实现过程中,也可以先根据第二色相、负向色相阈值和正向色相阈值划分色相区域,然后将每个图像块的第一色相与每个色相区域比较,以判断该第一色相是否处于对应色相区域内,再统计携带的第一色相处于每个色相区域内的图像块的总数,并在每个色相区域内携带同一第一色相的图像块的总数大于预设个数阈值时,确定与对应第一色相对应的标准色,得到至少一个标准色。
步骤104、基于至少一个标准色的标准像素值和图像像素值,确定色彩校正信息。可选地,该步骤104的实现过程可以包括:基于标准像素矩阵和图像像素矩阵,确定用于表征色 彩校正信息的色彩校正矩阵。其中,至少一个标准色的标准像素值用于形成标准像素矩阵,至少一个标准色的图像像素值用于形成图像像素矩阵。例如,标准像素矩阵可以为至少一个标准色的标准像素值组成的矩阵,图像像素矩阵可以为至少一个标准色的图像像素值组成的矩阵,标准像素矩阵中每列元素表示一个标准色的标准像素值,图像像素矩阵中每列元素表示一个标准色的图像像素值,每列元素中位于不同行的元素分别对应不同颜色分量。
在一种可实现方式中,可以将标准像素矩阵、图像像素矩阵的转置与目标逆矩阵的乘积确定为色彩校正矩阵。其中,目标逆矩阵为图像像素矩阵与图像像素矩阵的转置矩阵的乘积的逆矩阵。
示例地,假设待校正图像中包括5个标准色,该5个标准色的标准像素值分别为:(R11,G11,B11)、(R12,G12,B12)、(R13,G13,B13)、(R14,G14,B14)和(R15,G15,B15),该5个标准色的图像像素值分别为:(R21,G21,B21)、(R22,G22,B22)、(R23,G23,B23)、(R24,G24,B24)和(R25,G25,B25),该标准像素矩阵可表示为:
Figure PCTCN2018115273-appb-000001
该图像像素矩阵可表示为:
Figure PCTCN2018115273-appb-000002
则该用于表征色彩校正信息的色彩校正矩阵M可表示为:
Figure PCTCN2018115273-appb-000003
其中,[X] T表示矩阵[X]的转置矩阵,[X] -1表示矩阵[X]的逆矩阵。
需要说明的是,由于在预设数量的标准色块中存在用于维持自动白平衡效果需要的标准色,因此,无论待校正图像中是否包括该用于维持自动白平衡效果需要的标准色,在执行该步骤104时,均需要考虑该用于维持自动白平衡效果需要的标准色,也即是,在确定色彩校正矩阵时,既需要根据待校正图像中的标准色确定该色彩校正信息,还需要根据该用于维持自动白平衡效果需要的标准色确定该色彩校正信息,以保证根据色彩校正信息校正后的图像的自动白平衡效果。示例地,对于图11所示的标准色卡,在该标准色卡中,标号为19至24的标准色块用于定义维持自动白平衡效果需要的标准色,且该标号为19至24的标准色块是没有颜色的灰白色块,在确定色彩校正矩阵时,无论待校正图像中是否包括该标号为19至24的标准色块定义的标准色,均需要根据该标号为19至24的标准色块定义的标准色确定该色彩校正信息,以维持经过色彩校正后的图像的自动白平衡效果。
步骤105、基于色彩校正信息对待校正图像进行图像色彩校正。可选地,可以将用于表征色彩校正信息的色彩校正矩阵与待校正图像的图像矩阵相乘,并将该乘积所表征的图像确定为校正后的图像。其中,图像矩阵包括待校正图像中每个像素的图像像素值,该图像矩阵中每列元素表示一个像素的图像像素值,每列元素中位于不同行的元素分别表示对应像素值的不同颜色分量。示例地,假设待校正图像具有256×256=65536个像素,每个像素均用红色 分量、绿色分量和蓝色分量表示,则该待校正图像可用大小为3×65536的图像矩阵Q表示,且色彩校正矩阵M的大小为3×3,那么校正后的图像的矩阵Q1=M×Q,且该校正后的图像的矩阵Q1的带下仍为3×65536。
需要说明的是,本申请实施例提供的图像色彩校正方法可以在电子成像设备处于工作状态的整个过程执行。例如,在开启相机后,当图像进入相机的摄像头时,相机中的图像信号处理器就可以对该进入摄像头的图像进行自动白平衡校正,并采用本申请实施例提供的图像色彩校正方法对经过自动白平衡校正的图像进行色彩校正,直至关闭相机。
并且,当该图像色彩校正方法由图3所示的图像色彩校正装置602执行时,上述各个步骤可以分别由该图像色彩校正装置602中对应模块执行。示例地,步骤101可以由第一确定模块062a中的转换子模块062a1执行,步骤102可以由第一确定模块062a中的统计子模块062a3执行,步骤103可以由第一确定模块062a中的确定子模块062a2执行,步骤104可以由第二确定模块062b执行,步骤105可以由校正模块062c执行。
综上所述,本申请实施例提供的图像色彩校正方法,通过确定待校正图像中的至少一个标准色,基于该至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,并基于该色彩校正信息对待校正图像进行图像色彩校正,相较于相关技术,由于色彩校正信息是根据待校正图像中的至少一个标准色确定的,使得该色彩校正信息更能体现待校正图像的图像像素值与标准像素值的差异,增大了根据该色彩校正信息对待校正图像中每个标准色进行有效校正的概率,提高了根据该色彩校正信息校正后的图像的色彩准确性。
并且,由于大自然场景包括的标准色的总数通常较少,根据该图像色彩校正方法进行图像色彩校正时,该提高色彩准确性的优点会表现得尤其明显。例如,对于包括蓝天白云(没有红色与绿色)的待校正图像,对于包括青山绿水(没有蓝色)的待校正图像,或者,对于包括红花绿叶(没有蓝色)的待校正图像等大自然场景中的图像,采用该图像色彩校正方法能够得到更精准的校正效果。
需要说明的是,本申请实施例提供的图像色彩校正方法步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本发明的保护范围之内,因此不再赘述。
本申请实施例还提供了一种图像色彩校正装置,包括处理器和存储器;在处理器执行存储器存储的计算机程序时,图像色彩校正装置执行本申请实施例提供的图像色彩校正方法。可选地,该图像色彩校正装置可以部署在电子成像设备中。
本申请实施例还提供了一种存储介质,该存储介质可以为非易失性计算机可读存储介质,存储介质内存储有计算机程序,该计算机程序指示图像色彩校正装置执行本申请实施例提供的任一的图像色彩校正方法。该存储介质可以包括:只读存储器(read-only memory,ROM)或随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可存储程序代码的介质。
本申请实施例还提供了一种包含指令的计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行本申请实施例提供的图像色彩校正方法。该计算机程序产品可以包 括一个或多个计算机指令。在计算机上加载和执行该计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者通过该计算机可读存储介质进行传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如,固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (18)

  1. 一种图像色彩校正方法,其特征在于,所述方法包括:
    确定待校正图像中的至少一个标准色,每个标准色为一个由标准色块定义的颜色,所述待校正图像是拍摄所得到的图像;
    基于所述至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,每个标准色的图像像素值为对所述标准色块进行拍摄所得到的像素值;
    基于所述色彩校正信息对所述待校正图像进行图像色彩校正。
  2. 根据权利要求1所述的方法,其特征在于,所述色彩校正信息包括色彩校正矩阵,所述至少一个标准色的标准像素值用于形成标准像素矩阵,所述至少一个标准色的图像像素值用于形成图像像素矩阵,所述标准像素矩阵中每列元素表示一个标准色的标准像素值,所述图像像素矩阵中每列元素表示一个标准色的图像像素值,所述每列元素中位于不同行的元素分别对应不同颜色分量。
  3. 根据权利要求2所述的方法,其特征在于,基于所述至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,包括:
    将所述标准像素矩阵、所述图像像素矩阵的转置与目标逆矩阵的乘积确定为所述色彩校正矩阵,所述目标逆矩阵为所述图像像素矩阵与所述图像像素矩阵的转置矩阵的乘积的逆矩阵。
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述确定待校正图像所携带的至少一个标准色,包括:
    将所述待校正图像转换为包括至少一个第一色相的第一色相图;
    确定与每个所述第一色相对应的标准色,以得到所述至少一个标准色。
  5. 根据权利要求4所述的方法,其特征在于,所述确定与每个所述第一色相对应的标准色,包括:
    获取与至少一个预设标准色对应的至少一个第二色相,每个所述第二色相基于所述第二色相对应的预设标准色的图像像素值确定;
    对每个所述第一色相,当所述第一色相与所述至少一个第二色相中的目标第二色相相同时,将所述目标第二色相对应的预设标准色确定为所述第一色相对应的标准色。
  6. 根据权利要求4或5所述的方法,其特征在于,在所述确定与每个所述第一色相对应的标准色,得到所述至少一个标准色之前,所述确定待校正图像所携带的至少一个标准色,还包括:
    统计所述第一色相图中携带同一第一色相的图像块的总数,每个所述图像块包括至少一个图像像素;
    所述确定与每个所述第一色相对应的标准色,包括:
    当携带同一第一色相的图像块的总数大于预设个数阈值时,确定所述第一色相对应的标 准色。
  7. 根据权利要求4至6任一所述的方法,其特征在于,所述将所述待校正图像转换为包括至少一个第一色相的第一色相图,包括:
    获取所述待校正图像中每个图像块的像素平均值,每个所述图像块包括至少一个图像像素;
    基于每个所述图像块的像素平均值,确定所述图像块的第一色相,得到所述第一色相图。
  8. 根据权利要求2至7任一所述的方法,其特征在于,所述基于所述色彩校正信息对所述待校正图像进行图像色彩校正,包括:
    将所述色彩校正矩阵与所述待校正图像的图像矩阵相乘,所述图像矩阵包括所述待校正图像中像素的图像像素值。
  9. 一种图像色彩校正装置,其特征在于,所述装置包括:
    第一确定模块,用于确定待校正图像中的至少一个标准色,每个标准色为一个由标准色块定义的颜色,所述待校正图像是拍摄所得到的图像;
    第二确定模块,用于基于所述至少一个标准色的标准像素值和图像像素值,确定色彩校正信息,每个标准色的图像像素值为对所述标准色块进行拍摄所得到的像素值;
    校正模块,用于基于所述色彩校正信息对所述待校正图像进行图像色彩校正。
  10. 根据权利要求9所述的装置,其特征在于,所述色彩校正信息包括色彩校正矩阵,所述至少一个标准色的标准像素值用于形成标准像素矩阵,所述至少一个标准色的图像像素值用于形成图像像素矩阵,所述标准像素矩阵中每列元素表示一个标准色的标准像素值,所述图像像素矩阵中每列元素表示一个标准色的图像像素值,所述每列元素中位于不同行的元素分别对应不同颜色分量。
  11. 根据权利要求10所述的装置,其特征在于,第二确定模块,用于:
    将所述标准像素矩阵、所述图像像素矩阵的转置与目标逆矩阵的乘积确定为所述色彩校正矩阵,所述目标逆矩阵为所述图像像素矩阵与所述图像像素矩阵的转置矩阵的乘积的逆矩阵。
  12. 根据权利要求9至11任一所述的装置,其特征在于,所述第一确定模块,包括:
    转换子模块,用于将所述待校正图像转换为包括至少一个第一色相的第一色相图;
    确定子模块,用于确定与每个所述第一色相对应的标准色,以得到所述至少一个标准色。
  13. 根据权利要求12所述的装置,其特征在于,所述确定子模块,用于:
    获取与至少一个预设标准色对应的至少一个第二色相,每个所述第二色相基于所述第二色相对应的预设标准色的图像像素值确定,每个所述预设标准色为一个标准色块定义的颜色;
    对每个所述第一色相,当所述第一色相与所述至少一个第二色相中的目标第二色相相同 时,将所述目标第二色相对应的预设标准色确定为所述第一色相对应的标准色。
  14. 根据权利要求12或13所述的装置,其特征在于,所述第一确定模块,还包括:
    统计子模块,用于统计所述第一色相图中携带同一第一色相的图像块的总数,每个所述图像块包括至少一个图像像素;
    所述确定子模块,用于:
    当携带同一第一色相的图像块的总数大于预设个数阈值时,确定所述第一色相对应的标准色。
  15. 根据权利要求12至14任一所述的装置,其特征在于,所述转换子模块,用于:
    获取所述待校正图像中每个图像块的像素平均值,每个所述图像块包括至少一个图像像素;
    基于每个所述图像块的像素平均值,确定所述图像块的第一色相,得到所述第一色相图。
  16. 根据权利要求10至15任一所述的装置,其特征在于,所述校正模块,用于:
    将所述色彩校正矩阵与所述待校正图像的图像矩阵相乘,所述图像矩阵包括所述待校正图像中像素的图像像素值。
  17. 一种图像色彩校正装置,其特征在于,包括处理器和存储器;
    在所述处理器执行所述存储器存储的计算机程序时,所述图像色彩校正装置执行权利要求1至8任一所述的图像色彩校正方法。
  18. 一种存储介质,其特征在于,所述存储介质内存储有计算机程序,所述计算机程序指示图像色彩校正装置执行权利要求1至8任一所述的图像色彩校正方法。
PCT/CN2018/115273 2018-11-13 2018-11-13 图像色彩校正方法及装置、存储介质 WO2020097802A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/115273 WO2020097802A1 (zh) 2018-11-13 2018-11-13 图像色彩校正方法及装置、存储介质
CN201880088242.7A CN111656759A (zh) 2018-11-13 2018-11-13 图像色彩校正方法及装置、存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/115273 WO2020097802A1 (zh) 2018-11-13 2018-11-13 图像色彩校正方法及装置、存储介质

Publications (1)

Publication Number Publication Date
WO2020097802A1 true WO2020097802A1 (zh) 2020-05-22

Family

ID=70731046

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/115273 WO2020097802A1 (zh) 2018-11-13 2018-11-13 图像色彩校正方法及装置、存储介质

Country Status (2)

Country Link
CN (1) CN111656759A (zh)
WO (1) WO2020097802A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113379855A (zh) * 2021-06-22 2021-09-10 歌尔光学科技有限公司 图像处理方法、装置、设备、计算机程序产品及存储介质
CN115456894A (zh) * 2022-09-02 2022-12-09 北京墨境天合数字图像科技有限公司 一种视频制作色彩校正方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104219511A (zh) * 2013-06-03 2014-12-17 鸿富锦精密工业(深圳)有限公司 色彩校正系统及方法
WO2016101951A1 (en) * 2014-12-25 2016-06-30 Andersen Colour Research Three dimensional, hue-plane preserving and differentiable quasi-linear transformation method for color correction
CN105827897A (zh) * 2015-11-16 2016-08-03 维沃移动通信有限公司 调整卡制作方法、系统、调试色彩校正矩阵方法及设备
CN108347600A (zh) * 2018-03-05 2018-07-31 上海复瞻智能科技有限公司 工业相机校正方法及系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6234801B1 (en) * 2000-01-21 2001-05-22 Zenith Color-Tech Corporation Color comparison list for displaying of the color system
AU2012225194B2 (en) * 2011-03-04 2014-11-13 Lbt Innovations Limited Colour calibration method for an image capture device
JP6097629B2 (ja) * 2013-04-26 2017-03-15 Hoya株式会社 病変評価情報生成装置
CN103685856B (zh) * 2013-12-12 2016-01-20 中国印刷科学技术研究所 一种基于复频谱色度理论对大幅面扫描颜色色差进行校正的方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104219511A (zh) * 2013-06-03 2014-12-17 鸿富锦精密工业(深圳)有限公司 色彩校正系统及方法
WO2016101951A1 (en) * 2014-12-25 2016-06-30 Andersen Colour Research Three dimensional, hue-plane preserving and differentiable quasi-linear transformation method for color correction
CN105827897A (zh) * 2015-11-16 2016-08-03 维沃移动通信有限公司 调整卡制作方法、系统、调试色彩校正矩阵方法及设备
CN108347600A (zh) * 2018-03-05 2018-07-31 上海复瞻智能科技有限公司 工业相机校正方法及系统

Also Published As

Publication number Publication date
CN111656759A (zh) 2020-09-11

Similar Documents

Publication Publication Date Title
US10742889B2 (en) Image photographing method, image photographing apparatus, and terminal
KR102480600B1 (ko) 이미지 처리 장치의 저조도 화질 개선 방법 및 상기 방법을 수행하는 이미지 처리 시스템의 동작 방법
CN110572637B (zh) 图像异常的检测方法、终端设备及存储介质
CN104796683B (zh) 一种校准图像色彩的方法和系统
CN104618702B (zh) 一种基于白块假设的数码摄像装置自动白平衡方法
CN112073703B (zh) 一种色彩校正矩阵的调整方法、装置、终端设备及介质
WO2023016320A1 (zh) 图像处理方法、装置、设备及介质
CN103179322B (zh) 一种图像颜色校正方法及电子设备
CN107704798B (zh) 图像虚化方法、装置、计算机可读存储介质和计算机设备
CN111385461B (zh) 全景拍摄方法及装置、相机、移动终端
WO2020215180A1 (zh) 图像处理方法、装置和电子设备
TWI594224B (zh) 背光亮度調節系統及方法
US9854218B2 (en) Electronic system and image processing method
CN105681775A (zh) 一种白平衡方法和装置
WO2020097802A1 (zh) 图像色彩校正方法及装置、存储介质
US9319653B2 (en) White balance compensation method and electronic apparatus using the same
CN115088252A (zh) 一种图像处理方法及相关装置
CN110807735A (zh) 图像处理方法、装置、终端设备及计算机可读存储介质
CN113516636A (zh) 镜头阴影的评价方法、装置、设备和介质、镜头模组
CN116614716A (zh) 图像处理方法、图像处理装置、存储介质及电子设备
CN102938842B (zh) 影像校正装置、影像校正方法及相关装置和产品
CN115225828B (zh) 前置图像信号处理装置及图像信息传输方法
CN112950509B (zh) 一种图像处理方法、装置及电子设备
CN113473101B (zh) 一种色彩校正方法、装置、电子设备和存储介质
TWI723729B (zh) 白平衡調整方法、影像處理裝置與影像處理系統

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18939858

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18939858

Country of ref document: EP

Kind code of ref document: A1