WO2021217647A1 - Image color processing method and apparatus - Google Patents

Image color processing method and apparatus Download PDF

Info

Publication number
WO2021217647A1
WO2021217647A1 PCT/CN2020/088476 CN2020088476W WO2021217647A1 WO 2021217647 A1 WO2021217647 A1 WO 2021217647A1 CN 2020088476 W CN2020088476 W CN 2020088476W WO 2021217647 A1 WO2021217647 A1 WO 2021217647A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
color
look
pixel
coefficient
Prior art date
Application number
PCT/CN2020/088476
Other languages
French (fr)
Chinese (zh)
Inventor
李蒙
陈海
王海军
张秀峰
郑成林
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2020/088476 priority Critical patent/WO2021217647A1/en
Priority to CN202080096708.5A priority patent/CN115088253A/en
Publication of WO2021217647A1 publication Critical patent/WO2021217647A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/02Digital function generators
    • G06F1/03Digital function generators working, at least partly, by table look-up
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • G06F7/556Logarithmic or exponential functions

Definitions

  • This application relates to the field of image processing technology, and in particular to an image color processing method and device.
  • the optical digital imaging process converts the light radiation of the real scene into electrical signals through the image sensor, and saves them in the form of digital images.
  • the purpose of image display is to reproduce the real scene described by a digital image through the display device. In this way, the user obtains the same visual perception as he directly observes the real scene.
  • the present application provides an image color processing method and device, which are used to adjust the image color and improve the image quality.
  • an image color processing method is provided.
  • the execution subject of the method may be a terminal device.
  • the method specifically includes: determining the color values of multiple color components of pixels of an image to be processed; determining the brightness values of the pixels, respectively The ratio with the color values of the multiple color components; determine the first color adjustment coefficient of the pixel according to the ratio and a first look-up table; perform color processing on the pixel according to the first color adjustment coefficient To get the target image.
  • the first color adjustment coefficient is determined to perform color processing on the image to be processed, which can reduce the color deviation phenomenon of the color processed image and improve the color processing The quality of the image.
  • each step can be implemented by the hardware circuit of the terminal device.
  • the method of determining the first color adjustment coefficient through the first look-up table can realize the processing of the integer data, so that the execution process of the image color processing flow can be implemented to
  • the hardware circuit improves the practical application possibilities of the image color processing method.
  • the first look-up table includes a mapping relationship between a color adjustment coefficient and a preset ratio.
  • the determination of the first color adjustment coefficient of the pixel according to the ratio and the first look-up table may include the following situations: when the preset ratio includes the ratio: according to The mapping relationship determines the first color adjustment coefficient corresponding to the ratio; when the preset ratio does not include the ratio: determine the first preset ratio and the second preset ratio in the first look-up table According to the mapping relationship, respectively determine the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio; perform an interpolation operation on the first coefficient and the second coefficient, To obtain the first color adjustment coefficient corresponding to the ratio.
  • determining the first color adjustment system through the interpolation method can reduce the number of entry values in the first look-up table, so that the space occupied by the first look-up table is reduced, and the complexity of the hardware circuit is reduced.
  • the interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.
  • the mapping relationship between the first entry value of the first look-up table and the first look-up table value satisfies the first power function.
  • the first table item value may correspond to a color adjustment coefficient
  • the first look-up table value may correspond to a preset ratio.
  • the exponent b of the first power function is a function coefficient.
  • the coefficient b of the first power function can be determined by means of a look-up table using the statistical information of the image or image sequence.
  • the statistical information of the image or image sequence can include the maximum, minimum, average, standard deviation, and histogram distribution of the image or image sequence. information.
  • the first look-up table value is a fixed-point value; the determination of the first table entry value of the first look-up table can be achieved in the following manner: according to the bit width of the color value The maximum value of the value range of, the fixed-point value is inversely quantized to obtain a floating-point value; the floating-point value is determined based on the function value of the first power function; and the quantization coefficient is preset to The function value is quantized to obtain the first entry value of the first look-up table.
  • Determining the value of the first entry of the first lookup table by the above method can make the value of the lookup table of the first lookup table and the value of the first entry be fixed-point values, and the mapping relationship conforms to the first power function, so that the value of the first lookup table Both the input data and output data can be fixed-point values, which implements the possibility of hardware circuits.
  • the above-mentioned method can be implemented by software, so that the actual usability of the image color processing flow is improved through the separation of software and hardware. And this part of the method is realized by software, and the software process can be updated at any time according to the effect of image color processing, so that the adaptability is high and the effect is good.
  • the first look-up table value is determined based on the step size between the index value of the first look-up table and the index value of the first look-up table.
  • the step size can be an integer equal to or greater than one.
  • the method further includes: determining the first look-up table corresponding to the first value range in which the ratio is located; wherein the value range determined by the bit width of the color value includes The first value range and the second value range corresponding to the second lookup table.
  • mapping relationship between the second table entry value of the second look-up table and the second look-up table value satisfies the first power function.
  • the method for generating the second lookup table is similar to that of the first lookup table, and can be cross-referenced.
  • the minimum value of the first value range is greater than the maximum value of the second value range
  • the first lookup value of the first lookup table is based on the index value of the first lookup table, the step size between the index values of the first lookup table, and the maximum value of the second value range Sure.
  • the first lookup value of the first lookup table is based on the index of the first lookup table The step size between the value and the index value of the first look-up table is determined.
  • the step size between the index values of the first look-up table and the step size between the index values of the second look-up table may be different.
  • the color processing of the pixel according to the first color adjustment coefficient can be achieved by: determining the second color adjustment coefficient of the pixel; adjusting the first color The coefficient is multiplied by the second color adjustment coefficient; and color processing is performed on the pixel according to the product of the multiplication.
  • the image to be processed is an image that has undergone dynamic range adjustment processing; the determining the second color adjustment coefficient of the pixel includes the following steps: determining that the pixel is after the dynamic range adjustment processing And the ratio of the electrical signal before the dynamic range adjustment processing; and the second color adjustment coefficient is determined according to the ratio of the electrical signal.
  • the color deviation phenomenon caused by the dynamic range adjustment processing of the image to be processed can be reduced, and the quality of the image subjected to color processing can be improved.
  • the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table.
  • the second color adjustment coefficient is determined according to the electrical signal ratio and a third look-up table; the third look-up table includes a mapping relationship between the color adjustment coefficient and a preset ratio, and the mapping relationship conforms to the second power function.
  • the multiple color components include R, G, and B components in the RGB space, and the target image is obtained according to the following formula:
  • R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the pixel, and R', G', and B'respectively represent the R of the corresponding pixel in the target image.
  • the color value of the component, the color value of the G component, and the color value of the B component, Y represents the brightness value of the pixel
  • AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel
  • AlphyG0 represents the G component of the pixel
  • AlphyB0 represents the first color adjustment coefficient corresponding to the B component of the pixel
  • Alphy1 represents the second color adjustment coefficient
  • A1 is the quantization coefficient of Alphy1
  • A2 is the quantization coefficient of AlphyR0 Coefficient
  • A3 is the quantized coefficient of AlphyG0
  • A4 is the quantized coefficient of AlphyB0.
  • the multiple color components include U and V components in YUV space, and the target image is obtained according to the following formula:
  • U and V respectively represent the color value of the U component and the color value of the V component of the pixel
  • U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image
  • AlphyU0 represents the first color adjustment coefficient corresponding to the U component of the pixel
  • AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel
  • Alphy1 represents the second color adjustment coefficient
  • A1 is the quantization coefficient of Alphy1
  • A2 is the quantized coefficient of AlphyU0
  • A3 is the quantized coefficient of AlphyV0.
  • an image color processing device in a second aspect, can be a terminal device, a device in a terminal device (such as a chip, or a chip system, or a circuit), or a device that can be matched with the terminal device.
  • the device may include modules that perform one-to-one correspondence of the methods/operations/steps/actions described in the first aspect.
  • the modules may be hardware circuits, software, or hardware circuits combined with software.
  • the device may include a determination module and a processing module. Illustratively:
  • the determining module is used to determine the color values of the multiple color components of the pixels of the image to be processed; determine the ratio of the brightness value of the pixel to the color values of the multiple color components respectively; according to the ratio and the first look-up table , Determining the first color adjustment coefficient of the pixel; a processing module, configured to perform color processing on the pixel according to the first color adjustment coefficient to obtain a target image.
  • the first look-up table includes a mapping relationship between a color adjustment coefficient and a preset ratio.
  • the determining module when determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table, is specifically configured to: when the preset ratio includes the ratio: According to the mapping relationship, determine the first color adjustment coefficient corresponding to the ratio; when the preset ratio does not include the ratio: determine the first preset ratio and the second preset in the first look-up table Ratio; according to the mapping relationship, respectively determine the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio; perform interpolation operations on the first coefficient and the second coefficient , To obtain the first color adjustment coefficient corresponding to the ratio.
  • the interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.
  • the mapping relationship between the first entry value of the first look-up table and the first look-up table value satisfies the first power function.
  • the first table item value may correspond to a color adjustment coefficient
  • the first look-up table value may correspond to a preset ratio.
  • the exponent b of the first power function is a function coefficient.
  • the coefficient b of the first power function can be determined by means of a look-up table using the statistical information of the image or image sequence.
  • the statistical information of the image or image sequence can include the maximum, minimum, average, standard deviation, and histogram distribution of the image or image sequence. information.
  • the first look-up table value is a fixed-point value
  • the determining module is specifically configured to: dequantize the fixed-point value according to the maximum value of the value range determined by the bit width of the color value to Obtain a floating-point value; determine that the floating-point value is based on the function value of the first power function; quantize the function value according to a preset quantization coefficient to obtain the first entry of the first look-up table Numerical value.
  • the first look-up table value is determined based on the step size between the index value of the first look-up table and the index value of the first look-up table.
  • the determining module is further configured to: determine the first look-up table corresponding to the first value range in which the ratio is located; wherein the value determined by the bit width of the color value The range includes the first value range and the second value range corresponding to the second lookup table.
  • mapping relationship between the second table entry value of the second look-up table and the second look-up table value satisfies the first power function.
  • the minimum value of the first value range is greater than the maximum value of the second value range
  • the first lookup value of the first lookup table is based on the index value of the first lookup table, the step size between the index values of the first lookup table, and the maximum value of the second value range Sure.
  • the step size between the index values of the first look-up table and the step size between the index values of the second look-up table are different.
  • the processing module when performing color processing on the pixel according to the first color adjustment coefficient, is specifically configured to: determine the second color adjustment coefficient of the pixel; The color adjustment coefficient is multiplied by the second color adjustment coefficient; and color processing is performed on the pixel according to the product of the multiplication.
  • the image to be processed is an image processed by dynamic range adjustment
  • the determining module is specifically configured to: determine the ratio of the electrical signal of the pixel after the dynamic range adjustment process and before the dynamic range adjustment process; The ratio of the electrical signal determines the second color adjustment coefficient.
  • the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table.
  • the multiple color components include R, G, and B components in the RGB space, and the target image is obtained according to the following formula:
  • R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the pixel, and R', G', and B'respectively represent the R of the corresponding pixel in the target image.
  • the color value of the component, the color value of the G component, and the color value of the B component, Y represents the brightness value of the pixel
  • AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel
  • AlphyG0 represents the G component of the pixel
  • AlphyB0 represents the first color adjustment coefficient corresponding to the B component of the pixel
  • Alphy1 represents the second color adjustment coefficient
  • A1 is the quantization coefficient of Alphy1
  • A2 is the quantization coefficient of AlphyR0 Coefficient
  • A3 is the quantized coefficient of AlphyG0
  • A4 is the quantized coefficient of AlphyB0.
  • the multiple color components include U and V components in YUV space, and the target image is obtained according to the following formula:
  • U and V respectively represent the color value of the U component and the color value of the V component of the pixel
  • U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image
  • AlphyU0 represents the first color adjustment coefficient corresponding to the U component of the pixel
  • AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel
  • Alphy1 represents the second color adjustment coefficient
  • A1 is the quantization coefficient of Alphy1
  • A2 is the quantized coefficient of AlphyU0
  • A3 is the quantized coefficient of AlphyV0.
  • an embodiment of the present application provides an image color processing device, the device includes a processor, and the processor is used to call a set of programs, instructions, or data to execute the first aspect or any possible design of the first aspect.
  • the described method may also include a memory for storing programs, instructions or data called by the processor.
  • the memory is coupled with the processor, and when the processor executes the instructions or data stored in the memory, it can implement the method described in the first aspect or any possible design.
  • an embodiment of the present application provides a chip system, which includes a processor and may also include a memory, for implementing the method described in the first aspect or any one of the possible designs of the first aspect.
  • the chip system can be composed of chips, or it can include chips and other discrete devices.
  • the embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores computer-readable instructions.
  • the method described in one aspect or any one of the possible designs of the first aspect is executed.
  • the embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the method described in the first aspect or any possible design of the first aspect .
  • Figure 1 is a schematic structural diagram of a terminal device in an embodiment of the application
  • FIG. 2 is a schematic diagram of image color processing by a terminal device in an embodiment of the application
  • FIG. 3 is a schematic flowchart of an image color processing method in an embodiment of the application.
  • FIG. 4 is a schematic flow chart of a color processing method for an RGB format image in an embodiment of the application
  • FIG. 5 is one of the schematic diagrams of the structure of the image color processing device in an embodiment of the application.
  • FIG. 6 is the second structural diagram of the image color processing device in the embodiment of the application.
  • the embodiments of the present application provide an image color processing method and device, in order to realize the adjustment of the image color and improve the image quality.
  • the method and the device are based on the same or similar technical conception. Since the method and the device have similar principles for solving the problem, the implementation of the device and the method can be referred to each other, and the repetition will not be repeated.
  • references described in this specification to "one embodiment” or “some embodiments”, etc. mean that one or more embodiments of the present application include a specific feature, structure, or characteristic described in combination with the embodiment. Therefore, the sentences “in one embodiment”, “in some embodiments”, “in some other embodiments”, “in some other embodiments”, etc. appearing in different places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless it is specifically emphasized otherwise.
  • the terms “including”, “including”, “having” and their variations all mean “including but not limited to”, unless otherwise specifically emphasized.
  • the image-based color processing method and device provided in the embodiments of the present application can be applied to electronic equipment.
  • the electronic device can be a mobile device such as a mobile terminal (mobile terminal), a mobile station (MS), user equipment (UE), etc., or a fixed device, such as a fixed telephone, a desktop computer, etc., or Video monitor.
  • the electronic device has an image color processing function.
  • the electronic device can also optionally have a wireless connection function to provide users with a handheld device with voice and/or data connectivity, or other processing devices connected to a wireless modem.
  • the electronic device can be a mobile phone (or (Called "cellular" phones), computers with mobile terminals, etc., can also be portable, pocket-sized, handheld, computer-built or vehicle-mounted mobile devices, of course, can also be wearable devices (such as smart watches, smart bracelets) Etc.), tablet computers, personal computers (PC), personal digital assistants (PDAs), point of sales (POS), etc.
  • a terminal device may be used as an example for description.
  • FIG. 1 is a schematic diagram of an optional hardware structure of a terminal device 100 related to an embodiment of this application.
  • the terminal device 100 mainly includes a chip set, where the chip set can be used to process image colors.
  • the chip set includes an image signal processor (ISP), and the ISP processes image colors.
  • the chipset in the terminal device 100 further includes other modules, and the terminal device 100 may also include peripheral devices. The details are as follows.
  • the power management unit PMU
  • voice data codec codec
  • short-distance module and radio frequency RF
  • arithmetic processor random-access memory
  • PMU voice data codec
  • RF radio frequency
  • Memory RAM
  • input/output input/output
  • display interface sensor hub
  • Sensor hub baseband communication module and other components make up a chip or chipset.
  • Components such as USB interface, memory, display screen, battery/mains power, earphone/speaker, antenna, sensor, etc. can be understood as peripheral devices.
  • the arithmetic processor, RAM, I/O, display interface, ISP, Sensor hub, baseband and other components in the chipset can form a system-on-a-chip (SOC), which is the main part of the chipset.
  • SOC system-on-a-chip
  • the components in the SOC can all be integrated into a complete chip, or part of the components in the SOC can be integrated, and the other parts are not integrated.
  • the baseband communication module in the SOC can not be integrated with other parts and become an independent part.
  • the components in the SOC can be connected to each other through a bus or other connecting lines.
  • the PMU, voice codec, RF, etc. outside the SOC usually include analog circuit parts, so they are often outside the SOC and are not integrated with each other.
  • the PMU is used for external mains or batteries to supply power to the SOC, and the mains can be used to charge the battery.
  • the voice codec is used as the sound codec unit to connect with earphones or speakers to realize the conversion between natural analog voice signals and digital voice signals that can be processed by the SOC.
  • the short-range module can include wireless fidelity (WiFi) and Bluetooth, and can also optionally include infrared, near field communication (NFC), radio (FM), or global positioning system (GPS) ) Module etc.
  • the RF is connected with the baseband communication module in the SOC to realize the conversion between the air interface RF signal and the baseband signal, that is, mixing. For mobile phones, receiving is down-conversion, and sending is up-conversion.
  • Baseband is used for baseband communication, including one or more of a variety of communication modes, used for processing wireless communication protocols, including physical layer (layer 1), medium access control (MAC) ( The processing of each protocol layer such as layer 2), radio resource control (RRC) (layer 3), etc., can support various cellular communication standards, such as long term evolution (LTE) communication, or 5G new air interface ( new radio, NR) communication, etc.
  • the Sensor hub is an interface between the SOC and external sensors, and is used to collect and process data from at least one external sensor.
  • the external sensors can be, for example, accelerometers, gyroscopes, control sensors, image sensors, and so on.
  • the arithmetic processor can be a general-purpose processor, such as a central processing unit (CPU), or one or more integrated circuits, such as one or more application specific integrated circuits (ASICs), or , One or more digital signal processors (digital signal processors, DSP), or microprocessors, or, one or more field programmable gate arrays (FPGA), etc.
  • the arithmetic processor can include one or more cores, and can selectively schedule other units.
  • RAM can store some intermediate data during calculation or processing, such as intermediate calculation data of CPU and baseband.
  • ISP is used to process the data collected by the image sensor.
  • I/O is used for the SOC to interact with various external interfaces, such as the universal serial bus (USB) interface for data transmission.
  • USB universal serial bus
  • the memory can be a chip or a group of chips.
  • the display screen can be a touch screen, which is connected to the bus through a display interface.
  • the display interface can be used for data processing before image display, such as aliasing of multiple layers to be displayed, buffering of display data, or control and adjustment of screen brightness.
  • the image signal processor involved in the embodiment of the present application may be one or a group of chips, that is, it may be integrated or independent.
  • the image signal processor included in the terminal device 100 may be an integrated ISP chip integrated in the arithmetic processor.
  • Figure 2 shows a schematic diagram of image color processing by a terminal device.
  • the terminal device can perform image processing on the input image to be processed.
  • the image processing process can include image color processing, and can also include other processing processes such as dynamic range adjustment processing.
  • the terminal device outputs The processed target image.
  • the ISP in the terminal device can process the image color to obtain the processed target image.
  • the format of the image may be a red, green, and blue (RGB) format, may also be a bright color separation (YUV) format, or may be a Bayer format.
  • RGB red, green, and blue
  • YUV bright color separation
  • the image may include one or more pixels, and each pixel includes one or more dimensional image color components.
  • the color in the embodiment of the present invention may include hue and saturation. Among them, components can also be referred to as channels, signals, color components, and so on.
  • the color component can also be referred to as the channel of the color space, the channel of the color space, the color component of the color space, and so on.
  • the color value represents the digital expression value of the image color component of the image pixel.
  • the color value of the color component may include the U component and the V component of the YUV space.
  • the color value can include the R component, G component, and B component of the RGB space.
  • the color value of the color component can also be understood as the corresponding color component value, color channel value, color component value, and so on.
  • the lookup table can be any form of lookup table that can be understood by those skilled in the art.
  • a one-dimensional (1D) lookup table is used in the embodiment of the present application.
  • the lookup table includes a series of input data and output data, and the input data and the output data have a one-to-one correspondence.
  • the output data in the lookup table can be embodied in the form of table item values, and the input data can be expressed as the lookup table value.
  • the look-up table value may not be displayed in the look-up table, and the look-up table value is expressed in the form of table item index or table item subscript. That is, the lookup table includes one or more table item values, and each table item value corresponds to a lookup table value. By inputting the lookup table value, the table item value corresponding to the lookup table value can be obtained.
  • lookup table can be embodied in a table form, or can be embodied in other forms that can represent the corresponding relationship between the input data and the output data.
  • a first lookup table, a second lookup table, or a third lookup table is used to represent multiple lookup tables, and the concept of each lookup table can refer to the description in point 4) of this article.
  • the image color processing method provided by the embodiment of the present application is as follows. This method can be executed by the terminal device shown in FIG. 1 or by other devices with image color processing functions.
  • S301 Determine color values of multiple color components of pixels of the image to be processed.
  • S302 Determine the ratio of the brightness value of the pixel of the image to be processed to the color value of the multiple color components.
  • the method for determining the brightness value of the pixel is not limited in the embodiment of the present application.
  • the brightness value may be the brightness value of the Y component of the YUV space.
  • the brightness value of the Y component can be calculated based on the color values of the R component, G component, and B component.
  • a 11 , a 12 , and a 13 are fixed coefficients.
  • YUV space For the YUV space, it includes two color components, and the ratio of the luminance value Y of the pixel to the color values of the two color components can be expressed as Y/U and Y/V respectively.
  • RGB space For the RGB space, it includes 3 color components, and the ratio of the luminance value Y of the pixel to the color values of the 3 color components can be expressed as Y/R, Y/G, and Y/B, respectively.
  • S303 Determine the first color adjustment coefficient of the pixels of the image to be processed according to the ratio obtained in S302 and the first look-up table.
  • the first look-up table includes or indicates the mapping relationship between the color adjustment coefficient and the preset ratio.
  • the preset ratio can be used as input data, and the color adjustment coefficient can be used as output data.
  • S304 Perform color processing on pixels of the image to be processed according to the first color adjustment coefficient to obtain a target image.
  • the image to be processed may include multiple pixels, and each pixel can be processed according to the process shown in FIG. 3 to obtain the target image.
  • the first color adjustment coefficient is determined according to the ratio of the brightness value of the pixel of the image to be processed to the color value of the color component to perform color processing on the image to be processed, which can reduce the color deviation phenomenon of the image to be processed. Improved the quality of the image for color processing.
  • each step of the embodiment in FIG. 3 can be implemented by the hardware circuit of the terminal device.
  • the method of determining the first color adjustment coefficient through the first look-up table can realize the processing of the integer data, so that the image color processing flow can be changed.
  • the implementation of the process is implemented in the hardware circuit to improve the practical application possibilities of the image color processing method.
  • the input data of the first look-up table can be floating-point values, integer values or fixed-point values. Take the input data of the first look-up table as a fixed-point value as an example.
  • the value range of the input data of the lookup table may be determined according to the bit width of the color value, and the value range of the input data of the lookup table may be less than or equal to the value range determined by the bit width of the color value.
  • the color value is an integer value
  • the color value is N bits, and N is a positive integer.
  • the color value is 8 bits, 10 bits, 12 bits, 14 bits, or 16 bits.
  • the value range of the color value is (0 ⁇ 2 N -1) or (1 ⁇ 2 N ).
  • the value of the color value of an RGB image is 10 bits
  • the value range of the color value is (0-2 10 -1).
  • the look-up table value of the look-up table is used as the input data, and the output data is the table item value of the look-up table.
  • the mapping relationship between the table entry value of the lookup table and the lookup table value satisfies the first power function. That is, the table look-up value is input into the first power function for operation to obtain the corresponding table item value.
  • the look-up table value is a fixed-point value
  • the look-up table can be generated in the following way.
  • the look-up table value (that is, the fixed-point value) is inversely quantized to obtain the floating-point value.
  • the maximum value of the value range determined by the bit width of the color value is 2 N -1
  • the look-up table value is M
  • the floating point value M1 is obtained by M/(2 N -1).
  • Determine the function value of the floating point value based on the first power function for example, substituting the floating point value M1 into the first power function for calculation to obtain M2.
  • M2 is a floating-point value.
  • the function value is quantized to obtain the entry value of the look-up table.
  • the data obtained after M2 quantization is a fixed-point value.
  • the table item value corresponding to each look-up table value can be obtained, thereby generating the look-up table.
  • the look-up table value of the look-up table is the input data of the look-up table, which is used to obtain the corresponding table item value according to the look-up table value.
  • the index value of the lookup table is the sequence number of the table item value, which is generally generated according to the order of natural numbers from small to large or from large to small.
  • the look-up table value can be determined according to the index value and the step length between the index value.
  • the value range of the first look-up table value of the first look-up table described in the embodiment of FIG. 3 is determined by the bit width of the color value.
  • the value of the color value is N bits
  • the value range of the color value is (0-2 N -1)
  • the maximum value is 2 N -1.
  • the first look-up table value can be set to a value from 0 to 2 N -1.
  • the sequence number of the first entry value in the first lookup table can be referred to as the index value of the first lookup table. For example, if the first lookup table includes L entry values, then the sequence number of the first lookup table entry value is 0 ⁇ L-1 or (1 ⁇ L), L is a positive integer.
  • the index value of the first look-up table is 0 ⁇ L-1 or (1 ⁇ L).
  • the step length between every two index values in the lookup table can be 1 or an integer greater than 1.
  • the first look-up table value is determined based on the index value of the first look-up table and the step size between the index value. When the first look-up table value is 2 N , the first look-up table value corresponds to the index value one-to-one, and the step size is 1.
  • the color value is 12 bits, the color value ranges from 0 to 4095, and the maximum value is 4095.
  • the index value can be from 0 to 4095, or from 1 to 4096. Assuming that the index value can be 0 ⁇ 1023, the step size is 4, and the table lookup value M is (0,4,8,12,16,20,...,4092) in turn.
  • the value range determined by the bit width of the color value includes a first value range and at least one second value range. That is, the value range determined by the bit width of the color value may include multiple subsets. Each subset is a value range, and the union of multiple subsets is the value range determined by the bit width of the color value, or the union of multiple subsets can also be smaller than the value determined by the bit width of the color value Scope. Generally, two subsets are taken as an example, that is, the value range determined by the bit width of the color value includes a first value range and a second value range. The value range of the table look-up value of the first look-up table described in the embodiment of FIG. 3 is the first value range.
  • the value of the color value is N bits
  • the value range of the color value is (0-2 N -1)
  • the maximum value is 2 N -1.
  • the second value range is (0 ⁇ N1)
  • the first value range is (N1+1 ⁇ 2 N -1)
  • the minimum value of the first value range is greater than the maximum value of the second value range.
  • the value range of the table lookup value of the first lookup table is (N1+1 ⁇ 2 N -1), and the first lookup table value can be set to a value in (N1+1 ⁇ 2 N -1).
  • the sequence number of the first entry value in the first lookup table can be referred to as the index value of the first lookup table.
  • the sequence number of the first lookup table entry value is 0 ⁇ L-1 or (1 ⁇ L)
  • L is a positive integer
  • the index value of the first look-up table is 0 ⁇ L-1 or (1 ⁇ L).
  • the step size between every two index values in the first look-up table may be 1 or an integer greater than 1.
  • the first look-up table value is determined based on the index value of the first look-up table and the step size between the index value.
  • the first look-up table value can have a one-to-one correspondence with the index value, that is, the step size is 1.
  • the step size can also be greater than 1.
  • a second lookup table can be generated according to the second value range, and the value range of the table lookup value of the second lookup table corresponds to the second value range.
  • the value range of the table lookup value of the second lookup table is (0 ⁇ N1), and the second lookup table value can be set to a value in (0 ⁇ N1).
  • the sequence number of the second entry value in the second lookup table can be called the index value of the second lookup table. For example, if the second lookup table includes L1 entry values, the sequence number of the second lookup table entry value is 0 ⁇ L1-1 or (1 ⁇ L1), L1 is a positive integer.
  • the index value of the second lookup table is 0 ⁇ L1-1 or (1 ⁇ L1).
  • the step size between every two index values in the second lookup table may be 1 or an integer greater than 1.
  • the second look-up table value is determined based on the index value of the second look-up table and the step size between the index value.
  • the second look-up table value can have a one-to-one correspondence with the index value, that is, the step size is 1.
  • the step size can also be greater than 1.
  • the step size between the index values of the first look-up table and the step size between the index values of the second look-up table may be the same or different.
  • the color value is 12 bits
  • the color value ranges from 0 to 4095
  • the maximum value is 4095.
  • the second value range is (0 ⁇ 255)
  • the first value range is (256 ⁇ 4095).
  • the number of entries in the second look-up table is 64
  • the value of the entries in the second look-up table is (0,4,8,12,16,20 , Jerusalem,252).
  • the index value of the second lookup table may be 0-63, or 1-64.
  • the index value of the first look-up table may be 0-127, or 1-128.
  • look-up table generation process can be applied to the first look-up table, and can also be applied to the second look-up table.
  • the first look-up table corresponds to the first value range.
  • the first lookup table corresponding to the first value range in which the ratio is located may also be determined. For example, a threshold can be set, and the value range of the ratio can be determined according to the comparison result of the ratio and the threshold, and the lookup table corresponding to the value range can be further determined.
  • the ratio is less than the threshold, the second value range of the ratio is determined, the second lookup table corresponding to the second value range is determined, and the color adjustment coefficient corresponding to the ratio is determined based on the ratio and the second lookup table.
  • the first value range of the ratio is determined, and the first lookup table corresponding to the first value range is determined, and the first color adjustment corresponding to the ratio is determined according to the ratio and the first lookup table. coefficient.
  • the color value is 12 bits
  • the maximum value is 4095.
  • the second value range is (0 ⁇ 255)
  • the first value range is (256 ⁇ 4095).
  • the threshold can be set to 256.
  • the color adjustment coefficient can also be determined according to the following comparison method.
  • the ratio is less than or equal to the threshold, the second value range of the ratio is determined, the second lookup table corresponding to the second value range is determined, and the color adjustment coefficient corresponding to the ratio is determined based on the ratio and the second lookup table.
  • the ratio is greater than the threshold, the first value range of the ratio is determined, the first lookup table corresponding to the first value range is determined, and the first color adjustment coefficient corresponding to the ratio is determined according to the ratio and the first lookup table.
  • the color value is 12 bits, the color value ranges from 0 to 4095, and the maximum value is 4095.
  • the second value range is (0 ⁇ 255), and the first value range is (256 ⁇ 4095).
  • the threshold can be set to 255.
  • the following describes a possible implementation manner of determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table in S303.
  • the first lookup table includes the mapping relationship between the color adjustment coefficient and the preset ratio. It can be understood that the preset ratio is the lookup value of the first lookup table, and the color adjustment coefficient is the entry in the first lookup table corresponding to the lookup value. data.
  • the first color adjustment coefficient of the pixel is determined according to the ratio and the first look-up table.
  • the preset ratio of the first look-up table may include the ratio, and the first color adjustment coefficient corresponding to the ratio can be determined according to the mapping relationship between the color adjustment coefficient and the preset ratio.
  • the ratio may not be included in the preset ratio of the first look-up table.
  • the first color adjustment coefficient corresponding to the ratio may be determined by interpolation.
  • interpolation method is a method of estimating unknown data from known discrete data in numerical analysis in the field of mathematics.
  • the interpolation method used to determine the first color adjustment coefficient corresponding to the ratio may be an interpolation method, an extrapolation method, a linear interpolation method, or a nonlinear interpolation method, or It is any of the near interpolation method, bilinear quadratic interpolation method, cubic interpolation method or Lanczos interpolation method, and the specific interpolation method can be selected according to the actual situation.
  • the first preset ratio and the second preset ratio may be determined in the first look-up table, and the correspondence between the first preset ratio and the second preset ratio may be determined according to the mapping relationship between the color adjustment coefficient and the preset ratio.
  • the first coefficient and the second coefficient of, the first coefficient and the second coefficient are interpolated to obtain the first color adjustment coefficient corresponding to the ratio.
  • the first preset ratio and the second preset ratio may be two ratios that are adjacent to the ratio.
  • the ratio is located between the first preset ratio and the second preset ratio, and is between the first preset ratio and the second preset ratio.
  • the ratio is adjacent to both the first preset ratio and the second preset ratio.
  • the first preset ratio and the second preset ratio are both smaller than the ratio, and among the preset ratios, the ratio, the first preset ratio, and the second preset ratio are three Adjacent; or, the first preset ratio and the second preset ratio are both greater than the ratio, and in the preset ratio, the ratio, the first preset ratio, and the second preset ratio are adjacent to each other.
  • the step length of the first lookup table (LUT1) is 2 step , the number of entries in the first lookup table is NUM, and max is the input value of the lookup table interpolation.
  • the following is an example of how to perform linear interpolation on the first look-up table (LUT) to obtain the color adjustment coefficient corresponding to the ratio.
  • the final interpolation data3:data3 (data1*(step-dec)+data2*dec)/step.
  • data3 is the color adjustment coefficient corresponding to the ratio.
  • the first lookup table corresponds to the first value range.
  • LUT first look-up table
  • Radio1 Radio-thres.
  • data3 (data1*(step-dec)+data2*dec)/step.
  • data3 is the color adjustment coefficient corresponding to the ratio.
  • the process of generating the first lookup table is a software process, which can be implemented by software.
  • the software process can be packaged as firmware/software (firmware).
  • firmware/software firmware
  • Each step in the embodiment of FIG. 3 is a hardware flow, which can be implemented by a hardware circuit.
  • the hardware circuit of the terminal device can process each frame of the image to be processed according to the steps of the embodiment in FIG. 3 to obtain each frame to be processed.
  • the target image corresponding to the image.
  • the firmware/software of the terminal device may generate the first look-up table.
  • the terminal device's separation of software and hardware for the color processing process of the image may not be limited to the implementation manners exemplified in this paragraph.
  • the first power function is explained below.
  • the exponent b of the first power function is the function coefficient.
  • the coefficient b of the first power function can be determined by means of a look-up table using the statistical information of the image or image sequence.
  • the statistical information of the image or image sequence can include the maximum, minimum, average, standard deviation, and histogram distribution of the image or image sequence. information.
  • the average brightness value of the image to be processed may refer to the average value of the brightness of the image to be processed or a sequence of images to be processed.
  • the corresponding relationship may be as shown in Table 1 or Table 2.
  • the range of the average brightness value in Table 1 or Table 2 is [0,1].
  • the average brightness value when the average brightness value of the image to be processed is obtained, the average brightness value may be the average value of the Y component of the image to be processed, or the average value of other components of the image to be processed.
  • the exponent of the first power function when the average brightness value is less than 0.1, the exponent of the first power function can be 1.2; when the average brightness value is greater than 0.6, the exponent of the first power function can be 0.2.
  • the average brightness value is between the two table values, the exponential value of the first power function can be obtained by interpolation.
  • the embodiment of the present application does not limit the interpolation method. For example, linear interpolation, quadratic linear interpolation, etc. can be adopted. For example, when the average brightness value is between 0.55 and 0.6, the following linear interpolation method can be adopted to obtain the exponent value of the first power function:
  • the above-mentioned output represents the exponential value of the first power function
  • the above-mentioned input represents the average brightness value of the image to be processed or the sequence of images to be processed.
  • the power function in the embodiment of the present application can also be replaced with a linear function.
  • each ratio corresponds to a first look-up table.
  • the multiple first look-up tables corresponding to the multiple ratios may be different, that is, the mapping relationship between the color adjustment coefficients and the preset ratios included or indicated by the multiple first look-up tables may be different.
  • the mapping relationship between the value of the table entry of the first look-up table and the value of the look-up table satisfies the first power function. Then the exponent values of the multiple first power functions corresponding to multiple ratios may be different, and of course there may also be the same situation.
  • Y represents the brightness value of the image to be processed
  • R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the image to be processed
  • R', G', and B' respectively represent The color value of the R component, the color value of the G component, and the color value of the B component of the target image
  • a 1 represents the first color adjustment coefficient corresponding to the R component
  • a 2 represents the first color adjustment coefficient corresponding to the G component
  • a 3 represents The first color adjustment coefficient corresponding to the B component.
  • a 1 , a 2 or a 3 can be floating-point values or fixed-point values.
  • u, v respectively represent the color value of the U component and the color value of the V component of the image to be processed
  • u', v' respectively represent the color value of the U component and the color value of the V component of the target image
  • a 4 represents the U component
  • a 5 represents the first color adjustment coefficient corresponding to the V component.
  • the first color adjustment coefficient may be preset.
  • the first color adjustment coefficient may be obtained through calibration of experimental data.
  • the mapping relationship between the first color adjustment coefficient and the color value of the color component of the pixel may be calculated based on experimental data, and the first color adjustment coefficient may be determined based on the mapping relationship.
  • the first color adjustment coefficient corresponding to the pixels of the image to be processed is determined to perform color processing on the image to be processed, which can improve the quality of the image for color processing.
  • the above-mentioned second color adjustment coefficient may be a color adjustment coefficient of a given image to be processed, or may be determined according to other methods.
  • the image to be processed may be an image that has undergone a dynamic range adjustment process
  • the dynamic range adjustment process means compressing or stretching the electrical signal value (for example, Y component, R component, G component, B component) of the image.
  • the dynamic range adjustment processing of the image may cause the color deviation phenomenon of the image.
  • the second color adjustment coefficient may be determined according to the ratio of the electrical signal.
  • the electrical signal ratio may be the electrical signal ratio of the electrical signal value of each pixel after the dynamic range adjustment process and the electrical signal value before the dynamic range adjustment process.
  • the process of converting an image between high dynamic range (HDR) and standard dynamic range (standard dynamic range, SDR) involves adjusting the dynamic range of the image.
  • the electrical signal value can be the Y component in the YUV space, or the R component, G component, and B component in the RGB space.
  • the dynamic range adjustment processing of the electrical signal value of the image to be processed can be as shown in the following formula (3):
  • the electrical signal value before the dynamic range adjustment processing is Y 1
  • the electrical signal value after the dynamic range adjustment processing is Y 2
  • c is the ratio of the electrical signals before and after the dynamic range adjustment processing.
  • the color value of the image to be processed is subjected to dynamic range adjustment processing, as shown in the following formula (4):
  • the color values before the dynamic range adjustment processing are R 1 , G 1 , B 1
  • the color values after the dynamic range adjustment processing are R 2 , G 2 , B 2
  • f is the ratio of the electrical signals before and after the dynamic range adjustment processing.
  • f can be the ratio of the largest component in RGB.
  • determining the second color adjustment coefficient according to the electrical signal ratio includes multiple methods.
  • the electrical signal ratio can be directly determined as the second color adjustment coefficient.
  • the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table.
  • the second color adjustment coefficient is determined according to the ratio of the electrical signal and the look-up table (denoted as the third look-up table).
  • the third look-up table includes or indicates the mapping relationship between the color adjustment coefficient and the preset ratio, and the mapping relationship between the color adjustment coefficient and the preset ratio conforms to the second power function.
  • the second color adjustment coefficient may also be determined according to the ratio of the electrical signal and the second power function, and the second color adjustment coefficient may be a value obtained by substituting the ratio of the electrical signal into the second power function.
  • the process of determining the second color adjustment coefficient according to the ratio of the electrical signal and the third look-up table may be implemented by a hardware circuit, and the process of generating the third look-up table may be implemented by firmware/software.
  • the value of d can be determined by a fixed value selected by those skilled in the art based on experimental data and experience, or by using image or image sequence statistical information through a look-up table.
  • the image or image sequence statistical information can include the maximum value of the image or image sequence. , Minimum, average, standard deviation, and histogram distribution information.
  • the average brightness value of the image to be processed may refer to the average value of the brightness of the image to be processed or a sequence of images to be processed.
  • the corresponding relationship may be as shown in Table 3 or Table 4.
  • the average brightness value in Table 3 or Table 4 is expressed in a normalized manner, and its range is [0,1]. Among them, 1 represents the maximum value of the brightness value, and 0 represents the minimum value of the brightness value.
  • the target image in S304 can be obtained in the following manner.
  • the target image is obtained according to the following formula (5):
  • R, G, B respectively represent the color value of the R component of the pixel, the color value of the G component and the color value of the B component
  • R', G', B' respectively represent the color value of the R component of the corresponding pixel in the target image
  • Y represents the brightness value of the pixel
  • AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel
  • AlphyG0 represents the first color adjustment coefficient corresponding to the G component of the pixel
  • AlphyB0 represents The first color adjustment coefficient corresponding to the B component of the pixel
  • Alphy1 represents the second color adjustment coefficient
  • A1 is the quantization coefficient of Alphy1
  • A2 is the quantization coefficient of AlphyR0
  • A3 is the quantization coefficient of AlphyG0
  • A4 is the quantization coefficient of AlphyB0.
  • the target image is obtained according to the following formula (6):
  • U and V respectively represent the color value of the U component and the color value of the V component of the pixel
  • U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image
  • AlphyU0 represents the color value of the pixel
  • AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel
  • Alphy1 represents the second color adjustment coefficient
  • A1 is the quantization coefficient of Alphy1
  • A2 is the quantization coefficient of AlphyU0
  • A3 is the quantization coefficient of AlphyV0 Quantization coefficient.
  • FIG. 4 taking an image in RGB format as an example, an optional embodiment of a specific scene is introduced.
  • the processing process of any pixel of the image to be processed is described.
  • Each pixel of the multiple pixels included in the image to be processed can be operated with reference to the method shown in FIG. Target image.
  • the electrical signal ratio a may be the electrical signal ratio between the electrical signal value of each pixel of the image to be processed after the dynamic range adjustment processing and the electrical signal value before the dynamic range adjustment processing.
  • S402 Calculate the brightness value Y of the pixels of the image to be processed according to the color values R, G, and B.
  • the value range determined by the bit width of the color value includes multiple value ranges, and each value range corresponds to a look-up table, then before substituting the electrical signal ratio a into the look-up table 1, it is also necessary to determine the electrical For the value range of signal ratio a, select the lookup table corresponding to the value range of a. This optional step is indicated by a dashed frame in FIG. 4.
  • the coefficient d can be determined by means of a look-up table using the statistical information of the image or image sequence.
  • the coefficient d can be determined according to Table 2.
  • d can be a fixed value selected based on experience, such as 0.2.
  • S404 Calculate the ratios of the brightness value Y to the color values R, G, and B of the three color components: Y/R, Y/G, and Y/B.
  • the index b can be determined by means of a look-up table using statistical information of the image or image sequence.
  • the index b can be determined according to Table 1.
  • the value range determined by the bit width of the color value includes multiple value ranges, and a lookup table is generated for each value range, before substituting Y/R into the lookup table 2, it is also necessary to determine Y/ For the value range of R, select the lookup table corresponding to the value range of Y/R.
  • Y/G and Y/B before substituting Y/G and Y/B into look-up table 3 and look-up table 4, you need to determine the value range of Y/G and Y/B respectively, and choose the value range where Y/G and Y/B are located.
  • the lookup table corresponding to the value range Of course, the number of look-up tables corresponding to Y/R, Y/G, and Y/B may be inconsistent.
  • Y/R corresponds to multiple look-up tables
  • Y/G and Y/B respectively correspond to one look-up table. Only when there are multiple lookup tables, it is necessary to compare with the threshold before substituting into the difference table.
  • the thresholds for Y/R, Y/G, or Y/B comparison may be the same or different. This optional step is not illustrated in FIG. 4.
  • the three color channels of the pixel are color-processed and the corresponding color values R', G', B'. Specifically, it can be implemented through the following S406 to S409.
  • S406 Multiply Alphy1 with AlphyR0, AlphyG0, and AlphyB0 respectively to obtain three products BetaR, BetaG, and BetaB.
  • S407 Multiply BetaR, BetaG, and BetaB by (R-Y), (G-Y), and (B-Y), respectively, to obtain (R-Y)', (G-Y)', and (B-Y)'.
  • S408 use A1 and A2 to divide or shift (RY)', use A1 and A3 to divide or shift (GY)', and use A1 and A4 to divide or shift (BY)' to obtain ( RY)”, (GY)” and (BY)”.
  • the shift operation refers to shifting the exponent to the left.
  • A is 2 R1
  • Z is 2 R2
  • A is used to shift a value Z, that is, shift A to the left by R1 bits
  • the result of the operation is 2 R2-R1 .
  • the result of the shift operation is the same as that of the division operation.
  • the terminal device may include a hardware structure and/or a software module, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether a certain function among the above-mentioned functions is executed by a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraint conditions of the technical solution.
  • an embodiment of the present application further provides an image color processing apparatus 500, which may be a mobile terminal or any device with an image processing function.
  • the image color processing device 500 may include modules that perform one-to-one correspondence of the methods/operations/steps/actions in the foregoing method embodiments.
  • the modules may be hardware circuits, software, or hardware circuits. Combined with software implementation.
  • the image color processing device 500 may include a determining module 501 and a processing module 502.
  • the hardware circuit is called hardware (hardware) or c pipe (cpipe).
  • the determining module 501 is used to determine the color values of the multiple color components of the pixels of the image to be processed; determine the ratio of the brightness value of the pixel to the color values of the multiple color components, respectively; according to the ratio and the first look-up table , Determining the first color adjustment coefficient of the pixel.
  • the processing module 502 is configured to perform color processing on the pixels according to the first color adjustment coefficient to obtain a target image.
  • the determining module 501 and the processing module 502 may be hardware circuits.
  • the determining module 501 when determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table, is specifically configured to: when the preset ratio includes the ratio: The mapping relationship, determine the first color adjustment coefficient corresponding to the ratio; when the preset ratio does not include the ratio: determine the first preset ratio and the second preset ratio in the first look-up table; According to the mapping relationship, the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio are respectively determined; an interpolation operation is performed on the first coefficient and the second coefficient to The first color adjustment coefficient corresponding to the ratio is obtained.
  • the determination module 501 may be a hardware circuit.
  • the first look-up table value is a fixed-point value
  • the determining module 501 when determining the first entry value of the first look-up table, is specifically configured to: according to the value determined by the bit width of the color value The maximum value of the range, dequantize the fixed-point value to obtain a floating-point value; determine that the floating-point value is based on the function value of the first power function; perform the function value on the preset quantization coefficient Quantify to obtain the value of the first entry of the first look-up table.
  • the determining module 501 may be software.
  • the determining module 501 is further configured to determine the first look-up table corresponding to the first value range where the ratio is located; wherein the value range determined by the bit width of the color value includes The first value range and the second value range corresponding to the second lookup table.
  • the determination module 501 may be a hardware circuit.
  • the determining module 501 and the processing module 502 may also be used to perform other corresponding steps or operations in the foregoing method embodiments, which will not be repeated here.
  • the division of modules in the embodiments of this application is illustrative, and it is only a logical function division. In actual implementation, there may be other division methods.
  • the functional modules in the various embodiments of this application can be integrated into one process. In the device, it can also exist alone physically, or two or more modules can be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • an embodiment of the present application also provides an image color processing apparatus 600.
  • the image color processing device 600 includes a processor 601.
  • the processor 601 is used to call a group of programs, so that the foregoing method embodiments are executed.
  • the image color processing device 600 further includes a memory 602, and the memory 602 is configured to store program instructions and/or data executed by the processor 601.
  • the memory 602 and the processor 601 are coupled.
  • the coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units or modules, and may be in electrical, mechanical or other forms, and is used for information exchange between devices, units or modules.
  • the processor 601 may operate in cooperation with the memory 602.
  • the processor 601 may execute program instructions stored in the memory 602.
  • the memory 602 may be included in the processor 601.
  • the image color processing device 600 may be a chip system.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • the chip system is an application specific integrated circuit (ASIC) chip
  • the hardware part of the image color processing device 600 is a c-model (cmode) emulated by an ASIC core, and the above-mentioned cmode can achieve bit consistency with the ASIC chip.
  • ASIC application specific integrated circuit
  • the processor 601 is configured to input the image to be processed into the first neural network for calculation to obtain a first image, the first image being a first component image of the image to be processed that has been processed by the first neural network;
  • the image and the image to be processed are vector concatenated (concatenate) to obtain a first image matrix to be processed;
  • the second component image of the processed image processed by the second neural network based on the second image, the processed image is obtained.
  • the processor 601 may also be used to execute other corresponding steps or operations in the foregoing method embodiments, which will not be repeated here.
  • the processor 601 may be a general-purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the The disclosed methods, steps and logic block diagrams.
  • the general-purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in combination with the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
  • the memory 602 may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., and may also be a volatile memory, such as random access memory (random access memory). -access memory, RAM).
  • the memory is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this.
  • the memory in the embodiments of the present application may also be a circuit or any other device capable of realizing a storage function for storing program instructions and/or data.
  • the embodiment of the present application also provides a chip including a processor, which is used to support the image color processing device to implement the functions involved in the foregoing method embodiments.
  • the chip is connected to a memory or the chip includes a memory, and the memory is used to store the necessary program instructions and data of the communication device.
  • the embodiment of the present application provides a computer-readable storage medium that stores a computer program, and the computer program includes instructions for executing the foregoing method embodiments.
  • the embodiments of the present application provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the foregoing method embodiments.
  • this application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Optimization (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)
  • Color Image Communication Systems (AREA)

