WO2023124165A1 - 一种图像处理方法及相关电子设备 - Google Patents

一种图像处理方法及相关电子设备 Download PDF

Info

Publication number
WO2023124165A1
WO2023124165A1 PCT/CN2022/115486 CN2022115486W WO2023124165A1 WO 2023124165 A1 WO2023124165 A1 WO 2023124165A1 CN 2022115486 W CN2022115486 W CN 2022115486W WO 2023124165 A1 WO2023124165 A1 WO 2023124165A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
color space
value
light source
electronic device
Prior art date
Application number
PCT/CN2022/115486
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
Priority claimed from CN202210022487.8A external-priority patent/CN116437060B/zh
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Priority to EP22843605.1A priority Critical patent/EP4261771A4/en
Priority to US18/006,183 priority patent/US20240155254A1/en
Publication of WO2023124165A1 publication Critical patent/WO2023124165A1/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
    • H04N1/6083Colour correction or control controlled by factors external to the apparatus
    • H04N1/6086Colour correction or control controlled by factors external to the apparatus by scene illuminant, i.e. conditions at the time of picture capture, e.g. flash, optical filter used, evening, cloud, daylight, artificial lighting, white point measurement, colour temperature
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/71Circuitry for evaluating the brightness variation
    • 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
    • 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
    • H04N1/6077Colour balance, e.g. colour cast correction
    • H04N1/608Colour balance, e.g. colour cast correction within the L, C1, C2 colour signals

Definitions

  • the present application relates to the field of image processing, in particular to an image processing method and related electronic equipment.
  • the human eye has color constancy, that is, when the color of the light on the surface of the object changes, people's perception of the color of the object's surface remains unchanged.
  • Circuit Charge-coupled Device, CCD
  • CMOS circuit has no way to correct the color change of the light source like the human eye. Therefore, it is necessary to estimate the chromaticity value of the light source of the captured image through the white balance algorithm, and adjust the image color through the estimated chromaticity value of the light source, so as to eliminate the influence of the color temperature of the ambient light source on the image color, and the processed image color will not Affected by the CCT of the shooting environment light source, which leads to the problem of color cast in the image.
  • the embodiment of the present application provides an image processing method, which solves the problem that the color of the photographed object in the image output by the electronic device is inconsistent with the color of the photographed object actually observed by human eyes during the photographing process.
  • the embodiment of the present application provides an image processing method applied to an electronic device, the electronic device includes a camera, and the method includes: detecting a first operation; in response to the first operation, the electronic device starts the camera ; The second operation is detected; in response to the second operation, the camera collects the first image under the first ambient light source, the first image is an image in the first color space, and the first ambient light source is when the first image is collected at least one ambient light source; perform first image processing on the first image to obtain a second image in a second color space, and the second color space is different from the first color space; perform second image processing on the second image to obtain the target image; save the target image; wherein, performing second image processing on the second image to obtain the target image includes: obtaining the second parameter based on the first parameter of the first ambient light source, and the second parameter is the same as the third color Space-related parameters, the first parameter includes the white balance parameter of the first ambient light source, the second parameter has a corresponding relationship with the first parameter, and the second parameter is
  • the electronic device calculates the chromaticity information of the shooting environment light source through the white balance algorithm, and performs white balance processing and color restoration on the image to obtain the processed image, which is the image under the reference light source, and Convert that image to LMS color space. Then, the electronic device calculates the chromaticity transformation matrix based on the chromaticity information of the shooting environment light source and the chromatic adaptation algorithm, and uses the chromatic adaptation transformation matrix to adjust the image in the LMS color space, thereby obtaining a chromatic adaptation image close to the visual effect of the human eye .
  • the first color space is a RAW space
  • the second color space is an sRGB color space
  • the third color space is an LMS color space or an XYZ color space.
  • the first parameter is an x 1 value and a y 1 value of the first ambient light source on an xy chromaticity diagram.
  • the electronic device can convert the first image in the RAW space into the second image in the sRGB color space (the second color space), so that the electronic device can convert the second image into the LMS color space, and in the LMS color space Apply chroma adaptation to the image.
  • obtaining the second parameter based on the first parameter of the first ambient light source includes: calculating the color adaptation degree D according to the first parameter; calculating the corresponding value of the first ambient light source based on the first parameter
  • the LMS value of the white point on the third color space by the formula Calculate the gain matrix, L dst M dst S dst is the LMS value of the reference white point in the third color space, the light source corresponding to the reference white point is the reference light source L src M src S src value is the first ambient light source corresponding to the white point at The LMS value in three color spaces; according to the formula Calculate the LMS value of the target white point in the third color space, the light source corresponding to the target white point is the target light source, the is the XYZ value of the white point corresponding to the first ambient light source in the XYZ color space, It is obtained based on the value of L src M sr
  • the electronic device can calculate CA through the chromatic adaptation degree D, so as to perform chromatic adaptation processing on the image in the LMS color space through CA, so as to obtain a chromatic adaptation image consistent with the visual effect of human eyes.
  • X src Y src Z src is the XYZ value of the white point corresponding to the first ambient light source in the XYZ color space
  • the Y src m
  • the m is the electronic device preset image brightness
  • the electronic device calculate CA through the LMS value of the white point corresponding to the first ambient light source in the third color space, so that the image can be color-adapted in the LMS color space through CA, so that the visual effect consistent with the human eye can be obtained.
  • the color adaptation image is beneficial for the electronic device to calculate CA through the LMS value of the white point corresponding to the first ambient light source in the third color space, so that the image can be color-adapted in the LMS color space through CA, so that the visual effect consistent with the human eye can be obtained.
  • the color adaptation image is beneficial for the electronic device to calculate CA through the LMS value of the white point corresponding to the first ambient light source in the third color space, so that the image can be color-adapted in the LMS color space through CA, so that the visual effect consistent with the human eye can be obtained.
  • performing second image processing on the second image based on the second parameter to obtain the target image specifically includes: performing third image processing on the second image to obtain the third image; According to the formula Carry out chromatic adaptation processing to the third image, obtain the fourth image; CA is the second parameter, is the LMS value of the third image in the third color space, is the LMS value of the fourth image in the third color space; the fourth image is subjected to the fourth image processing to obtain the target image.
  • the electronic device performs chromatic adaptation processing on the image in the LMS color space through the CA, so as to obtain a chromatic adaptation image consistent with the visual effect of human eyes.
  • the second image is subjected to third image processing to obtain the third image, which specifically includes: according to the formula Converting the second image from the second color space to the XYZ color space to obtain the first converted image; is the RGB value of the i-th pixel of the second image in the second color space, M 1 is the conversion matrix from the second color space to the XYZ color space, is the XYZ value of the i-th pixel of the first converted image in the XYZ color space; based on the formula Convert the first conversion image from the XYZ color space to the third color space to obtain the third image; Mcat 1 is the conversion matrix for converting the XYZ color space to the LMS color space, is the LMS value of the third image in the third color space.
  • the electronic device converts the second image from the sRGB color space to the LMS color space.
  • the fourth image is subjected to fourth image processing to obtain the target image, which specifically includes: according to the formula Converting the fourth image from the third color space to the XYZ color space to obtain a second converted image; Be the XYZ value of the i-th pixel of the second converted image in the XYZ color space, Mcat 2 is the transformation matrix converted from the LMS color space to the XYZ color space; by the formula The second converted image is converted from the XYZ color space to the second color space to obtain the third converted image, M 2 is used to convert the second converted image from the XYZ color space to the second color space, In the second color space for the third converted image, the RGB value of the i pixel; the third converted image is processed in RGB color space to obtain the fourth converted image; the fourth converted image is converted from the second color space to The fifth converted image is obtained in the YUV color space; the fifth converted image is processed in the YUV color space to obtain the target image.
  • the second image processing is performed on the second image based on the second parameter to obtain the target image, which specifically includes: according to the formula performing fifth image processing on the second image to obtain a third transformed image;
  • the third converted image in the second color space the RGB value of the i-th pixel
  • CA 1 is the target matrix
  • the third converted image is processed in RGB color space to obtain the fourth converted image
  • the fourth converted image is obtained from Convert the second color space to the YUV color space to obtain the fifth converted image
  • CA 1 M 2 Mcat 2 CA Mcat 1 M 1 ;
  • M 1 is the conversion matrix from the second color space to XYZ color space,
  • M 2 is the conversion matrix from XYZ color space to the first color space,
  • Mcat 1 is the conversion matrix from XYZ to LMS color space
  • Mcat 2 is the LMS color
  • an embodiment of the present application provides an electronic device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes,
  • the computer program code includes computer instructions invoked by the one or more processors to cause the electronic device to: detect a first operation; activate the camera in response to the first operation; detect a second operation; respond In the second operation, the camera is used to collect a first image under a first ambient light source, the first image is an image in a first color space, and the first ambient light source is at least one ambient light source when the first image is collected; Performing first image processing on the first image to obtain a second image in a second color space, where the second color space is different from the first color space; performing second image processing on the second image to obtain a target image; saving the target image ;
  • said performing second image processing on the second image to obtain the target image includes: obtaining the second parameter based on the first parameter of the first ambient light source, the second parameter is a parameter
  • the one or more processors call the computer instruction to make the electronic device execute: performing the first image processing on the first image to obtain the second image in the second color space.
  • the one or more processors call the computer instruction to make the electronic device execute: obtaining the second parameter based on the first parameter of the first ambient light source, including: according to the first ambient light source Calculating the color adaptability D with a parameter; calculating the LMS value of the white point corresponding to the first ambient light source in the third color space based on the first parameter; through the formula Calculate the gain matrix, L dst M dst S dst is the LMS value of the reference white point in the third color space, the light source corresponding to the reference white point is the reference light source L src M src S src value is the first ambient light source corresponding to the white point at The LMS value in three color spaces; according to the formula Calculate the LMS value of the target white point in the third color space, the light source corresponding to the target white point is the target light source, the is the XYZ value of the white point corresponding to the first ambient light source in the XY
  • the one or more processors call the computer instruction to make the electronic device execute: calculate the white point corresponding to the first ambient light source in the third color space based on the first parameter
  • X src Y src Z src is the XYZ value of the white point corresponding to the first ambient light source in the XYZ color space
  • the Y src m
  • the m is the electronic device preset image brightness
  • the one or more processors call the computer instruction to make the electronic device perform: performing second image processing on the second image based on the second parameter to obtain the target image, It specifically includes: performing third image processing on the second image to obtain the third image; according to the formula Carry out chromatic adaptation processing to the third image, obtain the fourth image; CA is the second parameter, is the LMS value of the third image in the third color space, is the LMS value of the fourth image in the third color space; the fourth image is subjected to the fourth image processing to obtain the target image.
  • the one or more processors call the computer instruction to make the electronic device perform: performing third image processing on the second image to obtain the third image, specifically including: According to the formula Converting the second image from the second color space to the XYZ color space to obtain the first converted image; is the RGB value of the i-th pixel of the second image in the second color space, M 1 is the conversion matrix from the second color space to the XYZ color space, The XYZ value of the i-th pixel of the first converted image in the XYZ color space; based on the formula Convert the first conversion image from the XYZ color space to the third color space to obtain the third image; Mcat 1 is the conversion matrix for converting the XYZ color space to the LMS color space, is the LMS value of the third image in the third color space.
  • the one or more processors call the computer instruction to make the electronic device perform: performing fourth image processing on the fourth image to obtain the target image, specifically including: according to formula Converting the fourth image from the third color space to the XYZ color space to obtain a second converted image; Be the XYZ value of the i-th pixel of the second converted image in the XYZ color space, Mcat 2 is the transformation matrix converted from the LMS color space to the XYZ color space; by the formula The second converted image is converted from the XYZ color space to the second color space to obtain the third converted image, M 2 is used to convert the second converted image from the XYZ color space to the second color space, In the second color space for the third converted image, the RGB value of the i pixel; the third converted image is processed in RGB color space to obtain the fourth converted image; the fourth converted image is converted from the second color space to The fifth converted image is obtained in the YUV color space; the fifth converted image is processed in the
  • an embodiment of the present application provides an electronic device, including: a touch screen, a camera, one or more processors, and one or more memories; the one or more processors and the touch screen , the camera, the one or more memories are coupled, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions , so that the electronic device executes the method described in the first aspect or any possible implementation manner of the first aspect.
  • an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call a computer instruction so that the electronic device executes the first Aspect or the method described in any possible implementation manner of the first aspect.
  • the embodiment of the present application provides a computer program product containing instructions.
  • the computer program product is run on an electronic device, the electronic device is made to execute any one of the possible implementations of the first aspect or the first aspect. The method described in the manner.
  • the embodiment of the present application provides a computer-readable storage medium, including instructions, and when the instructions are run on the electronic device, the electronic device executes any one of the possible implementations of the first aspect or the first aspect. The method described in the manner.
  • Figures 1A-1B are a set of exemplary images under different light source conditions provided by the embodiment of the present application without adjusting the white balance of the image;
  • FIG. 1C is an image after white balance processing provided by the embodiment of the present application.
  • FIG. 2 is a schematic diagram of a hardware structure of an electronic device 100 provided in an embodiment of the present application
  • 3A-3D are exemplary user interfaces of a group of electronic devices 100 provided by the embodiment of the present application.
  • 4A-4D are exemplary interfaces of another group of electronic devices 100 provided by the embodiment of the present application.
  • 5A-5E are exemplary user interfaces of another group of electronic devices 100 provided by the embodiment of the present application.
  • FIG. 5F is a human visual effect diagram of a whiteboard in a shooting environment provided by an embodiment of the present application.
  • FIG. 6 is a frame diagram of an image processing provided by an embodiment of the present application.
  • FIG. 7 is a flowchart of an image processing method provided in an embodiment of the present application.
  • FIG. 8 is a flow chart of an electronic device calculating a chromatic adaptation transformation matrix provided by an embodiment of the present application.
  • Fig. 9 is a set of exemplary CCT Shift Table and D uv Shift Table provided by the embodiment of the present application.
  • Fig. 10 is the CIE1931 xyz mark observer curve diagram that the embodiment of the present application provides;
  • Fig. 11A is a frame diagram of another image processing provided by the embodiment of the present application.
  • FIG. 11B is a flowchart of another image processing method provided by the embodiment of the present application.
  • FIG. 12 is a flow chart of another image processing method provided by the embodiment of the present application.
  • FIG. 13 is a flow chart of another image processing method provided by the embodiment of the present application.
  • a unit may be, but is not limited to being limited to, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or distributed between two or more computers.
  • these units can execute from various computer readable media having various data structures stored thereon.
  • a unit may, for example, be based on a signal having one or more data packets (eg, data from a second unit interacting with another unit between a local system, a distributed system, and/or a network. For example, the Internet via a signal interacting with other systems) Communicate through local and/or remote processes.
  • Planckian locus An object that neither reflects nor completely projects under the action of radiation, but can absorb all the radiation falling on it is called a black body or a complete radiator.
  • the black body When the black body is continuously heated, the maximum value of its relative spectral power distribution will move to the short-wave direction, and the corresponding light color will change in the order of red, yellow, white, and blue. At different temperatures, the light color corresponding to the black body will change.
  • the arc locus formed on the chromaticity diagram is called the black body locus or Planck locus.
  • Correlated color temperature refers to the temperature of the black body radiator closest to the color with the same brightness stimulus, expressed in K temperature, used to describe the color of light located near the Planckian locus measure.
  • K temperature used to describe the color of light located near the Planckian locus measure.
  • Light sources other than thermal radiation light sources have linear spectra, and their radiation characteristics are quite different from black body radiation characteristics. Therefore, the light color of these light sources may not exactly fall on the black body locus on the chromaticity diagram.
  • CCT is usually used to describe the color characteristics of the light source.
  • Chromaticity distance refers to the distance from the chromaticity value (u, v) of the test light source to the nearest point on the Planckian locus, and D uv characterizes the chromaticity value (u, v) of the test light source v) Information on the color shift (green or pink) and orientation from the Planckian locus.
  • Exposure is the exposure time
  • Aperture is the aperture size
  • Iso is the sensitivity
  • Luma is the average value of Y in the XYZ color space of the image.
  • the human eye has color constancy, that is, when the color of the light on the surface of the object changes, people's perception of the color of the object's surface remains unchanged.
  • Circuit Charge-coupled Device, CCD
  • CMOS circuit has no way to correct the color change of the light source like the human eye. Therefore, it is necessary to estimate the chromaticity value of the light source of the captured image through the white balance algorithm, and adjust the image color through the estimated chromaticity value of the light source, so as to eliminate the influence of the color temperature of the ambient light source on the image color, and the processed image color will not Affected by the CCT of the shooting environment light source, which leads to the problem of color cast in the image.
  • FIG. 1A is a set of exemplary images under different light source conditions without adjusting the white balance of the images.
  • image 1, image 2 and image 3 are images taken in the same shooting environment.
  • electric lamp 11 and whiteboard 12 in this shooting environment, and electric lamp 11 is the only light source in this shooting environment.
  • Electric lamp 11 can emit three
  • the position of the whiteboard 12 is within the illumination range of the electric lamp 11 for the light of different colors (color 1 to color 3).
  • Image 1 is an image taken when the light color of the electric lamp 11 is color 1
  • image 2 is an image taken when the light color of the electric lamp 11 is color 2
  • image 3 is an image taken when the light color of the electric lamp 11 is color 3 .
  • the color of the whiteboard in Image 1 will change as the light changes, that is, in Image 1, the color of the whiteboard is Color 1, and in Image 2 , the color of the whiteboard is color 2, and in image 3, the color of the whiteboard is color 3.
  • FIG. 1B is a group of exemplary images after white balance processing is performed on captured images under the same shooting environment as in FIG. 1A above.
  • image 1 is the image taken when the light color of electric lamp 13 is color 1
  • image 2 is the image taken when the light color of electric lamp 13 is color 2
  • image 3 is the image taken when the light color of electric lamp 13 is color 2.
  • the image taken when the light color of is color 3. It can be seen from FIG.
  • the human eye has the characteristic of incomplete color adaptation, that is, the human eye is affected by the ambient light source and ambient brightness, and cannot completely correct the color of the object, which makes the human eye not maintain color in many light source environments.
  • Color constancy when observing an object, the visual effect of the human eye on the object often has a certain gap with the real color of the object. Therefore, after the camera performs white balance processing on the image, although the influence of factors such as the correlated color temperature of the ambient light source on the color of the subject is eliminated, and the original color of the image is restored, due to the incomplete color adaptation characteristics of the human eye, this It may make the color of the image processed by the white balance inconsistent with the color actually observed by human eyes.
  • image 1 is an image after white balance processing.
  • the color of whiteboard 16 is white
  • image 2 is the whiteboard observed by human eyes.
  • the color of the whiteboard viewed by human eyes is color 4.
  • an embodiment of the present application proposes an image color adaptation processing method.
  • the chromaticity information of the ambient light source, and white balance processing and color restoration processing are performed on the image to obtain a processed image, which is an image under a reference light source (for example, D65 light source).
  • a reference light source for example, D65 light source
  • the electronic device calculates the chromaticity transformation matrix based on the chromaticity information of the shooting environment light source and the chromatic adaptation algorithm, and uses the chromatic adaptation transformation matrix to perform chromatic adaptation processing on the image in the LMS color space, thereby obtaining the chromatic adaptation processed image , and transform the color-adapted image from the LMS color space to the XYZ color space, then convert the image from the XYZ color space to the sRGB color space, and then perform a series of processing on the image to obtain a visual effect consistent with the human eye to adapt the color to the image.
  • FIG. 2 is a schematic diagram of a hardware structure of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.
  • a pressure sensor 180A a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different
  • Processor 110 can include one or more processing units, for example: processor 110 can include application processor (AP chip replication processor, AP chip), modem processor, graphics processing unit (grAP chip hics processing unit, GPU) , image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) and so on. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor AP chip replication processor, AP chip
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves and radiate them through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.
  • the wireless communication module 160 can provide wireless local area network (wireless local area networks, WLAN) (such as Wi-Fi network), Bluetooth (BlueTooth, BT), BLE broadcasting, global navigation satellite system (global navigation satellite system) applied on the electronic device 100. system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the electronic device 100 realizes the display function through the GPU, the display screen 194 , and the application processor.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos and the like.
  • the display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
  • the electronic device 100 can realize the shooting function through the ISP, the camera 193 , the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP is used for processing the data fed back by the camera 193 .
  • the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin color.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be located in the camera 193 .
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the electronic device 100 can implement audio functions through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal.
  • the audio module 170 may also be used to encode and decode audio signals.
  • the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .
  • Speaker 170A also referred to as a "horn" is used to convert audio electrical signals into sound signals.
  • Electronic device 100 can listen to music through speaker 170A, or listen to hands-free calls.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the receiver 170B can be placed close to the human ear to receive the voice.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can put his mouth close to the microphone 170C to make a sound, and input the sound signal to the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 may be provided with two microphones 170C, which may also implement a noise reduction function in addition to collecting sound signals. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to realize sound signal collection, noise reduction, sound source identification, and directional recording functions.
  • the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • pressure sensor 180A may be disposed on display screen 194 .
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip leather case.
  • the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access to application locks, take pictures with fingerprints, answer incoming calls with fingerprints, and the like.
  • Touch sensor 180K also known as "touch panel”.
  • the touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.
  • the bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
  • Scenario 1 After the electronic device starts the camera application, the electronic device performs white balance processing and color adaptation processing on the image captured by the camera, and displays the processed image on the preview interface.
  • the electronic device 100 detects a click on the camera control
  • the electronic device takes a photo and stores the photo, which is an image after color adaptation processing.
  • scene 1 will be introduced with reference to FIG. 3A-FIG. 3D.
  • 3A-3D are exemplary user interfaces of a group of electronic devices 100 provided by the embodiment of the present application.
  • the user interface 30 is the main interface of the electronic device 100 , and the user interface 30 includes a camera icon 301 , a gallery icon 302 and other application icons.
  • the electronic device 100 detects an input operation (eg, click) on the camera icon 301 , in response to the operation, the electronic device 100 displays a user interface 31 as shown in FIG. 3B .
  • the user interface 31 is a photographing interface of the electronic device 100 , and the user interface 31 includes an image display area 311 , a photographing control 312 , and a photographing function setting area 313 .
  • the image display area 311 is used for displaying a preview image
  • the preview image includes an electric lamp 3111 and a whiteboard 3112
  • the preview image is an image after chromatic adaptation processing.
  • the electronic device 100 detects an input operation (eg, click) on the photographing control 312 , in response to the operation, the electronic device 100 takes a photograph.
  • the electronic device 100 detects a click operation on the photo browsing icon 314 after taking pictures, and in response to the operation, the electronic device 100 displays the user interface 32 as shown in FIG. 3C .
  • the user interface 32 is an interface for displaying an image captured by the electronic device 100 , the interface includes an edit box 413 , and the image is a picture subjected to chromatic adaptation processing.
  • This image includes a light bulb 3211 and a whiteboard 3212 , the light color of the light bulb 3211 is color 1 , and the color of the whiteboard 3212 is color 2 .
  • Fig. 3D is an effect diagram of the photographed image (image 1) and the image actually observed by the human eye (image 2) under the same shooting environment only through white balance processing. In image 1 and image 2, the light color of the electric lamp is color 1 , in image 1 the color of the whiteboard is white and in image 2 the color of the whiteboard is color 2. It can be seen that the color of the captured image in FIG. 3C is closer to the color actually observed by human eyes.
  • Scenario 2 After the electronic device 100 starts the camera application, the image preview window in the shooting interface displays the image of the shooting environment after white balance processing, and the shooting interface includes a color adaptation processing control. After adapting to an input operation such as clicking on the processing control, in response to the operation, the electronic device performs chromatic adaptation processing on the preview image, and displays the preview image after chromatic adaptation processing in the image preview window. When the electronic device 100 detects the After an input operation such as clicking, the electronic device 100 takes a photo and saves the photo after color adaptation processing.
  • scenario 2 will be introduced with reference to FIG. 4A-FIG. 4D.
  • 4A-4B are exemplary interfaces of a group of electronic devices 100 provided by the embodiment of the present application.
  • the user interface 40 is the shooting interface of the electronic device 100 , and the user interface 40 includes an image preview window 401 , a shooting control 402 , a shooting function setting area 403 and a chromatic adaptation processing control 404 .
  • the image preview window 401 is used to display the preview image of the current shooting environment
  • the shooting function setting area 403 includes multiple shooting function controls such as the color adaptation processing control 404 .
  • the preview image window 404 It can be seen from the preview image window 404 that the preview image includes an electric light 4041 and a whiteboard 4042, the whiteboard 4042 is within the lighting range of the electric light 4041, the light color of the electric light 4041 is color 1, and the color of the whiteboard is white.
  • the electronic device 100 detects a click operation on the chromatic adaptation processing control 404, in response to the operation, the electronic device 100 displays the user interface 41 as shown in FIG. 4B.
  • the user interface 41 is the shooting interface of the electronic device 100.
  • the displayed preview image is an image processed by chromatic adaptation, and the image includes an electric lamp 4111 and a whiteboard 4112. .
  • the light color of the electric lamp 4111 is color 1
  • the color of the whiteboard 4112 is color 2.
  • FIG. 4C is a color effect diagram of the photographed environment objects actually observed by human eyes.
  • the light color of the lamp is color 1, and the color of the whiteboard is color 2. It can be seen from FIG. 4A-FIG. 4C that the color of the whiteboard is closer to the color of the whiteboard actually observed by human eyes through the preview image processed by chromatic adaptation.
  • an input operation eg, click
  • the user interface 42 is a photographing interface of the electronic device, and the photographing interface includes a photographing prompt box 421 , and the photographing prompt box 421 is used to prompt that the electronic device 100 is taking a photograph.
  • the photo prompt box 421 displays a text message "taking pictures, please wait”.
  • the electronic device 100 performs chromatic adaptation processing on the image during the photographing process, and stores the photo after the chromatic adaptation processing in the gallery, so that the user can browse the photo by visiting the gallery.
  • Scenario 3 The electronic device performs chromatic adaptation processing on the pictures offline: the user can browse the pictures taken by the user through the gallery, and when the electronic device 100 detects an input operation on the chromatic adaptation processing control, in response to the input operation, the electronic device 100 can process the photos. Chromatic adaptation processing, obtain and save the photo after chromatic adaptation processing.
  • scene 3 will be introduced with reference to FIG. 5A-FIG. 5D.
  • 5A-5D are exemplary user interfaces of a group of electronic devices 100 provided by the embodiment of the present application.
  • the user interface 50 is the main interface of the electronic device 100 , and the user interface 50 includes a "gallery" control 501 and other functional controls.
  • the electronic device 100 detects an input operation (for example, click) on the “Gallery” control 501 , in response to the operation, the electronic device 100 displays a user interface 51 as shown in FIG. 5B .
  • the user interface 51 is a photo browsing interface, and the image displayed on the photo browsing interface is an image that has not been processed by color adaptation.
  • the light color of the electric lamp 511 is color 1
  • the color of the white board 512 is white.
  • an image setting area 513 is included, and the image setting area 513 includes a "send” control, a "favorite” control, an "edit” control, a “more” control, and a “delete” control.
  • the electronic device 100 detects a click operation on the "edit” control, in response to the operation, the electronic device 100 displays the user interface 52 as shown in FIG. 5C .
  • the user interface 52 includes a picture setting function box 521.
  • functions such as a "cropping picture” function box, a "color adaptation processing” function box, and a "one-key beautification” function box are included. frame.
  • the electronic device 100 After the electronic device 100 detects a click operation on the "chromatic adaptation processing" function box, in response to the operation, the electronic device 100 displays the user interface 53 as shown in FIG. 5D .
  • the user interface 53 includes a "chromatic adaptation processing prompt box" 531, and the chromatic adaptation processing prompt box 531 is used to prompt that the electronic device 100 is currently performing chromatic adaptation processing, including prompt information of chromatic adaptation processing, as shown in FIG. 5D shows that the prompt information of the chromatic adaptation process may be "the chromatic adaptation process is being performed on the image, please wait”.
  • the electronic device 100 displays the user interface 54 as shown in FIG. 5E .
  • the image displayed on the user interface 54 is an image after chromatic adaptation processing.
  • the light color of the lamp is color 1
  • the color of the whiteboard is color 2.
  • the visual effect diagram of the shooting environment observed by human eyes can be shown in FIG. 5F shown. It can be seen from FIG. 5E that the color of the whiteboard in the image after the chromatic adaptation process is close to the color of the whiteboard actually observed by human eyes in the same shooting environment.
  • FIG. 6 is a frame diagram of an image processing provided by the embodiment of the present application, and the specific process for:
  • Step S601 The electronic device performs light source prediction through the RAW image output by the camera, and calculates R g , B g of the white point of the ambient light source and RGB values of the white point of the ambient light source.
  • Step S602 The electronic device calculates the x 1 value and y 1 value of the white point of the ambient light source according to the RGB value of the white point of the ambient light source, and then calculates the CCT src and D uv_src of the ambient light source according to the x 1 value and y 1 value.
  • Step S603 The electronic device performs CCM interpolation according to the CCT of the shooting environment light source to obtain a color correction matrix CCM.
  • Step S604 The electronic device performs white balance processing on the RAW image according to 1/R g and 1/B g , to obtain a RAW image after white balance processing.
  • Step S605 The electronic device performs color restoration processing on the RAW image after the white balance processing through CCM to obtain a second image in the sRGB color space.
  • Step S606 the electronic device converts the second image into the XYZ color space through the sRGB to XYZ matrix, and obtains the first converted image.
  • Step S607 The electronic device converts the first converted image into an LMS color space through an XYZ-to-LMS matrix to obtain a third image.
  • Step S608 The electronic device performs chromatic adaptation processing on the third image to obtain a fourth image.
  • Step S609 the electronic device converts the fourth image into the XYZ color space through the LMS to XYZ matrix, and obtains the second converted image.
  • Step S610 the electronic device converts the second converted image into the sRGB color space through an XYZ-to-sRGB matrix to obtain a third converted image.
  • Step S611 The electronic device performs RGB color space image processing on the third converted image to obtain a fourth converted image.
  • the RGB color space image processing includes performing DRC (Dynamic Range Compression) processing and/or Gamma (GAMMA) processing on the third converted image.
  • DRC Dynamic Range Compression
  • GAMMA Gamma
  • Step S612 the electronic device converts the fourth converted image from the sRGB color space to the YUV color space to obtain a fifth converted image.
  • Step S613 The electronic device performs YUV color space processing on the fifth converted image to obtain a target image.
  • the YUV color space image processing includes performing tone mapping processing (Tomapping processing) and/or 3D LUT processing on the image.
  • tone mapping processing Tomapping processing
  • 3D LUT processing 3D LUT processing
  • the electronic device may convert the processed image into a JPEG format to obtain the target image.
  • the electronic device processes the RAW image output by the camera based on the flow in the above frame diagram of image processing, and can obtain a color-adapted image consistent with the visual effect of the human eye.
  • FIG. 7 is a flow chart of an image processing method provided in an embodiment of the present application. The specific process is as follows:
  • Step S701 The electronic device starts a camera application in response to a first operation.
  • the first operation may be the click operation on the camera icon in the above embodiment in FIG. 3A .
  • the electronic device 100 detects the click operation on the camera icon, the electronic device starts the camera application.
  • Step S702 the electronic device calculates the chromaticity information of the white point of the shooting environment light source through a white balance algorithm.
  • the camera After the camera is started, it will output a RAW image, the RAW image is the first image under the first color space, the first color space is the RAW space, and the RAW image will be captured by the camera's CMOS image sensor or CCD image sensor
  • the received light source signal is converted into the original data of the digital signal.
  • the electronic device can calculate the RGB value of the white point of the shooting environment light source in the RGB color space based on the white balance algorithm, as well as R g and B g .
  • R g and B g are the chromaticity information of the white point of the shooting environment light source
  • the shooting environment light source is the first environment light source
  • the first environment light source includes at least one kind of environment light source
  • the environment light source can be the sun light source , light sources, etc.
  • R gain 1/R g
  • B gain 1/B g
  • R gain G/R
  • B gain G/B
  • R gain and B gain are R used for white balance processing under the ambient light source respectively.
  • the gain value on channel and B channel, R, G, B are the R value, G value and B value of the RGB channel respectively.
  • the electronic device can calculate the chromaticity information of the light source of the shooting environment through the traditional automatic white balance algorithm (for example, the grayscale world algorithm), or can calculate the chromaticity information of the light source of the shooting environment through the AI automatic white balance algorithm.
  • the embodiment of the application does not limit the type of the white balance algorithm used by the electronic device.
  • Step S703 the electronic device performs white balance processing and color restoration processing on the RAW image output by the camera to obtain a second image.
  • the electronic device needs to perform white balance processing and color restoration processing on the RAW image output by the camera, so as to obtain the second image.
  • the electronic device can adjust the RGB value of the RAW image through the formula (1), so as to adjust the white balance of the image, and the formula (1) is as follows:
  • RGB value of the i-th pixel in the RAW image is the RGB value of the i-th pixel in the RAW image, RGB value of the i-th pixel in the image after white balance adjustment.
  • the RGB of the RAW image is a device-related RGB color space.
  • the RGB of the RAW image is not a universal color space, and besides that, after white balance adjustment on this RAW image, only part of the color of the subject in the image is restored (for example, only neutral colors such as white or gray in the image are adjusted reduction). Therefore, in order to improve the restoration of the object color in the image, and convert the color space of the image from the device-dependent Device RGB space to the device-independent sRGB space.
  • the electronic device needs to perform color restoration processing on the image after white balance processing to improve the color restoration of the image.
  • the electronic device can use the color correction matrix (Color Correction Matrix, CCM) to perform color restoration processing on the image after white balance processing, and obtain second image.
  • CCM Color Correction Matrix
  • the electronic device can calibrate a CCM with a size of 3x3 in different light source environments (typical light sources include A, H, U30, TL84, D50, D65, D75, etc.), and store it in the electronic device.
  • the electronic device can select the corresponding CCM by calculating the RGB value of the white point of the shooting environment light source, if the RGB value is between two light sources (for example, the RGB value of the shooting environment light source white point falls between D50 and D65) , CCM can be obtained by bilinear interpolation of D50 and D65.
  • the electronic equipment can be calculated according to formula (2) To obtain a proportional value g, the formula (2) is as follows:
  • the electronic device can calculate the CCM corresponding to the white point of the shooting environment light source according to the formula (3):
  • the electronic device After the electronic device calculates the CCM corresponding to the white point of the shooting environment light source, the electronic device can adjust the RGB value of the image through the formula (4) to obtain the second image.
  • the formula (4) is as follows:
  • the RGB value of the i-th pixel of the RAW image after white balance adjustment is the RGB value of the i-th pixel of the second image
  • the color space of the second image is the sRGB color space
  • the sRGB color space is the second color space.
  • Step S704 the electronic device converts the second image from the sRGB color space to the XYZ color space to obtain a first converted image.
  • the second image after white balance processing solves the problem of color cast due to the influence of the shooting environment light source.
  • the eye does not always maintain color constancy, that is, the color of the object actually observed by the human eye always deviates from the real color of the object. Therefore, the color of the second image after white balance processing and color restoration processing is different from the color observed by the human eye under some ambient light sources.
  • the LMS color space can be Adjust the color of the image so that the color of the image conforms to the color actually observed by the human eye.
  • the LMS color space is the third color space, which is a color space represented by the responses of the three cones of the human eye, named after its responsivity at long wavelengths, medium wavelengths, and short wavelengths, in the LMS color space
  • the color adaptation process on the image can make the color of the processed image more in line with the color actually observed by the human eye. Since the LMS color space can be converted from the XYZ color space, the electronic device can convert the color space of the second image from the sRGB color space to the XYZ color space to obtain the first converted image.
  • the electronic device can convert the second image through the formula (5) to obtain the first converted image, and the formula (5) is as follows:
  • M 1 is a conversion matrix with a size of 3x3, which is an sRGB to XYZ matrix, and is used to convert the second image from the sRGB color space to the XYZ color space .
  • the form of M1 can be:
  • Step S705 the electronic device converts the first converted image from the XYZ color space to the LMS color space to obtain a third image.
  • the LMS color space is a color space represented by the responses of the three cones of the human eye, named after its responsivity at long wavelengths, medium wavelengths, and short wavelengths, and the image is subjected to chromatic adaptation processing on the LMS color space,
  • the color of the processed image can be made more in line with the color actually observed by the human eye.
  • the electronic device may convert the first converted image from the XYZ color space to the LMS color space through the formula (6), and the formula (6) is as follows:
  • Mcat 1 is the XYZ to LMS matrix, used to convert the image from the XYZ color space to the LMS color space, is the LMS value of the i-th pixel of the third image in the LMS color space, for example, Mcat 1 can be:
  • Step S706 The electronic device performs color adaptation processing on the third image in the LMS color space to obtain a fourth image.
  • the electronic device needs to perform chromatic adaptation processing on the third image, so that the color of the captured image conforms to the theory of incomplete chromatic adaptation of the human eye. It is closer to the color actually observed by the human eye.
  • the electronic device may perform chromatic adaptation processing on the third image in the LMS color space through the chromatic adaptation transformation matrix CA, so as to obtain the fourth image.
  • Step S801 The electronic device calculates the color adaptability D based on the x 1 value and y 1 value of the white point of the shooting environment light source in the xy chromaticity diagram.
  • the color adaptation degree D is a parameter of the color adaptation model, which is used to characterize the degree of color adaptation of the color adaptation model under different light source conditions, mainly composed of the CCT of the ambient light source and the brightness La of the environment (unit: candela/square meter ) determines that the electronic device can calculate the Lv of the shooting environment, and then convert the Lv to calculate La.
  • the calculation method of Lv please refer to the relevant explanation of the above technical term (4), which will not be repeated in the embodiment of the present application.
  • the value range of D is [0, 1].
  • D When D is 0, it means that the color adaptation model does not adapt to the environment light source at all, that is, the color adaptation model is affected by the environment light source CCT and La, and the acquired object color is consistent The actual color of the object deviates greatly.
  • D 1, it means that the chromatic adaptation model has complete chromatic adaptation to the ambient light source, that is, the chromatic adaptation model is almost not affected by the ambient light source CCT and La, and the acquired object color has almost no deviation from the real color of the object, and the chromatic adaptation degree The larger the numerical value of D, the higher the color adaptation degree of the color adaptation model.
  • the color adaptation model is a model designed by researchers to simulate the adaptation of human eyes to environmental color through a large number of experiments, collecting corresponding color data sets and fitting them.
  • the corresponding color data sets are obtained through psychophysical experiments.
  • the purpose of this psychophysical experiment is to allow the observer to find the corresponding color that matches the color under two different lighting conditions, for example, let the observer adjust or select a familiar object under the lighting condition and the reference light source (D65 light source) respectively.
  • Memory color in order to obtain multiple sets of corresponding color data under various light sources and D65 light source.
  • the electronic device can calculate the first variable P xy through the formula (7), and the formula (7) is as follows:
  • the first parameter includes x1 value and y1 value.
  • the x1 value and y1 value can be obtained by shooting the RGB value of the white point of the ambient light source.
  • the RGB value of the white point of the shooting environment light source can be converted to the shooting environment light source by CCM
  • the X 1 Y 1 Z 1 value of the white point in the XYZ color space, and based on the X 1 Y 1 Z 1 value, the x 1 value and the y 1 value are obtained, and the related calculation formulas of the x 1 value and the y 1 value can be as in the formula (8 ) ⁇ Formula (10):
  • the electronic device can calculate the second variable D c through the formula (11), and the formula (11) is as follows:
  • the electronic device can calculate the color fitness D according to the formula (12), and the formula (12) is as follows:
  • e (-4.28 ⁇ log La) is an exponential function based on the constant e, and e is about 2.71828.
  • the calculation method of the above-mentioned color fitness degree D is only an example of one of the calculation methods of the color fitness degree D in the embodiment of the present application, and the calculation method of the color fitness degree D is not limited by the embodiment of the application .
  • Step S802 The electronic device calculates L cur M cur S cur values of the target white point in the LMS color space based on the chromaticity D and the x 1 value and y 1 value of the shooting environment light source white point in the xy chromaticity diagram.
  • the target white point is the white point calculated by the color adaptation algorithm, which is the white point of the light source predicted by the electronic device
  • the value of L cur M cur S cur is the LMS value of the target white point in the LMS color space
  • the value of the target white point is The calculation method of L cur M cur S cur value is as follows:
  • the electronic device can calculate the XYZ value of the white point of the shooting environment light source in the XYZ color space through the formula (15), namely: X src Y src Z src value.
  • the electronic device can obtain the LMS value of the white point of the shooting environment light source in the LMS color space based on the X src Y src Z src value, that is, the L src M src S src value.
  • the electronic device can calculate the L src M src S src value of the white point of the shooting environment light source in the LMS color space through the formula (16), and the formula (16) is as follows:
  • the electronic device can use the formula (16) to compare the XYZ values of the reference white point (in the embodiment of the present application, the reference light source is D65 light source as an example) in the XYZ color space (under the D65 light source, the value of the reference white point
  • the XYZ values are: 0.95047, 1, 1.08883) converted to L dst M dst S dst values in the LMS color space.
  • the electronic device can calculate the gain of the reference white point and the white point of the ambient light source in the LMS color space Matrix M Gain1 , the electronic device can calculate M Gain1 through the formula (17), the formula (17) is as follows:
  • the electronic device After the electronic device calculates the gain matrix M Gain1 , the LMS value of the target white point in the LMS can be calculated based on M Gain1 and fitness D, namely: L cur M cur S cur value, the electronic device can calculate L cur by formula (18) M cur S cur value, the XYZ value of the target white point in the XYZ color space is calculated by formula (19), that is: X cur Y cur Z cur value, formula (18) - formula (19) is as follows:
  • (D ⁇ M Gain1 +1-D) is the gain matrix of the white point of the shooting environment light source and the reference white point in the LMS color space with a color adaptability of D.
  • Step S803 the electronic device calculates the color adaptation transformation matrix CA according to the L cur M cur S cur value of the target white point and the L dst M dst S dst value of the reference white point.
  • the L dst M dst S dst value is the LMS value of the reference white point in the LMS color space
  • the electronic device can calculate the chromatic adaptation conversion matrix CA according to the formula (20).
  • the chromatic adaptation conversion matrix CA is the second parameter, and the formula (20) as follows:
  • step S801-step S803 exemplarily described a specific flow for calculating the CA matrix of an electronic device. It should be understood that after the electronic device calculates the chromaticity information of the white point of the shooting environment light source through the white balance algorithm (the electronic device completes the execution After step S701), before the electronic device performs chromatic adaptation processing on the third image, execute step S801-step S803.
  • the chromatic adaptation conversion matrix CA is a parameter related to the LMS color space, and the chromatic adaptation conversion matrix CA has a corresponding relationship with the t1 value and the y1 value, and the chromatic adaptation conversion matrix CA
  • the matrix CA can identify the light source information of the ambient light source in the LMS color space when shooting. Due to the conversion relationship between the LMS color space and the XYZ color space, it can be understood that the color adaptation conversion matrix CA is also a parameter related to the XYZ color space, and the color adaptation conversion matrix CA can identify the light source of the ambient light source in the XYZ color space when shooting information.
  • the electronic device can adjust the LMS value of the third image through the CA matrix, so as to obtain a color-adapted fourth image.
  • the electronic device can adjust the LMS value of the third image in the LMS color space through the formula (21) to obtain the fourth image, and the formula (21) is as follows:
  • Step S707 the electronic device converts the fourth image from the LMS color space to the XYZ color space to obtain a second converted image.
  • the electronic device may convert the fourth image from the LMS color space to the XYZ color space through the formula (22) to obtain the second converted image, and the formula (22) is as follows:
  • Mcat 2 is an LMS-to-XYZ matrix, which is used to convert the image from the LMS color space to the XYZ color space.
  • Mcat 2 can be:
  • Step S708 the electronic device converts the second converted image from the XYZ color space to the sRGB color space to obtain a third converted image.
  • the second converted image is an image in the XYZ color space under the target white point
  • the electronic device needs to convert the second converted image from the XYZ color space to the sRGB color space to obtain a third converted image, so that the electronic device can subsequently A step of performing other image processing such as gamma correction processing or tone mapping on the third converted image.
  • the electronic device can convert the third image from the XYZ color space to the sRGB color space through the formula (23), and the formula (23) is as follows:
  • M 2 is the conversion matrix for converting the image from the XYZ color space to the sRGB color space, and M 2 can be:
  • Step S709 the electronic device performs RGB color space image processing on the third converted image to obtain a fourth converted image.
  • the RGB color space image processing includes performing DRC (Dynamic Range Compression) processing and/or Gamma (GAMMA) processing on the third converted image.
  • DRC Dynamic Range Compression
  • GAMMA Gamma
  • Step S710 the electronic device converts the fourth converted image from the sRGB color space to the YUV color space to obtain a fifth converted image.
  • Step S711 The electronic device performs YUV color space processing on the fifth converted image to obtain a target image.
  • the YUV color space image processing includes performing tone mapping processing (Tomapping processing) and/or 3D LUT processing on the image.
  • tone mapping processing Tomapping processing
  • 3D LUT processing 3D LUT processing
  • the electronic device may convert the processed image into a JPEG format to obtain the target image.
  • step S701 to step S711 have described the specific flow of the color adaptation process performed by the electronic device on the image.
  • the electronic device calculates the color adaptation transformation matrix CA by querying the correlated color temperature transformation table (CCT Shift Table) and the D uv transformation table (D uv Shift Table), and then performs the third
  • the image is chromatically adjusted to obtain the fourth image, and then the fourth image is converted from the LMS color space to the sRGB color space to obtain the third converted image, and then a series of image processing is performed on the third converted image to obtain the target image.
  • the electronic device can capture the correlated color temperature CCT src of the ambient light source and the D uv of the white point of the ambient light source, namely: D uv_src , in the preset correlated color temperature conversion table (CCT Shift Table) and D uv conversion table (D uv Shift Table ) to find the correlated color temperature CCT cur of the target white point and D uv of the target white point, namely: D uv_cur .
  • CCT Shift Table preset correlated color temperature conversion table
  • D uv Shift Table D uv Shift Table
  • the electronic device can construct a three-dimensional correlated color temperature conversion table (CCT Shift Table) and D uv conversion table (D uv Shift Table) according to the above formula (7)-formula (19) and the relevant conversion formulas of CCT, D uv and XYZ values, CCT cur and D uv_cur can be obtained in the CCT Shift Table and D uv Shift Table by shooting the Lv, CCT src and D uv_src of the ambient light source, and then through the conversion formula of CCT cur and D uv_cur and x 1 value and y 1 value, Obtain the x 1 value and y 1 value, so as to calculate the X cur Y cur Z cur value of the target white point in the XYZ color space based on the x 1 value and y 1 value.
  • CCT Shift Table three-dimensional correlated color temperature conversion table
  • D uv Shift Table D uv Shift Table
  • the electronic device can calculate the D uv_src of the white point of the shooting environment light source based on the x 1 value and the y 1 value. It should be understood that there are various calculation methods of D uv_src , and this embodiment of the present application only does one of the calculation methods of D uv_src As an exemplary illustration, the embodiment of the present application does not impose any limitation on the method used by the electronic device to calculate D uv_src .
  • the specific method for electronic equipment to calculate D uv_src is as follows:
  • the electronic device can calculate the u 1 value and v 1 value of the white point of the shooting environment light source under the uv chromaticity diagram according to the formula (24) and the formula (25).
  • the formula (24) and the formula (25) are as follows:
  • u 1 (4*x 1 )/(-2*x 1 +12*y 1 +3) (24);
  • v 1 (6*y 1 )/(-2*x 1 +12*y 1 +3) (25);
  • the electronic device can calculate the third parameter L Fp , the fourth parameter a 1 and the fifth parameter L BB according to the formula (26) to the formula (28), and the formula (26) to the formula (28) are as follows:
  • k 06 , k 05 , k 04 , k 03 , k 02 , k 01 , and k 00 are constants.
  • the electronic device can calculate the correlated color temperature CCT src of the white point of the ambient light source based on the formula (30), and the formula (30) is as follows:
  • T 2 T 1 - ⁇ T c1 .
  • T 1 1/(k 16 *a 6 +k 15 *a 5 +k 14 *a 4 +k 13 *a 3 +k 12 *a 2 +k 11 *a+k 10 );
  • ⁇ T c1 (k 36 *a 6 +k 35 *a 5 +k 34 *a 4 +k 33 *a 3 +k 32 *a 2 +k 31 *a+k 30 )*(L BB +0.01)/ L Fp *D uv_cur /0.01.
  • T 1 1/(k 26 *a 6 +k 25 *a 5 +k 24 *a 4 +k 23 *a 3 +k 22 *a 2 +k 21 *a+k 20 );
  • ⁇ T c1 (k 46 *a 6 +k 45 *a 5 +k 44 *a 4 +k 43 *a 3 +k 42 *a 2 +k 41 *a+k 40 )*(L BB +0.01)/ L Fp *D uv_cur /0.01.
  • ⁇ T c2 (k 56 *c 6 +k 55 *c 5 +k 54 *c 4 +k 53 *c 3 +k 52 *c 2 +k 51 *c+k 50 ).
  • c log(T 2 ), k 10 to k 41 , k 20 to k 26 , k 30 to k 36 , k 40 to k 46 , k 50 to k 56 , and k 60 to k 66 are constants.
  • the electronic device can calculate the D uv_cur of the target white point through the D uv Shift Table. Then, the electronic device can calculate the X cur Y cur Z cur value of the target white point in the XYZ color space through CCT cur and D uv_cur .
  • the electronic device calculates the x 2 value and y 2 value of the black body radiation light when the color temperature is CCT cur .
  • the specific process is: the electronic device can calculate the black body radiation light at XYZ
  • the XYZ values on the color space, formula (31) ⁇ formula (33) are as follows:
  • X2 is the X value of the blackbody radiation light in the XYZ color space
  • Y2 is the Y value of the blackbody radiation light in the XYZ color space
  • Z2 is the Z value of the blackbody radiation light in the XYZ color space
  • k is a constant.
  • the electronic device can calculate the x 2 value and y 2 value of the blackbody radiation light on the xy chromaticity diagram based on X 2 Y 2 Z 2 , the calculation formulas of the x 2 value and y 2 value can refer to the above formula (9) and Formula (10), which is not repeated in this embodiment of the present application.
  • the electronic device converts the x 2 value and y 2 value into u 2 value and v 2 value on the uv chromaticity diagram
  • the calculation formula of u 2 value and v 2 value can refer to the above formula (24) and formula (25) , the embodiment of the present application will not be repeated here.
  • the electronic device can calculate the blackbody radiation curve L 1 ( ⁇ ) whose color temperature is CCT cur +Delta_T (the embodiment of this application takes Delta_T as 0.01 as an example for illustration) based on the above formula (31), so as to calculate the color temperature as The u 3 value and v 3 value of the black body radiation of CCT cur +Delta_T on the CIE uv chromaticity diagram.
  • the electronic device can calculate the u cur value and v cur value of the target white point in the CIE uv chromaticity diagram according to formula (35) to formula (36).
  • Formula (35) to formula (36) are as follows:
  • the electronic device can calculate the x cur value and y cur value of the target white point in the CIE xy chromaticity diagram through formula (37) to formula (38).
  • Formula (37) to formula (38) are as follows:
  • the electronic device can calculate X cur Y cur Z cur of the target white point based on the x cur value and y cur value.
  • the electronic device calculates the X src Y src Z src value of the white point of the shooting environment light source in the XYZ color space according to the x 1 value and y 1 value in the CIExy chromaticity diagram of the shooting environment light source white point, the embodiment of the present application I won't repeat them here.
  • the electronic device After the electronic device calculates X cur Y cur Z cur , it can convert X cur Y cur Z cur into L cur M cur S cur , and convert X cur Y cur Z cur into L cur M cur S cur . You can refer to the above formula ( 16), the embodiment of the present application will not be repeated here.
  • the electronic device may calculate the CA matrix according to the method described in step S803 above, and then use the CA matrix to adjust the third image according to the above formula (21) to obtain the fourth image.
  • step S707-step S711 to obtain the target image.
  • the electronic device can perform chromatic adaptation processing on the third image in the LMS color space through a nonlinear method.
  • the electronic device uses a nonlinear method to perform color adaptation processing on the third image in the LMS color space.
  • the chromatic adaptation process is exemplarily illustrated, and the electronic device can use the formula:
  • L cur [D(L dst /L src )+1-D] ⁇ L src ;
  • M cur [D(M dst /M src )+1-D] ⁇ M src ;
  • M 4i (M cur /M dst ) ⁇ M 3i
  • step S707-step S711 the electronic device executes step S707-step S711 to obtain the target image.
  • the electronic device calculates the chromaticity information of the shooting environment light source through a white balance algorithm, and performs white balance processing and color restoration on the image to obtain a processed image, which is an image under the reference light source, and The image is converted to LMS color space. Then, the electronic device calculates the chromaticity transformation matrix based on the chromaticity information of the shooting environment light source and the chromatic adaptation algorithm, and uses the chromatic adaptation transformation matrix to adjust the image in the LMS color space, so as to obtain the situation where the chromaticity D is 1 Next, the chromatic adaptation image close to the visual effect of human eyes is obtained. When the chromatic adaptation degree D is 0, the chromatic adaptation image close to the visual effect of human eyes is obtained. When the chromatic adaptation degree D is 0-1, it is close to the Chroma-adapted images for visual effects.
  • FIG. 7 introduces the flow chart of the color adaptation process performed by the electronic device on the image.
  • the electronic device can adjust the second image in the sRGB color space through the target matrix, so as to obtain the color-adapted, A third converted image in the sRGB color space, and a series of related image processing is performed on the third converted image, and finally the target image is obtained.
  • the electronic device adjusts the second image through the target matrix.
  • FIG. 11A is a frame diagram of another image processing provided by the embodiment of the present application. The specific process is as follows:
  • Step S1101A The electronic device performs light source prediction through the RAW image output by the camera, and calculates R g , B g of the white point of the ambient light source and RGB values of the white point of the ambient light source.
  • Step S1102A The electronic device calculates the x 1 value and y 1 value of the white point of the ambient light source according to the RGB value of the white point of the ambient light source, and then calculates the CCT src and D uv_src of the ambient light source according to the x 1 value and y 1 value.
  • Step S1103A The electronic device performs CCM interpolation according to the CCT of the shooting environment light source to obtain a color correction matrix CCM.
  • Step S1104A The electronic device performs white balance processing on the RAW image according to 1/R g and 1/B g , and obtains a RAW image after white balance processing.
  • Step S1105A the electronic device performs color restoration processing on the RAW image after the white balance processing by CCM to obtain a second image in the sRGB color space.
  • step S1101A-step S1105A please refer to the relevant description of the above-mentioned step S601-step S605, which will not be repeated in this embodiment of the present application.
  • Step S1106A the electronic device adjusts the second image through the target matrix to obtain a third converted image in the sRGB color space.
  • the electronic device can adjust the second image through the formula (39) to obtain the third converted image, and the formula (39) is as follows:
  • CA 1 M 2 ⁇ Mcat 2 ⁇ CA ⁇ Mcat 1 ⁇ M 1 .
  • M 1 is the conversion matrix from sRGB color space to XYZ color space
  • M 2 is the conversion matrix from XYZ color space to sRGB color space
  • Mcat 1 is the conversion matrix from XYZ color space to LMS color space
  • Mcat 2 is the LMS color space
  • CA is the color adaptation transformation matrix, and CA can be obtained through the above formula (7) - formula (20), and will not be repeated in this embodiment of the present application.
  • Step S1107A The electronic device performs RGB color space image processing on the third converted image to obtain a fourth converted image.
  • the RGB color space image processing includes performing DRC (Dynamic Range Compression) processing and/or Gamma (GAMMA) processing on the third converted image.
  • DRC Dynamic Range Compression
  • GAMMA Gamma
  • Step S1108A the electronic device converts the fourth converted image from the sRGB color space to the YUV color space to obtain a fifth converted image.
  • Step S1109A the electronic device performs YUV color space processing on the fifth converted image to obtain a target image.
  • the electronic device may convert the processed image into a JPEG format to obtain the target image.
  • step S1107A-step S1109A please refer to the relevant description of the above-mentioned step S709-step S711, which will not be repeated in this embodiment of the present application.
  • FIG. 11B is a flow chart of another image processing method provided by the embodiment of the present application. The specific process is as follows:
  • Step S1101B The electronic device starts the camera application in response to the first operation.
  • Step S1102B The electronic device calculates the chromaticity information of the white point of the shooting environment light source through a white balance algorithm.
  • Step S1103B The electronic device performs white balance processing and color restoration processing on the RAW image output by the camera to obtain a second image.
  • step S1101B-step S1103B please refer to step S701-step S703, which will not be repeated in this embodiment of the present application.
  • Step S1104B the electronic device adjusts the second image through the target matrix to obtain a third converted image in the sRGB color space.
  • step S1104B please refer to the relevant description in the above-mentioned step S1106A, which will not be repeated in this embodiment of the present application.
  • Step S1105B The electronic device performs RGB color space image processing on the third converted image to obtain a fourth converted image.
  • Step S1106B the electronic device converts the fourth converted image from the sRGB color space to the YUV color space to obtain a fifth converted image.
  • Step S1107B The electronic device performs YUV color space processing on the fifth converted image to obtain a target image.
  • the electronic device may convert the processed image into a JPEG format to obtain the target image.
  • step S1105B-step S1107B please refer to step S709-step S711, which will not be repeated in this embodiment of the present application.
  • the third converted image in the sRGB color space after color adaptation processing is obtained, and the third converted image is subjected to a series of image processing to obtain an approximate
  • the color adaptation image of the visual effect of the human eye also reduces the calculation times of the electronic equipment and saves the calculation resources of the electronic equipment.
  • Fig. 12 is a flow chart of another image processing method provided by the embodiment of the present application, and the specific process is as follows:
  • Step S1201 The electronic device starts a camera application in response to a first operation.
  • Step S1202 The electronic device calculates the chromaticity information of the white point of the shooting environment light source through a white balance algorithm.
  • Step S1203 the electronic device performs white balance processing and color restoration processing on the RAW image output by the camera to obtain a second image.
  • step S1201 to step S1203 please refer to the related description of above steps S701 to step S703, which will not be repeated in this embodiment of the present application.
  • Step S1204 In response to the second operation, the electronic device converts the first target image from the sRGB color space to the XYZ color space to obtain a first converted image.
  • the second operation may be the single-click operation on the chromatic adaptation processing control 404 in FIG. 4A
  • the first target image is an image that is currently processed by the electronic device for white balance processing and color restoration processing.
  • Step S1205 the electronic device converts the first converted image from the XYZ color space to the LMS color space to obtain a third image.
  • Step S1206 The electronic device performs color adaptation processing on the third image in the LMS color space to obtain a fourth image.
  • Step S1207 The electronic device converts the fourth image from the LMS color space to the XYZ color space to obtain a second converted image.
  • Step S1208 the electronic device converts the second converted image from the XYZ color space to the sRGB color space to obtain a third converted image.
  • Step S1209 The electronic device performs RGB color space image processing on the third converted image to obtain a fourth converted image.
  • Step S1210 the electronic device converts the fourth converted image from the sRGB color space to the YUV color space to obtain a fifth converted image.
  • Step S1211 The electronic device performs YUV color space processing on the fifth converted image to obtain a target image.
  • the electronic device may convert the processed image into a JPEG format to obtain the target image.
  • step S1204 to step S1211 please refer to the related description of above steps S704 to step S711, which will not be repeated in this embodiment of the present application.
  • the electronic device calculates the chromatic adaptation transformation matrix of the image after starting the camera, and saves the photo and its corresponding chromatic adaptation transformation matrix after the user takes a photo.
  • the electronic device detects a click operation on the chromatic adaptation processing control in the gallery, the electronic device obtains the chromatic adaptation transformation matrix of the photo, performs chromatic adaptation processing on the photo through the matrix, and obtains the processed photo.
  • Fig. 13 is a flow chart of another image processing method provided by the embodiment of the present application, and the specific process is as follows:
  • Step S1301 The electronic device displays the first interface in response to the third operation.
  • the third operation may be clicking a first application image in the gallery application, where the first application image is a photo taken by a camera, and the first interface may be a browsing interface of the first application image.
  • the browsing interface It may be the user interface 52 in the embodiment of FIG. 5C described above.
  • Step S1302 the electronic device detects a second operation on the first function control in the first interface, and in response to the operation, the electronic device converts the first application image from the sRGB color space to the XYZ color space to obtain a first converted image.
  • the first function control may be the "chromatic adaptation processing" function box in the above-mentioned embodiment of FIG. 5C
  • the second operation may be a click operation for the "chromatic adaptation processing" functional box in the above-mentioned embodiment of FIG. 5C
  • the electronic device converts the first application image from the sRGB color space to the XYZ color space.
  • the electronic device converts the second image from the sRGB color space described in step S704 in the embodiment of FIG. 7 above.
  • To the XYZ color space obtain the relevant description of the first converted image, which will not be repeated in this embodiment of the present application.
  • Step S1303 the electronic device converts the first converted image from the XYZ color space to the LMS color space to obtain a third image.
  • step S1303 please refer to the above step S705, which will not be repeated in this embodiment of the present application.
  • Step S1304 The electronic device reads the chromatic adaptation transformation matrix of the first application image.
  • the electronic device takes pictures with the camera, and in the process of obtaining the first application image, the electronic device calculates the chromatic adaptation transformation matrix CA of the first application image, and saves the first application image and its corresponding chromatic adaptation transformation matrix in the In the image or memory, when the electronic device uses the chromatic adaptation transformation matrix to perform chromatic adaptation processing on the first application image, the electronic device can read the chromatic adaptation transformation matrix.
  • the electronic device uses the chromatic adaptation transformation matrix to perform chromatic adaptation processing on the first application image, the electronic device can read the chromatic adaptation transformation matrix.
  • step S1304 only needs to be executed before step S1305, and this embodiment of the present application does not limit the execution order of step S1304.
  • Step S1305 The electronic device performs color adaptation processing on the third image in the LMS color space to obtain a fourth image.
  • Step S1306 the electronic device converts the fourth image from the LMS space to the XYZ color space to obtain a second converted image.
  • Step S1307 the electronic device converts the second converted image from the XYZ color space to the sRGB color space to obtain a third converted image.
  • Step S1308 the electronic device performs RGB color space image processing on the third converted image to obtain a fourth converted image.
  • Step S1309 the electronic device converts the fourth converted image from the sRGB color space to the YUV color space to obtain a fifth converted image.
  • Step S1310 the electronic device performs YUV color space processing on the fifth converted image to obtain a target image.
  • the electronic device may convert the processed image into a JPEG format to obtain the target image.
  • step S1305-step S1310 For the relevant description of step S1305-step S1310, please refer to the relevant description of step S706-step S711 in the embodiment of FIG.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented using software, it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the present application will be generated in whole or in part.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, DSL) or wireless (eg, infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media.
  • the available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, a Solid State Disk).
  • the program can be stored in a computer-readable storage medium. When the program is executed, it can It includes the processes of the above-mentioned method embodiments.
  • the aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk, and other various media that can store program codes.