Abstract

Provided are an image color processing method and apparatus. The method comprises: determining color values of a plurality of color components of a pixel of an image to be subjected to processing (S301); respectively determining the ratios of a brightness value of the pixel to the color values of the plurality of color components (S302); determining a first color adjustment coefficient of the pixel according to the ratios and a first lookup table (S303); and performing color processing on the pixel according to the first color adjustment coefficient, so as to obtain a target image (S304). Accordingly, the color deviation phenomenon of an image subjected to color processing can be reduced, and the quality of the image subjected to color processing is improved. Each step can be implemented by means of a hardware circuit of a terminal device, for example, the processing of integer data can be implemented by means of determining the first color adjustment coefficient by means of the first lookup table, such that the execution process of an image color processing procedure can be implemented into the hardware circuit, and the practical application possibilities of the image color processing method can be increased.

Description

一种图像色彩处理方法及装置Image color processing method and device 技术领域Technical field
本申请涉及图像处理技术领域,特别涉及一种图像色彩处理方法及装置。This application relates to the field of image processing technology, and in particular to an image color processing method and device.
背景技术Background technique
光学数字成像过程是将真实场景的光辐射通过图像传感器转化为电信号,并以数字图像的方式保存下来。图像显示的目的是通过显示设备重现一幅数字图像所描述的真实场景。从而使用户获得与其直接观察真实场景相同的视觉感知。The optical digital imaging process converts the light radiation of the real scene into electrical signals through the image sensor, and saves them in the form of digital images. The purpose of image display is to reproduce the real scene described by a digital image through the display device. In this way, the user obtains the same visual perception as he directly observes the real scene.
在图像处理领域中,针对色彩空间存在不均匀的现象,需要对图像色彩进行调整。如何对图像色彩进行调整是需要解决的问题。In the field of image processing, in view of the unevenness of the color space, the color of the image needs to be adjusted. How to adjust the color of the image is a problem that needs to be solved.
发明内容Summary of the invention
本申请提供一种图像色彩处理方法及装置,用以实现对图像色彩的调整,提高图像质量。The present application provides an image color processing method and device, which are used to adjust the image color and improve the image quality.
第一方面,提供一种图像色彩处理方法,该方法的执行主体可以是终端设备,该方法具体包括:确定待处理图像的像素的多个色彩分量的色彩值;确定所述像素的亮度值分别与所述多个色彩分量的色彩值的比值;根据所述比值和第一查找表,确定所述像素的第一色彩调整系数;根据所述第一色彩调整系数,对所述像素进行色彩处理,以得到目标图像。根据待处理图像的像素的亮度值与色彩分量的色彩值的比值,确定第一色彩调整系数,以对待处理图像进行色彩处理,能够减少进行色彩处理的图像的色彩偏差现象,提高了进行色彩处理的图像的质量。其中,各个步骤可以通过终端设备的硬件电路来实现,例如,通过第一查找表确定第一色彩调整系数的方式,可以实现整型数据的处理,从而能够将图像色彩处理流程的执行过程落实到硬件电路,提高图像色彩处理方法的实际应用可能性。In a first aspect, an image color processing method is provided. The execution subject of the method may be a terminal device. The method specifically includes: determining the color values of multiple color components of pixels of an image to be processed; determining the brightness values of the pixels, respectively The ratio with the color values of the multiple color components; determine the first color adjustment coefficient of the pixel according to the ratio and a first look-up table; perform color processing on the pixel according to the first color adjustment coefficient To get the target image. According to the ratio of the brightness value of the pixel of the image to be processed to the color value of the color component, the first color adjustment coefficient is determined to perform color processing on the image to be processed, which can reduce the color deviation phenomenon of the color processed image and improve the color processing The quality of the image. Among them, each step can be implemented by the hardware circuit of the terminal device. For example, the method of determining the first color adjustment coefficient through the first look-up table can realize the processing of the integer data, so that the execution process of the image color processing flow can be implemented to The hardware circuit improves the practical application possibilities of the image color processing method.
在一个可能的设计中,所述第一查找表包括色彩调整系数和预设比值的映射关系。In a possible design, the first look-up table includes a mapping relationship between a color adjustment coefficient and a preset ratio.
在一个可能的设计中,所述根据所述比值和第一查找表,确定所述像素的第一色彩调整系数,可以包括以下几种情况:当所述预设比值包括所述比值时:根据所述映射关系,确定所述比值对应的第一色彩调整系数;当所述预设比值不包括所述比值时:在所述第一查找表中确定第一预设比值和第二预设比值;根据所述映射关系,分别确定所述第一预设比值和所述第二预设比值对应的第一系数和第二系数;对所述第一系数和所述第二系数进行插值运算,以得到所述比值对应的第一色彩调整系数。这样,通过插值法确定第一色彩调整系统,能够降低第一查找表的表项数值的数量,使得第一查找表占用空间缩小,降低硬件电路的复杂度。In a possible design, the determination of the first color adjustment coefficient of the pixel according to the ratio and the first look-up table may include the following situations: when the preset ratio includes the ratio: according to The mapping relationship determines the first color adjustment coefficient corresponding to the ratio; when the preset ratio does not include the ratio: determine the first preset ratio and the second preset ratio in the first look-up table According to the mapping relationship, respectively determine the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio; perform an interpolation operation on the first coefficient and the second coefficient, To obtain the first color adjustment coefficient corresponding to the ratio. In this way, determining the first color adjustment system through the interpolation method can reduce the number of entry values in the first look-up table, so that the space occupied by the first look-up table is reduced, and the complexity of the hardware circuit is reduced.
可选的,所述插值运算包括以下任一类型的运算:线性插值、近插值、双线性二次插值、三次插值或Lanczos插值。Optionally, the interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.
在一个可能的设计中,所述第一查找表的第一表项数值和第一查表值之间的映射关系满足第一幂函数。其中,第一表项数值可以对应色彩调整系数,第一查表值可以对应预设比值。例如,第一幂函数可以表示为f(x)=x bIn a possible design, the mapping relationship between the first entry value of the first look-up table and the first look-up table value satisfies the first power function. Among them, the first table item value may correspond to a color adjustment coefficient, and the first look-up table value may correspond to a preset ratio. For example, the first power function can be expressed as f(x)=x b .
可选的,第一幂函数的指数b为函数系数。第一幂函数的系数b可以利用图像或图像 序列统计信息通过查找表的方式确定,图像或图像序列统计信息可以包括图像或图像序列的最大值、最小值、平均值、标准差以及直方图分布信息。Optionally, the exponent b of the first power function is a function coefficient. The coefficient b of the first power function can be determined by means of a look-up table using the statistical information of the image or image sequence. The statistical information of the image or image sequence can include the maximum, minimum, average, standard deviation, and histogram distribution of the image or image sequence. information.
在一个可能的设计中,所述第一查表值为定点数值;所述第一查找表的第一表项数值的确定,可以通过以下方式实现:根据由所述色彩值的比特位宽确定的取值范围的最大值,对所述定点数值进行反量化,以得到浮点数值;确定所述浮点数值基于所述第一幂函数的函数值;根据预设的量化系数,对所述函数值进行量化,以得到所述第一查找表的第一表项数值。通过上述方法确定第一查找表的第一表项数值,能够使得第一查找表的查表值和第一表项数值为定点数值,且映射关系符合第一幂函数,使得第一查找表的输入数据和输出数据均可以为定点数值,落实了硬件电路的实现可能性。上述方法可以通过软件实现,从而通过软件硬件分离的方式,提高了图像色彩处理流程的实际可用性。并且本部分方法通过软件实现,可以随时根据图像色彩处理的效果来更新该软件流程,使得可适配性高,效果可调性好。In a possible design, the first look-up table value is a fixed-point value; the determination of the first table entry value of the first look-up table can be achieved in the following manner: according to the bit width of the color value The maximum value of the value range of, the fixed-point value is inversely quantized to obtain a floating-point value; the floating-point value is determined based on the function value of the first power function; and the quantization coefficient is preset to The function value is quantized to obtain the first entry value of the first look-up table. Determining the value of the first entry of the first lookup table by the above method can make the value of the lookup table of the first lookup table and the value of the first entry be fixed-point values, and the mapping relationship conforms to the first power function, so that the value of the first lookup table Both the input data and output data can be fixed-point values, which implements the possibility of hardware circuits. The above-mentioned method can be implemented by software, so that the actual usability of the image color processing flow is improved through the separation of software and hardware. And this part of the method is realized by software, and the software process can be updated at any time according to the effect of image color processing, so that the adaptability is high and the effect is good.
在一个可能的设计中,所述第一查表值基于所述第一查找表的索引值和所述第一查找表的索引值间的步长确定。步长可以是等于1或大于1的整数。In a possible design, the first look-up table value is determined based on the step size between the index value of the first look-up table and the index value of the first look-up table. The step size can be an integer equal to or greater than one.
在一个可能的设计中,所述方法还包括:确定所述比值所在的第一取值范围对应的所述第一查找表;其中,由所述色彩值的比特位宽确定的取值范围包括所述第一取值范围和第二查找表对应的第二取值范围。In a possible design, the method further includes: determining the first look-up table corresponding to the first value range in which the ratio is located; wherein the value range determined by the bit width of the color value includes The first value range and the second value range corresponding to the second lookup table.
在一个可能的设计中,所述第二查找表的第二表项数值和第二查表值之间的映射关系满足所述第一幂函数。第二查找表与第一查找表的生成方法类似,可以相互参照。In a possible design, the mapping relationship between the second table entry value of the second look-up table and the second look-up table value satisfies the first power function. The method for generating the second lookup table is similar to that of the first lookup table, and can be cross-referenced.
在一个可能的设计中,所述第一取值范围的最小值大于所述第二取值范围的最大值;In a possible design, the minimum value of the first value range is greater than the maximum value of the second value range;
对应的,所述第一查找表的第一查表值基于所述第一查找表的索引值、所述第一查找表的索引值间的步长和所述第二取值范围的最大值确定。Correspondingly, the first lookup value of the first lookup table is based on the index value of the first lookup table, the step size between the index values of the first lookup table, and the maximum value of the second value range Sure.
类似地,若所述第二取值范围的最小值大于所述第一取值范围的最大值;对应的,所述第一查找表的第一查表值基于所述第一查找表的索引值、所述第一查找表的索引值间的步长确定。Similarly, if the minimum value of the second value range is greater than the maximum value of the first value range; correspondingly, the first lookup value of the first lookup table is based on the index of the first lookup table The step size between the value and the index value of the first look-up table is determined.
在一个可能的设计中,所述第一查找表的索引值间的步长和所述第二查找表的索引值间的步长可以不同。In a possible design, the step size between the index values of the first look-up table and the step size between the index values of the second look-up table may be different.
在一个可能的设计中,所述根据所述第一色彩调整系数,对所述像素进行色彩处理,可以通过以下方式实现:确定所述像素的第二色彩调整系数;将所述第一色彩调整系数与所述第二色彩调整系数相乘;根据所述相乘的乘积,对所述像素进行色彩处理。In a possible design, the color processing of the pixel according to the first color adjustment coefficient can be achieved by: determining the second color adjustment coefficient of the pixel; adjusting the first color The coefficient is multiplied by the second color adjustment coefficient; and color processing is performed on the pixel according to the product of the multiplication.
在一个可能的设计中,所述待处理图像是经过动态范围调整处理的图像;所述确定所述像素的第二色彩调整系数,包括以下步骤:确定所述像素在所述动态范围调整处理之后和在所述动态范围调整处理之前的电信号比值;根据所述电信号比值,确定所述第二色彩调整系数。能够减少待处理图像由于动态范围调整处理引起的色彩偏差现象,提高了进行色彩处理的图像的质量。In a possible design, the image to be processed is an image that has undergone dynamic range adjustment processing; the determining the second color adjustment coefficient of the pixel includes the following steps: determining that the pixel is after the dynamic range adjustment processing And the ratio of the electrical signal before the dynamic range adjustment processing; and the second color adjustment coefficient is determined according to the ratio of the electrical signal. The color deviation phenomenon caused by the dynamic range adjustment processing of the image to be processed can be reduced, and the quality of the image subjected to color processing can be improved.
在一个可能的设计中,通过查表确定所述电信号比值对应的所述第二色彩调整系数。例如,根据所述电信号比值和第三查找表,确定所述第二色彩调整系数;所述第三查找表包括色彩调整系数和预设比值的映射关系,该映射关系符合第二幂函数。In a possible design, the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table. For example, the second color adjustment coefficient is determined according to the electrical signal ratio and a third look-up table; the third look-up table includes a mapping relationship between the color adjustment coefficient and a preset ratio, and the mapping relationship conforms to the second power function.
在一个可能的设计中,所述多个色彩分量包括RGB空间中的R分量、G分量、B分量,所述目标图像根据以下公式获得:In a possible design, the multiple color components include R, G, and B components in the RGB space, and the target image is obtained according to the following formula:
Figure PCTCN2020088476-appb-000001
Figure PCTCN2020088476-appb-000001
其中,R、G、B分别表示所述像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,R'、G'、B'分别表示所述目标图像中对应像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,Y表示所述像素的亮度值,AlphyR0表示所述像素的R分量对应的第一色彩调整系数,AlphyG0表示所述像素的G分量对应的第一色彩调整系数,AlphyB0表示所述像素的B分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyR0的量化系数,A3是所述AlphyG0的量化系数,A4是所述AlphyB0的量化系数。Wherein, R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the pixel, and R', G', and B'respectively represent the R of the corresponding pixel in the target image. The color value of the component, the color value of the G component, and the color value of the B component, Y represents the brightness value of the pixel, AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel, and AlphyG0 represents the G component of the pixel The corresponding first color adjustment coefficient, AlphyB0 represents the first color adjustment coefficient corresponding to the B component of the pixel, Alphy1 represents the second color adjustment coefficient, A1 is the quantization coefficient of Alphy1, and A2 is the quantization coefficient of AlphyR0 Coefficient, A3 is the quantized coefficient of AlphyG0, and A4 is the quantized coefficient of AlphyB0.
在一个可能的设计中,所述多个色彩分量包括YUV空间中的U分量、V分量,所述目标图像根据以下公式获得:In a possible design, the multiple color components include U and V components in YUV space, and the target image is obtained according to the following formula:
Figure PCTCN2020088476-appb-000002
Figure PCTCN2020088476-appb-000002
其中,U、V分别表示所述像素的U分量的色彩值和V分量的色彩值,U′、V′分别表示所述目标图像中对应像素的U分量的色彩值和V分量的色彩值,AlphyU0表示所述像素的U分量对应的第一色彩调整系数,AlphyV0表示所述像素的V分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyU0的量化系数,A3是所述AlphyV0的量化系数。Wherein, U and V respectively represent the color value of the U component and the color value of the V component of the pixel, U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image, AlphyU0 represents the first color adjustment coefficient corresponding to the U component of the pixel, AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel, Alphy1 represents the second color adjustment coefficient, and A1 is the quantization coefficient of Alphy1 , A2 is the quantized coefficient of AlphyU0, and A3 is the quantized coefficient of AlphyV0.
第二方面,提供一种图像色彩处理装置,该装置可以是终端设备,也可以是终端设备中的装置(例如芯片、或者芯片系统、或者电路),或者是能够和终端设备匹配使用的装置。一种设计中,该装置可以包括执行第一方面中所描述的方法/操作/步骤/动作所一一对应的模块,该模块可以是硬件电路,也可是软件,也可以是硬件电路结合软件实现。一种设计中,该装置可以包括确定模块和处理模块。示例性地:In a second aspect, an image color processing device is provided. The device can be a terminal device, a device in a terminal device (such as a chip, or a chip system, or a circuit), or a device that can be matched with the terminal device. In one design, the device may include modules that perform one-to-one correspondence of the methods/operations/steps/actions described in the first aspect. The modules may be hardware circuits, software, or hardware circuits combined with software. . In one design, the device may include a determination module and a processing module. Illustratively:
确定模块,用于确定待处理图像的像素的多个色彩分量的色彩值;确定所述像素的亮度值分别与所述多个色彩分量的色彩值的比值;根据所述比值和第一查找表,确定所述像素的第一色彩调整系数;处理模块,用于根据所述第一色彩调整系数,对所述像素进行色彩处理,以得到目标图像。The determining module is used to determine the color values of the multiple color components of the pixels of the image to be processed; determine the ratio of the brightness value of the pixel to the color values of the multiple color components respectively; according to the ratio and the first look-up table , Determining the first color adjustment coefficient of the pixel; a processing module, configured to perform color processing on the pixel according to the first color adjustment coefficient to obtain a target image.
在一个可能的设计中,所述第一查找表包括色彩调整系数和预设比值的映射关系。In a possible design, the first look-up table includes a mapping relationship between a color adjustment coefficient and a preset ratio.
在一个可能的设计中,在根据所述比值和第一查找表,确定所述像素的第一色彩调整系数时,所述确定模块具体用于:当所述预设比值包括所述比值时:根据所述映射关系,确定所述比值对应的第一色彩调整系数;当所述预设比值不包括所述比值时:在所述第一查找表中确定第一预设比值和第二预设比值;根据所述映射关系,分别确定所述第一预设比值和所述第二预设比值对应的第一系数和第二系数;对所述第一系数和所述第二系数进行插值运算,以得到所述比值对应的第一色彩调整系数。In a possible design, when determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table, the determining module is specifically configured to: when the preset ratio includes the ratio: According to the mapping relationship, determine the first color adjustment coefficient corresponding to the ratio; when the preset ratio does not include the ratio: determine the first preset ratio and the second preset in the first look-up table Ratio; according to the mapping relationship, respectively determine the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio; perform interpolation operations on the first coefficient and the second coefficient , To obtain the first color adjustment coefficient corresponding to the ratio.
在一个可能的设计中,所述插值运算包括以下任一类型的运算:线性插值、近插值、 双线性二次插值、三次插值或Lanczos插值。In a possible design, the interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.
在一个可能的设计中,所述第一查找表的第一表项数值和第一查表值之间的映射关系满足第一幂函数。其中,第一表项数值可以对应色彩调整系数,第一查表值可以对应预设比值。例如,第一幂函数可以表示为f(x)=x bIn a possible design, the mapping relationship between the first entry value of the first look-up table and the first look-up table value satisfies the first power function. Among them, the first table item value may correspond to a color adjustment coefficient, and the first look-up table value may correspond to a preset ratio. For example, the first power function can be expressed as f(x)=x b .
可选的,第一幂函数的指数b为函数系数。第一幂函数的系数b可以利用图像或图像序列统计信息通过查找表的方式确定,图像或图像序列统计信息可以包括图像或图像序列的最大值、最小值、平均值、标准差以及直方图分布信息。Optionally, the exponent b of the first power function is a function coefficient. The coefficient b of the first power function can be determined by means of a look-up table using the statistical information of the image or image sequence. The statistical information of the image or image sequence can include the maximum, minimum, average, standard deviation, and histogram distribution of the image or image sequence. information.
在一个可能的设计中,所述第一查表值为定点数值;In a possible design, the first look-up table value is a fixed-point value;
在确定第一查找表的第一表项数值时,确定模块,具体用于:根据由所述色彩值的比特位宽确定的取值范围的最大值,对所述定点数值进行反量化,以得到浮点数值;确定所述浮点数值基于所述第一幂函数的函数值;根据预设的量化系数,对所述函数值进行量化,以得到所述第一查找表的第一表项数值。When determining the value of the first entry in the first look-up table, the determining module is specifically configured to: dequantize the fixed-point value according to the maximum value of the value range determined by the bit width of the color value to Obtain a floating-point value; determine that the floating-point value is based on the function value of the first power function; quantize the function value according to a preset quantization coefficient to obtain the first entry of the first look-up table Numerical value.
在一个可能的设计中,所述第一查表值基于所述第一查找表的索引值和所述第一查找表的索引值间的步长确定。In a possible design, the first look-up table value is determined based on the step size between the index value of the first look-up table and the index value of the first look-up table.
在一个可能的设计中,所述确定模块还用于:确定所述比值所在的第一取值范围对应的所述第一查找表;其中,由所述色彩值的比特位宽确定的取值范围包括所述第一取值范围和第二查找表对应的第二取值范围。In a possible design, the determining module is further configured to: determine the first look-up table corresponding to the first value range in which the ratio is located; wherein the value determined by the bit width of the color value The range includes the first value range and the second value range corresponding to the second lookup table.
在一个可能的设计中,所述第二查找表的第二表项数值和第二查表值之间的映射关系满足所述第一幂函数。In a possible design, the mapping relationship between the second table entry value of the second look-up table and the second look-up table value satisfies the first power function.
在一个可能的设计中,所述第一取值范围的最小值大于所述第二取值范围的最大值;In a possible design, the minimum value of the first value range is greater than the maximum value of the second value range;
对应的,所述第一查找表的第一查表值基于所述第一查找表的索引值、所述第一查找表的索引值间的步长和所述第二取值范围的最大值确定。Correspondingly, the first lookup value of the first lookup table is based on the index value of the first lookup table, the step size between the index values of the first lookup table, and the maximum value of the second value range Sure.
在一个可能的设计中,所述第一查找表的索引值间的步长和所述第二查找表的索引值间的步长不同。In a possible design, the step size between the index values of the first look-up table and the step size between the index values of the second look-up table are different.
在一个可能的设计中,在根据所述第一色彩调整系数,对所述像素进行色彩处理时,所述处理模块具体用于:确定所述像素的第二色彩调整系数;将所述第一色彩调整系数与所述第二色彩调整系数相乘;根据所述相乘的乘积,对所述像素进行色彩处理。In a possible design, when performing color processing on the pixel according to the first color adjustment coefficient, the processing module is specifically configured to: determine the second color adjustment coefficient of the pixel; The color adjustment coefficient is multiplied by the second color adjustment coefficient; and color processing is performed on the pixel according to the product of the multiplication.
在一个可能的设计中,所述待处理图像是经过动态范围调整处理的图像;In a possible design, the image to be processed is an image processed by dynamic range adjustment;
在确定所述像素的第二色彩调整系数时,所述确定模块具体用于:确定所述像素在所述动态范围调整处理之后和在所述动态范围调整处理之前的电信号比值;根据所述电信号比值,确定所述第二色彩调整系数。When determining the second color adjustment coefficient of the pixel, the determining module is specifically configured to: determine the ratio of the electrical signal of the pixel after the dynamic range adjustment process and before the dynamic range adjustment process; The ratio of the electrical signal determines the second color adjustment coefficient.
在一个可能的设计中,通过查表确定所述电信号比值对应的所述第二色彩调整系数。In a possible design, the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table.
在一个可能的设计中,所述多个色彩分量包括RGB空间中的R分量、G分量、B分量,所述目标图像根据以下公式获得:In a possible design, the multiple color components include R, G, and B components in the RGB space, and the target image is obtained according to the following formula:
Figure PCTCN2020088476-appb-000003
Figure PCTCN2020088476-appb-000003
其中,R、G、B分别表示所述像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,R'、G'、B'分别表示所述目标图像中对应像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,Y表示所述像素的亮度值,AlphyR0表示所述像素的R分量对应的第一色彩调整系数,AlphyG0表示所述像素的G分量对应的第一色彩调整系数,AlphyB0表示所述像素的B分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyR0的量化系数,A3是所述AlphyG0的量化系数,A4是所述AlphyB0的量化系数。Wherein, R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the pixel, and R', G', and B'respectively represent the R of the corresponding pixel in the target image. The color value of the component, the color value of the G component, and the color value of the B component, Y represents the brightness value of the pixel, AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel, and AlphyG0 represents the G component of the pixel The corresponding first color adjustment coefficient, AlphyB0 represents the first color adjustment coefficient corresponding to the B component of the pixel, Alphy1 represents the second color adjustment coefficient, A1 is the quantization coefficient of Alphy1, and A2 is the quantization coefficient of AlphyR0 Coefficient, A3 is the quantized coefficient of AlphyG0, and A4 is the quantized coefficient of AlphyB0.
在一个可能的设计中,所述多个色彩分量包括YUV空间中的U分量、V分量,所述目标图像根据以下公式获得:In a possible design, the multiple color components include U and V components in YUV space, and the target image is obtained according to the following formula:
Figure PCTCN2020088476-appb-000004
Figure PCTCN2020088476-appb-000004
其中,U、V分别表示所述像素的U分量的色彩值和V分量的色彩值,U′、V′分别表示所述目标图像中对应像素的U分量的色彩值和V分量的色彩值,AlphyU0表示所述像素的U分量对应的第一色彩调整系数,AlphyV0表示所述像素的V分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyU0的量化系数,A3是所述AlphyV0的量化系数。Wherein, U and V respectively represent the color value of the U component and the color value of the V component of the pixel, U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image, AlphyU0 represents the first color adjustment coefficient corresponding to the U component of the pixel, AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel, Alphy1 represents the second color adjustment coefficient, and A1 is the quantization coefficient of Alphy1 , A2 is the quantized coefficient of AlphyU0, and A3 is the quantized coefficient of AlphyV0.
第二方面及各个可能的设计的有益效果可以参考第一方面对应的效果,在此不再赘述。For the beneficial effects of the second aspect and each possible design, reference may be made to the corresponding effects of the first aspect, which will not be repeated here.
第三方面,本申请实施例提供一种图像色彩处理装置,所述装置包括处理器,处理器用于调用一组程序、指令或数据,执行上述第一方面或第一方面的任一可能的设计所描述的方法。所述装置还可以包括存储器,用于存储处理器调用的程序、指令或数据。所述存储器与所述处理器耦合,所述处理器执行所述存储器中存储的、指令或数据时,可以实现上述第一方面或任一可能的设计描述的方法。In a third aspect, an embodiment of the present application provides an image color processing device, the device includes a processor, and the processor is used to call a set of programs, instructions, or data to execute the first aspect or any possible design of the first aspect. The described method. The device may also include a memory for storing programs, instructions or data called by the processor. The memory is coupled with the processor, and when the processor executes the instructions or data stored in the memory, it can implement the method described in the first aspect or any possible design.
第四方面,本申请实施例提供了一种芯片系统,该芯片系统包括处理器,还可以包括存储器,用于实现上述第一方面或第一方面中任一种可能的设计中所述的方法。该芯片系统可以由芯片构成,也可以包含芯片和其他分立器件。In a fourth aspect, an embodiment of the present application provides a chip system, which includes a processor and may also include a memory, for implementing the method described in the first aspect or any one of the possible designs of the first aspect. . The chip system can be composed of chips, or it can include chips and other discrete devices.
第五方面,本申请实施例中还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可读指令,当所述计算机可读指令在计算机上运行时,使得如第一方面或第一方面中任一种可能的设计中所述的方法被执行。In a fifth aspect, the embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores computer-readable instructions. When the computer-readable instructions run on a computer, The method described in one aspect or any one of the possible designs of the first aspect is executed.
第六方面,本申请实施例中还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面或第一方面的任一可能的设计中所述的方法。In a sixth aspect, the embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the method described in the first aspect or any possible design of the first aspect .
附图说明Description of the drawings
图1为本申请实施例中终端设备的结构示意图;Figure 1 is a schematic structural diagram of a terminal device in an embodiment of the application;
图2为本申请实施例中终端设备对图像色彩处理的示意图;FIG. 2 is a schematic diagram of image color processing by a terminal device in an embodiment of the application;
图3为本申请实施例中图像色彩处理方法流程示意图;FIG. 3 is a schematic flowchart of an image color processing method in an embodiment of the application;
图4为本申请实施例中RGB格式图像色彩处理方法流程示意图;FIG. 4 is a schematic flow chart of a color processing method for an RGB format image in an embodiment of the application;
图5为本申请实施例中图像色彩处理装置结构示意图之一;FIG. 5 is one of the schematic diagrams of the structure of the image color processing device in an embodiment of the application;
图6为本申请实施例中图像色彩处理装置结构示意图之二。FIG. 6 is the second structural diagram of the image color processing device in the embodiment of the application.
具体实施方式Detailed ways
本申请实施例提供一种图像色彩处理方法及装置,以期实现对图像色彩的调整,提高图像质量。其中,方法和装置是基于相同或相似技术构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施可以相互参见,重复之处不再赘述。The embodiments of the present application provide an image color processing method and device, in order to realize the adjustment of the image color and improve the image quality. Among them, the method and the device are based on the same or similar technical conception. Since the method and the device have similar principles for solving the problem, the implementation of the device and the method can be referred to each other, and the repetition will not be repeated.
需要说明的是,本申请实施例的描述中,“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。本申请中所涉及的至少一个是指一个或多个;多个,是指两个或两个以上。另外,需要理解的是,在本申请的描述中,“第一”、“第二”、“第三”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。It should be noted that in the description of the embodiments of the present application, "and/or" describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B can indicate that A exists alone and exists at the same time A and B, there are three cases of B alone. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. At least one involved in this application refers to one or more; multiple refers to two or more. In addition, it should be understood that in the description of this application, words such as "first", "second", and "third" are only used for the purpose of distinguishing description, and cannot be understood as indicating or implying relative importance. Nor can it be understood as indicating or implying order. References described in this specification to "one embodiment" or "some embodiments", etc. mean that one or more embodiments of the present application include a specific feature, structure, or characteristic described in combination with the embodiment. Therefore, the sentences "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless it is specifically emphasized otherwise. The terms "including", "including", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
本申请实施例提供的基于图像色彩处理方法及装置可应用于电子设备。该电子设备可以是移动终端(mobile terminal)、移动台(mobile station,MS)、用户设备(user equipment,UE)等移动设备,也可以是固定设备,如固定电话、台式电脑等,还可以是视频监控器。该电子设备具有图像色彩处理功能。该电子设备还可以选择性地具有无线连接功能,以向用户提供语音和/或数据连通性的手持式设备、或连接到无线调制解调器的其他处理设备,比如:该电子设备可以是移动电话(或称为“蜂窝”电话)、具有移动终端的计算机等,还可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,当然也可以是可穿戴设备(如智能手表、智能手环等)、平板电脑、个人电脑(personal computer,PC)、个人数字助理(personal digital assistant,PDA)、销售终端(Point of Sales,POS)等。本申请实施例中不妨以一种终端设备为例进行说明。The image-based color processing method and device provided in the embodiments of the present application can be applied to electronic equipment. The electronic device can be a mobile device such as a mobile terminal (mobile terminal), a mobile station (MS), user equipment (UE), etc., or a fixed device, such as a fixed telephone, a desktop computer, etc., or Video monitor. The electronic device has an image color processing function. The electronic device can also optionally have a wireless connection function to provide users with a handheld device with voice and/or data connectivity, or other processing devices connected to a wireless modem. For example, the electronic device can be a mobile phone (or (Called "cellular" phones), computers with mobile terminals, etc., can also be portable, pocket-sized, handheld, computer-built or vehicle-mounted mobile devices, of course, can also be wearable devices (such as smart watches, smart bracelets) Etc.), tablet computers, personal computers (PC), personal digital assistants (PDAs), point of sales (POS), etc. In the embodiment of the present application, a terminal device may be used as an example for description.
下面将结合附图,对本申请实施例进行详细描述。The embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
图1所示为本申请实施例涉及的终端设备100的一种可选的硬件结构示意图。FIG. 1 is a schematic diagram of an optional hardware structure of a terminal device 100 related to an embodiment of this application.
如图1所示,终端设备100主要包括芯片组,其中,芯片组可以用于对图像色彩进行处理,例如芯片组包括图像信号处理器(image signal processor,ISP),ISP对图像色彩进行处理。可选的,终端设备100中的芯片组还包括其他模块,终端设备100还可以包括外设装置。具体如下所述。图1中实线框中的电源管理单元(power management unit,PMU)、语音数据编解码器(codec)、短距离模块和射频(radio frequency,RF)、运算处理器、随机存储器(random-access memory,RAM)、输入/输出(input/output,I/O)、显示接口、传感器接口(Sensor hub)、基带通信模块等各部件组成芯片或芯片组。USB接口、存储器、显示屏、电池/市电、耳机/扬声器、天线、传感器(Sensor)等部件可以理解为是外设装置。芯片组内的运算处理器、RAM、I/O、显示接口、ISP、Sensor hub、基带等部件可组成片上系统(system-on-a-chip,SOC),为芯片组的主要部分。SOC内的各部件可以全部集成为一个完整芯片,或者SOC内也可以是部分部件集成,另一部分部件不集成,比如SOC内的基带通信模块,可以与其他部分不集成在一起,成为独立部分。SOC中的各部件可通过总线 或其他连接线互相连接。SOC外部的PMU、语音codec、RF等通常包括模拟电路部分,因此经常在SOC之外,彼此并不集成。As shown in FIG. 1, the terminal device 100 mainly includes a chip set, where the chip set can be used to process image colors. For example, the chip set includes an image signal processor (ISP), and the ISP processes image colors. Optionally, the chipset in the terminal device 100 further includes other modules, and the terminal device 100 may also include peripheral devices. The details are as follows. The power management unit (PMU), voice data codec (codec), short-distance module and radio frequency (RF), arithmetic processor, random-access memory (PMU), voice data codec, and radio frequency (RF) in the solid-line box in Figure 1 Memory, RAM), input/output (input/output, I/O), display interface, sensor hub (Sensor hub), baseband communication module and other components make up a chip or chipset. Components such as USB interface, memory, display screen, battery/mains power, earphone/speaker, antenna, sensor, etc. can be understood as peripheral devices. The arithmetic processor, RAM, I/O, display interface, ISP, Sensor hub, baseband and other components in the chipset can form a system-on-a-chip (SOC), which is the main part of the chipset. The components in the SOC can all be integrated into a complete chip, or part of the components in the SOC can be integrated, and the other parts are not integrated. For example, the baseband communication module in the SOC can not be integrated with other parts and become an independent part. The components in the SOC can be connected to each other through a bus or other connecting lines. The PMU, voice codec, RF, etc. outside the SOC usually include analog circuit parts, so they are often outside the SOC and are not integrated with each other.
图1中,PMU用于外接市电或电池,为SOC供电,可以利用市电为电池充电。语音codec作为声音的编解码单元外接耳机或扬声器,实现自然的模拟语音信号与SOC可处理的数字语音信号之间的转换。短距离模块可包括无线保真(wireless fidelity,WiFi)和蓝牙,也可选择性包括红外、近距离无线通信(near field communication,NFC)、收音机(FM)或全球定位系统(global positioning system,GPS)模块等。RF与SOC中的基带通信模块连接,用来实现空口RF信号和基带信号的转换,即混频。对手机而言,接收是下变频,发送则是上变频。短距离模块和RF都可以有一个或多个用于信号发送或接收的天线。基带用来做基带通信,包括多种通信模式中的一种或多种,用于进行无线通信协议的处理,可包括物理层(层1)、媒体接入控制(medium access control,MAC)(层2)、无线资源控制(radio resource control,RRC)(层3)等各个协议层的处理,可支持各种蜂窝通信制式,例如长期演进(long term evolution,LTE)通信、或5G新空口(new radio,NR)通信等。Sensor hub是SOC与外界传感器的接口,用来收集和处理外界至少一个传感器的数据,外界的传感器例如可以是加速计、陀螺仪、控制传感器、图像传感器等。运算处理器可以是通用处理器,例如中央处理器(central processing unit,CPU),还可以是一个或多个集成电路,例如:一个或多个特定集成电路(application specific integrated circuit,ASIC),或,一个或多个数字信号处理器(digital singnal processor,DSP),或微处理器,或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)等。运算处理器可包括一个或多个核,并可选择性调度其他单元。RAM可存储一些计算或处理过程中的中间数据,如CPU和基带的中间计算数据。ISP用于图像传感器采集的数据进行处理。I/O用于SOC与外界各类接口进行交互,如可与用于数据传输的通用串行总线(universal serial bus,USB)接口进行交互等。存储器可以是一个或一组芯片。显示屏可以是触摸屏,通过显示接口与总线连接,显示接口可以是进行图像显示前的数据处理,比如需要显示的多个图层的混叠、显示数据的缓存或对屏幕亮度的控制调整等。In Figure 1, the PMU is used for external mains or batteries to supply power to the SOC, and the mains can be used to charge the battery. The voice codec is used as the sound codec unit to connect with earphones or speakers to realize the conversion between natural analog voice signals and digital voice signals that can be processed by the SOC. The short-range module can include wireless fidelity (WiFi) and Bluetooth, and can also optionally include infrared, near field communication (NFC), radio (FM), or global positioning system (GPS) ) Module etc. The RF is connected with the baseband communication module in the SOC to realize the conversion between the air interface RF signal and the baseband signal, that is, mixing. For mobile phones, receiving is down-conversion, and sending is up-conversion. Both the short-range module and the RF can have one or more antennas for signal transmission or reception. Baseband is used for baseband communication, including one or more of a variety of communication modes, used for processing wireless communication protocols, including physical layer (layer 1), medium access control (MAC) ( The processing of each protocol layer such as layer 2), radio resource control (RRC) (layer 3), etc., can support various cellular communication standards, such as long term evolution (LTE) communication, or 5G new air interface ( new radio, NR) communication, etc. The Sensor hub is an interface between the SOC and external sensors, and is used to collect and process data from at least one external sensor. The external sensors can be, for example, accelerometers, gyroscopes, control sensors, image sensors, and so on. The arithmetic processor can be a general-purpose processor, such as a central processing unit (CPU), or one or more integrated circuits, such as one or more application specific integrated circuits (ASICs), or , One or more digital signal processors (digital signal processors, DSP), or microprocessors, or, one or more field programmable gate arrays (FPGA), etc. The arithmetic processor can include one or more cores, and can selectively schedule other units. RAM can store some intermediate data during calculation or processing, such as intermediate calculation data of CPU and baseband. ISP is used to process the data collected by the image sensor. I/O is used for the SOC to interact with various external interfaces, such as the universal serial bus (USB) interface for data transmission. The memory can be a chip or a group of chips. The display screen can be a touch screen, which is connected to the bus through a display interface. The display interface can be used for data processing before image display, such as aliasing of multiple layers to be displayed, buffering of display data, or control and adjustment of screen brightness.
可以理解的是,本申请实施例中涉及的图像信号处理器可以是一个或一组芯片,即可以是集成的,也可以是独立的。例如,终端设备100中包括的图像信号处理器可以是集成在运算处理器中的集成ISP芯片。It can be understood that the image signal processor involved in the embodiment of the present application may be one or a group of chips, that is, it may be integrated or independent. For example, the image signal processor included in the terminal device 100 may be an integrated ISP chip integrated in the arithmetic processor.
图2示出终端设备对图像色彩处理的示意图,终端设备可以对输入的待处理图像进行图像处理,图像处理过程可以包括图像色彩处理,还可以包括动态范围调整处理等其他处理过程,终端设备输出处理后的目标图像。结合图1所示的终端设备,终端设备中的ISP可以对图像色彩进行处理,得到处理后的目标图像。Figure 2 shows a schematic diagram of image color processing by a terminal device. The terminal device can perform image processing on the input image to be processed. The image processing process can include image color processing, and can also include other processing processes such as dynamic range adjustment processing. The terminal device outputs The processed target image. Combined with the terminal device shown in Figure 1, the ISP in the terminal device can process the image color to obtain the processed target image.
为了更好的理解本申请实施例的方案,首先对本申请实施例涉及到的概念术语进行解释说明。In order to better understand the solutions of the embodiments of the present application, firstly, the conceptual terms involved in the embodiments of the present application are explained.
1)图像格式:1) Image format:
本申请实施例中,图像的格式可以为红绿蓝(RGB)格式,也可以为亮色分离(YUV)格式,也可以为贝尔(bayer)格式。In the embodiments of the present application, the format of the image may be a red, green, and blue (RGB) format, may also be a bright color separation (YUV) format, or may be a Bayer format.
2)色彩值:2) Color value:
本申请实施例中,图像可以包括一个或多个像素,每一个像素包括一个或多个维度图像色彩分量。本发明实施例中的色彩可以包括色调与饱和度。其中,分量也可以称作通道、 信号、颜色分量等。色彩分量也可以称作颜色空间的通道、颜色空间的信道、颜色空间的颜色分量等。色彩值表示图像像素的图像色彩分量的数字表达值。例如,针对YUV格式图像,色彩分量的色彩值可以包括YUV空间的U分量和V分量。针对RGB格式图像,色彩值可以包括RGB空间的R分量、G分量和B分量。色彩分量的色彩值,也可以理解为对应的色彩分量值、色彩通道值、颜色分量值等。In the embodiment of the present application, the image may include one or more pixels, and each pixel includes one or more dimensional image color components. The color in the embodiment of the present invention may include hue and saturation. Among them, components can also be referred to as channels, signals, color components, and so on. The color component can also be referred to as the channel of the color space, the channel of the color space, the color component of the color space, and so on. The color value represents the digital expression value of the image color component of the image pixel. For example, for a YUV format image, the color value of the color component may include the U component and the V component of the YUV space. For the RGB format image, the color value can include the R component, G component, and B component of the RGB space. The color value of the color component can also be understood as the corresponding color component value, color channel value, color component value, and so on.
3)亮度值:3) Brightness value:
表示图像像素的亮度分量的数字表达值,亮度值可以用于表征YUV空间的Y分量。也可以用于表征RGB空间的R分量、G分量和B分量。Represents the digital expression value of the brightness component of an image pixel, and the brightness value can be used to characterize the Y component of the YUV space. It can also be used to characterize the R, G, and B components of the RGB space.
4)查找表(lookup table,LUT):4) Lookup table (LUT):
查找表可以为本领域技术人员可以理解的任意形式的查找表。可选的,本申请实施例中采用一维(1D)查找表。可选的,查找表中包括一系列的输入数据与输出数据,输入数据与输出数据呈一一对应的关系。其中,查找表中的输出数据可以是以表项数值的形式体现,输入数据可以表示为查表值。查找表中可以不显示查表值,查表值以表项索引或表项下标的形式表示。即查找表中包括一个或多个表项数值,每一个表项数值对应一个查表值,通过输入查表值,可以得到与该查表值对应的表项数值。The lookup table can be any form of lookup table that can be understood by those skilled in the art. Optionally, a one-dimensional (1D) lookup table is used in the embodiment of the present application. Optionally, the lookup table includes a series of input data and output data, and the input data and the output data have a one-to-one correspondence. Among them, the output data in the lookup table can be embodied in the form of table item values, and the input data can be expressed as the lookup table value. The look-up table value may not be displayed in the look-up table, and the look-up table value is expressed in the form of table item index or table item subscript. That is, the lookup table includes one or more table item values, and each table item value corresponds to a lookup table value. By inputting the lookup table value, the table item value corresponding to the lookup table value can be obtained.
可以理解的是,查找表可以以表格形式体现,也可以以其他能够表示输入数据与输出数据的对应关系的形式体现。It is understandable that the lookup table can be embodied in a table form, or can be embodied in other forms that can represent the corresponding relationship between the input data and the output data.
本申请实施例中,为作区分,用第一查找表、第二查找表或第三查找表来表示多个查找表,每个查找表的概念可以参照本第4)点的描述。In the embodiments of the present application, for distinction, a first lookup table, a second lookup table, or a third lookup table is used to represent multiple lookup tables, and the concept of each lookup table can refer to the description in point 4) of this article.
基于上述描述,如图3所示,本申请实施例提供的图像色彩处理方法如下所述。该方法可以由图1所示的终端设备执行,也可以由其它具有图像色彩处理功能的装置执行。Based on the foregoing description, as shown in FIG. 3, the image color processing method provided by the embodiment of the present application is as follows. This method can be executed by the terminal device shown in FIG. 1 or by other devices with image color processing functions.
S301、确定待处理图像的像素的多个色彩分量的色彩值。S301: Determine color values of multiple color components of pixels of the image to be processed.
S302、确定待处理图像的像素的亮度值分别与多个色彩分量的色彩值的比值。S302: Determine the ratio of the brightness value of the pixel of the image to be processed to the color value of the multiple color components.
例如,像素的亮度值的确定方法本申请实施例中不作限定。对于YUV空间,该亮度值可以是YUV空间的Y分量的亮度值。对于RGB空间,可以根据R分量、G分量、B分量的色彩值计算Y分量的亮度值。例如,可以根据公式Y=a 11*R+a 12*G+a 13*B,计算Y分量的色彩值。其中,a 11、a 12、a 13是固定系数。本领域技术人员能够理解,a 11、a 12、a 13的取值可以有多种选择,本申请实施例对此不作限定。举例来讲,Y=0.2126*R+0.7152*G+0.0722*B或者Y=0.2627*R+0.6780*G+0.0593*B。 For example, the method for determining the brightness value of the pixel is not limited in the embodiment of the present application. For the YUV space, the brightness value may be the brightness value of the Y component of the YUV space. For the RGB space, the brightness value of the Y component can be calculated based on the color values of the R component, G component, and B component. For example, the color value of the Y component can be calculated according to the formula Y=a 11 *R+a 12 *G+a 13 *B. Among them, a 11 , a 12 , and a 13 are fixed coefficients. Those skilled in the art can understand that there can be multiple choices for the values of a 11 , a 12 , and a 13 , which is not limited in the embodiment of the present application. For example, Y=0.2126*R+0.7152*G+0.0722*B or Y=0.2627*R+0.6780*G+0.0593*B.
对于YUV空间来说,包括2个色彩分量,像素的亮度值Y分别与2个色彩分量的色彩值的比值可以分别表示为Y/U和Y/V。对于RGB空间来说,包括3个色彩分量,像素的亮度值Y分别与3个色彩分量的色彩值的比值可以分别表示为Y/R、Y/G和Y/B。For the YUV space, it includes two color components, and the ratio of the luminance value Y of the pixel to the color values of the two color components can be expressed as Y/U and Y/V respectively. For the RGB space, it includes 3 color components, and the ratio of the luminance value Y of the pixel to the color values of the 3 color components can be expressed as Y/R, Y/G, and Y/B, respectively.
S303、根据S302中得到的比值和第一查找表,确定待处理图像的像素的第一色彩调整系数。S303: Determine the first color adjustment coefficient of the pixels of the image to be processed according to the ratio obtained in S302 and the first look-up table.
可选的,第一查找表中包括或指示色彩调整系数和预设比值的映射关系。预设比值可以作为输入数据,色彩调整系数可以作为输出数据。Optionally, the first look-up table includes or indicates the mapping relationship between the color adjustment coefficient and the preset ratio. The preset ratio can be used as input data, and the color adjustment coefficient can be used as output data.
S304、根据第一色彩调整系数,对待处理图像的像素进行色彩处理,以得到目标图像。S304: Perform color processing on pixels of the image to be processed according to the first color adjustment coefficient to obtain a target image.
可以理解的是,待处理图像可能包括多个像素,每个像素均可以按照图3所示的流程进行处理,以得到目标图像。It is understandable that the image to be processed may include multiple pixels, and each pixel can be processed according to the process shown in FIG. 3 to obtain the target image.
图3实施例,根据待处理图像的像素的亮度值与色彩分量的色彩值的比值,确定第一 色彩调整系数,以对待处理图像进行色彩处理,能够减少进行色彩处理的图像的色彩偏差现象,提高了进行色彩处理的图像的质量。其中,图3实施例的各个步骤可以通过终端设备的硬件电路来实现,例如,通过第一查找表确定第一色彩调整系数的方式,可以实现整型数据的处理,从而能够将图像色彩处理流程的执行过程落实到硬件电路,提高图像色彩处理方法的实际应用可能性。In the embodiment of FIG. 3, the first color adjustment coefficient is determined according to the ratio of the brightness value of the pixel of the image to be processed to the color value of the color component to perform color processing on the image to be processed, which can reduce the color deviation phenomenon of the image to be processed. Improved the quality of the image for color processing. Among them, each step of the embodiment in FIG. 3 can be implemented by the hardware circuit of the terminal device. For example, the method of determining the first color adjustment coefficient through the first look-up table can realize the processing of the integer data, so that the image color processing flow can be changed. The implementation of the process is implemented in the hardware circuit to improve the practical application possibilities of the image color processing method.
下面对图3实施例的一些可选的实现方式作进一步介绍。The following further introduces some optional implementation manners of the embodiment in FIG. 3.
第一查找表的输入数据可以是浮点型数值也可以是整型数值或定点数值。以第一查找表的输入数据为定点数值为例进行介绍。The input data of the first look-up table can be floating-point values, integer values or fixed-point values. Take the input data of the first look-up table as a fixed-point value as an example.
首先介绍一下查找表的生成过程的可能实现方式。First introduce the possible implementation of the lookup table generation process.
查找表的输入数据的取值范围可以根据色彩值的比特位宽确定,查找表的输入数据的取值范围可以小于或等于色彩值的比特位宽确定的取值范围。当色彩值为整型数值时,一般情况下,色彩值取值为N比特,N为正整数,例如,色彩值取值为8比特、10比特、12比特、14比特或16比特。色彩值的取值范围为(0~2 N-1)或(1~2 N)。例如,当RGB图像色彩值的取值为10比特时,色彩值的取值范围为(0~2 10-1)。 The value range of the input data of the lookup table may be determined according to the bit width of the color value, and the value range of the input data of the lookup table may be less than or equal to the value range determined by the bit width of the color value. When the color value is an integer value, in general, the color value is N bits, and N is a positive integer. For example, the color value is 8 bits, 10 bits, 12 bits, 14 bits, or 16 bits. The value range of the color value is (0~2 N -1) or (1~2 N ). For example, when the value of the color value of an RGB image is 10 bits, the value range of the color value is (0-2 10 -1).
查找表的查表值作为输入数据,输出数据为查找表的表项数值。本申请实施例中,查找表的表项数值和查表值之间的映射关系满足第一幂函数。即,将查表值输入第一幂函数进行运算获得对应的表项数值。The look-up table value of the look-up table is used as the input data, and the output data is the table item value of the look-up table. In the embodiment of the present application, the mapping relationship between the table entry value of the lookup table and the lookup table value satisfies the first power function. That is, the table look-up value is input into the first power function for operation to obtain the corresponding table item value.
当查表值为定点数值时,可以通过以下方式生成查找表。When the look-up table value is a fixed-point value, the look-up table can be generated in the following way.
根据由色彩值的比特位宽确定的取值范围的最大值,对查表值(即定点数值)进行反量化,以得到浮点数值。例如,根据由色彩值的比特位宽确定的取值范围的最大值为2 N-1,查表值为M,通过M/(2 N-1)得到浮点数值M1。确定浮点数值基于第一幂函数的函数值,例如,将浮点数值M1代入第一幂函数进行运算,得到M2。M2为浮点型数值。根据预设的量化系数,对函数值进行量化,以得到查找表的表项数值。M2量化后得到的数据为定点型数值。 According to the maximum value of the value range determined by the bit width of the color value, the look-up table value (that is, the fixed-point value) is inversely quantized to obtain the floating-point value. For example, the maximum value of the value range determined by the bit width of the color value is 2 N -1, the look-up table value is M, and the floating point value M1 is obtained by M/(2 N -1). Determine the function value of the floating point value based on the first power function, for example, substituting the floating point value M1 into the first power function for calculation to obtain M2. M2 is a floating-point value. According to the preset quantization coefficient, the function value is quantized to obtain the entry value of the look-up table. The data obtained after M2 quantization is a fixed-point value.
遍历查找表的查表值,按照上述方法可以得到每一个查表值对应的表项数值,从而生成查找表。Traverse the look-up table values of the look-up table, according to the above method, the table item value corresponding to each look-up table value can be obtained, thereby generating the look-up table.
查找表的查表值为查找表的输入数据,用于根据查表值得到对应的表项数值。查找表的索引值为表项数值的序号,一般根据自然数由小到大或由大到小的顺序排列生成。查表值可以根据索引值和索引值间的步长确定。The look-up table value of the look-up table is the input data of the look-up table, which is used to obtain the corresponding table item value according to the look-up table value. The index value of the lookup table is the sequence number of the table item value, which is generally generated according to the order of natural numbers from small to large or from large to small. The look-up table value can be determined according to the index value and the step length between the index value.
在一种可能的实施例中,图3实施例中所述的第一查找表的第一查表值的取值范围由色彩值的比特位宽确定。例如,色彩值取值为N比特,色彩值的取值范围为(0~2 N-1),最大值为2 N-1。第一查表值可以设置为0~2 N-1中的值。第一查找表中的第一表项数值的序号可以称为第一查找表的索引值,例如,第一查找表中包括L个表项数值,则第一查找表的表项数值的序号为0~L-1或(1~L),L为正整数。第一查找表的索引值为0~L-1或(1~L)。查找表中每两个索引值之间的步长可以为1或大于1的整数。第一查表值基于第一查找表的索引值和索引值间的步长确定。当第一查表值为2 N个时,第一查表值与索引值一一对应,步长为1。步长也可以大于1,第一查表值=索引值×步长。 In a possible embodiment, the value range of the first look-up table value of the first look-up table described in the embodiment of FIG. 3 is determined by the bit width of the color value. For example, the value of the color value is N bits, the value range of the color value is (0-2 N -1), and the maximum value is 2 N -1. The first look-up table value can be set to a value from 0 to 2 N -1. The sequence number of the first entry value in the first lookup table can be referred to as the index value of the first lookup table. For example, if the first lookup table includes L entry values, then the sequence number of the first lookup table entry value is 0~L-1 or (1~L), L is a positive integer. The index value of the first look-up table is 0~L-1 or (1~L). The step length between every two index values in the lookup table can be 1 or an integer greater than 1. The first look-up table value is determined based on the index value of the first look-up table and the step size between the index value. When the first look-up table value is 2 N , the first look-up table value corresponds to the index value one-to-one, and the step size is 1. The step length can also be greater than 1, the first look-up table value=index value×step length.
例如,色彩值取值为12比特,色彩值的取值范围为0~4095,最大值为4095。索引值可以为0~4095,或者为1~4096。假设索引值可以为0~1023,步长为4,查表值M依次为(0,4,8,12,16,20,……,4092)。For example, the color value is 12 bits, the color value ranges from 0 to 4095, and the maximum value is 4095. The index value can be from 0 to 4095, or from 1 to 4096. Assuming that the index value can be 0~1023, the step size is 4, and the table lookup value M is (0,4,8,12,16,20,...,4092) in turn.
将(0,4,8,12,16,20,……,4092)中的每一个定点数值除以4095,得到每一个定点数值对应的浮点数值M1。Divide each fixed-point value in (0,4,8,12,16,20,...,4092) by 4095 to obtain the floating-point value M1 corresponding to each fixed-point value.
上述查找表的生成过程的可能实现方式适用于第一查找表。The possible implementation of the above-mentioned look-up table generation process is applicable to the first look-up table.
在另一种可能的实施例中,色彩值的比特位宽确定的取值范围包括第一取值范围和至少一个第二取值范围。即,色彩值的比特位宽确定的取值范围可以包括多个子集。每个子集为一个取值范围,多个子集的并集为该色彩值的比特位宽确定的取值范围,或者多个子集的并集也可以小于该色彩值的比特位宽确定的取值范围。一般以两个子集为例,即色彩值的比特位宽确定的取值范围包括第一取值范围和一个第二取值范围。图3实施例中所述的第一查找表的查表值的取值范围为第一取值范围。例如,色彩值取值为N比特,色彩值的取值范围为(0~2 N-1),最大值为2 N-1。第二取值范围为(0~N1),第一取值范围为(N1+1~2 N-1),第一取值范围的最小值大于第二取值范围的最大值。第一查找表的查表值的取值范围为(N1+1~2 N-1),第一查表值可以设置为(N1+1~2 N-1)中的值。第一查找表中的第一表项数值的序号可以称为第一查找表的索引值,例如,第一查找表中包括L个表项数值,则第一查找表的表项数值的序号为0~L-1或(1~L),L为正整数。第一查找表的索引值为0~L-1或(1~L)。第一查找表中每两个索引值之间的步长可以为1或大于1的整数。第一查表值基于第一查找表的索引值和索引值间的步长确定。第一查表值可以与索引值一一对应,即步长为1。步长也可以大于1,此时第一查找表的第一查表值基于第一查找表的索引值、第一查找表的索引值间的步长和第二取值范围的最大值确定,例如第一查表值=索引值×步长+N1。N1为第二取值范围的最大值。若色彩值的比特位宽确定的取值范围包括第一取值范围和多个第二取值范围,图3实施例中所述的第一查找表的查表值的取值范围为第一取值范围,第一查表值=索引值×步长+N1。N1为第一取值范围之前所有取值范围的最大值。 In another possible embodiment, the value range determined by the bit width of the color value includes a first value range and at least one second value range. That is, the value range determined by the bit width of the color value may include multiple subsets. Each subset is a value range, and the union of multiple subsets is the value range determined by the bit width of the color value, or the union of multiple subsets can also be smaller than the value determined by the bit width of the color value Scope. Generally, two subsets are taken as an example, that is, the value range determined by the bit width of the color value includes a first value range and a second value range. The value range of the table look-up value of the first look-up table described in the embodiment of FIG. 3 is the first value range. For example, the value of the color value is N bits, the value range of the color value is (0-2 N -1), and the maximum value is 2 N -1. The second value range is (0~N1), the first value range is (N1+1~2 N -1), and the minimum value of the first value range is greater than the maximum value of the second value range. The value range of the table lookup value of the first lookup table is (N1+1~2 N -1), and the first lookup table value can be set to a value in (N1+1~2 N -1). The sequence number of the first entry value in the first lookup table can be referred to as the index value of the first lookup table. For example, if the first lookup table includes L entry values, then the sequence number of the first lookup table entry value is 0~L-1 or (1~L), L is a positive integer. The index value of the first look-up table is 0~L-1 or (1~L). The step size between every two index values in the first look-up table may be 1 or an integer greater than 1. The first look-up table value is determined based on the index value of the first look-up table and the step size between the index value. The first look-up table value can have a one-to-one correspondence with the index value, that is, the step size is 1. The step size can also be greater than 1. At this time, the first lookup value of the first lookup table is determined based on the index value of the first lookup table, the step length between the index values of the first lookup table, and the maximum value of the second value range. For example, the first look-up table value=index value×step size+N1. N1 is the maximum value of the second value range. If the value range determined by the bit width of the color value includes a first value range and a plurality of second value ranges, the value range of the look-up table value of the first look-up table in the embodiment of FIG. 3 is the first value range. Value range, the first look-up table value=index value×step size+N1. N1 is the maximum value of all value ranges before the first value range.
与第一查找表类似,根据第二取值范围可以生成第二查找表,第二查找表的查表值的取值范围对应第二取值范围。第二查找表的查表值的取值范围为(0~N1),第二查表值可以设置为(0~N1)中的值。第二查找表中的第二表项数值的序号可以称为第二查找表的索引值,例如,第二查找表中包括L1个表项数值,则第二查找表的表项数值的序号为0~L1-1或(1~L1),L1为正整数。第二查找表的索引值为0~L1-1或(1~L1)。第二查找表中每两个索引值之间的步长可以为1或大于1的整数。第二查表值基于第二查找表的索引值和索引值间的步长确定。第二查表值可以与索引值一一对应,即步长为1。步长也可以大于1,此时第二查找表的第二查表值基于第一查找表的索引值和第一查找表的索引值间的步长确定,例如第二查表值=索引值×步长。Similar to the first lookup table, a second lookup table can be generated according to the second value range, and the value range of the table lookup value of the second lookup table corresponds to the second value range. The value range of the table lookup value of the second lookup table is (0~N1), and the second lookup table value can be set to a value in (0~N1). The sequence number of the second entry value in the second lookup table can be called the index value of the second lookup table. For example, if the second lookup table includes L1 entry values, the sequence number of the second lookup table entry value is 0~L1-1 or (1~L1), L1 is a positive integer. The index value of the second lookup table is 0~L1-1 or (1~L1). The step size between every two index values in the second lookup table may be 1 or an integer greater than 1. The second look-up table value is determined based on the index value of the second look-up table and the step size between the index value. The second look-up table value can have a one-to-one correspondence with the index value, that is, the step size is 1. The step size can also be greater than 1. In this case, the second lookup value of the second lookup table is determined based on the step length between the index value of the first lookup table and the index value of the first lookup table, for example, the second lookup table value=index value × step length.
可选的,第一查找表的索引值间的步长和第二查找表的索引值间的步长可以相同也可以不同。Optionally, the step size between the index values of the first look-up table and the step size between the index values of the second look-up table may be the same or different.
例如,色彩值取值为12比特,色彩值的取值范围为0~4095,最大值为4095。第二取值范围为(0~255),第一取值范围为(256~4095)。第二查找表的表项数为64项,第二查找表的索引值间的步长256/64=4,第二查找表的表项数值为(0,4,8,12,16,20,……,252)。第一查找表的表项数为128项,第一查找表的索引值间的步长(4095-256)/128=30,第二查找表的表项数值为(256,286,316,,……,4066)。For example, the color value is 12 bits, the color value ranges from 0 to 4095, and the maximum value is 4095. The second value range is (0~255), and the first value range is (256~4095). The number of entries in the second look-up table is 64, the step size between the index values of the second look-up table is 256/64=4, and the value of the entries in the second look-up table is (0,4,8,12,16,20 ,……,252). The number of entries in the first look-up table is 128, the step size between the index values of the first look-up table is (4095-256)/128=30, and the value of the entries in the second look-up table is (256,286,316,,...,4066 ).
第二查找表的索引值可以为0~63,或者为1~64。第一查找表的索引值可以为0~127,或者为1~128。The index value of the second lookup table may be 0-63, or 1-64. The index value of the first look-up table may be 0-127, or 1-128.
将第一查找表(256,286,316,,……,4066)中的每一个定点数值除以4095,得到每一个定点数值对应的浮点数值M1。将第二查找表(0,4,8,12,16,20,……,252)中的每一个定点数值除以4095,得到每一个定点数值对应的浮点数值。Divide each fixed-point value in the first lookup table (256,286,316,,...,4066) by 4095 to obtain the floating-point value M1 corresponding to each fixed-point value. Divide each fixed-point value in the second lookup table (0,4,8,12,16,20,...,252) by 4095 to obtain the floating-point value corresponding to each fixed-point value.
上文中查找表的生成过程的可能实现方式可以适用于第一查找表,也可以适用于第二查找表。The above possible implementation of the look-up table generation process can be applied to the first look-up table, and can also be applied to the second look-up table.
当色彩值的比特位宽确定的取值范围包括第一取值范围和至少一个第二取值范围时,第一查找表对应第一取值范围。在这种情况下,在S303之前,还可以确定该比值所在的第一取值范围对应的第一查找表。例如,可以设定一个阈值,根据该比值与阈值的比较结果,确定该比值所在的取值范围,进一步确定该取值范围对应的查找表。当该比值小于阈值时,确定比值所在第二取值范围,并确定第二取值范围对应的第二查找表,根据该比值与第二查找表,确定比值对应的色彩调整系数。当该比值大于或等于阈值时,确定该比值所在第一取值范围,并确定第一取值范围对应的第一查找表,根据该比值与第一查找表,确定比值对应的第一色彩调整系数。基于上述举例,色彩值取值为12比特,色彩值的取值范围为0~4095,最大值为4095。第二取值范围为(0~255),第一取值范围为(256~4095)。该阈值可以设置为256。When the value range determined by the bit width of the color value includes the first value range and at least one second value range, the first look-up table corresponds to the first value range. In this case, before S303, the first lookup table corresponding to the first value range in which the ratio is located may also be determined. For example, a threshold can be set, and the value range of the ratio can be determined according to the comparison result of the ratio and the threshold, and the lookup table corresponding to the value range can be further determined. When the ratio is less than the threshold, the second value range of the ratio is determined, the second lookup table corresponding to the second value range is determined, and the color adjustment coefficient corresponding to the ratio is determined based on the ratio and the second lookup table. When the ratio is greater than or equal to the threshold, the first value range of the ratio is determined, and the first lookup table corresponding to the first value range is determined, and the first color adjustment corresponding to the ratio is determined according to the ratio and the first lookup table. coefficient. Based on the above example, the color value is 12 bits, the color value ranges from 0 to 4095, and the maximum value is 4095. The second value range is (0~255), and the first value range is (256~4095). The threshold can be set to 256.
当然,还可以根据以下比较方式确定色彩调整系数。当该比值小于或等于阈值时,确定比值所在第二取值范围,并确定第二取值范围对应的第二查找表,根据该比值与第二查找表,确定比值对应的色彩调整系数。当该比值大于阈值时,确定该比值所在第一取值范围,并确定第一取值范围对应的第一查找表,根据该比值与第一查找表,确定比值对应的第一色彩调整系数。基于上述举例,色彩值取值为12比特,色彩值的取值范围为0~4095,最大值为4095。第二取值范围为(0~255),第一取值范围为(256~4095)。该阈值可以设置为255。Of course, the color adjustment coefficient can also be determined according to the following comparison method. When the ratio is less than or equal to the threshold, the second value range of the ratio is determined, the second lookup table corresponding to the second value range is determined, and the color adjustment coefficient corresponding to the ratio is determined based on the ratio and the second lookup table. When the ratio is greater than the threshold, the first value range of the ratio is determined, the first lookup table corresponding to the first value range is determined, and the first color adjustment coefficient corresponding to the ratio is determined according to the ratio and the first lookup table. Based on the above example, the color value is 12 bits, the color value ranges from 0 to 4095, and the maximum value is 4095. The second value range is (0~255), and the first value range is (256~4095). The threshold can be set to 255.
以下介绍一下S303中根据比值和第一查找表确定像素的第一色彩调整系数的可能实现方式。The following describes a possible implementation manner of determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table in S303.
第一查找表包括色彩调整系数和预设比值的映射关系,可以理解为,预设比值为第一查找表的查表值,色彩调整系数为第一查找表中与查表值对应的表项数据。The first lookup table includes the mapping relationship between the color adjustment coefficient and the preset ratio. It can be understood that the preset ratio is the lookup value of the first lookup table, and the color adjustment coefficient is the entry in the first lookup table corresponding to the lookup value. data.
在S303中,根据比值和第一查找表,确定像素的第一色彩调整系数。其中,第一查找表的预设比值中可能包括该比值,则可以根据色彩调整系数和预设比值的映射关系,确定该比值对应的第一色彩调整系数即可。In S303, the first color adjustment coefficient of the pixel is determined according to the ratio and the first look-up table. Wherein, the preset ratio of the first look-up table may include the ratio, and the first color adjustment coefficient corresponding to the ratio can be determined according to the mapping relationship between the color adjustment coefficient and the preset ratio.
但是,第一查找表的预设比值中可能不包括该比值,则可选的,本申请实施例可以通过插值法确定该比值对应的第一色彩调整系数。However, the ratio may not be included in the preset ratio of the first look-up table. Optionally, in the embodiment of the present application, the first color adjustment coefficient corresponding to the ratio may be determined by interpolation.
其中,插值法,是数学领域数值分析中,由已知的离散数据来估计未知数据的方法。在本申请实施例中,确定该比值对应的第一色彩调整系数所采用的插值法可以是内插值法,也可以是外插值法,可以是线性插值法,也可以是非线性插值法,还可以是近插值法、双线性二次插值法、三次插值法或Lanczos插值法中的任一种,具体可以根据实际情况选择具体的插值法。Among them, interpolation method is a method of estimating unknown data from known discrete data in numerical analysis in the field of mathematics. In the embodiment of the present application, the interpolation method used to determine the first color adjustment coefficient corresponding to the ratio may be an interpolation method, an extrapolation method, a linear interpolation method, or a nonlinear interpolation method, or It is any of the near interpolation method, bilinear quadratic interpolation method, cubic interpolation method or Lanczos interpolation method, and the specific interpolation method can be selected according to the actual situation.
可选的,可以在第一查找表中确定第一预设比值和第二预设比值,根据色彩调整系数和预设比值的映射关系,分别确定第一预设比值和第二预设比值对应的第一系数和第二系数,对第一系数和第二系数进行插值运算,以得到该比值对应的第一色彩调整系数。Optionally, the first preset ratio and the second preset ratio may be determined in the first look-up table, and the correspondence between the first preset ratio and the second preset ratio may be determined according to the mapping relationship between the color adjustment coefficient and the preset ratio. The first coefficient and the second coefficient of, the first coefficient and the second coefficient are interpolated to obtain the first color adjustment coefficient corresponding to the ratio.
第一预设比值和第二预设比值可以是该比值邻近的两个比值,例如,若采用内插值法, 该比值位于第一预设比值和第二预设比值之间,且在预设比值中,该比值与第一预设比值和第二预设比值均相邻。又例如,例如,若采用外插值法,第一预设比值和第二预设比值均小于该比值,且在预设比值中,该比值、第一预设比值和第二预设比值三者相邻;或者,第一预设比值和第二预设比值均大于该比值,且在预设比值中,该比值、第一预设比值和第二预设比值三者相邻。The first preset ratio and the second preset ratio may be two ratios that are adjacent to the ratio. For example, if an interpolation method is used, the ratio is located between the first preset ratio and the second preset ratio, and is between the first preset ratio and the second preset ratio. Among the ratios, the ratio is adjacent to both the first preset ratio and the second preset ratio. For another example, for example, if the extrapolation method is used, the first preset ratio and the second preset ratio are both smaller than the ratio, and among the preset ratios, the ratio, the first preset ratio, and the second preset ratio are three Adjacent; or, the first preset ratio and the second preset ratio are both greater than the ratio, and in the preset ratio, the ratio, the first preset ratio, and the second preset ratio are adjacent to each other.
下面对线性插值法进行举例说明。The following is an example of linear interpolation.
第一查找表(LUT1)的步长为2 step,第一查找表的表项个数为NUM,max为查找表插值的输入数值。 The step length of the first lookup table (LUT1) is 2 step , the number of entries in the first lookup table is NUM, and max is the input value of the lookup table interpolation.
第一步,计算插值下标:i_int=((max>>step));The first step is to calculate the interpolation subscript: i_int=((max>>step));
第二步,计算插值权重:i_dec=((max&(((1<<step)-1))));The second step is to calculate the interpolation weight: i_dec=((max&(((1<<step)-1))));
第三步,计算最终量化插值:C1=(LUT1[i_int]*((1<<step)-i_dec)+LUT1[iClip(i_int+1,0,NUM-1)]*i_dec+(1<<(step-1)))>>step。The third step is to calculate the final quantization interpolation: C1=(LUT1[i_int]*((1<<step)-i_dec)+LUT1[iClip(i_int+1,0,NUM-1)]*i_dec+(1<<( step-1)))>>step.
下面举例介绍一下如何对第一查找表(LUT)进行线性插值,得到比值对应的色彩调整系数。The following is an example of how to perform linear interpolation on the first look-up table (LUT) to obtain the color adjustment coefficient corresponding to the ratio.
1、比值(Radio)除以步长(step)后的数值再取整就是索引值A:A=Radio/step;1. The ratio (Radio) divided by the step size (step) and then rounded to the whole is the index value A: A=Radio/step;
2、索引值A对应第一查表值的数值(data1)就是第一预设比值:data1=LUT[A];2. The value (data1) of the index value A corresponding to the first look-up table value is the first preset ratio: data1=LUT[A];
3、索引值A+1对应的第一查表值的数值(data2)就是第二预设比值:data2=LUT[A+1];3. The value (data2) of the first look-up table value corresponding to the index value A+1 is the second preset ratio: data2=LUT[A+1];
4、比值(Radio)模除所述步长(step)后的数值dec,dec=Radio%step;4. The ratio (Radio) modulo the value dec after the step (step), dec=Radio%step;
5、最终插值data3:data3=(data1*(step-dec)+data2*dec)/step。data3即比值对应的色彩调整系数。5. The final interpolation data3:data3=(data1*(step-dec)+data2*dec)/step. data3 is the color adjustment coefficient corresponding to the ratio.
下面举例介绍一下当色彩值的比特位宽确定的取值范围包括第一取值范围和至少一个第二取值范围时,第一查找表对应第一取值范围,在这种情况下,如何对第一查找表(LUT)进行线性插值,得到比值对应的色彩调整系数。The following is an example to introduce when the value range determined by the bit width of the color value includes a first value range and at least one second value range, the first lookup table corresponds to the first value range. In this case, how to Perform linear interpolation on the first look-up table (LUT) to obtain the color adjustment coefficient corresponding to the ratio.
1、假设阈值为thres。比值(Radio)减去thres后的数值为Radio1:Radio1=Radio-thres。1. Assume that the threshold is thres. The value of the ratio (Radio) minus thres is Radio1: Radio1=Radio-thres.
2、数值Radio1除以所述步长step后的数值取整就是索引值A:A=Radio1/step。2. The numerical value of Radio1 divided by the step size step is rounded to the index value A: A=Radio1/step.
3、索引值A对应查表值data1就是第一预设比值:data1=LUT[A]。3. The index value A corresponding to the table lookup value data1 is the first preset ratio: data1=LUT[A].
4、索引值A+1对应的查表值data2就是第二预设比值:data2=LUT[A+1]。4. The table lookup value data2 corresponding to the index value A+1 is the second preset ratio: data2=LUT[A+1].
5、比值Radio1模除所述步长step后的数值dec:dec=Radio1%step。5. The ratio Radio1 modulo the value dec obtained by dividing the step length step: dec=Radio1%step.
6、最终差值data3:6. The final difference data3:
data3=(data1*(step-dec)+data2*dec)/step。data3即比值对应的色彩调整系数。data3=(data1*(step-dec)+data2*dec)/step. data3 is the color adjustment coefficient corresponding to the ratio.
本申请实施例中,生成第一查找表的流程为软件流程,可以通过软件实现。软件流程可以封装为固件/软件(firmware)。图3实施例的各个步骤为硬件流程,可以通过硬件电路实现。In the embodiment of the present application, the process of generating the first lookup table is a software process, which can be implemented by software. The software process can be packaged as firmware/software (firmware). Each step in the embodiment of FIG. 3 is a hardware flow, which can be implemented by a hardware circuit.
基于此,例如,终端设备对连续的多帧待处理图像进行色彩处理时,终端设备的硬件电路可以对每一帧待处理图像按照图3实施例的各个步骤进行处理,得到每一帧待处理图像对应的目标图像。在连续的每两帧之间的间隔内,终端设备的固件/软件可以生成第一查找表。当然终端设备对图像的色彩处理过程进行软硬件分离,可以不局限于本段中举例的实现方式。Based on this, for example, when the terminal device performs color processing on consecutive multiple frames of images to be processed, the hardware circuit of the terminal device can process each frame of the image to be processed according to the steps of the embodiment in FIG. 3 to obtain each frame to be processed. The target image corresponding to the image. In the interval between every two consecutive frames, the firmware/software of the terminal device may generate the first look-up table. Of course, the terminal device's separation of software and hardware for the color processing process of the image may not be limited to the implementation manners exemplified in this paragraph.
以下对第一幂函数进行说明。The first power function is explained below.
第一幂函数可以表示为f(x)=x b。其中,第一幂函数的指数b为函数系数。第一幂 函数的系数b可以利用图像或图像序列统计信息通过查找表的方式确定,图像或图像序列统计信息可以包括图像或图像序列的最大值、最小值、平均值、标准差以及直方图分布信息。 The first power function can be expressed as f(x)=x b . Among them, the exponent b of the first power function is the function coefficient. The coefficient b of the first power function can be determined by means of a look-up table using the statistical information of the image or image sequence. The statistical information of the image or image sequence can include the maximum, minimum, average, standard deviation, and histogram distribution of the image or image sequence. information.
例如,作为一个具体实施例,本领域技术人员可以基于实验数据或经验,建立第一幂函数的指数和待处理图像的平均亮度值的对应关系。此处,待处理图像的平均亮度值可以指待处理图像或者待处理图像序列的亮度的平均值。作为一个示例,该对应关系可以如表1或表2所示。For example, as a specific embodiment, those skilled in the art can establish the correspondence between the exponent of the first power function and the average brightness value of the image to be processed based on experimental data or experience. Here, the average brightness value of the image to be processed may refer to the average value of the brightness of the image to be processed or a sequence of images to be processed. As an example, the corresponding relationship may be as shown in Table 1 or Table 2.
表1或表2中的平均亮度值的范围为[0,1]。The range of the average brightness value in Table 1 or Table 2 is [0,1].
表1Table 1
平均亮度值Average brightness value 0.10.1 0.250.25 0.30.3 0.550.55 0.60.6
第一幂函数的指数Exponent of the first power function 1.21.2 1.01.0 0.80.8 0.60.6 0.20.2
表2Table 2
平均亮度值Average brightness value 0.10.1 0.30.3 0.50.5
第一幂函数的指数Exponent of the first power function 0.00.0 0.10.1 0.20.2
以表1为例,如表1所示,当获取待处理图像的平均亮度值,该平均亮度值可以是待处理图像的Y分量的平均值,或者是待处理图像的其他分量的平均值。当平均亮度值小于0.1时,第一幂函数的指数可以取1.2;当平均亮度值大于0.6时,第一幂函数的指数可以取0.2。当平均亮度值在两个表值之间时,可以通过插值方式获得第一幂函数的指数值。本申请实施例对插值方式不作限定。例如,可以采取线性插值、二次线性插值等方式。例如,当平均亮度值在0.55与0.6之间时,可以采取如下线性插值方式获得第一幂函数的指数值:Taking Table 1 as an example, as shown in Table 1, when the average brightness value of the image to be processed is obtained, the average brightness value may be the average value of the Y component of the image to be processed, or the average value of other components of the image to be processed. When the average brightness value is less than 0.1, the exponent of the first power function can be 1.2; when the average brightness value is greater than 0.6, the exponent of the first power function can be 0.2. When the average brightness value is between the two table values, the exponential value of the first power function can be obtained by interpolation. The embodiment of the present application does not limit the interpolation method. For example, linear interpolation, quadratic linear interpolation, etc. can be adopted. For example, when the average brightness value is between 0.55 and 0.6, the following linear interpolation method can be adopted to obtain the exponent value of the first power function:
output=0.6+(0.2-0.6)*(input-0.55)/(0.6-0.55)。output=0.6+(0.2-0.6)*(input-0.55)/(0.6-0.55).
其中,上述output表示第一幂函数的指数值,上述input表示待处理图像或者待处理图像序列的平均亮度值。Wherein, the above-mentioned output represents the exponential value of the first power function, and the above-mentioned input represents the average brightness value of the image to be processed or the sequence of images to be processed.
本申请实施例中的幂函数也可以替换为线性函数,例如,该线性函数可以为f(x)=cx+d。The power function in the embodiment of the present application can also be replaced with a linear function. For example, the linear function can be f(x)=cx+d.
可以理解的是,本申请实施例中待处理图像的像素具有多个色彩分量,因此,S302中针对每一个色彩分量的色彩值均可以获得一个比值,即获得多个比值。那么S303中对多个比值来说,每个比值对应一个第一查找表。多个比值对应的多个第一查找表可能是不同的,即多个第一查找表包括或指示的色彩调整系数和预设比值的映射关系可能是不同的。第一查找表的表项数值和查表值之间的映射关系满足第一幂函数。那么多个比值对应的多个第一幂函数的指数值可以是不同的,当然也可能有相同的情况。It can be understood that the pixels of the image to be processed in the embodiment of the present application have multiple color components. Therefore, the color value of each color component in S302 can obtain a ratio, that is, multiple ratios. Then, for multiple ratios in S303, each ratio corresponds to a first look-up table. The multiple first look-up tables corresponding to the multiple ratios may be different, that is, the mapping relationship between the color adjustment coefficients and the preset ratios included or indicated by the multiple first look-up tables may be different. The mapping relationship between the value of the table entry of the first look-up table and the value of the look-up table satisfies the first power function. Then the exponent values of the multiple first power functions corresponding to multiple ratios may be different, and of course there may also be the same situation.
以下对304的可选实现方式进行说明。The optional implementation of 304 is described below.
S304中,根据第一色彩调整系数,对待处理图像的像素进行色彩处理,以得到目标图像。In S304, color processing is performed on the pixels of the image to be processed according to the first color adjustment coefficient to obtain the target image.
可选的实现方式1:Optional implementation 1:
对于RGB空间,可采用如下公式(1),对待处理图像进行色彩处理:For the RGB space, the following formula (1) can be used to perform color processing on the image to be processed:
Figure PCTCN2020088476-appb-000005
Figure PCTCN2020088476-appb-000005
其中,Y表示待处理图像的亮度值,R、G、B分别表示待处理图像的R分量的色彩值、G分量的色彩值和B分量的色彩值,R'、G'、B'分别表示目标图像的R分量的色彩值、G分量的色彩值和B分量的色彩值,a 1表示R分量对应的第一色彩调整系数,a 2表示G分量对应的第一色彩调整系数,a 3表示B分量对应的第一色彩调整系数。a 1、a 2或a 3可以为浮点数值,也可以为定点数值。 Among them, Y represents the brightness value of the image to be processed, R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the image to be processed, and R', G', and B'respectively represent The color value of the R component, the color value of the G component, and the color value of the B component of the target image, a 1 represents the first color adjustment coefficient corresponding to the R component, a 2 represents the first color adjustment coefficient corresponding to the G component, and a 3 represents The first color adjustment coefficient corresponding to the B component. a 1 , a 2 or a 3 can be floating-point values or fixed-point values.
对于YUV空间,可以采用如下公式(2),对待处理图像进行色彩处理:For YUV space, the following formula (2) can be used to perform color processing on the image to be processed:
Figure PCTCN2020088476-appb-000006
Figure PCTCN2020088476-appb-000006
其中,u、v分别表示待处理图像的U分量的色彩值和V分量的色彩值,u'、v'分别表示目标图像的U分量的色彩值和V分量的色彩值,a 4表示U分量对应的第一色彩调整系数,a 5表示V分量对应的第一色彩调整系数。 Among them, u, v respectively represent the color value of the U component and the color value of the V component of the image to be processed, u', v'respectively represent the color value of the U component and the color value of the V component of the target image, and a 4 represents the U component The corresponding first color adjustment coefficient, a 5 represents the first color adjustment coefficient corresponding to the V component.
在可选的实现方式1中,第一色彩调整系数可以是预置的。例如,第一色彩调整系数可以是通过实验数据标定获得的。例如,可以基于实验数据,统计第一色彩调整系数与像素的色彩分量的色彩值的映射关系,并基于该映射关系,确定第一色彩调整系数。In optional implementation manner 1, the first color adjustment coefficient may be preset. For example, the first color adjustment coefficient may be obtained through calibration of experimental data. For example, the mapping relationship between the first color adjustment coefficient and the color value of the color component of the pixel may be calculated based on experimental data, and the first color adjustment coefficient may be determined based on the mapping relationship.
基于实验数据的分析,确定待处理图像的像素对应的第一色彩调整系数,以对待处理图像的进行色彩处理,能够提高进行色彩处理的图像的质量。Based on the analysis of the experimental data, the first color adjustment coefficient corresponding to the pixels of the image to be processed is determined to perform color processing on the image to be processed, which can improve the quality of the image for color processing.
可选的实现方式2:Optional implementation 2:
确定待处理图像的像素的第二色彩调整系数,将第一色彩调整系数与第二色彩调整系数相乘,根据相乘的乘积,对待处理图像的像素进行色彩处理。Determine the second color adjustment coefficient of the pixels of the image to be processed, multiply the first color adjustment coefficient and the second color adjustment coefficient, and perform color processing on the pixels of the image to be processed according to the product of the multiplication.
其中,上述第二色彩调整系数,可以是给定的待处理图像的色彩调整系数,也可以是根据其他方式确定的。例如,待处理图像可以是经过动态范围调整处理的图像,动态范围调整处理表示对图像的电信号值(例如、Y分量、R分量、G分量、B分量)进行压缩或拉伸处理。其中,对图像做动态范围调整处理可能会引起图像的产生色彩偏差现象。第二色彩调整系数可以是根据电信号比值确定的。该电信号比值可以是各像素在动态范围调整处理后的电信号值和动态范围调整处理前的电信号值的电信号比值。例如,在对图像进行高动态范围(high dynamic range,HDR)和标准动态范围(standard dynamic range,SDR)之间转换的过程中,涉及到对图像的动态范围调整。该电信号值可以是YUV空间的Y分量、也可以是RGB空间的R分量、G分量、B分量。Wherein, the above-mentioned second color adjustment coefficient may be a color adjustment coefficient of a given image to be processed, or may be determined according to other methods. For example, the image to be processed may be an image that has undergone a dynamic range adjustment process, and the dynamic range adjustment process means compressing or stretching the electrical signal value (for example, Y component, R component, G component, B component) of the image. Among them, the dynamic range adjustment processing of the image may cause the color deviation phenomenon of the image. The second color adjustment coefficient may be determined according to the ratio of the electrical signal. The electrical signal ratio may be the electrical signal ratio of the electrical signal value of each pixel after the dynamic range adjustment process and the electrical signal value before the dynamic range adjustment process. For example, the process of converting an image between high dynamic range (HDR) and standard dynamic range (standard dynamic range, SDR) involves adjusting the dynamic range of the image. The electrical signal value can be the Y component in the YUV space, or the R component, G component, and B component in the RGB space.
例如,在YUV色彩空间,对待处理图像的电信号值进行动态范围调整处理,可以如以下公式(3)所示:For example, in the YUV color space, the dynamic range adjustment processing of the electrical signal value of the image to be processed can be as shown in the following formula (3):
Y 2=cY 1   公式(3) Y 2 =cY 1 formula (3)
其中,动态范围调整处理前的电信号值为Y 1,动态范围调整处理后的电信号值为Y 2,c为该动态范围调整处理前后的电信号比值。 Wherein, the electrical signal value before the dynamic range adjustment processing is Y 1 , the electrical signal value after the dynamic range adjustment processing is Y 2 , and c is the ratio of the electrical signals before and after the dynamic range adjustment processing.
又例如,在RGB色彩空间,对待处理图像的色彩值进行动态范围调整处理,可以如以下公式(4)所示:For another example, in the RGB color space, the color value of the image to be processed is subjected to dynamic range adjustment processing, as shown in the following formula (4):
Figure PCTCN2020088476-appb-000007
Figure PCTCN2020088476-appb-000007
其中动态范围调整处理前的色彩值为R 1,G 1,B 1,动态范围调整处理后的色值为R 2,G 2,B 2,f为该动态范围调整处理前后的电信号比值,可选的,f可以是RGB中最大分量得比值。 The color values before the dynamic range adjustment processing are R 1 , G 1 , B 1 , and the color values after the dynamic range adjustment processing are R 2 , G 2 , B 2 , and f is the ratio of the electrical signals before and after the dynamic range adjustment processing. Optionally, f can be the ratio of the largest component in RGB.
可选地,根据该电信号比值,确定该第二色彩调整系数包括多种方式。例如,可以直接将该电信号比值确定为该第二色彩调整系数。又例如,通过查表确定电信号比值对应的第二色彩调整系数。具体地,根据电信号比值与查找表(记为第三查找表)确定第二色彩调整系数。第三查找表的生成方式可以参考上述第一查找表的描述。第三查找表中包括或指示色彩调整系数和预设比值的映射关系,色彩调整系数和预设比值的映射关系符合第二幂函数。也可以根据电信号比值和第二幂函数,确定第二色彩调整系数,第二色彩调整系数可以是将电信号比值代入第二幂函数得到的值。根据电信号比值与第三查找表确定第二色彩调整系数的流程可以通过硬件电路来实现,生成第三查找表的过程可以通过固件/软件来实现。Optionally, determining the second color adjustment coefficient according to the electrical signal ratio includes multiple methods. For example, the electrical signal ratio can be directly determined as the second color adjustment coefficient. For another example, the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table. Specifically, the second color adjustment coefficient is determined according to the ratio of the electrical signal and the look-up table (denoted as the third look-up table). For the method of generating the third look-up table, refer to the description of the above-mentioned first look-up table. The third look-up table includes or indicates the mapping relationship between the color adjustment coefficient and the preset ratio, and the mapping relationship between the color adjustment coefficient and the preset ratio conforms to the second power function. The second color adjustment coefficient may also be determined according to the ratio of the electrical signal and the second power function, and the second color adjustment coefficient may be a value obtained by substituting the ratio of the electrical signal into the second power function. The process of determining the second color adjustment coefficient according to the ratio of the electrical signal and the third look-up table may be implemented by a hardware circuit, and the process of generating the third look-up table may be implemented by firmware/software.
其中,第二幂函数可以表示为f(x)=x d,第二幂函数的指数d为函数系数。其中,d的取值可以本领域技术人员基于实验数据、经验选取的固定值或利用图像或图像序列统计信息通过查找表的方式确定,图像或图像序列统计信息可以包括图像或图像序列的最大值、最小值、平均值、标准差以及直方图分布信息。 Among them, the second power function can be expressed as f(x)=x d , and the exponent d of the second power function is the function coefficient. Among them, the value of d can be determined by a fixed value selected by those skilled in the art based on experimental data and experience, or by using image or image sequence statistical information through a look-up table. The image or image sequence statistical information can include the maximum value of the image or image sequence. , Minimum, average, standard deviation, and histogram distribution information.
例如,作为一个具体实施例,本领域技术人员可以基于实验数据或经验,建立第二幂函数的指数和待处理图像的平均亮度值的对应关系。此处,待处理图像的平均亮度值可以指待处理图像或者待处理图像序列的亮度的平均值。作为一个示例,该对应关系可以如表3或表4所示。表3或表4中的平均亮度值采用归一化方式表示,其范围为[0,1]。其中,1表示亮度值的最大值,0表示亮度值的最小值。For example, as a specific embodiment, those skilled in the art can establish the correspondence between the exponent of the second power function and the average brightness value of the image to be processed based on experimental data or experience. Here, the average brightness value of the image to be processed may refer to the average value of the brightness of the image to be processed or a sequence of images to be processed. As an example, the corresponding relationship may be as shown in Table 3 or Table 4. The average brightness value in Table 3 or Table 4 is expressed in a normalized manner, and its range is [0,1]. Among them, 1 represents the maximum value of the brightness value, and 0 represents the minimum value of the brightness value.
表3table 3
平均亮度值Average brightness value 0.10.1 0.250.25 0.30.3 0.550.55 0.60.6
第二幂函数的指数Exponent of the second power function 0.10.1 0.150.15 0.20.2 0.250.25 0.30.3
表4Table 4
平均亮度值Average brightness value 0.10.1 0.50.5
第二幂函数的指数Exponent of the second power function -0.1-0.1 -0.3-0.3
为了描述的方便和简洁,在表2所对应的方法中,查找第二幂函数的指数的方法可以参考与表1有关的详细描述,此处不再赘述。For the convenience and conciseness of description, in the method corresponding to Table 2, the method of finding the exponent of the second power function can refer to the detailed description related to Table 1, which will not be repeated here.
在可选的实现方式2的基础上,S304中的目标图像可以根据以下方式获得。Based on the optional implementation manner 2, the target image in S304 can be obtained in the following manner.
若多个色彩分量包括RGB空间中的R分量、G分量、B分量,目标图像根据以下公式(5)获得:If multiple color components include R, G, and B components in the RGB space, the target image is obtained according to the following formula (5):
Figure PCTCN2020088476-appb-000008
Figure PCTCN2020088476-appb-000008
其中,R、G、B分别表示像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,R'、G'、B'分别表示目标图像中对应像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,Y表示像素的亮度值,AlphyR0表示像素的R分量对应的第一色彩调整系数,AlphyG0表示像素的G分量对应的第一色彩调整系数,AlphyB0表示像素的B分量对应的第一色彩调整系数,Alphy1表示第二色彩调整系数,A1是Alphy1的量化系数,A2是AlphyR0的量化系数,A3是AlphyG0的量化系数,A4是AlphyB0的量化系数。Among them, R, G, B respectively represent the color value of the R component of the pixel, the color value of the G component and the color value of the B component, R', G', B'respectively represent the color value of the R component of the corresponding pixel in the target image , G component color value and B component color value, Y represents the brightness value of the pixel, AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel, AlphyG0 represents the first color adjustment coefficient corresponding to the G component of the pixel, AlphyB0 represents The first color adjustment coefficient corresponding to the B component of the pixel, Alphy1 represents the second color adjustment coefficient, A1 is the quantization coefficient of Alphy1, A2 is the quantization coefficient of AlphyR0, A3 is the quantization coefficient of AlphyG0, and A4 is the quantization coefficient of AlphyB0.
若多个色彩分量包括YUV空间中的U分量、V分量,目标图像根据以下公式(6)获得:If multiple color components include U and V components in the YUV space, the target image is obtained according to the following formula (6):
Figure PCTCN2020088476-appb-000009
Figure PCTCN2020088476-appb-000009
其中,U、V分别表示像素的U分量的色彩值和V分量的色彩值,U′、V′分别表示目标图像中对应像素的U分量的色彩值和V分量的色彩值,AlphyU0表示像素的U分量对应的第一色彩调整系数,AlphyV0表示像素的V分量对应的第一色彩调整系数,Alphy1表示第二色彩调整系数,A1是Alphy1的量化系数,A2是AlphyU0的量化系数,A3是AlphyV0的量化系数。Among them, U and V respectively represent the color value of the U component and the color value of the V component of the pixel, U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image, and AlphyU0 represents the color value of the pixel The first color adjustment coefficient corresponding to the U component, AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel, Alphy1 represents the second color adjustment coefficient, A1 is the quantization coefficient of Alphy1, A2 is the quantization coefficient of AlphyU0, and A3 is the quantization coefficient of AlphyV0 Quantization coefficient.
基于上述实施例,为了对本申请实施例提供的图像色彩处理方法作进一步了解,如图4所示,以RGB格式的图像为例,介绍一种具体场景的可选实施例。图4实施例中,描述了对待处理图像的任一像素的处理过程,待处理图像包括的多个像素中的每一个像素均可以参照图4所示的方法操作,最终获得待处理图像对应的目标图像。Based on the foregoing embodiment, in order to further understand the image color processing method provided in the embodiment of the present application, as shown in FIG. 4, taking an image in RGB format as an example, an optional embodiment of a specific scene is introduced. In the embodiment of FIG. 4, the processing process of any pixel of the image to be processed is described. Each pixel of the multiple pixels included in the image to be processed can be operated with reference to the method shown in FIG. Target image.
S401,获取待处理图像的像素的3个色彩分量的色彩值R、G、B,以及待处理图像的电信号比值a。S401: Obtain the color values R, G, and B of the three color components of the pixels of the image to be processed, and the electrical signal ratio a of the image to be processed.
其中,电信号比值a可以是待处理图像的各像素在动态范围调整处理后的电信号值与动态范围调整处理前的电信号值之间的电信号比值。Wherein, the electrical signal ratio a may be the electrical signal ratio between the electrical signal value of each pixel of the image to be processed after the dynamic range adjustment processing and the electrical signal value before the dynamic range adjustment processing.
S402,根据色彩值R、G、B计算待处理图像的像素的亮度值Y。S402: Calculate the brightness value Y of the pixels of the image to be processed according to the color values R, G, and B.
例如,可以根据前文所述的公式Y=a 11*R+a 12*G+a 13*B,确定Y。 For example, Y can be determined according to the aforementioned formula Y=a 11 *R+a 12 *G+a 13 *B.
S403,将电信号比值a代入查找表1,得到第二色彩调整系数Alphy1。S403: Substituting the electric signal ratio a into the look-up table 1 to obtain the second color adjustment coefficient Alphy1.
查找表1中色彩调整系数和预设比值的映射关系符合第二幂函数为f(x)=x dThe mapping relationship between the color adjustment coefficient and the preset ratio in the look-up table 1 conforms to the second power function as f(x)=x d .
可选的,若色彩值的比特位宽确定的取值范围包括多个取值范围,每个取值范围对应生成一个查找表,则将电信号比值a代入查找表1之前,还需要判断电信号比值a所在的取值范围,选择与a所在的取值范围对应的查找表。在图4中对该可选的步骤通过虚线框来示意。Optionally, if the value range determined by the bit width of the color value includes multiple value ranges, and each value range corresponds to a look-up table, then before substituting the electrical signal ratio a into the look-up table 1, it is also necessary to determine the electrical For the value range of signal ratio a, select the lookup table corresponding to the value range of a. This optional step is indicated by a dashed frame in FIG. 4.
其中,系数d可以利用图像或图像序列统计信息通过查找表的方式确定。例如,可以根据表2确定系数d。或者,d可以为根据经验选取的固定值,如0.2。Among them, the coefficient d can be determined by means of a look-up table using the statistical information of the image or image sequence. For example, the coefficient d can be determined according to Table 2. Or, d can be a fixed value selected based on experience, such as 0.2.
S404,分别计算亮度值Y与3个色彩分量的色彩值R、G、B的比值:Y/R、Y/G、Y/B。S404: Calculate the ratios of the brightness value Y to the color values R, G, and B of the three color components: Y/R, Y/G, and Y/B.
S405,分别将Y/R、Y/G、Y/B代入查找表2、查找表3和查找表4,得到3个色彩分量分别对应的第一色彩调整系数AlphyR0、AlphyG0、AlphyB0。S405: Substituting Y/R, Y/G, and Y/B into look-up table 2, look-up table 3, and look-up table 4 to obtain first color adjustment coefficients AlphyR0, AlphyG0, and AlphyB0 respectively corresponding to the three color components.
查找表2、查找表3和查找表4中色彩调整系数和预设比值的映射关系符合第一幂函数为该第一幂函数为f(x)=x b。可以理解的是,查找表2、查找表3和查找表4中色彩调整系数和预设比值的映射关系符合的第一幂函数中的指数可以不同。 The mapping relationship between the color adjustment coefficients and the preset ratios in the look-up table 2, the look-up table 3, and the look-up table 4 conforms to the first power function, and the first power function is f(x)=x b . It is understandable that the index in the first power function to which the mapping relationship between the color adjustment coefficient and the preset ratio in the lookup table 2, the lookup table 3, and the lookup table 4 conforms may be different.
其中,指数b可以利用图像或图像序列统计信息通过查找表的方式确定。例如,可以根据表1确定指数b。Wherein, the index b can be determined by means of a look-up table using statistical information of the image or image sequence. For example, the index b can be determined according to Table 1.
需要说明的是,S403与S404和S405的步骤执行顺序不作限定,可以交换顺序,也可以同时进行。It should be noted that the order in which the steps of S403, S404 and S405 are executed is not limited, and the order can be exchanged, or can be carried out at the same time.
可选的,若色彩值的比特位宽确定的取值范围包括多个取值范围,每个取值范围对应生成一个查找表,则将Y/R代入查找表2之前,还需要判断Y/R所在的取值范围,选择与Y/R所在的取值范围对应的查找表。类似地,将Y/G、Y/B代入查找表3和查找表4之前,还需要分别判断Y/G、Y/B代所在的取值范围,选择与Y/G、Y/B所在的取值范围对应的查找表。当然,Y/R、Y/G、Y/B对应的查找表数量可以不一致,例如,Y/R对应多个查找表,Y/G、Y/B分别对应一个查找表。只有当对应多个查找表时,才需要在代入差值表之前与阈值进行比较。另外,Y/R、Y/G或Y/B比较的阈值可以相同也可以不同。在图4中未对该可选步骤进行示意。Optionally, if the value range determined by the bit width of the color value includes multiple value ranges, and a lookup table is generated for each value range, before substituting Y/R into the lookup table 2, it is also necessary to determine Y/ For the value range of R, select the lookup table corresponding to the value range of Y/R. Similarly, before substituting Y/G and Y/B into look-up table 3 and look-up table 4, you need to determine the value range of Y/G and Y/B respectively, and choose the value range where Y/G and Y/B are located. The lookup table corresponding to the value range. Of course, the number of look-up tables corresponding to Y/R, Y/G, and Y/B may be inconsistent. For example, Y/R corresponds to multiple look-up tables, and Y/G and Y/B respectively correspond to one look-up table. Only when there are multiple lookup tables, it is necessary to compare with the threshold before substituting into the difference table. In addition, the thresholds for Y/R, Y/G, or Y/B comparison may be the same or different. This optional step is not illustrated in FIG. 4.
将预设的量化系数A1、A2、A3、A4、Alphy1、AlphyR0、AlphyG0、AlphyB0代入公式(5)进行计算,得到像素的3个色彩通道进行色彩处理后对应的色彩值R’、G’、B’。具体可以通过下述S406~S409实现。Substituting the preset quantization coefficients A1, A2, A3, A4, Alphy1, AlphyR0, AlphyG0, AlphyB0 into formula (5) for calculation, the three color channels of the pixel are color-processed and the corresponding color values R', G', B'. Specifically, it can be implemented through the following S406 to S409.
S406,将Alphy1与AlphyR0、AlphyG0、AlphyB0分别相乘,得到3个乘积BetaR、BetaG和BetaB。S406: Multiply Alphy1 with AlphyR0, AlphyG0, and AlphyB0 respectively to obtain three products BetaR, BetaG, and BetaB.
S407,将BetaR、BetaG、BetaB分别与(R-Y)、(G-Y)和(B-Y)相乘,得到(R-Y)’、(G-Y)’和(B-Y)’。S407: Multiply BetaR, BetaG, and BetaB by (R-Y), (G-Y), and (B-Y), respectively, to obtain (R-Y)', (G-Y)', and (B-Y)'.
S408,采用A1和A2对(R-Y)’进行除法或位移运算,采用A1和A3对(G-Y)’进行除法或位移运算,采用A1和A4对(B-Y)’进行除法或位移运算,分别得到(R-Y)”、(G-Y)”和(B-Y)”。S408, use A1 and A2 to divide or shift (RY)', use A1 and A3 to divide or shift (GY)', and use A1 and A4 to divide or shift (BY)' to obtain ( RY)”, (GY)” and (BY)”.
其中,位移运算是指将指数向左进行位移,例如A为2 R1,Z为2 R2,使用A对一个数值Z进行位移运算,即对A左移R1位,运算结果为2 R2-R1。位移运算与除法运算的运算结果相同。 Among them, the shift operation refers to shifting the exponent to the left. For example, A is 2 R1 , Z is 2 R2 , and A is used to shift a value Z, that is, shift A to the left by R1 bits, and the result of the operation is 2 R2-R1 . The result of the shift operation is the same as that of the division operation.
S409,将Y分别与(R-Y)”、(G-Y)”和(B-Y)”进行加法运算,得到R’、G’、B’。S409: Add Y with (R-Y)", (G-Y)" and (B-Y)" respectively to obtain R', G', and B'.
需要说明的是,本申请中的各个应用场景中的举例仅仅表现了一些可能的实现方式,是为了对本申请的方法更好的理解和说明。本领域技术人员可以根据申请提供的图像色彩处理方法,得到一些演变形式的举例。It should be noted that the examples in each application scenario in this application only show some possible implementation manners, which are for a better understanding and description of the method of this application. Those skilled in the art can obtain some examples of evolution forms according to the image color processing method provided in the application.
为了实现上述本申请实施例提供的方法中的各功能,终端设备可以包括硬件结构和/或软件模块,以硬件结构、软件模块、或硬件结构加软件模块的形式来实现上述各功能。上述各功能中的某个功能以硬件结构、软件模块、还是硬件结构加软件模块的方式来执行,取决于技术方案的特定应用和设计约束条件。In order to implement the functions in the methods provided in the above embodiments of the present application, the terminal device may include a hardware structure and/or a software module, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether a certain function among the above-mentioned functions is executed by a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraint conditions of the technical solution.
基于同一技术构思,如图5所示,本申请实施例还提供了一种图像色彩处理装置500, 该图像色彩处理装置500可以是移动终端或任意具有图像处理功能的设备。一种设计中,该图像色彩处理装置500可以包括执行上述方法实施例中各方法/操作/步骤/动作所一一对应的模块,该模块可以是硬件电路,也可是软件,也可以是硬件电路结合软件实现。一种设计中,该图像色彩处理装置500可以包括确定模块501和处理模块502。硬件电路称为硬件(hardware)或者c管线(cpipe)。Based on the same technical concept, as shown in FIG. 5, an embodiment of the present application further provides an image color processing apparatus 500, which may be a mobile terminal or any device with an image processing function. In one design, the image color processing device 500 may include modules that perform one-to-one correspondence of the methods/operations/steps/actions in the foregoing method embodiments. The modules may be hardware circuits, software, or hardware circuits. Combined with software implementation. In one design, the image color processing device 500 may include a determining module 501 and a processing module 502. The hardware circuit is called hardware (hardware) or c pipe (cpipe).
确定模块501用于确定待处理图像的像素的多个色彩分量的色彩值;确定所述像素的亮度值分别与所述多个色彩分量的色彩值的比值;根据所述比值和第一查找表,确定所述像素的第一色彩调整系数。处理模块502,用于根据所述第一色彩调整系数,对所述像素进行色彩处理,以得到目标图像。此时,确定模块501和处理模块502可以是硬件电路。The determining module 501 is used to determine the color values of the multiple color components of the pixels of the image to be processed; determine the ratio of the brightness value of the pixel to the color values of the multiple color components, respectively; according to the ratio and the first look-up table , Determining the first color adjustment coefficient of the pixel. The processing module 502 is configured to perform color processing on the pixels according to the first color adjustment coefficient to obtain a target image. At this time, the determining module 501 and the processing module 502 may be hardware circuits.
可选的,在根据所述比值和第一查找表,确定所述像素的第一色彩调整系数时,所述确定模块501具体用于:当所述预设比值包括所述比值时:根据所述映射关系,确定所述比值对应的第一色彩调整系数;当所述预设比值不包括所述比值时:在所述第一查找表中确定第一预设比值和第二预设比值;根据所述映射关系,分别确定所述第一预设比值和所述第二预设比值对应的第一系数和第二系数;对所述第一系数和所述第二系数进行插值运算,以得到所述比值对应的第一色彩调整系数。确定模块501可以是硬件电路。Optionally, when determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table, the determining module 501 is specifically configured to: when the preset ratio includes the ratio: The mapping relationship, determine the first color adjustment coefficient corresponding to the ratio; when the preset ratio does not include the ratio: determine the first preset ratio and the second preset ratio in the first look-up table; According to the mapping relationship, the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio are respectively determined; an interpolation operation is performed on the first coefficient and the second coefficient to The first color adjustment coefficient corresponding to the ratio is obtained. The determination module 501 may be a hardware circuit.
可选的,所述第一查表值为定点数值;在确定第一查找表的第一表项数值时,确定模块501具体用于:根据由所述色彩值的比特位宽确定的取值范围的最大值,对所述定点数值进行反量化,以得到浮点数值;确定所述浮点数值基于所述第一幂函数的函数值;根据预设的量化系数,对所述函数值进行量化,以得到所述第一查找表的第一表项数值。这里确定模块501可以是软件。Optionally, the first look-up table value is a fixed-point value; when determining the first entry value of the first look-up table, the determining module 501 is specifically configured to: according to the value determined by the bit width of the color value The maximum value of the range, dequantize the fixed-point value to obtain a floating-point value; determine that the floating-point value is based on the function value of the first power function; perform the function value on the preset quantization coefficient Quantify to obtain the value of the first entry of the first look-up table. Here, the determining module 501 may be software.
可选的,所述确定模块501还用于:确定所述比值所在的第一取值范围对应的所述第一查找表;其中,由所述色彩值的比特位宽确定的取值范围包括所述第一取值范围和第二查找表对应的第二取值范围。确定模块501可以是硬件电路。Optionally, the determining module 501 is further configured to determine the first look-up table corresponding to the first value range where the ratio is located; wherein the value range determined by the bit width of the color value includes The first value range and the second value range corresponding to the second lookup table. The determination module 501 may be a hardware circuit.
确定模块501和处理模块502还可以用于执行上述方法实施例的其它对应的步骤或操作,在此不再一一赘述。The determining module 501 and the processing module 502 may also be used to perform other corresponding steps or operations in the foregoing method embodiments, which will not be repeated here.
本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,另外,在本申请各个实施例中的各功能模块可以集成在一个处理器中,也可以是单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。The division of modules in the embodiments of this application is illustrative, and it is only a logical function division. In actual implementation, there may be other division methods. In addition, the functional modules in the various embodiments of this application can be integrated into one process. In the device, it can also exist alone physically, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
基于同一技术构思,如图6所示,本申请实施例还提供一种图像色彩处理装置600。该图像色彩处理装置600包括处理器601。该处理器601用于调用一组程序,以使得上述方法实施例被执行。该图像色彩处理装置600还包括存储器602,存储器602用于存储处理器601执行的程序指令和/或数据。存储器602和处理器601耦合。本申请实施例中的耦合是装置、单元或模块之间的间接耦合或通信连接,可以是电性,机械或其它的形式,用于装置、单元或模块之间的信息交互。处理器601可能和存储器602协同操作。处理器601可能执行存储器602中存储的程序指令。存储器602可以包括于处理器601中。Based on the same technical concept, as shown in FIG. 6, an embodiment of the present application also provides an image color processing apparatus 600. The image color processing device 600 includes a processor 601. The processor 601 is used to call a group of programs, so that the foregoing method embodiments are executed. The image color processing device 600 further includes a memory 602, and the memory 602 is configured to store program instructions and/or data executed by the processor 601. The memory 602 and the processor 601 are coupled. The coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units or modules, and may be in electrical, mechanical or other forms, and is used for information exchange between devices, units or modules. The processor 601 may operate in cooperation with the memory 602. The processor 601 may execute program instructions stored in the memory 602. The memory 602 may be included in the processor 601.
该图像色彩处理装置600可以为芯片系统。本申请实施例中,芯片系统可以由芯片构成,也可以包含芯片和其他分立器件。例如,芯片系统为专用集成电路(application specific integrated circuit,ASIC)芯片片,图像色彩处理装置600的硬件部分为ASIC芯仿真的c模型(cmode),上述cmode可以和ASIC芯片效果达到比特位一致。The image color processing device 600 may be a chip system. In the embodiments of the present application, the chip system may be composed of chips, or may include chips and other discrete devices. For example, the chip system is an application specific integrated circuit (ASIC) chip, and the hardware part of the image color processing device 600 is a c-model (cmode) emulated by an ASIC core, and the above-mentioned cmode can achieve bit consistency with the ASIC chip.
处理器601用于将待处理图像输入第一神经网络进行运算,以获得第一图像,第一图像为待处理图像的经第一神经网络处理后的第一分量图像;以及用于将第一图像和待处理图像进行向量拼接(concatenate),以获得第一待处理图像矩阵;以及用于将第一待处理图像矩阵输入第二神经网络进行运算,以获得第二图像,第二图像为待处理图像的经第二神经网络处理后的第二分量图像;基于第二图像,获得处理后的图像。The processor 601 is configured to input the image to be processed into the first neural network for calculation to obtain a first image, the first image being a first component image of the image to be processed that has been processed by the first neural network; The image and the image to be processed are vector concatenated (concatenate) to obtain a first image matrix to be processed; The second component image of the processed image processed by the second neural network; based on the second image, the processed image is obtained.
处理器601还可以用于执行上述方法实施例其它对应的步骤或操作,在此不再一一赘述。The processor 601 may also be used to execute other corresponding steps or operations in the foregoing method embodiments, which will not be repeated here.
处理器601可以是通用处理器、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。The processor 601 may be a general-purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and may implement or execute the The disclosed methods, steps and logic block diagrams. The general-purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in combination with the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
存储器602可以是非易失性存储器,比如硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)等,还可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM)。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。The memory 602 may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., and may also be a volatile memory, such as random access memory (random access memory). -access memory, RAM). The memory is any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this. The memory in the embodiments of the present application may also be a circuit or any other device capable of realizing a storage function for storing program instructions and/or data.
本申请上述方法实施例所描述的各个操作和功能中的部分或全部,可以用芯片或集成电路来完成。Part or all of the various operations and functions described in the foregoing method embodiments of the present application may be completed by chips or integrated circuits.
本申请实施例还提供一种芯片,包括处理器,用于支持该图像色彩处理装置实现上述方法实施例所涉及的功能。在一种可能的设计中,该芯片与存储器连接或者该芯片包括存储器,该存储器用于保存该通信装置必要的程序指令和数据。The embodiment of the present application also provides a chip including a processor, which is used to support the image color processing device to implement the functions involved in the foregoing method embodiments. In a possible design, the chip is connected to a memory or the chip includes a memory, and the memory is used to store the necessary program instructions and data of the communication device.
本申请实施例提供了一种计算机可读存储介质,存储有计算机程序,该计算机程序包括用于执行上述方法实施例的指令。The embodiment of the present application provides a computer-readable storage medium that stores a computer program, and the computer program includes instructions for executing the foregoing method embodiments.
本申请实施例提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述方法实施例。The embodiments of the present application provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the foregoing method embodiments.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。This application is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of this application. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are used to generate It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方 式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
显然,本领域的技术人员可以对本申请实施例进行各种改动和变型而不脱离本申请实施例的精神和范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. In this way, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.

Claims (33)

  1. 一种图像色彩处理方法,其特征在于,包括:An image color processing method, characterized in that it comprises:
    确定待处理图像的像素的多个色彩分量的色彩值;Determine the color values of multiple color components of the pixels of the image to be processed;
    确定所述像素的亮度值分别与所述多个色彩分量的色彩值的比值;Determining the ratio of the brightness value of the pixel to the color value of the multiple color components;
    根据所述比值和第一查找表,确定所述像素的第一色彩调整系数;Determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table;
    根据所述第一色彩调整系数,对所述像素进行色彩处理,以得到目标图像。According to the first color adjustment coefficient, color processing is performed on the pixels to obtain a target image.
  2. 如权利要求1所述的方法,其特征在于,所述第一查找表包括色彩调整系数和预设比值的映射关系。8. The method of claim 1, wherein the first look-up table includes a mapping relationship between a color adjustment coefficient and a preset ratio.
  3. 如权利要求2所述的方法,其特征在于,所述根据所述比值和第一查找表,确定所述像素的第一色彩调整系数,包括:The method of claim 2, wherein the determining the first color adjustment coefficient of the pixel according to the ratio and a first look-up table comprises:
    当所述预设比值包括所述比值时:根据所述映射关系,确定所述比值对应的第一色彩调整系数;When the preset ratio includes the ratio: determine the first color adjustment coefficient corresponding to the ratio according to the mapping relationship;
    当所述预设比值不包括所述比值时:When the preset ratio does not include the ratio:
    在所述第一查找表中确定第一预设比值和第二预设比值;Determining a first preset ratio and a second preset ratio in the first look-up table;
    根据所述映射关系,分别确定所述第一预设比值和所述第二预设比值对应的第一系数和第二系数;Determine the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio respectively according to the mapping relationship;
    对所述第一系数和所述第二系数进行插值运算,以得到所述比值对应的第一色彩调整系数。Perform an interpolation operation on the first coefficient and the second coefficient to obtain a first color adjustment coefficient corresponding to the ratio.
  4. 如权利要求3所述的方法,其特征在于,所述插值运算包括以下任一类型的运算:线性插值、近插值、双线性二次插值、三次插值或Lanczos插值。The method of claim 3, wherein the interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.
  5. 如权利要求1~4任一项所述的方法,其特征在于,所述第一查找表的第一表项数值和第一查表值之间的映射关系满足第一幂函数。The method according to any one of claims 1 to 4, wherein the mapping relationship between the first entry value of the first lookup table and the first lookup table value satisfies a first power function.
  6. 如权利要求1~5任一项所述的方法,其特征在于,所述第一查表值为定点数值;The method according to any one of claims 1 to 5, wherein the first look-up table value is a fixed-point value;
    所述第一查找表的第一表项数值的确定,包括:The determination of the value of the first entry of the first look-up table includes:
    根据由所述色彩值的比特位宽确定的取值范围的最大值,对所述定点数值进行反量化,以得到浮点数值;Performing inverse quantization on the fixed-point value according to the maximum value of the value range determined by the bit width of the color value to obtain a floating-point value;
    确定所述浮点数值基于所述第一幂函数的函数值;Determining that the floating-point value is based on the function value of the first power function;
    根据预设的量化系数,对所述函数值进行量化,以得到所述第一查找表的第一表项数值。According to the preset quantization coefficient, the function value is quantized to obtain the first entry value of the first look-up table.
  7. 如权利要求5或6所述的方法,其特征在于,所述第一查表值基于所述第一查找表的索引值和所述第一查找表的索引值间的步长确定。The method according to claim 5 or 6, wherein the first look-up table value is determined based on the step size between the index value of the first look-up table and the index value of the first look-up table.
  8. 如权利要求1~7任一项所述的方法,其特征在于,所述方法还包括:确定所述比值所在的第一取值范围对应的所述第一查找表;8. The method according to any one of claims 1 to 7, wherein the method further comprises: determining the first lookup table corresponding to the first value range in which the ratio is located;
    其中,由所述色彩值的比特位宽确定的取值范围包括所述第一取值范围和第二查找表对应的第二取值范围。Wherein, the value range determined by the bit width of the color value includes the first value range and the second value range corresponding to the second look-up table.
  9. 如权利要求8所述的方法,其特征在于,所述第二查找表的第二表项数值和第二查表值之间的映射关系满足所述第一幂函数。The method according to claim 8, wherein the mapping relationship between the second table entry value and the second table look-up value of the second look-up table satisfies the first power function.
  10. 如权利要求8或9所述的方法,其特征在于,所述第一取值范围的最小值大于所述第二取值范围的最大值;The method according to claim 8 or 9, wherein the minimum value of the first value range is greater than the maximum value of the second value range;
    对应的,所述第一查找表的第一查表值基于所述第一查找表的索引值、所述第一查找表的索引值间的步长和所述第二取值范围的最大值确定。Correspondingly, the first lookup value of the first lookup table is based on the index value of the first lookup table, the step size between the index values of the first lookup table, and the maximum value of the second value range Sure.
  11. 如权利要求8~10任一项所述的方法,其特征在于,所述第一查找表的索引值间的步长和所述第二查找表的索引值间的步长不同。The method according to any one of claims 8 to 10, wherein the step size between the index values of the first look-up table and the step size between the index values of the second look-up table are different.
  12. 如权利要求1~11任一项所述的方法,其特征在于,所述根据所述第一色彩调整系数,对所述像素进行色彩处理,包括:The method according to any one of claims 1 to 11, wherein the performing color processing on the pixel according to the first color adjustment coefficient comprises:
    确定所述像素的第二色彩调整系数;Determining the second color adjustment coefficient of the pixel;
    将所述第一色彩调整系数与所述第二色彩调整系数相乘;Multiplying the first color adjustment coefficient and the second color adjustment coefficient;
    根据所述相乘的乘积,对所述像素进行色彩处理。According to the product of the multiplication, color processing is performed on the pixel.
  13. 如权利要求12所述的方法,其特征在于,所述待处理图像是经过动态范围调整处理的图像;The method according to claim 12, wherein the image to be processed is an image processed by dynamic range adjustment;
    所述确定所述像素的第二色彩调整系数,包括:The determining the second color adjustment coefficient of the pixel includes:
    确定所述像素在所述动态范围调整处理之后和在所述动态范围调整处理之前的电信号比值;Determining the ratio of the electrical signal of the pixel after the dynamic range adjustment process and before the dynamic range adjustment process;
    根据所述电信号比值,确定所述第二色彩调整系数。The second color adjustment coefficient is determined according to the ratio of the electrical signals.
  14. 如权利要求13所述的方法,其特征在于,通过查表确定所述电信号比值对应的所述第二色彩调整系数。The method of claim 13, wherein the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table.
  15. 如权利要求12~14任一项所述的方法,其特征在于,所述多个色彩分量包括RGB空间中的R分量、G分量、B分量,所述目标图像根据以下公式获得:The method according to any one of claims 12 to 14, wherein the multiple color components include R, G, and B components in RGB space, and the target image is obtained according to the following formula:
    Figure PCTCN2020088476-appb-100001
    Figure PCTCN2020088476-appb-100001
    其中,R、G、B分别表示所述像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,R'、G'、B'分别表示所述目标图像中对应像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,Y表示所述像素的亮度值,AlphyR0表示所述像素的R分量对应的第一色彩调整系数,AlphyG0表示所述像素的G分量对应的第一色彩调整系数,AlphyB0表示所述像素的B分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyR0的量化系数,A3是所述AlphyG0的量化系数,A4是所述AlphyB0的量化系数。Wherein, R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the pixel, and R', G', and B'respectively represent the R of the corresponding pixel in the target image. The color value of the component, the color value of the G component, and the color value of the B component, Y represents the brightness value of the pixel, AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel, and AlphyG0 represents the G component of the pixel The corresponding first color adjustment coefficient, AlphyB0 represents the first color adjustment coefficient corresponding to the B component of the pixel, Alphy1 represents the second color adjustment coefficient, A1 is the quantization coefficient of Alphy1, and A2 is the quantization coefficient of AlphyR0 Coefficient, A3 is the quantized coefficient of AlphyG0, and A4 is the quantized coefficient of AlphyB0.
  16. 如权利要求12~14任一项所述的方法,其特征在于,所述多个色彩分量包括YUV空间中的U分量、V分量,所述目标图像根据以下公式获得:The method according to any one of claims 12 to 14, wherein the multiple color components include U and V components in YUV space, and the target image is obtained according to the following formula:
    Figure PCTCN2020088476-appb-100002
    Figure PCTCN2020088476-appb-100002
    其中,U、V分别表示所述像素的U分量的色彩值和V分量的色彩值,U′、V′分别表示所述目标图像中对应像素的U分量的色彩值和V分量的色彩值,AlphyU0表示所述像素的U分量对应的第一色彩调整系数,AlphyV0表示所述像素的V分量对应的第一色彩调整 系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyU0的量化系数,A3是所述AlphyV0的量化系数。Wherein, U and V respectively represent the color value of the U component and the color value of the V component of the pixel, U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image, AlphyU0 represents the first color adjustment coefficient corresponding to the U component of the pixel, AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel, Alphy1 represents the second color adjustment coefficient, and A1 is the quantization coefficient of the Alphy1 , A2 is the quantized coefficient of AlphyU0, and A3 is the quantized coefficient of AlphyV0.
  17. 一种图像色彩处理装置,其特征在于,包括:An image color processing device, characterized in that it comprises:
    确定模块,用于确定待处理图像的像素的多个色彩分量的色彩值;确定所述像素的亮度值分别与所述多个色彩分量的色彩值的比值;根据所述比值和第一查找表,确定所述像素的第一色彩调整系数;The determining module is used to determine the color values of the multiple color components of the pixels of the image to be processed; determine the ratios of the brightness values of the pixels to the color values of the multiple color components respectively; according to the ratios and the first look-up table , Determining the first color adjustment coefficient of the pixel;
    处理模块,用于根据所述第一色彩调整系数,对所述像素进行色彩处理,以得到目标图像。The processing module is configured to perform color processing on the pixels according to the first color adjustment coefficient to obtain a target image.
  18. 如权利要求17所述的装置,其特征在于,所述第一查找表包括色彩调整系数和预设比值的映射关系。18. The device of claim 17, wherein the first look-up table includes a mapping relationship between a color adjustment coefficient and a preset ratio.
  19. 如权利要求18所述的装置,其特征在于,在根据所述比值和第一查找表,确定所述像素的第一色彩调整系数时,所述确定模块具体用于:The device of claim 18, wherein when determining the first color adjustment coefficient of the pixel according to the ratio and the first look-up table, the determining module is specifically configured to:
    当所述预设比值包括所述比值时:根据所述映射关系,确定所述比值对应的第一色彩调整系数;When the preset ratio includes the ratio: determine the first color adjustment coefficient corresponding to the ratio according to the mapping relationship;
    当所述预设比值不包括所述比值时:When the preset ratio does not include the ratio:
    在所述第一查找表中确定第一预设比值和第二预设比值;Determining a first preset ratio and a second preset ratio in the first look-up table;
    根据所述映射关系,分别确定所述第一预设比值和所述第二预设比值对应的第一系数和第二系数;Determine the first coefficient and the second coefficient corresponding to the first preset ratio and the second preset ratio respectively according to the mapping relationship;
    对所述第一系数和所述第二系数进行插值运算,以得到所述比值对应的第一色彩调整系数。Perform an interpolation operation on the first coefficient and the second coefficient to obtain a first color adjustment coefficient corresponding to the ratio.
  20. 如权利要求19所述的装置,其特征在于,所述插值运算包括以下任一类型的运算:线性插值、近插值、双线性二次插值、三次插值或Lanczos插值。The apparatus of claim 19, wherein the interpolation operation comprises any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.
  21. 如权利要求17~20任一项所述的装置,其特征在于,所述第一查找表的第一表项数值和第一查表值之间的映射关系满足第一幂函数。22. The device according to any one of claims 17 to 20, wherein the mapping relationship between the first table entry value and the first lookup table value of the first lookup table satisfies a first power function.
  22. 如权利要求17~21任一项所述的装置,其特征在于,所述第一查表值为定点数值;The device according to any one of claims 17 to 21, wherein the first look-up table value is a fixed-point value;
    所述确定模块,具体用于:The determining module is specifically used for:
    根据由所述色彩值的比特位宽确定的取值范围的最大值,对所述定点数值进行反量化,以得到浮点数值;Performing inverse quantization on the fixed-point value according to the maximum value of the value range determined by the bit width of the color value to obtain a floating-point value;
    确定所述浮点数值基于所述第一幂函数的函数值;Determining that the floating-point value is based on the function value of the first power function;
    根据预设的量化系数,对所述函数值进行量化,以得到所述第一查找表的第一表项数值。According to the preset quantization coefficient, the function value is quantized to obtain the first entry value of the first look-up table.
  23. 如权利要求21或22所述的装置,其特征在于,所述第一查表值基于所述第一查找表的索引值和所述第一查找表的索引值间的步长确定。The device according to claim 21 or 22, wherein the first look-up table value is determined based on the step size between the index value of the first look-up table and the index value of the first look-up table.
  24. 如权利要求17~23任一项所述的装置,其特征在于,所述确定模块还用于:确定所述比值所在的第一取值范围对应的所述第一查找表;The device according to any one of claims 17 to 23, wherein the determining module is further configured to: determine the first lookup table corresponding to the first value range in which the ratio is located;
    其中,由所述色彩值的比特位宽确定的取值范围包括所述第一取值范围和第二查找表对应的第二取值范围。Wherein, the value range determined by the bit width of the color value includes the first value range and the second value range corresponding to the second look-up table.
  25. 如权利要求24所述的装置,其特征在于,所述第二查找表的第二表项数值和第二查表值之间的映射关系满足所述第一幂函数。The device according to claim 24, wherein the mapping relationship between the second table entry value and the second lookup table value of the second lookup table satisfies the first power function.
  26. 如权利要求24或25所述的装置,其特征在于,所述第一取值范围的最小值大于 所述第二取值范围的最大值;The device according to claim 24 or 25, wherein the minimum value of the first value range is greater than the maximum value of the second value range;
    对应的,所述第一查找表的第一查表值基于所述第一查找表的索引值、所述第一查找表的索引值间的步长和所述第二取值范围的最大值确定。Correspondingly, the first lookup value of the first lookup table is based on the index value of the first lookup table, the step size between the index values of the first lookup table, and the maximum value of the second value range Sure.
  27. 如权利要求24~26任一项所述的装置,其特征在于,所述第一查找表的索引值间的步长和所述第二查找表的索引值间的步长不同。The device according to any one of claims 24 to 26, wherein the step size between the index values of the first look-up table and the step size between the index values of the second look-up table are different.
  28. 如权利要求17~27任一项所述的装置,其特征在于,在根据所述第一色彩调整系数,对所述像素进行色彩处理时,所述处理模块具体用于:The device according to any one of claims 17 to 27, wherein when performing color processing on the pixel according to the first color adjustment coefficient, the processing module is specifically configured to:
    确定所述像素的第二色彩调整系数;Determining the second color adjustment coefficient of the pixel;
    将所述第一色彩调整系数与所述第二色彩调整系数相乘;Multiplying the first color adjustment coefficient and the second color adjustment coefficient;
    根据所述相乘的乘积,对所述像素进行色彩处理。According to the product of the multiplication, color processing is performed on the pixel.
  29. 如权利要求28所述的装置,其特征在于,所述待处理图像是经过动态范围调整处理的图像;The device according to claim 28, wherein the image to be processed is an image processed by dynamic range adjustment;
    在确定所述像素的第二色彩调整系数时,所述确定模块具体用于:When determining the second color adjustment coefficient of the pixel, the determining module is specifically configured to:
    确定所述像素在所述动态范围调整处理之后和在所述动态范围调整处理之前的电信号比值;Determining the ratio of the electrical signal of the pixel after the dynamic range adjustment process and before the dynamic range adjustment process;
    根据所述电信号比值,确定所述第二色彩调整系数。The second color adjustment coefficient is determined according to the ratio of the electrical signals.
  30. 如权利要求29所述的装置,其特征在于,通过查表确定所述电信号比值对应的所述第二色彩调整系数。The device of claim 29, wherein the second color adjustment coefficient corresponding to the electrical signal ratio is determined by looking up a table.
  31. 如权利要求28~30任一项所述的装置,其特征在于,所述多个色彩分量包括RGB空间中的R分量、G分量、B分量,所述目标图像根据以下公式获得:The device according to any one of claims 28 to 30, wherein the multiple color components include R, G, and B components in RGB space, and the target image is obtained according to the following formula:
    Figure PCTCN2020088476-appb-100003
    Figure PCTCN2020088476-appb-100003
    其中,R、G、B分别表示所述像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,R'、G'、B'分别表示所述目标图像中对应像素的R分量的色彩值、G分量的色彩值和B分量的色彩值,Y表示所述像素的亮度值,AlphyR0表示所述像素的R分量对应的第一色彩调整系数,AlphyG0表示所述像素的G分量对应的第一色彩调整系数,AlphyB0表示所述像素的B分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyR0的量化系数,A3是所述AlphyG0的量化系数,A4是所述AlphyB0的量化系数。Wherein, R, G, and B respectively represent the color value of the R component, the color value of the G component and the color value of the B component of the pixel, and R', G', and B'respectively represent the R of the corresponding pixel in the target image. The color value of the component, the color value of the G component, and the color value of the B component, Y represents the brightness value of the pixel, AlphyR0 represents the first color adjustment coefficient corresponding to the R component of the pixel, and AlphyG0 represents the G component of the pixel The corresponding first color adjustment coefficient, AlphyB0 represents the first color adjustment coefficient corresponding to the B component of the pixel, Alphy1 represents the second color adjustment coefficient, A1 is the quantization coefficient of Alphy1, and A2 is the quantization coefficient of AlphyR0 Coefficient, A3 is the quantized coefficient of AlphyG0, and A4 is the quantized coefficient of AlphyB0.
  32. 如权利要求28~30任一项所述的装置,其特征在于,所述多个色彩分量包括YUV空间中的U分量、V分量,所述目标图像根据以下公式获得:The device according to any one of claims 28 to 30, wherein the multiple color components include U and V components in YUV space, and the target image is obtained according to the following formula:
    Figure PCTCN2020088476-appb-100004
    Figure PCTCN2020088476-appb-100004
    其中,U、V分别表示所述像素的U分量的色彩值和V分量的色彩值,U′、V′分别表示所述目标图像中对应像素的U分量的色彩值和V分量的色彩值,AlphyU0表示所述像素 的U分量对应的第一色彩调整系数,AlphyV0表示所述像素的V分量对应的第一色彩调整系数,Alphy1表示所述第二色彩调整系数,A1是所述Alphy1的量化系数,A2是所述AlphyU0的量化系数,A3是所述AlphyV0的量化系数。Wherein, U and V respectively represent the color value of the U component and the color value of the V component of the pixel, U′, V′ respectively represent the color value of the U component and the color value of the V component of the corresponding pixel in the target image, AlphyU0 represents the first color adjustment coefficient corresponding to the U component of the pixel, AlphyV0 represents the first color adjustment coefficient corresponding to the V component of the pixel, Alphy1 represents the second color adjustment coefficient, and A1 is the quantization coefficient of the Alphy1 , A2 is the quantized coefficient of AlphyU0, and A3 is the quantized coefficient of AlphyV0.
  33. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机可读指令,当所述计算机可读指令在基于神经网络的图像处理装置上运行时,使得所述装置执行权利要求1-16任一项所述的方法。A computer-readable storage medium is characterized in that computer-readable instructions are stored in the computer-readable storage medium, and when the computer-readable instructions run on a neural network-based image processing device, the device Perform the method of any one of claims 1-16.