Landscapes

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

Abstract

本申请提出了一种图像处理方法及相关电子设备,该方法包括:检测到第一操作;响应于第一操作,电子设备启动摄像头;检测到第二操作;响应于第二操作,摄像头在第一环境光源下采集第一图像,所述第一图像为在第一颜色空间的图像;对第一图像进行第一图像处理,得到第二颜色空间的第二图像,第二颜色空间与第一颜色空间不同;对第二图像进行第二图像处理,得到目标图像;保存目标图像;其中,对第二图像进行第二图像处理包括:基于第一环境光源的第一参数得到第二参数,第一参数包括第一环境光源的白平衡参数,第二参数与第一参数具有对应关系,第二参数用于标识第一环境光源在第三颜色空间的光源信息,第三颜色空间与第一颜色空间和第二颜色空间均不同;基于第二参数对第二图像进行第二图像处理。

Description

一种图像处理方法及相关电子设备
本申请要求于2021年12月31日提交中国专利局、申请号为202111680029.5、发明名称为“一种图像色适应处理方法及相关电子设备”,2022年1月10日提交中国专利局、申请号为202210022487.8、发明名称为“一种图像处理方法及相关电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理领域,尤其涉及一种图像处理方法及相关电子设备。
背景技术
人眼具有颜色恒常性,即当照射物体表面光的颜色发生变化时,人们对该物体表面颜色的知觉仍然保持不变的知觉特性,由于摄像机内用于将光信号转化为电信号的电荷耦合元件电路(Charge-coupled Device,CCD)或CMOS电路没有办法像人眼一样会对光源的颜色变化进行修正。因此,需要通过白平衡算法来估计捕获图像光源的色度值,并通过估计的光源色度值来调整图像颜色,从而消除拍摄环境光源的色温对于图像颜色的影响,处理后的图像颜色不会受到拍摄环境光源的CCT的影响,从而导致图像发生偏色的问题。
发明内容
本申请实施例提供了一种图像处理方法,解决了在拍摄过程中,电子设备输出的图像中,拍摄对象的颜色与人眼真实观察的拍摄对象的颜色不一致的问题。
第一方面,本申请实施例提供了一种图像处理方法,应用于电子设备,该电子设备包括摄像头,该方法包括:检测到第一操作;响应于第一操作,该电子设备启动所述摄像头;检测到第二操作;响应于第二操作,该摄像头在第一环境光源下采集第一图像,第一图像为在第一颜色空间的图像,第一环境光源为所述第一图像采集时的至少一种环境光源;对第一图像进行第一图像处理,得到第二颜色空间的第二图像,第二颜色空间与第一颜色空间不同;对第二图像进行第二图像处理,得到目标图像;保存所述目标图像;其中,所述对第二图像进行第二图像处理,得到目标图像,包括:基于第一环境光源的第一参数得到第二参数,第二参数是与第三颜色空间相关的参数,第一参数包括所述第一环境光源的白平衡参数,所述第二参数与第一参数具有对应关系,第二参数用于标识第一环境光源在第三颜色空间的光源信息,第三颜色空间与所述第一颜色空间不同,第三颜色空间与第二颜色空间不同;基于第二参数对第二图像进行第二图像处理,得到目标图像。
在上述实施例中,电子设备通过白平衡算法计算拍摄环境光源的色度信息,并对图像进行白平衡处理和色彩还原,得到处理后的图像,处理后的图像为参考光源下的图像,并将该图像转换到LMS颜色空间。然后,电子设备基于拍摄环境光源的色度信息和色适应算法计算得到色适应转换矩阵,并使用该色适应转换矩阵调节在LMS颜色空间中的图像,从而得到接近人眼视觉效果的色适应图像。
结合第一方面,在一种可能实现的方式中,第一颜色空间为RAW空间,第二颜色空间为sRGB颜色空间,第三颜色空间为LMS颜色空间或者XYZ颜色空间。
结合第一方面,在一种可能实现的方式中,第一参数为第一环境光源在xy色度图上的x 1值和y 1值。
结合第一方面,在一种可能实现的方式中,对第一图像进行第一图像处理,得到第二颜色空间的第二图像,包括:根据公式
Figure PCTCN2022115486-appb-000001
对第一图像进行调节,得到调节后的第一图像;
Figure PCTCN2022115486-appb-000002
为第一图像的第i个像素的RGB值,
Figure PCTCN2022115486-appb-000003
为调节后的第一图像的第i个像素的RGB值,R gain=G/R,B gain=G/B,该RGB为第一环境光源在所述第一颜色空间中的RGB值;根据公式
Figure PCTCN2022115486-appb-000004
对调节后的第一图像进行调节,得到第二图像;CCM为基于第一参数得到的颜色校正矩阵,
Figure PCTCN2022115486-appb-000005
为第二图像在第二颜色空间下的第i个像素的RGB值。这样,电子设备可以将RAW空间中的第一图像转换为sRGB颜色空间(第二颜色空间)下的第二图像,从而使得电子设备可以将第二图像转换到LMS颜色空间,在LMS颜色空间下对图像进行色适应处理。
结合第一方面,在一种可能实现的方式中,基于第一环境光源的第一参数得到第二参数,包括:根据第一参数计算色适应度D;基于第一参数计算第一环境光源对应白点在所述第三颜色空间上的LMS值;通过公式
Figure PCTCN2022115486-appb-000006
计算增益矩阵,L dstM dstS dst为参考白点在第三颜色空间下的LMS值,参考白点对应的光源为参考光源L srcM srcS src值为第一环境光源对应白点在第三颜色空间下的LMS值;根据公式
Figure PCTCN2022115486-appb-000007
计算目标白点在第三颜色空间下的LMS值,目标白点对应的光源为目标光源,所述
Figure PCTCN2022115486-appb-000008
为第一环境光源对应白点在XYZ颜色空间下的XYZ值,
Figure PCTCN2022115486-appb-000009
是基于L srcM srcS src值得到的,Mcat 1为XYZ颜色空间转换到LMS颜色空间 的转换矩阵,
Figure PCTCN2022115486-appb-000010
为目标白点在第三颜色空间下的LMS值;通过公式
Figure PCTCN2022115486-appb-000011
计算第二参数,所述CA为第二参数。这样,电子设备在计算出CA之后,可以通过CA在LMS颜色空间下,对图像进行色适应处理,从而得到与人眼视觉效果一致的色适应图像。
结合第一方面,在一种可能实现的方式中,根据第一参数计算色适应度D,具体包括:根据公式
Figure PCTCN2022115486-appb-000012
计算第一变量,P xy为第一变量,x N为参考白点在xy色度图上的x值,y N为参考白点在xy色度图上的y值;根据公式
Figure PCTCN2022115486-appb-000013
计算第二变量,D c为第二变量;基于公式D=0.96·D c((1-e (-4.28·log La)) 406.5-1)+1,得到色适应度D,La为第一环境光源的亮度值。这样,电子设备可以通过色适应度D计算CA,从而通过CA在LMS颜色空间下,对图像进行色适应处理,从而得到与人眼视觉效果一致的色适应图像。
结合第一方面,在一种可能实现的方式中,基于第一参数计算第一环境光源对应白点在第三颜色空间上的LMS值,具体包括:基于公式
Figure PCTCN2022115486-appb-000014
计算第三变量,i y为第三变量;根据公式X src=x 1·Y src·i y和公式Z src=Y src·(1-x 1-y 1)·i y计算第一环境光源对应白点在XYZ颜色空间上的XYZ值,X srcY srcZ src为第一环境光源对应白点在XYZ颜色空间上的XYZ值,所述Y src=m,所述m为所述电子设备预设的图像亮度;通过公式
Figure PCTCN2022115486-appb-000015
计算第一环境光源对应白点在第三颜色空间上的LMS值,
Figure PCTCN2022115486-appb-000016
为第一环境光源对应白点在第三颜色空间上的LMS值,Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵。这样,有利于电子设备通过第一环境光源对应白点在第三颜色空间上的LMS值计算CA,从而通过CA在LMS颜色空间下,对图像进行色适应处理,从而得到与人眼视觉效果一致的色适应图像。
结合第一方面,在一种可能实现的方式中,基于第二参数对第二图像进行第二图像处理,得到目标图像,具体包括:将第二图像进行第三图像处理,得到第三图像;根据公式
Figure PCTCN2022115486-appb-000017
对第三图像进行色适应处理,得到第四图像;CA为第二参数,
Figure PCTCN2022115486-appb-000018
为第三图像在第三颜色空间下的LMS值,
Figure PCTCN2022115486-appb-000019
为第四图像在第三颜色空间下的LMS值;将第 四图像进行第四图像处理,得到目标图像。这样,电子设备通过CA在LMS颜色空间下对图像进行色适应处理,从而得到与人眼视觉效果一致的色适应图像。
结合第一方面,在一种可能实现的方式中,将第二图像进行第三图像处理,得到第三图像,具体包括:根据公式
Figure PCTCN2022115486-appb-000020
将第二图像由第二颜色空间转换到XYZ颜色空间,得到第一转换图像;
Figure PCTCN2022115486-appb-000021
为第二图像在第二颜色空间下,第i个像素的RGB值,M 1为第二颜色空间转换到XYZ颜色空间的转换矩阵,
Figure PCTCN2022115486-appb-000022
为第一转换图像在XYZ颜色空间下的第i个像素的XYZ值;基于公式
Figure PCTCN2022115486-appb-000023
将第一转换图像由XYZ颜色空间转换到第三颜色空间,得到第三图像;Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵,
Figure PCTCN2022115486-appb-000024
为第三图像在所述第三颜色空间下的LMS值。这样,电子设备将第二图像由sRGB颜色空间转换到了LMS颜色空间。
结合第一方面,在一种可能实现的方式中,将第四图像进行第四图像处理,得到目标图像,具体包括:根据公式
Figure PCTCN2022115486-appb-000025
将第四图像由第三颜色空间转换到XYZ颜色空间,得到第二转换图像;
Figure PCTCN2022115486-appb-000026
为第二转换图像在XYZ颜色空间下的第i个像素的XYZ值,Mcat 2为LMS颜色空间转换到XYZ颜色空间的转换矩阵;通过公式
Figure PCTCN2022115486-appb-000027
将第二转换图像由XYZ颜色空间转换到第二颜色空间,得到第三转换图像,M 2用于将第二转换图像由XYZ颜色空间转换到第二颜色空间,
Figure PCTCN2022115486-appb-000028
为第三转换图像在第二颜色空间中,第i个像素的RGB值;将第三转换图像进行RGB颜色空间图像处理,得到第四转换图像;将第四转换图像从第二颜色空间转换到YUV颜色空间得到第五转换图像;将第五转换图像 进行YUV颜色空间处理,得到目标图像。
结合第一方面,在一种可能实现的方式中,基于第二参数对第二图像进行第二图像处理,得到目标图像,具体包括:根据公式
Figure PCTCN2022115486-appb-000029
对第二图像进行第五图像处理,得到第三转换图像;
Figure PCTCN2022115486-appb-000030
为第三转换图像在第二颜色空间中,第i个像素的RGB值,
Figure PCTCN2022115486-appb-000031
为第二图像在第二颜色空间下中,第i个像素的RGB值,CA 1为目标矩阵;将第三转换图像进行RGB颜色空间图像处理,得到第四转换图像;将第四转换图像从第二颜色空间转换到YUV颜色空间得到第五转换图像;将第五转换图像进行YUV颜色空间处理,得到目标图像;其中,CA 1=M 2·Mcat 2·CA·Mcat 1·M 1;M 1为第二颜色空间转换到XYZ颜色空间的转换矩阵,M 2为XYZ颜色空间转换到第一颜色空间的转换矩阵,Mcat 1为XYZ转换到LMS颜色空间的转换矩阵、Mcat 2为LMS颜色空间转换到XYZ颜色空间的转换矩阵、CA为第二参数。在上述实施例中,通过将第二图像与目标矩阵相乘,从而得到了色适应处理后的、在sRGB颜色空间下的第三转换图像,节约了电子设备的计算资源。
第二方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该电子设备执行:检测到第一操作;响应于第一操作,启动所述摄像头;检测到第二操作;响应于第二操作,通过该摄像头在第一环境光源下采集第一图像,第一图像为在第一颜色空间的图像,第一环境光源为所述第一图像采集时的至少一种环境光源;对第一图像进行第一图像处理,得到第二颜色空间的第二图像,第二颜色空间与第一颜色空间不同;对第二图像进行第二图像处理,得到目标图像;保存所述目标图像;其中,所述对第二图像进行第二图像处理,得到目标图像,包括:基于第一环境光源的第一参数得到第二参数,第二参数是与第三颜色空间相关的参数,第一参数包括所述第一环境光源的白平衡参数,所述第二参数与第一参数具有对应关系,第二参数用于标识第一环境光源在第三颜色空间的光源信息,第三颜色空间与所述第一颜色空间不同,第三颜色空间与第二颜色空间不同;基于第二参数对第二图像进行第二图像处理,得到目标图像。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:对第一图像进行第一图像处理,得到第二颜色空间的第二图像,包括:根据公式
Figure PCTCN2022115486-appb-000032
对第一图像进行调节,得到调节后的第一图 像;
Figure PCTCN2022115486-appb-000033
为第一图像的第i个像素的RGB值,
Figure PCTCN2022115486-appb-000034
为调节后的第一图像的第i个像素的RGB值,R gain=G/R,B gain=G/B,该RGB为第一环境光源在所述第一颜色空间中的RGB值;根据公式
Figure PCTCN2022115486-appb-000035
对调节后的第一图像进行调节,得到第二图像;CCM为基于第一参数得到的颜色校正矩阵,
Figure PCTCN2022115486-appb-000036
为第二图像在第二颜色空间下的第i个像素的RGB值。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:基于第一环境光源的第一参数得到第二参数,包括:根据第一参数计算色适应度D;基于第一参数计算第一环境光源对应白点在所述第三颜色空间上的LMS值;通过公式
Figure PCTCN2022115486-appb-000037
计算增益矩阵,L dstM dstS dst为参考白点在第三颜色空间下的LMS值,参考白点对应的光源为参考光源L srcM srcS src值为第一环境光源对应白点在第三颜色空间下的LMS值;根据公式
Figure PCTCN2022115486-appb-000038
Figure PCTCN2022115486-appb-000039
计算目标白点在第三颜色空间下的LMS值,目标白点对应的光源为目标光源,所述
Figure PCTCN2022115486-appb-000040
为第一环境光源对应白点在XYZ颜色空间下的XYZ值,
Figure PCTCN2022115486-appb-000041
是基于L srcM srcS src值得到的,Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵,
Figure PCTCN2022115486-appb-000042
为目标白点在第三颜色空间下的LMS值;通过公式
Figure PCTCN2022115486-appb-000043
计算第二参数,所述CA为第二参数。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:根据第一参数计算色适应度D,具体包括:根据公式
Figure PCTCN2022115486-appb-000044
计算第一变量,P xy为第一变量,x N为参考白点在xy色度图上的x值,y N为参考白点在xy色度图上的y值;根据公式
Figure PCTCN2022115486-appb-000045
计算第二变量,D c为第二变量;基于公式D=0.96·D c((1-e (-4.28·log La)) 406.5-1)+1,得到色适应度D,La为第一环境光源的亮度值。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:基于第一参数计算第一环境光源对应白点在第三颜色空间上的LMS值,具体包括:基于公式
Figure PCTCN2022115486-appb-000046
计算第三变量,i y为第三变量;根据公式X src=x 1·Y src·i y和公式Z src=Y src·(1-x 1-y 1)·i y计算第一环境光源对应白点在XYZ颜色空间上的XYZ值,X srcY srcZ src为第一环境光源对应白点在XYZ颜色空间上的XYZ值,所述Y src=m,所述m为所述电子设备预设的图像亮度;通过公式
Figure PCTCN2022115486-appb-000047
计算第一环境光源对应白点在第三颜色空间上的LMS值,
Figure PCTCN2022115486-appb-000048
为第一环境光源对应白点在第三颜色空间上的LMS值,Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:基于第二参数对第二图像进行第二图像处理,得到目标图像,具体包括:将第二图像进行第三图像处理,得到第三图像;根据公式
Figure PCTCN2022115486-appb-000049
对第三图像进行色适应处理,得到第四图像;CA为第二参数,
Figure PCTCN2022115486-appb-000050
为第三图像在第三颜色空间下的LMS值,
Figure PCTCN2022115486-appb-000051
为第四图像在第三颜色空间下的LMS值;将第四图像进行第四图像处理,得到目标图像。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:将第二图像进行第三图像处理,得到第三图像,具体包括:根据公式
Figure PCTCN2022115486-appb-000052
将第二图像由第二颜色空间转换到XYZ颜色空间,得到第一转换图像;
Figure PCTCN2022115486-appb-000053
为第二图像在第二颜色空间下,第i个像素的RGB值,M 1为第二颜色空间转换到XYZ 颜色空间的转换矩阵,
Figure PCTCN2022115486-appb-000054
第一转换图像在XYZ颜色空间下的第i个像素的XYZ值;基于公式
Figure PCTCN2022115486-appb-000055
将第一转换图像由XYZ颜色空间转换到第三颜色空间,得到第三图像;Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵,
Figure PCTCN2022115486-appb-000056
为第三图像在所述第三颜色空间下的LMS值。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:将第四图像进行第四图像处理,得到目标图像,具体包括:根据公式
Figure PCTCN2022115486-appb-000057
将第四图像由第三颜色空间转换到XYZ颜色空间,得到第二转换图像;
Figure PCTCN2022115486-appb-000058
为第二转换图像在XYZ颜色空间下的第i个像素的XYZ值,Mcat 2为LMS颜色空间转换到XYZ颜色空间的转换矩阵;通过公式
Figure PCTCN2022115486-appb-000059
将第二转换图像由XYZ颜色空间转换到第二颜色空间,得到第三转换图像,M 2用于将第二转换图像由XYZ颜色空间转换到第二颜色空间,
Figure PCTCN2022115486-appb-000060
为第三转换图像在第二颜色空间中,第i个像素的RGB值;将第三转换图像进行RGB颜色空间图像处理,得到第四转换图像;将第四转换图像从第二颜色空间转换到YUV颜色空间得到第五转换图像;将第五转换图像进行YUV颜色空间处理,得到目标图像。
结合第二方面,在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:基于第二图像对第二图像进行第二图像处理,得到目标图像,具体包括:根据公式
Figure PCTCN2022115486-appb-000061
对第二参数进行第五图像处理,得到第三转换图像;
Figure PCTCN2022115486-appb-000062
为第三转换图像在第二颜色空间中,第i个像素的RGB值,
Figure PCTCN2022115486-appb-000063
为第二图像在第二颜色空间 下中,第i个像素的RGB值,CA 1为目标矩阵;将第三转换图像进行RGB颜色空间图像处理,得到第四转换图像;将第四转换图像从第二颜色空间转换到YUV颜色空间得到第五转换图像;将第五转换图像进行YUV颜色空间处理,得到目标图像;其中,CA 1=M 2·Mcat 2·CA·Mcat 1·M 1;M 1为第二颜色空间转换到XYZ颜色空间的转换矩阵,M 2为XYZ颜色空间转换到第一颜色空间的转换矩阵,Mcat 1为XYZ转换到LMS颜色空间的转换矩阵、Mcat 2为LMS颜色空间转换到XYZ颜色空间的转换矩阵、CA为第二参数。
第三方面,本申请实施例提供了一种电子设备,包括:触控屏、摄像头、一个或多个处理器和一个或多个存储器;所述一个或多个处理器与所述触控屏、所述摄像头、所述一个或多个存储器耦合,所述一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,使得所述电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。
第四方面,本申请实施例提供了一种芯片***,该芯片***应用于电子设备,该芯片***包括一个或多个处理器,该处理器用于调用计算机指令以使得该电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。
第五方面,本申请实施例提供了一种包含指令的计算机程序产品,当该计算机程序产品在电子设备上运行时,使得该电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。
第六方面,本申请实施例提供了一种计算机可读存储介质,包括指令,当该指令在电子设备上运行时,使得该电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。
附图说明
图1A-图1B为本申请实施例提供的在不对图像进行白平衡调节的情况下,不同光源条件下的一组示例性图像;
图1C为本申请实施例提供的经过白平衡处理后的图像;
图2为本申请实施例提供的电子设备100的硬件结构示意图;
图3A-图3D为本申请实施例提供的一组电子设备100的示例性用户界面;
图4A-图4D为本申请实施例提供的另一组电子设备100的示例性界面;
图5A-图5E为本申请实施例提供的另一组电子设备100的示例性用户界面;
图5F为本申请实施例提供的一种对拍摄环境中白板的人眼视觉效果图;
图6为本申请实施例提供的一种图像处理的框架图;
图7为本申请实施例提供的一种图像处理方法的流程图;
图8为本申请实施例提供的一种电子设备计算色适应转换矩阵的流程图;
图9为本申请实施例提供的一组示例性CCT Shift Table和D uvShift Table;
图10为本申请实施例提供的CIE1931 xyz标注观察者曲线图;
图11A为本申请实施例提供的另一种图像处理的框架图;
图11B为本申请实施例提供的另一种图像处理方法的流程图;
图12为本申请实施例提供的另一种图像处理方法的流程图;
图13为本申请实施例提供的另一种图像处理方法的流程图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或者特性可以包含在本实施例申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是相同的实施例,也不是与其它实施例互斥的独立的或是备选的实施例。本领域技术人员可以显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及所述附图中术语“第一”、“第二”、“第三”等是区别于不同的对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如,包含了一系列步骤或单元,或者可选地,还包括没有列出的步骤或单元,或者可选地还包括这些过程、方法、产品或设备固有的其它步骤或单元。
附图中仅示出了与本申请相关的部分而非全部内容。在更加详细地讨论示例性实施例之前,应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各项操作(或步骤)描述成顺序的处理,但是其中的许多操作可以并行地、并发地或者同时实施。此外,各项操作的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。
在本说明书中使用的术语“部件”、“模块”、“***”、“单元”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件或执行中的软件。例如,单元可以是但不限于在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或分布在两个或多个计算机之间。此外,这些单元可从在上面存储有各种数据结构的各种计算机可读介质执行。单元可例如根据具有一个或多个数据分组(例如来自与本地***、分布式***和/或网络间的另一单元交互的第二单元数据。例如,通过信号与其它***交互的互联网)的信号通过本地和/或远程进程来通信。
下面,对本申请实施例涉及的一些技术用语进行解释。
(1)普朗克轨迹:在辐射作用下既不反射也不完全投射,而能把落在它上面的辐射全部吸收的物体称为黑体或完全辐射体。当黑体连续加热时,它的相对光谱功率分布的最大值将向短波方向移动,相应的光色将按照红、黄、白、蓝的顺序进行变化,在不同温度下,黑体对应的光色变化在色度图上形成的弧形轨迹,叫做黑体轨迹或普朗克轨迹。
(2)相关色温(Correlated Colour Temperature,CCT):是指与具有相同亮度刺激的颜色最相近的黑体辐射体的温度,用K氏温度表示,用于描述位于普朗克轨迹附近的光的颜色的度量。除热辐射光源以外的其它光源具有线状光谱,其辐射特性与黑体辐射特性差别较大,所以这些光源的光色在色度图上不一定准确地落在黑体轨迹上,对这样一类光源,通常用CCT来描述光源的颜色特性。
(3)色度距离(D uv):是指从测试光源的色度值(u,v)到普朗克轨迹上的最近点的距离,D uv表征了测试光源的色度值(u,v)与普朗克轨迹的颜色偏移(绿色或粉红色)和方向的信息。
(4)亮度值(Lighting Value,Lv):用于估计环境亮度,其具体计算公式如下:
Figure PCTCN2022115486-appb-000064
其中,Exposure为曝光时间,Aperture为光圈大小,Iso为感光度,Luma为图像在XYZ颜色空间中,Y的平均值。
人眼具有颜色恒常性,即当照射物体表面光的颜色发生变化时,人们对该物体表面颜色的知觉仍然保持不变的知觉特性,由于摄像机内用于将光信号转化为电信号的电荷耦合元件电路(Charge-coupled Device,CCD)或CMOS电路没有办法像人眼一样会对光源的颜色变化进行修正。因此,需要通过白平衡算法来估计捕获图像光源的色度值,并通过估计的光源色度值来调整图像颜色,从而消除拍摄环境光源的色温对于图像颜色的影响,处理后的图像颜色不会受到拍摄环境光源的CCT的影响,从而导致图像发生偏色的问题。
例如,图1A为在不对图像进行白平衡调节的情况下,在不同光源条件下的一组示例性图像。如图1A所示,图像1、图像2和图像3为同一拍摄环境拍摄的图像,在该拍摄环境中存在电灯11和白板12,且电灯11为该拍摄环境的唯一光源,电灯11可以发出三种颜色的光(颜色1~颜色3)白板12所处的位置位于电灯11的照明范围之内。图像1为电灯11的灯光颜色为颜色1时所拍摄的图像,图像2为电灯11的灯光颜色为颜色2时所拍摄的图像,图像3为电灯11的灯光颜色为颜色3时所拍摄的图像。由图1A可知,在未对图像进行白平衡处理的情况下,图像1中白板的颜色会随着电灯灯光变化而变化,即:在图像1中,白板的颜色为颜色1,在图像2中,白板的颜色为颜色2,在图像3中,白板的颜色为颜色3。
图1B为在上述图1A的同一拍摄环境下,对拍摄图像进行白平衡处理后的一组示例性图像。如图1B所示,在图像1中,图像1为电灯13的灯光颜色为颜色1时所拍摄的图像,图像2为电灯13的灯光颜色为颜色2时所拍摄的图像,图像3为电灯13的灯光颜色为颜色3时所拍摄的图像。由图1B可知,在对图像1~图像3进行白平衡处理的情况下,图像1~图像3中白板的颜色不会随着电灯13的灯光颜色而有所变化,即:当电灯13的灯光颜色为颜色1时,白板14的颜色为白色,当电灯的灯光颜色为颜色2时,白板的颜色为白色,当电灯的灯光颜色为颜色3时,白板的颜色为白色。
由图1A-图1B可知,对图像进行白平衡处理,可以减少拍摄环境光源对图像颜色的影响,使得图像中的拍摄对象在不同光源环境下都能保持其原本的颜色,即:不管电灯的灯 光颜色如何变化,图像中白板给人的视觉效果依然是白色。
但是,科学研究发现,人眼具有不完全色适应的特性,即人眼受环境光源和环境亮度的影响,不能完全对物体的颜色进行修正,这使得人眼在许多光源环境下,不会保持颜色恒常性,在观察物体时,人眼对物体的视觉效果往往与物体的真实颜色有一定的差距。因此,相机对图像进行白平衡处理后,虽然消除了环境光源的相关色温等因素对拍摄对象颜色的影响,还原了图像原本的颜色,但是,由于人眼的不完全色适应的特性,这就可能使得经过白平衡处理后的图像的颜色与人眼真实观察的颜色不一致。
例如,如图1C所示,图像1为经过白平衡处理后的图像,当电灯15的灯光颜色为颜色1时,白板16的颜色为白色,图像2为人眼观察的白板,当电灯的灯光颜色为颜色1时,人眼观察的白板的颜色为颜色4。
为了解决上述白平衡处理后图像的颜色与人眼真实观察到的物体的颜色不一致的问题,本申请实施例提出了一种图像色适应处理方法,该方法包括:电子设备通过白平衡算法计算拍摄环境光源的色度信息,并对图像进行白平衡处理和色彩还原处理,得到处理后的图像,处理后的图像为参考光源(例如,D65光源)下的图像。然后,电子设备基于拍摄环境光源的色度信息和色适应算法计算得到色适应转换矩阵,并使用该色适应转换矩阵在LMS颜色空间下对图像进行色适应处理,从而得到色适应处理后的图像,并将该色适应处理后的图像由LMS颜色空间转换到XYZ颜色空间,再将图像由XYZ颜色空间转换到sRGB颜色空间,再对图像进行一系列处理,从而得到与人眼视觉效果一致的色适应图像。
下面,结合图2,对本申请实施例涉及的电子设备的硬件结构进行介绍,该电子设备具备蓝牙功能。请参见图2,图2是本申请实施例提供的电子设备100的硬件结构示意图。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(AP芯片plication processor,AP芯片),调制解调处理器,图形处理器(grAP芯片hics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件, 也可以集成在一个或多个处理器中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如Wi-Fi网络),蓝牙(BlueTooth,BT),BLE广播,全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号、降噪、还可以识别声音来源,实现定向录音功能等。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施 例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。
下面,对本申请实施例提供的一种图像色适应处理方法涉及的三个应用场景进行说明。
场景1:电子设备启动相机应用后,电子设备对相机采集的图像进行白平衡处理和色适应处理,并把处理后的图像显示在预览界面上,当电子设备100检测到针对拍照控件的单击操作后,电子设备进行拍照,并存储照片,该照片为经过色适应处理后的图像。下面,结合图3A-图3D对场景1进行相关介绍。图3A-图3D为本申请实施例提供的一组电子设备100的示例性用户界面。
如图3A所示,用户界面30为电子设备100的主界面,在用户界面30中,包括相机图标301、图库图标302以及其它应用图标。当电子设备100检测到针对相机图标301的输入操作(例如,单击),响应该操作,电子设备100显示如图3B所示的用户界面31。
如图3B所示,用户界面31为电子设备100的拍摄界面,在用户界面31中,包括图像显示区域311、拍照控件312、拍摄功能设置区域313。其中,图像显示区域311用于显示预览图像,该预览图像包括电灯3111和白板3112,该预览图像为经过色适应处理后的图像。当电子设备100检测到针对拍照控件312的输入操作(例如,单击)后,响应该操作,电子设备100进行拍照。电子设备100在拍照完成后,检测到针对相片浏览图标314的单击操作后,响应该操作,电子设备100显示如图3C所示的用户界面32。
如图3C所示,用户界面32为显示电子设备100拍摄图像的界面,所述界面包括编辑框413,该图像为经过色适应处理的图片。在该图像中,包括电灯3211和白板3212,电灯3211的灯光颜色为颜色1,白板3212的颜色为颜色2。图3D为相同拍摄环境下仅通过白平衡处理后的拍摄图像(图像1)和人眼真实观察的图像(图像2)的效果图,在图像1和图像2中,电灯的灯光颜色为颜色1,在图像1中,白板的颜色为白色,在图像2中,白板的颜色为颜色2。由此可知,图3C中的拍摄图像的颜色更接近人眼真实观察的颜色。
场景2:电子设备100启动相机应用后,拍摄界面中的图像预览窗口显示经过白平衡处理后的拍摄环境的图像,在拍摄界面中包括色适应处理控件,当电子设备100检测到用户针对该色适应处理控件的单击等输入操作后,响应该操作,电子设备对预览图像进行色适应处理,在图像预览窗口中显示经过色适应处理后的预览图像,当电子设备100检测到针对拍照控件的单击等输入操作后,电子设备100进行拍照,并保存经过色适应处理后的照片。下面,结合图4A-图4D对场景2进行相关介绍。图4A-图4B为本申请实施例提供的一组电子设备100的示例性界面。
如图4A所示,用户界面40为电子设备100的拍摄界面,在用户界面40中,包括图像预览窗口401、拍照控件402、拍摄功能设置区域403以及色适应处理控件404。其中,图像预览窗口401用于显示当前拍摄环境的预览图像,拍摄功能设置区域403包括色适应处理控件404等多个拍摄功能控件。由预览图像窗口404可知,预览图像包括电灯4041和 白板4042,白板4042在电灯4041的照明范围之内,电灯4041的灯光颜色为颜色1,白板的颜色为白色。当电子设备100检测到针对色适应处理控件404的单击操作后,响应该操作,电子设备100显示如图4B所示的用户界面41。
如图4B所示,用户界面41为电子设备100的拍摄界面,在该拍摄界面的图像预览窗口中,显示的预览图像为通过色适应处理后的图像,在该图像中包括电灯4111和白板4112。其中,电灯4111的灯光颜色为颜色1,白板4112的颜色的为颜色2。图4C为人眼真实观察该拍摄环境物体的颜色效果图,在图4C中,电灯的灯光颜色为颜色1,白板的颜色为颜色2。由图4A-图4C可知,通过色适应处理后的预览图像,白板的颜色更接近于人眼真实观察的白板的颜色。当电子设备100检测到针对拍照控件412的输入操作(例如,单击),响应该操作,电子设备100显示如图4D所示的用户界面42。
如图4D所示,用户界面42为电子设备的拍摄界面,该拍摄界面包括拍照提示框421,该拍照提示框421用于提示电子设备100正在进行拍照处理。示例性的,在图4D中,拍照提示框421显示文字信息“正在拍照中,请稍后”。电子设备100在拍照过程中会对图像进行色适应处理,并将色适应处理后的相片存储在图库中,以便用户可以通过访问图库,浏览该相片。
场景3:电子设备离线对图片进行色适应处理:用户可以通过图库浏览其拍摄的图片,当电子设备100检测到针对色适应处理控件的输入操作后,响应该输入操作,电子设备100可以相片进行色适应处理,得到并保存色适应处理后的相片。下面,结合图5A-图5D对场景3进行相关介绍。图5A-图5D为本申请实施例提供的一组电子设备100的示例性用户界面。
如图5A所示,用户界面50为电子设备100的主界面,用户界面50包括“图库”控件501和其它功能控件。当电子设备100检测到针对“图库”控件501的输入操作(例如,单击),响应该操作,电子设备100显示如图5B所示的用户界面51。
如图5B所示,用户界面51为相片浏览界面,该相片浏览界面显示的图像为未经过色适应处理后的图像,如图5B所示,在该相片浏览界面中,包括电灯511和白板512,电灯511的灯光颜色为颜色1,白板512的颜色为白色。在用户界面51中,包括图像设置区域513,在图像设置区域513中包括“发送”控件、“收藏”控件、“编辑”控件、“更多”控件以及“删除”控件。当电子设备100检测到针对“编辑”控件的单击操作,响应该操作,电子设备100显示如图5C所示的用户界面52。
如图5C所示,用户界面52包括图片设置功能框521,在该图片设置功能框521中,包括“裁剪图片”功能框、“色适应处理”功能框、“一键美化”功能框等功能框。当电子设备100检测到针对“色适应处理”功能框的单击操作后,响应该操作,电子设备100显示如图5D所示的用户界面53。
如图5D所示,用户界面53包括“色适应处理提示框”531,该色适应处理提示框531用于提示电子设备100当前进行色适应处理,包括色适应处理的提示信息,如图5D所示,色适应处理的提示信息可以为“正在对图像进行色适应处理,请稍后”。电子设备100对图像进行色适应处理后,显示如图5E所示的用户界面54。
如图5E所示,用户界面54显示的图像为经过色适应处理后的图像,电灯的灯光颜色为颜色1,白板的颜色为颜色2,人眼观察该拍摄环境的视觉效果图可以如图5F所示。由图5E可知,经过色适应处理后的图像,白板的颜色接近于人眼在同一拍摄环境下真实观察的白板的颜色。
上述图3A-图5E对本申请实施例提供的一种图像色适应处理方法所涉及的三个应用场景进行了介绍,下面,结合附图,分别对上述三个应用场景的中,电子设备对图像进行色适应处理的具体流程进行说。
下面,结合图6,对上述场景1中涉及的电子设备对图像进行色适应处理的框架进行说明,请参见图6,图6是本申请实施例提供的一种图像处理的框架图,具体过程为:
步骤S601:电子设备通过相机输出的RAW图进行光源预测,计算拍摄环境光源白点的R g、B g以及拍摄环境光源白点的RGB值。
步骤S602:电子设备根据拍摄环境光源白点的RGB值计算环境光源白点的x 1值和y 1值,再根据x 1值和y 1值,计算拍摄环境光源的CCT src和D uv_src
步骤S603:电子设备根据拍摄环境光源的CCT进行CCM插值,得到颜色校正矩阵CCM。
步骤S604:电子设备根据1/R g和1/B g对该RAW图进行白平衡处理,得到白平衡处理后的RAW图。
步骤S605:电子设备对白平衡处理后的RAW图通过CCM进行色彩还原处理,得到在sRGB颜色空间下的第二图像。
步骤S606:电子设备通过sRGB转XYZ矩阵,将第二图像转换到XYZ颜色空间,得到第一转换图像。
步骤S607:电子设备通过XYZ转LMS矩阵,将第一转换图像转换到LMS颜色空间,得到第三图像。
步骤S608:电子设备对第三图像进行色适应处理,得到第四图像。
步骤S609:电子设备通过LMS转XYZ矩阵,将第四图像转换到XYZ颜色空间,得到第二转换图像。
步骤S610:电子设备通过XYZ转sRGB矩阵,将第二转换图像转换到sRGB颜色空间,得到第三转换图像。
步骤S611:电子设备对第三转换图像进行RGB颜色空间图像处理,得到第四转换图像。
具体地,RGB颜色空间图像处理包括对第三转换图像进行DRC(动态范围压缩)处理和/或伽马(GAMMA)处理。
步骤S612:电子设备将第四转换图像由sRGB颜色空间转换到YUV颜色空间,得到第五转换图像。
步骤S613:电子设备对第五转换图像进行YUV颜色空间处理,得到目标图像。
具体地,YUV颜色空间图像处理包括对图像进行色调映射处理(Tomapping处理)和/或3D LUT处理。
在一种可能实现的方式中,电子设备可以在对第五转换图像进行YUV颜色空间处理之后,将该处理后的图像转换成JPEG格式,得到目标图像。
电子设备基于上述图像处理的框架图中的流程对相机输出的RAW图像进行处理,可以得到与人眼视觉效果一致的色适应图像。
下面,结合图7,对上述图6框架图中的步骤,进行具体说明。请参见图7,图7是本申请实施例提供的一种图像处理方法的流程图,具体流程如下:
步骤S701:电子设备响应第一操作,启动相机应用。
示例性的,第一操作可以为上述图3A实施例中,对相机图标的单击操作,当电子设备100检测到针对相机图标的单击操作后,电子设备启动相机应用。
步骤S702:电子设备通过白平衡算法计算拍摄环境光源白点的色度信息。
具体地,相机启动后,会输出RAW图像,该RAW图像为第一颜色空间下的第一图像,第一颜色空间为RAW空间,该RAW图像为相机CMOS图像感应器或CCD图像感应器将捕捉到的光源信号转换为数字信号的原始数据,在相机输出RAW图像后,电子设备可以基于白平衡算法计算拍摄环境光源白点在RGB颜色空间中的RGB值,以及R g和B g,该RGB值、R g和B g为拍摄环境光源白点的色度信息,该拍摄环境光源为第一环境光源,该第一环境光源包括至少一种环境光源,示例性的,环境光源可以为太阳光源、灯光光源等。其中,R gain=1/R g,B gain=1/B g,R gain=G/R,B gain=G/B,R gain和B gain分别为该环境光源下待白平衡处理使用的R通道和B通道上的增益值,R、G、B分别为RGB通道的R值、G值和B值。
应当理解的是,电子设备可以通过传统的自动白平衡算法(例如,灰度世界算法)计算拍摄环境的光源色度信息,也可以通过AI自动白平衡算法计算拍摄环境的光源色度信息,本申请实施例对电子设备使用的白平衡算法的类型不做限制。
步骤S703:电子设备将相机输出的RAW图像进行白平衡处理和色彩还原处理,得到第二图像。
具体地,为了解决拍摄环境光源导致的图像的偏色问题,电子设备需要对相机输出的RAW图像进行白平衡处理和色彩还原处理,从而得到第二图像。电子设备对RAW图像进行白平衡处理的具体过程为:电子设备调节RAW图像中每个像素的RGB值,使得图像光源白点的三颜色通道值相等,即R=G=B。电子设备可以通过公式(1)调节RAW图像的RGB值,从而对该图像进行白平衡调节,公式(1)如下所示:
Figure PCTCN2022115486-appb-000065
其中,
Figure PCTCN2022115486-appb-000066
为该RAW图像中,第i个像素的RGB值,
Figure PCTCN2022115486-appb-000067
为白平衡调节后的图像中,第i个像素的RGB值。
由于半导体传感器的频谱响应和人眼对可见光的频谱响应存在较大差异,导致相机的色彩还原与观察者感知到的物体颜色存在很大差异且RAW图像的RGB是一个与设备相关的RGB颜色空间,不是一个通用的颜色空间,除此之外,对该RAW图像进行白平衡调节后,仅还原了该图像中拍摄对象的部分颜色(例如,只对图像中的白色或灰色等中性色进行还原)。因此,为了提高图像中物体颜色的还原程度,以及将图像的颜色空间从设备相关的Device RGB空间转换到与设备无关的sRGB空间。因此,电子设备需要对白平衡处理后的图像做色彩还原处理,以提高图像的色彩还原度,电子设备可以使用颜色校正矩阵(Color Correction Matrix,CCM)对白平衡处理后的图像进行色彩还原处理,得到第二图像。
电子设备可以在不同光源环境(典型的光源包括A、H、U30、TL84、D50、D65、D75等等)标定出一个大小为3x3的CCM,并存储在电子设备中。电子设备可以通过其计算的拍摄环境光源白点的RGB值来选择对应的CCM,若该RGB值在两个光源之间(例如,拍摄环境光源白点的RGB值落在D50和D65之间),CCM可以由D50和D65进行双线性插值所得到。例如,D50的颜色校正矩阵为CCM 1,相关色温为CCT 1,D60的颜色校正矩阵为CCM 2,相关色温为CCT 2,拍摄环境光源的相关色温为CCT a,电子设备可以根据公式(2)得到一个比例值g,公式(2)如下所示:
Figure PCTCN2022115486-appb-000068
然后,电子设备可以根据公式(3)计算得到拍摄环境光源白点对应的CCM:
CCM=g*CCM 1+(1-g)*CCM 2  (3)
电子设备在计算出拍摄环境光源白点对应的CCM之后,电子设备可以通过公式(4)对对图像的RGB值进行调节,得到第二图像,公式(4)如下所示:
Figure PCTCN2022115486-appb-000069
其中,
Figure PCTCN2022115486-appb-000070
为白平衡调节后的RAW图像的第i个像素的RGB值,
Figure PCTCN2022115486-appb-000071
为第二图像第i个像素的RGB值,此时,第二图像的颜色空间为sRGB颜色空间,sRGB颜色空间为第二颜色空间。
应当理解的是,在上述实施例中,仅是对电子设备对图像进行白平衡处理和色彩还原处理进行示例性的说明,电子设备还可以通过其它方法对RAW图像进行白平衡处理和色彩还原处理,从而得到第二图像,本申请实施例对电子设备对RAW图像进行白平衡处理和色彩还原处理的方式不作限制。
步骤S704:电子设备将第二图像从sRGB颜色空间转换到XYZ颜色空间,得到第一转换图像。
具体地,经过白平衡处理后的第二图像解决了因拍摄环境光源的影响而发生偏色的问题,但是,由人眼不完全色适应理论可知,由于受到环境亮度和环境光源的影响,人眼不总是保持颜色恒常性,即:人眼真实观察到的物体的颜色总与物体真实的颜色有所偏差。 因此,经过白平衡处理和色彩还原处理的第二图像的颜色与人眼在一些环境光源下观察的颜色有所不同,为了使得图像的颜色与人眼观察到的一致,可以在LMS颜色空间上对图像进行颜色调节,使得图像的颜色符合人眼真实观察的颜色。其中,LMS颜色空间是第三颜色空间,该颜色空间是由人眼的三种锥体的响应表示的颜色空间,以其在长波长,中波长和短波长处的响应度命名,在LMS颜色空间上对图像进行色适应处理,可以使得处理后的图像的颜色更符合人眼真实观察的颜色。由于LMS颜色空间可以从XYZ颜色空间进行转换,因此,电子设备可以将第二图像的颜色空间从sRGB颜色空间转换到XYZ颜色空间,得到第一转换图像。
电子设备可以通过公式(5)对第二图像进行转换,从而得到第一转换图像,公式(5)如下所示:
Figure PCTCN2022115486-appb-000072
其中,
Figure PCTCN2022115486-appb-000073
为第二图像中,第i个像素的RGB值,
Figure PCTCN2022115486-appb-000074
为第一转换图像中,第i个像素的XYZ值,M 1是一个大小为3x3的转换矩阵,该转换矩阵为sRGB转XYZ矩阵,用于将第二图像由sRGB颜色空间转换到XYZ颜色空间。示例性的,M 1的形式可以为:
Figure PCTCN2022115486-appb-000075
步骤S705:电子设备将第一转换图像由XYZ颜色空间转换到LMS颜色空间,得到第三图像。
具体地,LMS颜色空间是由人眼的三种锥体的响应表示的颜色空间,以其在长波长,中波长和短波长处的响应度命名,在LMS颜色空间上对图像进行色适应处理,可以使得处理后的图像的颜色更符合人眼真实观察的颜色。示例性的,电子设备可以通过公式(6)将第一转换图像由XYZ颜色空间转换到LMS颜色空间,公式(6)如下所示:
Figure PCTCN2022115486-appb-000076
其中,
Figure PCTCN2022115486-appb-000077
为第一转换图像在XYZ颜色空间中第i个像素的XYZ值,Mcat 1为XYZ转LMS矩阵,用于将图像从XYZ颜色空间转到LMS颜色空间,
Figure PCTCN2022115486-appb-000078
为第三图像在LMS颜色空间中第i个像素的LMS值,示例性的,Mcat 1可以为:
Figure PCTCN2022115486-appb-000079
步骤S706:电子设备在LMS颜色空间对第三图像进行色适应处理,得到第四图像。
具体地,为了使电子设备拍摄出来的图像颜色更符合人眼真实观察的图像颜色,电子设备需要对第三图像进行色适应的处理,使得拍摄出来的图像颜色符合人眼不完全色适应理论,更接近人眼真实观察的颜色。电子设备可以通过色适应转换矩阵CA对在LMS颜色空间下的第三图像进行色适应处理,从而得到第四图像。
下面,结合图8,对电子设备计算色适应转换矩阵的具体流程进行说明,请参见图8,图8是本申请实施例提供的一种电子设备计算色适应转换矩阵的流程图,具体流程如下:
步骤S801:电子设备基于拍摄环境光源白点在xy色度图中的x 1值和y 1值计算色适应度D。
具体地,色适应度D为色适应模型的参数,用于表征色适应模型在不同光源条件下的色适应的程度,主要由环境光源的CCT和环境的亮度La(单位为:坎德拉/平方米)决定,电子设备可以计算拍摄环境的Lv,再将Lv转换成计算La,Lv的计算方法请参见上述技术用语(4)的相关解释,本申请实施例对此不再赘述。D的取值范围为[0,1],当D为0时,代表色适应模型对环境光源完全不色适应,即:色适应模型受环境光源CCT和La的影响,获取到的物体颜色与物体真实颜色偏差极大。当D为1时,代表色适应模型对环境光源完全色适应,即:色适应模型几乎不受环境光源CCT和La的影响,获取到的物体颜色与物体真实颜色几乎没有偏差,且色适应度D的数值越大,色适应模型的色适应程度越高。
色适应模型是研究人员通过大量实验,采集对应色数据集并进行拟合,设计得到的模拟人眼对环境色适应的模型,对应色数据集是通过心理物理学实验得到的。其中,该心理物理学实验的目的是让观察者找到两个不同照明条件下颜色匹配的对应色,例如,分别在光照条件下和参考光源下(D65光源)让观察者调节或者选择出熟悉物体的记忆色,以此获得各种光源和D65光源下的多组对应色数据。
电子设备可以通过公式(7)计算第一变量P xy,公式(7)如下所示:
Figure PCTCN2022115486-appb-000080
其中,P xy为第一变量,用于表征拍摄环境光源白点和参考白点的距离(本申请实施例以参考光源为D65光源为例,进行说明),x 1值和y 1值分别为拍摄环境光源白点在xy色度图上的x值和y值,x 1用于标识环境光源白点在xy色度图上的x值,y 1用于标识环境光源白点在xy色度图上的y值。x N和y N分别为参考白点在xy色度图上的x值(x N=0.3127),和y值(y N=0.3290)。
第一参数包括x 1值和y 1值,x 1值和y 1值可以通过拍摄环境光源白点的RGB值得到,例如,可以通过CCM将拍摄环境光源白点的RGB值转换为拍摄环境光源白点在XYZ颜色空间中的X 1Y 1Z 1值,并基于X 1Y 1Z 1值得到x 1值和y 1值,x 1值和y 1值的相关计算公式可以如公式(8)~公式(10)所示:
Figure PCTCN2022115486-appb-000081
在计算出第一变量后,电子设备可以通过公式(11)计算第二变量D c,公式(11)如下所示:
Figure PCTCN2022115486-appb-000082
在计算出第二变量D c之后,电子设备可以根据公式(12)计算色适应度D,公式(12)如下所示:
D=0.96·D c((1-e (-4.28·log La)) 406.5-1)+1  (12)
其中,e (-4.28·log La)为以常数e为底的指数函数,e约为2.71828。
应当理解的是,上述色适应度D的计算方法仅仅是本申请实施例对色适应度D的其中一种计算方法进行举例说明,对于色适应度D的计算方法,本申请实施例不做限制。
步骤S802:电子设备基于色适应度D和拍摄环境光源白点在xy色度图中的x 1值和y 1值计算目标白点在LMS颜色空间中的L curM curS cur值。
具体地,目标白点为通过色适应算法计算得到的白点,为电子设备预测的光源白点,L curM curS cur值为目标白点在LMS颜色空间下的LMS值,目标白点的L curM curS cur值计算方法如下:
由于在XYZ颜色空间中,Y值用于指示亮度,电子设备可以根据颜色亮度需求,设置Y src值为不同的常数m,当m=1时,表示电子设备在计算色适应转换关系时,不调整图像的亮度,本申请实施例以Y src=1.0为例,进行说明。电子设备在确定Y src之后,可以根据公式(13)计算第三变量i y,公式(13)如下所示:
Figure PCTCN2022115486-appb-000083
然后,电子设备根据公式(14)和公式(15)计算Y src=1的情况下,拍摄环境光源白点在XYZ颜色空间中的X src值和Z src值,公式(14)和公式(15)如下所示:
X src=x 1·Y src·i y  (14);Z src=Y src·(1-x 1-y 1)·i y  (15)
这样,通过公式(15)电子设备可以计算出拍摄环境光源白点在XYZ颜色空间中的XYZ值,即:X srcY srcZ src值。在计算出X srcY srcZ src值之后,电子设备可以基于X srcY srcZ src值得到拍摄环境光源白点在LMS颜色空间上的LMS值,即:L srcM srcS src值。示例性的,电子设备可以通过公式(16)计算拍摄环境光源白点在LMS颜色空间中的L srcM srcS src值,公式(16)如下所示:
Figure PCTCN2022115486-appb-000084
同理,电子设备可以根据公式(16)将参考白点(本申请实施例以参考光源为D65光源为例,进行说明)在XYZ颜色空间中的XYZ值(在D65光源下,参考白点的XYZ值分别为:0.95047、1、1.08883)转换为LMS颜色空间中的L dstM dstS dst值。
在计算出参考白点的L dstM dstS dst值以及拍摄环境光源白点的L srcM srcS src值之后,电子设备可以计算参考白点和拍摄环境光源白点在LMS颜色空间上的增益矩阵M Gain1,电子设备可以通过公式(17)计算M Gain1,公式(17)如下所示:
Figure PCTCN2022115486-appb-000085
电子设备计算出增益矩阵M Gain1之后,可以基于M Gain1和适应度D计算目标白点在LMS中的LMS值,即:L curM curS cur值,电子设备可以通过公式(18)计算L curM curS cur值,通过公式(19)计算目标白点在XYZ颜色空间下的XYZ值,即:X curY curZ cur值,公式(18)-公式(19)如下所示:
Figure PCTCN2022115486-appb-000086
Figure PCTCN2022115486-appb-000087
其中,(D·M Gain1+1-D)为拍摄环境光源白点和参考白点在LMS颜色空间下色适应度为D的增益矩阵。
步骤S803:电子设备根据目标白点的L curM curS cur值和参考白点的L dstM dstS dst值计算色适应转换矩阵CA。
具体地,L dstM dstS dst值为参考白点在LMS颜色空间下的LMS值,电子设备可以根据公式(20)计算色适应转换矩阵CA,该色适应转换矩阵CA为第二参数,公式(20)如下所示:
Figure PCTCN2022115486-appb-000088
上述步骤S801-步骤S803示例性地叙述了一种电子设备计算CA矩阵的具体流程,应当理解的是,在电子设备通过白平衡算法计算拍摄环境光源白点的色度信息之后(电子设备执行完步骤S701之后),在电子设备对第三图像进行色适应处理之前,执行步骤S801-步骤S803。可以理解的,根据计算过程,可以看出来,所述色适应转换矩阵CA是与LMS颜色空间相关的参数,所述色适应转换矩阵CA与t 1值和y 1值具有对应关系,色适应转换矩阵CA可以标识拍摄时环境光源在LMS颜色空间的光源信息。由于LMS颜色空间与XYZ颜色空间的存在转换关系,可以理解的,所述色适应转换矩阵CA也是与XYZ颜色空间相关的参数,色适应转换矩阵CA可以标识拍摄时环境光源在XYZ颜色空间的光源信息。
在电子设备计算出CA矩阵后,电子设备可以通过CA矩阵调节第三图像的LMS值,从而得到色适应的第四图像。示例性的,电子设备可以通过公式(21),调节第三图像在LMS颜色空间中的LMS值,得到第四图像,公式(21)如下所示:
Figure PCTCN2022115486-appb-000089
其中,
Figure PCTCN2022115486-appb-000090
为第三图像在LMS颜色空间中第i个像素的LMS值,
Figure PCTCN2022115486-appb-000091
为第四图像在LMS颜色空间中第i个像素的LMS值。
步骤S707:电子设备将第四图像从LMS颜色空间转换到XYZ颜色空间,得到第二转换图像。
示例性的,电子设备可以通过公式(22),将第四图像从LMS颜色空间转换到XYZ颜色空间,得到第二转换图像,公式(22)如下所示:
Figure PCTCN2022115486-appb-000092
其中,
Figure PCTCN2022115486-appb-000093
为第二转换图像在XYZ颜色空间中第i个像素的XYZ值,Mcat 2为LMS转XYZ矩阵,用于将图像从LMS颜色空间转到XYZ颜色空间。示例性的,Mcat 2可以为:
Figure PCTCN2022115486-appb-000094
步骤S708:电子设备将第二转换图像从XYZ颜色空间转换到sRGB颜色空间,得到第三转换图像。
具体地,第二转换图像为在目标白点下的XYZ颜色空间中的图像,电子设备需要将第二转换图像由XYZ颜色空间转换到sRGB颜色空间,得到第三转换图像,以便电子设备后续可以对第三转换图像进行伽马校正处理或色调映射等其他图像处理的步骤。示例性的,电子设备可以通过公式(23)将第三图像由XYZ颜色空间转换到sRGB颜色空间,公式(23)如下所示:
Figure PCTCN2022115486-appb-000095
其中,
Figure PCTCN2022115486-appb-000096
为第二转换图像在XYZ颜色空间下,第i个像素的XYZ值,
Figure PCTCN2022115486-appb-000097
为第三转换图像在sRGB颜色空间下,第i个像素的RGB值。M 2为将图像从XYZ颜色空间转换到sRGB颜色空间的转换矩阵,M 2可以为:
Figure PCTCN2022115486-appb-000098
步骤S709:电子设备对第三转换图像进行RGB颜色空间图像处理,得到第四转换图像。
具体地,RGB颜色空间图像处理包括对第三转换图像进行DRC(动态范围压缩)处理和/或伽马(GAMMA)处理。
步骤S710:电子设备将第四转换图像由sRGB颜色空间转换到YUV颜色空间,得到第五转换图像。
步骤S711:电子设备对第五转换图像进行YUV颜色空间处理,得到目标图像。
具体地,YUV颜色空间图像处理包括对图像进行色调映射处理(Tomapping处理)和/或3D LUT处理。
在一种可能实现的方式中,电子设备可以在对第五转换图像进行YUV颜色空间处理之后,将该处理后的图像转换成JPEG格式,得到目标图像。
上述步骤S701-步骤S711对电子设备对图像进行色适应处理的具体流程进行了说明。
在一种可能实现的方式中,电子设备通过查询相关色温转换表(CCT Shift Table)和D uv转换表(D uvShift Table)的方式来计算色适应转换矩阵CA,然后根据CA来对第三图像进行色适应调节得到第四图像,然后将第四图像从LMS颜色空间转换到sRGB颜色空间,得到第三转换图像,再对第三转换图像进行一系列图像处理,得到目标图像。
电子设备可以通过拍摄环境光源的相关色温CCT src以及拍摄环境光源白点的D uv,即:D uv_src,在预先设置的相关色温转换表(CCT Shift Table)和D uv转换表(D uvShift Table)中查找到目标白点相关色温CCT cur和目标白点的D uv,即:D uv_cur。再通过CCT、D uv与XYZ值的转换关系,计算目标白点的L curM curS cur值,从而计算CA矩阵,并根据CA矩阵调节第三图像,再根据第三图像,得到sRGB颜色空间下的第三转换图像。CCT Shift Table和D uvShift Table如图9所示,请参见图9,图9为本申请实施例提供的一组示例性CCT Shift Table和D uvShift Table。
电子设备可以根据上述公式(7)-公式(19)以及CCT、D uv与XYZ值的相关转换公式构建三维的相关色温转换表(CCT Shift Table)和D uv转换表(D uvShift Table),可以通过拍摄环境光源的Lv、CCT src以及D uv_src在该CCT Shift Table和D uvShift Table中得到CCT cur和D uv_cur,再通过CCT cur和D uv_cur与x 1值和y 1值的转换公式,得到x 1值和y 1值,从而基于x 1值和y 1值计算出目标白点在XYZ颜色空间中的X curY curZ cur值。
电子设备可以基于x 1值和y 1值计算拍摄环境光源白点的D uv_src,应当理解的是,存在多种D uv_src的计算方法,本申请实施例仅对其中一种D uv_src的计算方法做示例性的说明,对于电子设备采用何种方法计算D uv_src,本申请实施例不做任何限制。电子设备计算D uv_src的具体方法如下:
电子设备可以根据公式(24)和公式(25)分别计算拍摄环境光源白点在uv色度图下 的u 1值和v 1值,公式(24)和公式(25)如下所示:
u 1=(4*x 1)/(-2*x 1+12*y 1+3)  (24);
v 1=(6*y 1)/(-2*x 1+12*y 1+3)  (25);
然后,电子设备可以根据公式(26)~公式(28)计算第三参数L Fp、第四参数a 1以及第五参数L BB,公式(26)~公式(28)如下所示:
Figure PCTCN2022115486-appb-000099
a 1=arctan((v 1-0.24)/(u 1-0.292))  (27)
L BB=k 06*a 6+k 05*a 5+k 04*a 4+k 03*a 3+k 02*a 2+k 01*a+k 00  (28)
其中,k 06、k 05、k 04、k 03、k 02、k 01、k 00为常数,当a 1大于或等于0时,a=a 1,当a 1小于或等于0时,a=a 1+π。
最后,电子设备可以通过公式(29),计算得到D uv_src,公式(29)如下所示:
D uv_src=L Fp-L BB  (29)
计算出D uv_src之后,电子设备可以基于公式(30)计算拍摄环境光源白点的相关色温CCT src,公式(30)如下所示:
CCT src=T 2-ΔT c2  (30)
其中,T 2=T 1-ΔT c1。当a小于2.54时:
T 1=1/(k 16*a 6+k 15*a 5+k 14*a 4+k 13*a 3+k 12*a 2+k 11*a+k 10);
ΔT c1=(k 36*a 6+k 35*a 5+k 34*a 4+k 33*a 3+k 32*a 2+k 31*a+k 30)*(L BB+0.01)/L Fp*D uv_cur/0.01。
当a大于或等于2.54时:
T 1=1/(k 26*a 6+k 25*a 5+k 24*a 4+k 23*a 3+k 22*a 2+k 21*a+k 20);
ΔT c1=(k 46*a 6+k 45*a 5+k 44*a 4+k 43*a 3+k 42*a 2+k 41*a+k 40)*(L BB+0.01)/L Fp*D uv_cur/0.01。
当D uv_src大于或等于0时:
ΔT c2=(k 56*c 6+k 55*c 5+k 54*c 4+k 53*c 3+k 52*c 2+k 51*c+k 50)。
当D uv_src小于0时:
Figure PCTCN2022115486-appb-000100
其中,c=log(T 2),k 10~k 41、k 20~k 26、k 30~k 36、k 40~k 46、k 50~k 56、k 60~k 66为常数。
应当理解的是,存在多种CCT src的计算方法,本申请实施例仅示例性地列举出其中一种,对于CCT src的计算方法,本申请实施例不做任何限制。
同理,电子设备可以通过D uvShift Table计算得到目标白点的D uv_cur。然后,电子设备可以通过CCT cur和D uv_cur计算目标白点在XYZ颜色空间上的X curY curZ cur值。
下面,对电子设备通过CCT cur和D uv_cur计算目标白点在XYZ颜色空间上的X curY curZ cur值做示例性说明。
电子设备可以根据公式(31)得到色温为CCT cur的黑体辐射曲线L(λ),公式(31)如下所示:
Figure PCTCN2022115486-appb-000101
其中,c 1为第一常数,c 2为第二常数,λ为波长。然后,电子设备计算在色温为CCT cur的情况下,黑体辐射光的x 2值和y 2值,具体过程为:电子设备可以根据公式(32)~公式(34)计算该黑体辐射光在XYZ颜色空间上的XYZ值,公式(31)~公式(33)如下所示:
Figure PCTCN2022115486-appb-000102
其中,X 2为该黑体辐射光在XYZ颜色空间上的X值,Y 2为该黑体辐射光在XYZ颜色空间上的Y值,Z 2为该黑体辐射光在XYZ颜色空间上的Z值,k为常数。
Figure PCTCN2022115486-appb-000103
Figure PCTCN2022115486-appb-000104
分别为CIE1931 xyz标注观察者曲线中的x曲线、y曲线以及z曲线,CIE1931 xyz标注观察者曲线如图10所示。
然后,电子设备基于X 2Y 2Z 2可以计算该黑体辐射光在xy色度图上的x 2值和y 2值,x 2值和y 2值的计算公式可以参考上述公式(9)和公式(10),本申请实施例在此不再赘述。
然后,电子设备将x 2值和y 2值转换为uv色度图上的u 2值和v 2值,u 2值和v 2值的计算公式可以参考上述公式(24)和公式(25),本申请实施例在此不再赘述。
同理,电子设备可以基于上述公式(31),计算色温为CCT cur+Delta_T(本申请实施例以Delta_T为0.01为例,进行说明)的黑体辐射曲线L 1(λ),从而计算出色温为CCT cur+Delta_T的黑体辐射光在CIE uv色度图上的u 3值和v 3值。
然后,电子设备可以根据公式(35)~公式(36)计算目标白点在CIE uv色度图中的u cur值和v cur值,公式(35)~公式(36)如下所示:
u cur=u 2-D uv_cur*sinθ  (35);v cur=v 2+D uv_cur*cosθ  (36)
其中,
Figure PCTCN2022115486-appb-000105
du=u 2-u 3,dv=v 2-v 3
然后,电子设备可以通过公式(37)~公式(38)计算目标白点在CIE xy色度图中x cur值和y cur值,公式(37)~公式(38)如下所示:
x cur=9u cur/(6u cur-24v cur+12)  (37);y cur=3v cur/(3u cur-12v cur+6)  (38)
电子设备可以基于x cur值和y cur值计算得到目标白点的X curY curZ cur,电子设备基于x cur值和y cur计算X curY curZ cur的过程和方法请参考上述步骤S802中,电子设备根据拍摄环境光源白点在CIExy色度图中的x 1值和y 1值计算拍摄环境光源白点在XYZ颜色空间中的X srcY srcZ src值的相关叙述,本申请实施例在此不再赘述。
电子设备在计算出X curY curZ cur之后,可以将X curY curZ cur转换为L curM curS cur,X curY curZ cur转换为L curM curS cur,可以参考上述公式(16),本申请实施例在此不再赘述。电子设备在计算L curM curS cur之后,可以按照上述步骤S803所述的方法计算CA矩阵,然后,根据通过上述公式(21),利用CA矩阵调节第三图像,得到第四图像。
最后,电子设备执行步骤S707-步骤S711,得到目标图像。
在一种可能实现的方式中,电子设备可以通过非线性的方法在LMS颜色空间上对第三图像进行色适应处理,下面,对电子设备使用非线性方法在LMS颜色空间上对第三图像进行色适应处理进行示例性地说明,电子设备可以使用公式:
L cur=[D(L dst/L src)+1-D]·L src
M cur=[D(M dst/M src)+1-D]·M src
Figure PCTCN2022115486-appb-000106
计算目标白点在LMS颜色空间上的L curM curS cur值,其中,τ=(S dst/S src) 0.0834。然后,电子设备可以通过公式:
L 4i=(L cur/L dst)·L 3i
M 4i=(M cur/M dst)·M 3i
Figure PCTCN2022115486-appb-000107
调节第三图像在LMS颜色空间中的LMS值,得到第四图像。其中,τ1=(S cur/S dst) 0.0834
然后,电子设备执行步骤S707-步骤S711,得到目标图像。
本申请实施例,电子设备通过白平衡算法计算拍摄环境光源的色度信息,并对图像进行白平衡处理和色彩还原,得到处理后的图像,处理后的图像为参考光源下的图像,并将该图像转换到LMS颜色空间。然后,电子设备基于拍摄环境光源的色度信息和色适应算法计算得到色适应转换矩阵,并使用该色适应转换矩阵调节在LMS颜色空间中的图像,从而得到在色适应度D为1的情况下,接近人眼视觉效果的色适应图像,得到在色适应度D为0的情况下,接近人眼视觉效果的色适应图像,在色适应度D为0~1的情况下,接近人眼视觉效果的色适应图像。
上述图7实施例介绍了电子设备对图像进行色适应处理的流程图,在一些实施例中,电子设备可以通过目标矩阵对在sRGB颜色空间上的第二图像进行调节,从而得到色适应的、在sRGB颜色空间上的第三转换图像,并对第三转换图像进行一系列相关的图像处理,最后得到目标图像。下面,结合图11A,对电子设备通过目标矩阵对第二图像进行调节步骤进行说明,请参见图11A,图11A是本申请实施例提供的另一种图像处理的框架图,具体过程为:
步骤S1101A:电子设备通过相机输出的RAW图进行光源预测,计算拍摄环境光源白点的R g、B g以及拍摄环境光源白点的RGB值。
步骤S1102A:电子设备根据拍摄环境光源白点的RGB值计算环境光源白点的x 1值和y 1值,再根据x 1值和y 1值,计算拍摄环境光源的CCT src和D uv_src
步骤S1103A:电子设备根据拍摄环境光源的CCT进行CCM插值,得到颜色校正矩阵 CCM。
步骤S1104A:电子设备根据1/R g和1/B g对该RAW图进行白平衡处理,得到白平衡处理后的RAW图。
步骤S1105A:电子设备对白平衡处理后的RAW图通过CCM进行色彩还原处理,得到在sRGB颜色空间下的第二图像。
步骤S1101A-步骤S1105A请参见上述步骤S601-步骤S605的相关叙述,本申请实施例不再赘述。
步骤S1106A:电子设备通过目标矩阵对第二图像进行调节,得到sRGB颜色空间下的第三转换图像。
具体地,电子设备可以通过公式(39)对第二图像进行调节,得到第三转换图像,公式(39)如下所示:
Figure PCTCN2022115486-appb-000108
其中,
Figure PCTCN2022115486-appb-000109
为第二图像中,第i个像素的RGB值,
Figure PCTCN2022115486-appb-000110
为第三转换图像在sRGB颜色空间下,第i个像素的RGB值,CA 1为目标矩阵。
示例性的,CA 1=M 2·Mcat 2·CA·Mcat 1·M 1。其中,M 1为sRGB颜色空间转XYZ颜色空间的转换矩阵,M 2为XYZ颜色空间转sRGB颜色空间的转换矩阵,Mcat 1为XYZ颜色空间转LMS颜色空间的转换矩阵、Mcat 2为LMS颜色空间转XYZ颜色空间的转换矩阵、CA为色适应转换矩阵,CA可以通过上述公式(7)-公式(20)得到,本申请实施例在此不再赘述。
步骤S1107A:电子设备对第三转换图像进行RGB颜色空间图像处理,得到第四转换图像。
具体地,RGB颜色空间图像处理包括对第三转换图像进行DRC(动态范围压缩)处理和/或伽马(GAMMA)处理。
步骤S1108A:电子设备将第四转换图像由sRGB颜色空间转换到YUV颜色空间,得到第五转换图像。
步骤S1109A:电子设备对第五转换图像进行YUV颜色空间处理,得到目标图像。
在一种可能实现的方式中,电子设备可以在对第五转换图像进行YUV颜色空间处理之后,将该处理后的图像转换成JPEG格式,得到目标图像。
步骤S1107A-步骤S1109A请参见上述步骤S709-步骤S711的相关叙述,本申请实施例不再赘述。
下面,结合图11B,对上述图11A框架图中的步骤,进行具体说明。请参见图11B,图11B是本申请实施例提供的另一种图像处理方法的流程图,具体流程如下:
步骤S1101B:电子设备响应第一操作,启动相机应用。
步骤S1102B:电子设备通过白平衡算法计算拍摄环境光源白点的色度信息。
步骤S1103B:电子设备将相机输出的RAW图像进行白平衡处理和色彩还原处理,得到第二图像。
步骤S1101B-步骤S1103B请参考步骤S701-步骤S703,本申请实施例在此不再赘述。
步骤S1104B:电子设备通过目标矩阵对第二图像进行调节,得到sRGB颜色空间下的第三转换图像。
步骤S1104B请参考上述步骤S1106A中的相关叙述,本申请实施例在此不再赘述。
步骤S1105B:电子设备对第三转换图像进行RGB颜色空间图像处理,得到第四转换图像。
步骤S1106B:电子设备将第四转换图像由sRGB颜色空间转换到YUV颜色空间,得到第五转换图像。
步骤S1107B:电子设备对第五转换图像进行YUV颜色空间处理,得到目标图像。
在一种可能实现的方式中,电子设备可以在对第五转换图像进行YUV颜色空间处理之后,将该处理后的图像转换成JPEG格式,得到目标图像。
步骤S1105B-步骤S1107B请参考步骤S709-步骤S711,本申请实施例在此不再赘述。
本申请实施例,通过将第二图像与目标矩阵相乘,从而得到了色适应处理后的、在sRGB颜色空间下的第三转换图像,并将第三转换图像经过一系列图像处理,得到接近人眼视觉效果的色适应图像,同时,也减少了电子设备计算的次数,节约了电子设备的计算资源。
下面,结合图12,对上述场景2中涉及的电子设备对图像进行色适应处理的具体流程进行说明。在场景2中,当电子设备启动相机应用后,将通过白平衡处理的预览图像显示在预览界面中,当电子设备检测到针对相机应用拍摄界面中的色适应处理控件的单击操作后,电子设备对预览图像进行色适应处理,并将色适应处理后的预览图像显示在预览界面中。图12是本申请实施例提供的另一种图像处理方法的流程图,具体流程如下:
步骤S1201:电子设备响应第一操作,启动相机应用。
步骤S1202:电子设备通过白平衡算法计算拍摄环境光源白点的色度信息。
步骤S1203:电子设备将相机输出的RAW图像进行白平衡处理和色彩还原处理,得到第二图像。
步骤S1201~步骤S1203的相关描述请参见上述步骤S701~步骤S703的相关描述,本申请实施例不再赘述。
步骤S1204:电子设备响应第二操作,将第一目标图像从sRGB颜色空间转换到XYZ颜色空间,得到第一转换图像。
具体地,第二操作可以为上述图4A中针对色适应处理控件404的单击操作,第一目标图像为当前经过电子设备进行白平衡处理和色彩还原处理后的图像。
步骤S1205:电子设备将第一转换图像从XYZ颜色空间转换到LMS颜色空间,得到第三图像。
步骤S1206:电子设备在LMS颜色空间对第三图像进行色适应处理,得到第四图像。
步骤S1207:电子设备将第四图像从LMS颜色空间转换到XYZ颜色空间,得到第二 转换图像。
步骤S1208:电子设备将第二转换图像从XYZ颜色空间转换到sRGB颜色空间,得到第三转换图像。
步骤S1209:电子设备对第三转换图像进行RGB颜色空间图像处理,得到第四转换图像。
步骤S1210:电子设备将第四转换图像由sRGB颜色空间转换到YUV颜色空间,得到第五转换图像。
步骤S1211:电子设备对第五转换图像进行YUV颜色空间处理,得到目标图像。
在一种可能实现的方式中,电子设备可以在对第五转换图像进行YUV颜色空间处理之后,将该处理后的图像转换成JPEG格式,得到目标图像。
步骤S1204~步骤S1211的相关描述请参见上述步骤S704~步骤S711的相关描述,本申请实施例不再赘述。
下面,结合图13,对上述场景3中涉及的电子设备对图像进行色适应处理的具体流程进行说明。在场景3中,电子设备在启动相机后,计算图像的色适应转换矩阵,当用户拍照后,将照片及其对应的色适应转换矩阵保存。当用户浏览照片时,若电子设备检测到针对图库中,色适应处理控件的单击操作后,电子设备获取该照片的色适应转换矩阵,通过该矩阵对照片进行色适应处理,得到处理后的照片。图13是本申请实施例提供的另一种图像处理方法的流程图,具体流程如下:
步骤S1301:电子设备响应第三操作,显示第一界面。
具体地,第三操作可以为单击图库应用中的第一应用图像,该第一应用图像为相机拍摄的照片,第一界面可以为第一应用图像的浏览界面,示例性的,该浏览界面可以为上述图5C实施例中的用户界面52。
步骤S1302:电子设备检测到针对第一界面中第一功能控件的第二操作,响应该操作,电子设备将第一应用图像从sRGB颜色空间转换到XYZ颜色空间,得到第一转换图像。
具体地,第一功能控件可以为上述图5C实施例中的“色适应处理”功能框,第二操作可以为上述图5C实施例中针对“色适应处理”功能框的单击操作。电子设备将第一应用图像从sRGB颜色空间转换到XYZ颜色空间,得到第一转换图像的过程和方法请参见上述图7实施例中步骤S704所述的电子设备将第二图像从sRGB颜色空间转换到XYZ颜色空间,得到第一转换图像的相关叙述,本申请实施例在此不再赘述。
步骤S1303:电子设备将第一转换图像从XYZ颜色空间转换到LMS颜色空间,得到第三图像。
步骤S1303请参见上述步骤S705,本申请实施例不再赘述。
步骤S1304:电子设备读取第一应用图像的色适应转换矩阵。
具体地,电子设备通过相机进行拍照,得到第一应用图像的过程中,电子设备会计算第一应用图像的色适应转换矩阵CA,并将第一应用图像和其对应的色适应转换矩阵保存在图像或内存中,当电子设备要使用该色适应转换矩阵对第一应用图像进行色适应处理时,电子设备可以读取该色适应转换矩阵。在拍照过程中,电子设备计算第一应用图像的色适 应转换矩阵的方法和过程请参考上述图8实施例中的相关叙述,本申请实施例在此不做限制。
应当理解的是,步骤S1304仅需满足在步骤S1305之前执行即可,本申请实施例对步骤S1304的执行顺序,不做限制。
步骤S1305:电子设备在LMS颜色空间对第三图像进行色适应处理,得到第四图像。
步骤S1306:电子设备将第四图像从LMS空间转换到XYZ颜色空间,得到第二转换图像。
步骤S1307:电子设备将第二转换图像从XYZ颜色空间转换到sRGB颜色空间,得到第三转换图像。
步骤S1308:电子设备对第三转换图像进行RGB颜色空间图像处理,得到第四转换图像。
步骤S1309:电子设备将第四转换图像由sRGB颜色空间转换到YUV颜色空间,得到第五转换图像。
步骤S1310:电子设备对第五转换图像进行YUV颜色空间处理,得到目标图像。
在一种可能实现的方式中,电子设备可以在对第五转换图像进行YUV颜色空间处理之后,将该处理后的图像转换成JPEG格式,得到目标图像。
步骤S1305-步骤S1310的相关描述请参见上述图7实施例中步骤S706~步骤S711的相关描述,本申请实施例不再赘述。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk)等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。
总之,以上所述仅为本发明技术方案的实施例,并非用于限定本发明的保护范围。凡根据本发明的揭露,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (14)

  1. 一种图像处理方法,其特征在于,应用于电子设备,所述电子设备包括摄像头,所述方法包括:
    检测到第一操作;
    响应于所述第一操作,所述电子设备启动所述摄像头;
    检测到第二操作;
    响应于所述第二操作,所述摄像头在第一环境光源下采集第一图像,所述第一图像为在第一颜色空间的图像,所述第一环境光源为所述第一图像采集时的至少一种环境光源;
    对所述第一图像进行第一图像处理,得到第二颜色空间的第二图像,所述第二颜色空间与所述第一颜色空间不同;
    对所述第二图像进行第二图像处理,得到目标图像;
    保存所述目标图像;其中,所述对所述第二图像进行第二图像处理,得到目标图像,包括:
    基于所述第一环境光源的第一参数得到第二参数,所述第二参数是与第三颜色空间相关的参数,第一参数包括所述第一环境光源的白平衡参数,所述第二参数与第一参数具有对应关系,所述第二参数用于标识所述第一环境光源在所述第三颜色空间的光源信息,所述第三颜色空间与所述第一颜色空间不同,所述第三颜色空间与所述第二颜色空间不同;
    基于所述第二参数对所述第二图像进行第二图像处理,得到所述目标图像。
  2. 如权利要求1所述的方法,其特征在于,所述第一颜色空间为RAW空间,所述第二颜色空间为sRGB颜色空间,所述第三颜色空间为LMS颜色空间或者XYZ颜色空间。
  3. 如权利要求1-2任一项所述的方法,其特征在于,所述第一参数包括所述第一环境光源在xy色度图上的x 1值和y 1值。
  4. 如权利要求1-3任一项所述的方法,其特征在于,所述对所述第一图像进行第一图像处理,得到第二颜色空间的第二图像,包括:
    根据公式
    Figure PCTCN2022115486-appb-100001
    对所述第一图像进行调节,得到调节后的第一图像;所述
    Figure PCTCN2022115486-appb-100002
    为所述第一图像的第i个像素的RGB值,所述
    Figure PCTCN2022115486-appb-100003
    为所述调节后的第一图像的第i个像素的RGB值,所述R gain=G/R,所述B gain=G/B,所述RGB为所述第一环境光源在所述第一颜色空间中的RGB值;
    根据公式
    Figure PCTCN2022115486-appb-100004
    对所述调节后的第一图像进行调节,得到所述第二图像;所述CCM为基于所述第一参数得到的颜色校正矩阵,所述
    Figure PCTCN2022115486-appb-100005
    为所述第二图像在所述第二颜色空间下的第i个像素的RGB值。
  5. 如权利要求3-4任一项所述的方法,其特征在于,所述基于所述第一环境光源的第一参数得到第二参数,包括:
    根据所述第一参数计算色适应度D;
    基于所述第一参数计算所述第一环境光源对应白点在所述第三颜色空间上的LMS值;
    通过公式
    Figure PCTCN2022115486-appb-100006
    计算增益矩阵,所述L dstM dstS dst为参考白点在所述第三颜色空间下的LMS值,所述参考白点对应的光源为参考光源,所述L srcM srcS src值为所述第一环境光源对应白点在所述第三颜色空间下的LMS值;
    根据公式
    Figure PCTCN2022115486-appb-100007
    计算目标白点在所述第三颜色空间下的LMS值,所述目标白点对应的光源为目标光源,所述
    Figure PCTCN2022115486-appb-100008
    为所述第一环境光源对应白点在所述XYZ颜色空间下的XYZ值,所述
    Figure PCTCN2022115486-appb-100009
    是基于所述L srcM srcS src值得到的,所述Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵,所述
    Figure PCTCN2022115486-appb-100010
    为所述目标白点在所述第三颜色空间下的LMS值;
    通过公式
    Figure PCTCN2022115486-appb-100011
    计算所述第二参数,所述CA为所述第二参数。
  6. 如权利要求5所述的方法,其特征在于,所述根据所述第一参数计算色适应度D, 具体包括:
    根据公式
    Figure PCTCN2022115486-appb-100012
    计算第一变量,所述P xy为第一变量,所述x N为所述参考白点在xy色度图上的x值,所述y N为所述参考白点在xy色度图上的y值;
    根据公式
    Figure PCTCN2022115486-appb-100013
    计算第二变量,所述D c为第二变量;
    基于公式D=0.96·D c((1-e (-4.28·log La)) 406.5-1)+1,得到色适应度D,所述La为所述第一环境光源的亮度值。
  7. 如权利要求5-6任一项所述的方法,其特征在于,所述基于所述第一参数计算所述第一环境光源对应白点在所述第三颜色空间上的LMS值,具体包括:
    基于公式
    Figure PCTCN2022115486-appb-100014
    计算第三变量,所述i y为第三变量;
    根据公式X src=x 1·Y src·i y和公式Z src=Y src·(1-x 1-y 1)·i y计算所述第一环境光源对应白点在XYZ颜色空间上的XYZ值,所述X srcY srcZ src为所述第一环境光源对应白点在XYZ颜色空间上的XYZ值,所述Y src=m,所述m为所述电子设备预设的图像亮度;
    通过公式
    Figure PCTCN2022115486-appb-100015
    计算所述第一环境光源对应白点在所述第三颜色空间上的LMS值,所述
    Figure PCTCN2022115486-appb-100016
    为所述第一环境光源对应白点在所述第三颜色空间上的LMS值,所述Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵。
  8. 如权利要求1-7任一项所述的方法,其特征在于,所述基于所述第二参数对所述第二图像进行第二图像处理,得到所述目标图像,具体包括:
    将所述第二图像进行第三图像处理,得到第三图像;
    根据公式
    Figure PCTCN2022115486-appb-100017
    对所述第三图像进行色适应处理,得到第四图像;所述CA为所述第二参数,所述
    Figure PCTCN2022115486-appb-100018
    为所述第三图像在所述第三颜色空间下的LMS值,所述
    Figure PCTCN2022115486-appb-100019
    为所述第四图像在所述第三颜色空间下的LMS值;
    将所述第四图像进行第四图像处理,得到所述目标图像。
  9. 如权利要求8所述的方法,其特征在于,所述将所述第二图像进行第三图像处理,得到第三图像,具体包括:
    根据公式
    Figure PCTCN2022115486-appb-100020
    将所述第二图像由所述第二颜色空间转换到XYZ颜色空间,得到第一转换图像;所述
    Figure PCTCN2022115486-appb-100021
    为所述第二图像在所述第二颜色空间下,第i个像素的RGB值,所述M 1为所述第二颜色空间转换到所述XYZ颜色空间的转换矩阵,所述
    Figure PCTCN2022115486-appb-100022
    为所述第一转换图像在所述XYZ颜色空间下的第i个像素的XYZ值;
    基于公式
    Figure PCTCN2022115486-appb-100023
    将所述第一转换图像由所述XYZ颜色空间转换到所述第三颜色空间,得到所述第三图像;所述Mcat 1为XYZ颜色空间转换到LMS颜色空间的转换矩阵,所述
    Figure PCTCN2022115486-appb-100024
    为所述第三图像在所述第三颜色空间下的LMS值。
  10. 如权利要求8-9任一项所述的方法,其特征在于,所述将所述第四图像进行第四图像处理,得到所述目标图像,具体包括:
    根据公式
    Figure PCTCN2022115486-appb-100025
    将所述第四图像由所述第三颜色空间转换到XYZ颜色空间,得到第二转换图像;所述
    Figure PCTCN2022115486-appb-100026
    为所述第二转换图像在所述XYZ颜色空间下的第i个像素的XYZ值,所述Mcat 2为LMS颜色空间转换到XYZ颜色空间的转换矩阵;
    通过公式
    Figure PCTCN2022115486-appb-100027
    将所述第二转换图像由XYZ颜色空间转换到所述第二颜色空间,得到第三转换图像,所述M 2用于将所述第二转换图像由XYZ颜色空间转换到所述第二颜色空间,所述
    Figure PCTCN2022115486-appb-100028
    为所述第三转换图像在所述第二颜色空间中,第i个像素的RGB值;
    将所述第三转换图像进行RGB颜色空间图像处理,得到第四转换图像;
    将所述第四转换图像从所述第二颜色空间转换到YUV颜色空间得到第五转换图像;
    将所述第五转换图像进行YUV颜色空间处理,得到所述目标图像。
  11. 如权利要求1-7任一项所述的方法,其特征在于,所述基于所述第二参数对所述第二图像进行第二图像处理,得到所述目标图像,具体包括:
    根据公式
    Figure PCTCN2022115486-appb-100029
    对所述第二图像进行第五图像处理,得到第三转换图像;所述
    Figure PCTCN2022115486-appb-100030
    为所述第三转换图像在所述第二颜色空间中,第i个像素的RGB值,所述
    Figure PCTCN2022115486-appb-100031
    为所述第二图像在所述第二颜色空间下中,第i个像素的RGB值,所述CA 1为目标矩阵;
    将所述第三转换图像进行RGB颜色空间图像处理,得到第四转换图像;
    将所述第四转换图像从所述第二颜色空间转换到YUV颜色空间得到第五转换图像;
    将所述第五转换图像进行YUV颜色空间处理,得到所述目标图像;
    其中,CA 1=M 2·Mcat 2·CA·Mcat 1·M 1;所述M 1为所述第二颜色空间转换到XYZ颜色空间的转换矩阵,M 2为XYZ颜色空间转换到所述第一颜色空间的转换矩阵,Mcat 1为XYZ转换到LMS颜色空间的转换矩阵、Mcat 2为LMS颜色空间转换到XYZ颜色空间的转换矩阵、所述CA为所述第二参数。
  12. 一种电子设备,其特征在于,包括:存储器、处理器和触控屏;其中:
    所述触控屏用于显示内容;
    所述存储器,用于存储计算机程序,所述计算机程序包括程序指令;
    所述处理器用于调用所述程序指令,使得所述终端执行如权利要求1-11任一项所述的方法。
  13. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,该计算机程序被处理器执行时,实现如权利要求1-11任意一项所述的方法。
  14. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行如权利要求1-11中任意一项所述的方法。