PCT/CN2020/088476 2020-04-30 2020-04-30 Image color processing method and apparatus WO2021217647A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/088476 WO2021217647A1 (en) 2020-04-30 2020-04-30 Image color processing method and apparatus
CN202080096708.5A CN115088253A (en) 2020-04-30 2020-04-30 Image color processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/088476 WO2021217647A1 (en) 2020-04-30 2020-04-30 Image color processing method and apparatus

Publications (1)

Publication Number Publication Date
WO2021217647A1 true WO2021217647A1 (en) 2021-11-04

Family

ID=78373136

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/088476 WO2021217647A1 (en) 2020-04-30 2020-04-30 Image color processing method and apparatus

Country Status (2)

Country Link
CN (1) CN115088253A (en)
WO (1) WO2021217647A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110078A (en) * 2009-12-23 2011-06-29 富士通株式会社 Method and system for acquiring approximate operation result of power function X<p>
US9207910B2 (en) * 2009-01-30 2015-12-08 Intel Corporation Digital signal processor having instruction set with an xK function using reduced look-up table
WO2018035691A1 (en) * 2016-08-22 2018-03-01 华为技术有限公司 Image processing method and apparatus
CN108090879A (en) * 2017-12-12 2018-05-29 上海顺久电子科技有限公司 The method and display device that a kind of high dynamic range images to input are handled
CN110473502A (en) * 2018-05-09 2019-11-19 华为技术有限公司 Control method, device and the terminal device of screen intensity

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9207910B2 (en) * 2009-01-30 2015-12-08 Intel Corporation Digital signal processor having instruction set with an xK function using reduced look-up table
CN102110078A (en) * 2009-12-23 2011-06-29 富士通株式会社 Method and system for acquiring approximate operation result of power function X<p>
WO2018035691A1 (en) * 2016-08-22 2018-03-01 华为技术有限公司 Image processing method and apparatus
CN108090879A (en) * 2017-12-12 2018-05-29 上海顺久电子科技有限公司 The method and display device that a kind of high dynamic range images to input are handled
CN110473502A (en) * 2018-05-09 2019-11-19 华为技术有限公司 Control method, device and the terminal device of screen intensity

Also Published As

Publication number Publication date
CN115088253A (en) 2022-09-20

Similar Documents

Publication Publication Date Title
US10574936B2 (en) System and method of luminance processing in high dynamic range and standard dynamic range conversion
TWI536847B (en) Method and apparatus for adjusting the color gamut of a color image
CN107038715B (en) Image processing method and device
US7081899B2 (en) Image processing support system, image processing device and image display device
US9224365B2 (en) Method and apparatus for reducing interference and mobile terminal
US8416254B2 (en) Apparatus and method for providing enhanced visibility in mobile terminal
WO2022100048A1 (en) Image processing method and apparatus, electronic device, and readable storage medium
CN105447819B (en) Image processing method and device
CN107564493B (en) Color gamut compression method and device and display equipment
CN107784993B (en) Color gamut compression method and device and display equipment
US20210006686A1 (en) Color Gamut Mapping Method and Apparatus
EP3873091A1 (en) Color gamut matching method and apparatus, display terminal and readable storage medium
WO2018035696A1 (en) Image processing method and device
WO2020216085A1 (en) Tetrahedral interpolation calculation method and apparatus, gamut conversion method and apparatus, and medium
US20130222411A1 (en) Extended range color space
WO2021217647A1 (en) Image color processing method and apparatus
JP2017515373A (en) Clustering and encoding for color compression
WO2021226769A1 (en) Image processing method and apparatus
CN116843566A (en) Tone mapping method, tone mapping device, display device and storage medium
CN101304467A (en) Color processing apparatus and method
CN104640186A (en) Method and device for reducing power consumption of mobile terminal
US20210297558A1 (en) Cubiform method
CN104754313A (en) Image collecting method and electronic device
WO2020000255A1 (en) Rgb data color adjustment method
US8630488B2 (en) Creating a duotone color effect using an ICC profile

Legal Events

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

Ref document number: 20933213

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20933213

Country of ref document: EP

Kind code of ref document: A1