PCT/CN2022/115486 2021-12-31 2022-08-29 一种图像处理方法及相关电子设备 WO2023124165A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22843605.1A EP4261771A4 (en) 2021-12-31 2022-08-29 IMAGE PROCESSING METHOD AND ASSOCIATED ELECTRONIC DEVICE
US18/006,183 US20240155254A1 (en) 2021-12-31 2022-08-29 Image Processing Method and Related Electronic Device

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202111680029.5 2021-12-31
CN202111680029 2021-12-31
CN202210022487.8A CN116437060B (zh) 2021-12-31 2022-01-10 一种图像处理方法及相关电子设备
CN202210022487.8 2022-01-10

Publications (1)

Publication Number Publication Date
WO2023124165A1 true WO2023124165A1 (zh) 2023-07-06

Family

ID=86997442

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/115486 WO2023124165A1 (zh) 2021-12-31 2022-08-29 一种图像处理方法及相关电子设备

Country Status (3)

Country Link
US (1) US20240155254A1 (zh)
EP (1) EP4261771A4 (zh)
WO (1) WO2023124165A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108701365A (zh) * 2017-08-29 2018-10-23 广东虚拟现实科技有限公司 光点识别方法、装置以及***
US20200111447A1 (en) * 2018-10-05 2020-04-09 Disney Enterprises, Inc. Machine learning color science conversion
CN111899197A (zh) * 2020-08-05 2020-11-06 广州市百果园信息技术有限公司 一种图像增亮去噪方法、装置、移动终端和存储介质
CN113592887A (zh) * 2021-06-25 2021-11-02 荣耀终端有限公司 视频拍摄方法、电子设备及计算机可读存储介质
CN113810641A (zh) * 2021-08-12 2021-12-17 荣耀终端有限公司 视频处理方法、装置、电子设备和存储介质
CN113824913A (zh) * 2021-08-12 2021-12-21 荣耀终端有限公司 视频处理方法、装置、电子设备和存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108701365A (zh) * 2017-08-29 2018-10-23 广东虚拟现实科技有限公司 光点识别方法、装置以及***
US20200111447A1 (en) * 2018-10-05 2020-04-09 Disney Enterprises, Inc. Machine learning color science conversion
CN111899197A (zh) * 2020-08-05 2020-11-06 广州市百果园信息技术有限公司 一种图像增亮去噪方法、装置、移动终端和存储介质
CN113592887A (zh) * 2021-06-25 2021-11-02 荣耀终端有限公司 视频拍摄方法、电子设备及计算机可读存储介质
CN113810641A (zh) * 2021-08-12 2021-12-17 荣耀终端有限公司 视频处理方法、装置、电子设备和存储介质
CN113824913A (zh) * 2021-08-12 2021-12-21 荣耀终端有限公司 视频处理方法、装置、电子设备和存储介质

Also Published As

Publication number Publication date
US20240155254A1 (en) 2024-05-09
EP4261771A4 (en) 2024-07-03
EP4261771A1 (en) 2023-10-18

Similar Documents

Publication Publication Date Title
WO2023231583A1 (zh) 图像处理方法及其相关设备
CN112887582A (zh) 一种图像色彩处理方法、装置及相关设备
WO2023036034A1 (zh) 图像处理方法及其相关设备
JP6921972B2 (ja) 画像処理装置、撮像装置、画像処理方法、撮像方法、およびプログラム
US20230325999A1 (en) Image generation method and apparatus and electronic device
CN113727085B (zh) 一种白平衡处理方法、电子设备、芯片***和存储介质
WO2024027331A1 (zh) 拍照方法和相关装置
US20230342977A1 (en) Method for Determining Chromaticity Information and Related Electronic Device
CN116668862B (zh) 图像处理方法与电子设备
WO2023124165A1 (zh) 一种图像处理方法及相关电子设备
WO2022257574A1 (zh) Ai自动白平衡和自动白平衡的融合算法以及电子设备
CN116437060B (zh) 一种图像处理方法及相关电子设备
CN111885768B (zh) 调节光源的方法、电子设备和***
CN115550575A (zh) 图像处理方法及其相关设备
CN115118963A (zh) 画质调整方法、电子设备及存储介质
CN115514947B (zh) 一种ai自动白平衡的算法和电子设备
EP4254939A1 (en) Method for dynamically adjusting exposure parameter of spectral sensor, and electronic device
CN116668838B (zh) 图像处理方法与电子设备
WO2023035919A1 (zh) 控制曝光的方法、装置与电子设备
US20230325986A1 (en) Image processing method and related apparatus
EP4258676A1 (en) Automatic exposure method and electronic device
CN116051434B (zh) 一种图像处理方法及相关电子设备
EP4274246A1 (en) Image processing method and electronic device
CN117519555A (zh) 一种图像处理方法、电子设备及***
CN115442536A (zh) 一种曝光参数的确定方法、装置、影像***和电子设备

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 18006183

Country of ref document: US