An image processing method and apparatus

CN115428007BActive Publication Date: 2026-08-11HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-09
Publication Date
2026-08-11

Smart Images

  • Figure CN115428007B_ABST
    Figure CN115428007B_ABST
Patent Text Reader

Abstract

This application provides an image processing method and apparatus. The method includes: determining the maximum value among the primary color values ​​of multiple components of a pixel in an image to be processed; determining a ratio that has a mapping relationship with the maximum value according to a first lookup table, wherein the first lookup table includes a mapping relationship between a preset ratio and preset primary color values; dynamically adjusting the primary color values ​​of the multiple components of the pixel according to the determined ratio to obtain a target image; wherein determining the mapping relationship includes: obtaining a conversion value of the preset primary color value according to a first conversion function; and using the ratio of the conversion value to the preset primary color value as the preset ratio. Each step can be implemented through the hardware circuit of a terminal device, enabling the processing of integer data, thereby implementing the image processing flow in the hardware circuit and improving the practical application possibility of the image color processing method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image processing method and apparatus. Background Technology

[0002] Optical digital imaging converts the light radiation from a real scene into electrical signals using an image sensor, and saves this as a digital image. The purpose of image display is to reproduce the real scene described in the digital image using a display device, thereby giving the user the same visual perception as if they were directly observing the real scene.

[0003] Dynamic range is the ratio of the brightness of the brightest and darkest objects in a scene; in other words, it's the number of gray levels an image can represent from its brightest to its darkest. A larger dynamic range allows for a richer range of colors and encompasses a wider color space. When the dynamic range of an image does not match the dynamic range supported by the display device, it needs to be adjusted. How to adjust the dynamic range is a problem that needs to be solved. Summary of the Invention

[0004] This application provides an image processing method and apparatus for dynamically adjusting the image range and improving image quality.

[0005] Firstly, an image processing method is provided. The method can be executed by a terminal device. Specifically, the method includes the following steps: determining the maximum value among the primary color values ​​of multiple components of a pixel in an image to be processed; determining a ratio that has a mapping relationship with the maximum value according to a first lookup table, wherein the first lookup table includes a mapping relationship between a preset ratio and preset primary color values; and dynamically adjusting the primary color values ​​of the multiple components of the pixel according to the determined ratio to obtain a target image. The determination of the mapping relationship can be achieved by the following steps: obtaining a conversion value of the preset primary color value according to a first conversion function; and using the ratio of the conversion value to the preset primary color value as the preset ratio. During image conversion, a preset conversion curve or a first conversion function is used to achieve image conversion, making images with different dynamic ranges more compatible with display devices with different display capabilities. For example, it can achieve compatible display of images on SDR display devices and HDR display devices with different display capabilities, effectively ensuring consistent image display effects, helping to maintain contrast, avoid detail loss, and thus improve or maintain the image display effect. Each step can be implemented through the hardware circuit of the terminal device. For example, by determining the ratio that has a mapping relationship with the maximum value through the first lookup table, the processing of integer data can be realized, thereby implementing the execution process of the image processing flow into the hardware circuit and improving the practical application possibility of the image color processing method.

[0006] In one possible design, determining the ratio that maps to the maximum value based on the first lookup table can include the following cases: when the preset primary color value includes the maximum value: determine the first ratio corresponding to the maximum value based on the mapping relationship; when the preset primary color value does not include the maximum value: determine the first preset primary color value and the second preset primary color value in the first lookup table; determine the first ratio and the second ratio corresponding to the first preset primary color value and the second preset primary color value respectively based on the mapping relationship; and perform interpolation on the first ratio and the second ratio to obtain the ratio corresponding to the maximum value. In this way, determining the first color adjustment system using interpolation reduces the number of entries in the first lookup table, thus reducing the space occupied by the first lookup table and lowering the complexity of the hardware circuitry.

[0007] In one 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.

[0008] In one possible design, the value of the first entry in the first lookup table is the ratio of the transformed value of the first lookup value obtained through the first transformation function to the first lookup value.

[0009] In one possible design, the first lookup table value is a fixed-point value. The value of the first table entry can be determined as follows: determine the dynamic parameters of the first conversion function; dequantize the fixed-point value according to the value range determined by the bit width of the primary color value to obtain a floating-point value; convert the floating-point value into a converted value based on the first conversion function after determining the dynamic parameters; quantize the ratio of the converted value to the floating-point value according to a preset quantization coefficient to obtain the value of the first table entry. Determining the value of the first table entry in the first lookup table using the above method ensures that both the lookup table value and the first table entry value can be fixed-point values, thus realizing the feasibility of hardware circuit implementation. The above method can be implemented in software, thereby improving the practical usability of the image processing workflow through software-hardware separation. Furthermore, since this method is implemented in software, the software workflow can be updated at any time based on the image processing effect, resulting in high adaptability and good adjustability of the effect.

[0010] In one possible design, the first lookup value is determined based on the index value of the first lookup table and a step size between the index values ​​of the first lookup table. The step size can be an integer equal to or greater than 1.

[0011] In one possible design, the method further includes: determining the first lookup table corresponding to the first value range in which the maximum value is located; wherein the value range determined by the bit width of the primary color value includes the first value range and the second value range corresponding to the second lookup table.

[0012] In one possible design, the second entry value of the second lookup table is the ratio of the transformed value of the second lookup value obtained through the first transformation function to the second lookup value. The generation method of the second lookup table is similar to that of the first lookup table, and they can be referenced from each other.

[0013] In one 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 table value is determined 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.

[0014] In one possible design, the step size between index values ​​in the first lookup table is different from the step size between index values ​​in the second lookup table.

[0015] In one possible design, the dynamic range of the primary color values ​​of the plurality of components of the pixel is adjusted according to the first ratio, which can be done in the following ways: when the dynamic range of the image to be processed is greater than the dynamic range of the target image, the dynamic range of the primary color values ​​of the plurality of components of the pixel is reduced according to the first ratio; or, when the dynamic range of the image to be processed is less than the dynamic range of the target image, the dynamic range of the primary color values ​​of the plurality of components of the pixel is expanded according to the first ratio.

[0016] In one possible design, the primary color values ​​of the plurality of components of the pixel are dynamically adjusted according to the first ratio, including the following steps: calculating the product of the first ratio and the primary color values ​​of the plurality of components of the pixel to obtain the adjusted primary color values ​​of the plurality of components of the pixel. Optionally, other dynamic compression processing methods can also be performed based on the first ratio, as long as they enable dynamic range reduction or expansion adjustment processing of the plurality of components of the pixel of the image to be processed, with the aim of achieving better compatibility with the display device of the target image. Specific methods are not limited here.

[0017] In one possible design, the image to be processed is located in a sequence of images to be processed, and the target image is located in a sequence of target images. Determining the dynamic parameters of the first conversion function includes: determining the dynamic parameters based on at least one of the following: statistical information of the image to be processed or the sequence of images to be processed; a first reference value for the range of the image to be processed or the sequence of images to be processed; a second reference value for the range of the image to be processed or the sequence of images to be processed; a first reference value for the range of the target image or the sequence of target images; and a second reference value for the range of the target image or the sequence of target images. This application no longer utilizes fixed static parameters but instead uses dynamic parameters to perform dynamic compression processing of the image based on the first conversion curve. Compared to using static parameters during the dynamic range reduction adjustment of the image, this effectively ensures the consistency of the display effect after dynamic range adjustment, reduces the probability of problems such as contrast changes and detail loss, and thus reduces the impact on the image display effect.

[0018] In one possible design, the statistical information of the image to be processed or the sequence of images to be processed includes at least one of the following: the maximum, minimum, average, standard deviation, and histogram distribution information of the primary color values ​​of at least one component of the pixels of the image to be processed or the sequence of images to be processed.

[0019] In one possible design, the first reference value of the image to be processed or the range of the image sequence to be processed may include any of the following: the maximum brightness of the display device used to display the image to be processed; or, a value obtained by searching a first preset list based on statistical information of the image to be processed or the image sequence to be processed; or, a first preset value.

[0020] In one possible design, the second reference value for the image to be processed or the range of the image sequence to be processed may include any of the following: the minimum brightness value of the display device used to display the image to be processed; or, a value obtained by searching a second preset list based on statistical information of the image to be processed or the image sequence to be processed; or, a second preset value.

[0021] In one possible design, the target image or the first reference value of the target image sequence range may include any of the following: the maximum brightness value of the display device used to display the target image; or, a third preset value.

[0022] In one possible design, the target image or the second reference value of the target image sequence range may include any of the following: the minimum brightness value of the display device used to display the target image; or, a fourth preset value.

[0023] In one possible design, the first transformation function includes an S-shaped transformation curve or an inverse S-shaped transformation curve.

[0024] In one possible design, the S-shaped transition curve is a curve that first rises and then falls.

[0025] In one possible design, the S-shaped transition curve comprises one or more curve segments.

[0026] In one possible design, the S-shaped transition curve conforms to the following formula:

[0027] Wherein, L is the maximum value, L′ is the conversion value, and a, b, p, and m are the dynamic parameters of the S-shaped conversion curve.

[0028] In one possible design, p and m are obtained by looking up a first preset list based on statistical information of the image to be processed or the image sequence in which the image to be processed is located;

[0029] a and b are calculated using the following formula:

[0030] Wherein, L1 is a first reference value of the image to be processed or the image sequence range in which the image to be processed is located, L2 is a second reference value of the image to be processed or the image sequence range in which the image to be processed is located, L1 is a first reference value of the target image or the target image sequence range, and L2 is a second reference value of the target image or the target image sequence range.

[0031] In one possible design, the inverse S-shaped transition curve is a curve that first descends and then rises.

[0032] In one possible design, the inverse S-shaped transition curve comprises one or more curve segments.

[0033] In one possible design, the inverse S-shaped transition curve conforms to the following formula:

[0034] Wherein, L is the maximum value among the primary color values ​​of multiple components of the pixel of the target image, L' is the converted value of the maximum value among the primary color values ​​of multiple components of the pixel of the target image, and the parameters a, b, p and m are the dynamic parameters of the inverse S-shaped conversion curve.

[0035] In one possible design, the p and m parameters are obtained by looking up a second preset list; the a and b parameters are calculated using the following formula:

[0036]

[0037] Wherein, L1 is the first reference value of the image to be processed or the image sequence range in which the image to be processed is located, L2 is the second reference value of the image to be processed or the image sequence range in which the image to be processed is located, L1 is the first reference value of the target image or the target image sequence range, and L2 is the second reference value of the target image or the target image sequence range.

[0038] Secondly, an image processing apparatus is provided. This apparatus can be a terminal device, a device within a terminal device (e.g., a chip, chip system, or circuit), or a device compatible with a terminal device. In one design, the apparatus may include modules corresponding to each of the methods / operations / steps / actions described in the first aspect. These modules may be hardware circuits, software, or a combination of hardware circuits and software. In one design, the apparatus may include a determining module and a processing module. Exemplarily:

[0039] A determining module is configured to determine the maximum value among the primary color values ​​of multiple components of a pixel in an image to be processed; and to determine a ratio that has a mapping relationship with the maximum value according to a first lookup table, wherein the first lookup table includes a mapping relationship between a preset ratio and a preset primary color value; a processing module is configured to dynamically adjust the primary color values ​​of the multiple components of the pixel according to the ratio that has a mapping relationship with the maximum value to obtain a target image; wherein the determining module is further configured to determine the mapping relationship through the following steps: obtaining a conversion value of the preset primary color value according to a first conversion function; and using the ratio of the conversion value to the preset primary color value as the preset ratio.

[0040] In one possible design, when determining the ratio that has a mapping relationship with the maximum value according to the first lookup table, the determining module is specifically used to: when the preset primary color value includes the maximum value: determine the first ratio corresponding to the maximum value according to the mapping relationship; when the preset primary color value does not include the maximum value: determine the first preset primary color value and the second preset primary color value in the first lookup table; determine the first ratio and the second ratio corresponding to the first preset primary color value and the second preset primary color value respectively according to the mapping relationship; and perform interpolation operation on the first ratio and the second ratio to obtain the ratio corresponding to the maximum value.

[0041] In one 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.

[0042] In one possible design, the value of the first entry in the first lookup table is the ratio of the transformed value of the first lookup value obtained through the first transformation function to the first lookup value.

[0043] In one possible design, the first lookup table value is a fixed-point value; the determining module is further configured to determine the value of the first entry by: determining the dynamic parameters of the first conversion function; dequantizing the fixed-point value according to the value range determined by the bit width of the primary color value to obtain a floating-point value; converting the floating-point value into a converted value based on the first conversion function after determining the dynamic parameters; and quantizing the ratio of the converted value to the floating-point value according to a preset quantization coefficient to obtain the value of the first entry.

[0044] In one possible design, the first lookup value is determined based on the index value of the first lookup table and a step size between the index values ​​of the first lookup table. The step size can be an integer equal to or greater than 1.

[0045] In one possible design, the determining module is further configured to: determine the first lookup table corresponding to the first value range in which the maximum value is located; wherein the value range determined by the bit width of the primary color value includes the first value range and the second value range corresponding to the second lookup table.

[0046] In one possible design, the second entry value of the second lookup table is the ratio of the transformed value of the second lookup value obtained through the first transformation function to the second lookup value. The generation method of the second lookup table is similar to that of the first lookup table, and they can be referenced from each other.

[0047] In one 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 table value is determined 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.

[0048] In one possible design, the step size between index values ​​in the first lookup table is different from the step size between index values ​​in the second lookup table.

[0049] In one possible design, when adjusting the dynamic range of the primary color values ​​of the plurality of components of the pixel according to the first ratio, the processing module is specifically configured to: when the dynamic range of the image to be processed is greater than the dynamic range of the target image, adjust the dynamic range of the primary color values ​​of the plurality of components of the pixel by reducing the dynamic range according to the first ratio; or, when the dynamic range of the image to be processed is less than the dynamic range of the target image, adjust the dynamic range of the primary color values ​​of the plurality of components of the pixel by expanding the dynamic range according to the first ratio.

[0050] In one possible design, when dynamically adjusting the primary color values ​​of the plurality of components of the pixel according to the first ratio, the processing module is specifically used to: calculate the product of the first ratio and the primary color values ​​of the plurality of components of the pixel, respectively, to obtain the adjusted primary color values ​​of the plurality of components of the pixel. Optionally, the processing module may also be used to perform other dynamic compression processing methods according to the first ratio. The goal is simply to enable dynamic range scaling of the plurality of components of the pixel in the image to be processed, ensuring good compatibility with the display device of the target image; no specific limitations are imposed here.

[0051] In one possible design, the image to be processed is located in a sequence of images to be processed, and the target image is located in a sequence of target images. Determining the dynamic parameters of the first conversion function includes: determining the dynamic parameters based on at least one of the following: statistical information of the image to be processed or the sequence of images to be processed; a first reference value for the range of the image to be processed or the sequence of images to be processed; a second reference value for the range of the image to be processed or the sequence of images to be processed; a first reference value for the range of the target image or the sequence of target images; and a second reference value for the range of the target image or the sequence of target images. This application no longer utilizes fixed static parameters but instead uses dynamic parameters to perform dynamic compression processing of the image based on the first conversion curve. Compared to using static parameters during the dynamic range reduction adjustment of the image, this effectively ensures the consistency of the display effect after dynamic range adjustment, reduces the probability of problems such as contrast changes and detail loss, and thus reduces the impact on the image display effect.

[0052] In one possible design, the statistical information of the image to be processed or the sequence of images to be processed includes at least one of the following: the maximum, minimum, average, standard deviation, and histogram distribution information of the primary color values ​​of at least one component of the pixels of the image to be processed or the sequence of images to be processed.

[0053] In one possible design, the first reference value of the image to be processed or the range of the image sequence to be processed may include any of the following: the maximum brightness of the display device used to display the image to be processed; or, a value obtained by searching a first preset list based on statistical information of the image to be processed or the image sequence to be processed; or, a first preset value.

[0054] In one possible design, the second reference value for the image to be processed or the range of the image sequence to be processed may include any of the following: the minimum brightness value of the display device used to display the image to be processed; or, a value obtained by searching a second preset list based on statistical information of the image to be processed or the image sequence to be processed; or, a second preset value.

[0055] In one possible design, the target image or the first reference value of the target image sequence range may include any of the following: the maximum brightness value of the display device used to display the target image; or, a third preset value.

[0056] In one possible design, the target image or the second reference value of the target image sequence range may include any of the following: the minimum brightness value of the display device used to display the target image; or, a fourth preset value.

[0057] In one possible design, the first transformation function includes an S-shaped transformation curve or an inverse S-shaped transformation curve.

[0058] In one possible design, the S-shaped transition curve is a curve that first rises and then falls.

[0059] In one possible design, the S-shaped transition curve comprises one or more curve segments.

[0060] In one possible design, the S-shaped transition curve conforms to the following formula:

[0061] Wherein, L is the maximum value, L′ is the conversion value, and a, b, p, and m are the dynamic parameters of the S-shaped conversion curve.

[0062] In one possible design, p and m are obtained by looking up a first preset list based on statistical information of the image to be processed or the image sequence in which the image to be processed is located;

[0063] a and b are calculated using the following formula:

[0064] Wherein, L1 is a first reference value of the image to be processed or the image sequence range in which the image to be processed is located, L2 is a second reference value of the image to be processed or the image sequence range in which the image to be processed is located, L1 is a first reference value of the target image or the target image sequence range, and L2 is a second reference value of the target image or the target image sequence range.

[0065] In one possible design, the inverse S-shaped transition curve is a curve that first descends and then rises.

[0066] In one possible design, the inverse S-shaped transition curve comprises one or more curve segments.

[0067] In one possible design, the inverse S-shaped transition curve conforms to the following formula:

[0068] Wherein, L is the maximum value among the primary color values ​​of multiple components of the pixel of the target image, L' is the converted value of the maximum value among the primary color values ​​of multiple components of the pixel of the target image, and the parameters a, b, p and m are the dynamic parameters of the inverse S-shaped conversion curve.

[0069] In one possible design, the p and m parameters are obtained by looking up a second preset list; the a and b parameters are calculated using the following formula:

[0070]

[0071] Wherein, L1 is the first reference value of the image to be processed or the image sequence range in which the image to be processed is located, L2 is the second reference value of the image to be processed or the image sequence range in which the image to be processed is located, L1 is the first reference value of the target image or the target image sequence range, and L2 is the second reference value of the target image or the target image sequence range.

[0072] The beneficial effects of the second aspect and each possible design can be referred to the corresponding effects of the first aspect, and will not be elaborated here.

[0073] Thirdly, embodiments of this application provide an image processing apparatus, the apparatus including a processor, the processor being configured to invoke a set of programs, instructions, or data to execute the method described in the first aspect or any possible design of the first aspect. The apparatus may further include a memory for storing programs, instructions, or data invoked by the processor. The memory is coupled to 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.

[0074] Fourthly, embodiments of this application provide a chip system including a processor and potentially a memory, for implementing the methods described in the first aspect or any possible design within the first aspect. This chip system may be composed of chips or may include chips and other discrete devices.

[0075] Fifthly, this application also provides a computer-readable storage medium storing computer-readable instructions that, when executed on a computer, cause the method described in the first aspect or any possible design of the first aspect to be performed.

[0076] In a sixth aspect, this application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the method described in the first aspect or any possible design of the first aspect. Attached Figure Description

[0077] Figure 1 A schematic diagram of the terminal device in this application embodiment;

[0078] Figure 2 This is a schematic diagram of image processing by the terminal device in an embodiment of this application;

[0079] Figure 3 This is a schematic diagram of the image processing method in the embodiments of this application;

[0080] Figure 4 This is a schematic diagram of an S-shaped transition curve in an embodiment of this application;

[0081] Figure 5 This is a schematic diagram of an S-shaped transition curve composed of two curve segments in an embodiment of this application;

[0082] Figure 6 This is a schematic diagram of an inverse S-shaped transition curve in an embodiment of this application;

[0083] Figure 7 This is a schematic diagram of an inverse S-shaped transition curve composed of two curve segments in an embodiment of this application;

[0084] Figure 8 This is one of the schematic diagrams of the RGB format image processing method in the embodiments of this application;

[0085] Figure 9 This is the second schematic diagram of the RGB format image processing method in the embodiments of this application;

[0086] Figure 10 This is one of the schematic diagrams of the image color processing device in the embodiments of this application;

[0087] Figure 11 This is the second schematic diagram of the image color processing device in the embodiments of this application. Detailed Implementation

[0088] This application provides an image processing method and apparatus to adjust the dynamic range of an image and improve image quality. The method and apparatus are based on the same or similar technical concepts. Since the principles by which the method and apparatus solve the problem are similar, their implementations can be mutually referenced, and repeated details will not be elaborated further.

[0089] It should be noted that in the description of the embodiments of this application, "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the related objects before and after are in an "or" relationship. At least one 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 used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance or order. References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include the specific features, structures, or characteristics described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized. In the formulas of this application, multiplication can be represented by "*" or "×".

[0090] The image color processing method and apparatus provided in this application can be applied to electronic devices. These electronic devices can be mobile devices such as mobile terminals, mobile stations (MS), and user equipment (UE), or fixed devices such as landline telephones, desktop computers, or video surveillance systems. The electronic device has image color processing capabilities. It can also optionally have wireless connectivity, providing users with voice and / or data connectivity via handheld devices or other processing devices connected to a wireless modem. For example, the electronic device can be a mobile phone (or "cellular" phone), a computer with a mobile terminal, or a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device. It can also be a wearable device (such as a smartwatch, smart bracelet), tablet computer, personal computer (PC), personal digital assistant (PDA), or point-of-sale (POS) terminal. This application will use a terminal device as an example for illustration.

[0091] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0092] Figure 1 The diagram shown is an optional hardware structure schematic of the terminal device 100 involved in an embodiment of this application.

[0093] like Figure 1 As shown, the terminal device 100 mainly includes a chipset, which can be used to process image colors. For example, the chipset includes an image signal processor (ISP), which processes image colors. Optionally, the chipset in the terminal device 100 may also include other modules, and the terminal device 100 may also include peripheral devices. Details are as follows. Figure 1The components within the solid-lined box—power management unit (PMU), voice / data codec, short-range module, radio frequency (RF) module, processor, random-access memory (RAM), input / output (I / O), display interface, sensor hub, and baseband communication module—comprise a chip or chipset. Components such as USB interface, memory, display, battery / mains power, headphones / speakers, antenna, and sensor can be considered peripheral devices. The processor, RAM, I / O, display interface, ISP, sensor hub, and baseband components within a chipset can form a system-on-a-chip (SOC), which is the main part of the chipset. All components within a SOC can be integrated into a single complete chip, or some components can be integrated while others are not. For example, the baseband communication module within a SOC can be independent and not integrated with other components. The components within a SOC can be interconnected via buses or other connecting lines. External components of a System-on-a-Chip (SoC), such as the PMU, voice codec, and RF, typically include analog circuitry and are therefore often located outside the SoC and not integrated with each other.

[0094] Figure 1In this module, the PMU (Power Management Unit) is used to connect to external AC power or a battery to power the SOC (System-on-a-Chip), and can use AC power to charge the battery. The voice codec, acting as a voice encoding / decoding unit, connects to headphones or speakers to convert natural analog voice signals to digital voice signals that the SOC can process. Short-range modules may include Wireless Fidelity (WiFi) and Bluetooth, and may optionally include infrared, near-field communication (NFC), FM radio, or GPS modules. The RF module connects to the baseband communication module in the SOC to perform the conversion between air interface RF signals and baseband signals, i.e., frequency mixing. For mobile phones, receiving involves down-conversion, while transmitting involves up-conversion. Both the short-range module and the RF module can have one or more antennas for signal transmission or reception. The baseband is used for baseband communication, including one or more communication modes. It processes wireless communication protocols, including physical layer (layer 1), medium access control (MAC) (layer 2), and radio resource control (RRC) (layer 3), supporting various cellular communication standards such as Long Term Evolution (LTE) and 5G New Radio (NR). The sensor hub is the interface between the SOC and external sensors, used to collect and process data from at least one external sensor, such as an accelerometer, gyroscope, control sensor, or image sensor. The processing unit 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), one or more digital signal processors (DSPs), microprocessors, or one or more field-programmable gate arrays (FPGAs). The processing unit may include one or more cores and can selectively schedule other units. RAM stores intermediate data during computation or processing, such as intermediate computation data from the CPU and baseband. ISP is used to process data acquired 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 used for data transmission. Memory can be a single chip or a set of chips.The display screen can be a touch screen, connected to a bus via a display interface. The display interface can be used for data processing before image display, such as overlaying multiple layers to be displayed, caching display data, or controlling and adjusting screen brightness.

[0095] It is understood that the image signal processor involved in the embodiments of this application can be a single chip or a group of chips, that is, it can be integrated or independent. For example, the image signal processor included in the terminal device 100 can be an integrated ISP chip integrated into the computing processor.

[0096] Figure 2 This diagram illustrates image processing performed by a terminal device. The terminal device can process an input image, including dynamic range adjustment and other processing such as color processing. The terminal device outputs the processed target image. Figure 1 The terminal device shown can dynamically adjust the image to obtain the processed target image.

[0097] To better understand the solutions of the embodiments of this application, the concepts and terms involved in the embodiments of this application will be explained first.

[0098] 1) Lookup table (LUT):

[0099] 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 this embodiment. Optionally, the lookup table includes a series of input data and output data, and the input data and output data have a one-to-one correspondence. The output data in the lookup table can be represented in the form of table entry values, and the input data can be represented as lookup values. The lookup values ​​may not be displayed in the lookup table; they are represented in the form of table entry indexes or table entry subscripts. That is, the lookup table includes one or more table entry values, each table entry value corresponds to a lookup value, and by inputting the lookup value, the table entry value corresponding to that lookup value can be obtained.

[0100] It is understandable that a lookup table can be presented in tabular form or in other forms that can represent the correspondence between input and output data.

[0101] In this embodiment of the application, for the purpose of distinction, multiple lookup tables are represented by a first lookup table, a second lookup table, or a third lookup table, and the concept of each lookup table can be referred to the description in point 2).

[0102] 2) Some attributes or characteristics of the image:

[0103] A pixel is the basic unit that makes up an image. The color of a pixel is usually described by several (for example, three) relatively independent attributes. These independent attributes work together to form a spatial coordinate system, i.e., a color space. The independent attributes that make up a pixel are called the components of each pixel. For example, the components of a pixel can be the color components of the image, such as the R component, G component, B component, or Y component.

[0104] Luminance is a physical measurement of the radiant brightness of a scene, measured in candela per square meter (cd / m²). 2 ), can also be represented by nits.

[0105] A numerical value corresponding to a specific color component in an image is called the primary color value of that component. Primary color values ​​can exist in different forms; for example, primary color values ​​can be represented as linear primary color values ​​or non-linear primary color values.

[0106] The linear primary color value is proportional to the light intensity and its value is normalized to [0, 1]. It is also called the light signal value, where 1 represents the maximum display brightness. The meaning of 1 is different when using different transfer functions. For example, when using the PQ transfer function, 1 represents a maximum display brightness of 10,000 nits. When using the SLF transfer function, 1 represents a maximum display brightness of 10,000 nits. When using the HLG transfer function, 1 represents a maximum display brightness of 2,000 nits. When using the BT.1886 transfer function, for example, 1 generally represents a maximum display brightness of 300 nits.

[0107] Nonlinear primary color values ​​are normalized digital representations of image information, normalized to [0, 1], and are also called electrical signal values. There are conversion relationships between linear and nonlinear primary color values. For example, the optical-electro transfer function (OETF) can be used to convert linear primary color values ​​to nonlinear primary color values, while the electro-optical transfer function (EOTF) can be used to convert nonlinear primary color values ​​to linear primary color values.

[0108] Commonly used SDR photoelectric transfer functions include the ITU-R BT.1886 photoelectric conversion function; correspondingly, SDR electro-optical conversion functions include the ITU-R BT.1886 electro-optical conversion function. Commonly used HDR photoelectric conversion functions may include, but are not limited to, the following: perceptual quantizer (PQ) photoelectric conversion function, hybrid log-gamma (HLG) photoelectric conversion function, and scene luminance fidelity (SLF) photoelectric conversion function. Correspondingly, HDR electro-optical conversion functions may include, but are not limited to, the following: PQ electro-optical conversion function, HLG electro-optical conversion function, and SLF electro-optical conversion function.

[0109] The aforementioned different photoelectric / electro-optical conversion functions are proposed by different high dynamic range (HDR) imaging solutions. For example, the PQ photoelectric / electro-optical conversion function (also known as the PQ conversion curve) is defined by the SMPTE 2084 standard, while the HLG photoelectric / electro-optical conversion function (also known as the HLG conversion curve) is defined by a HDR standard jointly proposed by the BBC and NHK. It should be understood that, by way of example, images converted via the PQ conversion curve conform to the SMPTE 2084 standard, and images converted via the HLG conversion curve conform to the HLG standard.

[0110] For example, data converted using a PQ conversion curve can be referred to as optical / electrical signal values ​​in the PQ domain; data converted using an HLG conversion curve can be referred to as optical / electrical signal values ​​in the HLG domain; and data converted using an SLF conversion curve can be referred to as optical / electrical signal values ​​in the SLF domain.

[0111] In this embodiment of the application, the image format can be red-green-blue (RGB) format, light-color separation (YUV) format, or Bayer format.

[0112] 3) Dynamic range:

[0113] Image sensors generally have very small dynamic ranges; for example, the dynamic range of a CCD sensor is typically no more than 1000:1. However, the dynamic range of brightness changes in real-world scenes is extremely wide. For instance, the average height of a scene under starlight at night is approximately 0.0001 cd / m. 2 The brightness of the scene under sunlight during the day reached 100,000 cd / m². 2 .

[0114] The dynamic range of an image can generally be divided into high dynamic range (HDR) and standard dynamic range (SDR). HDR images are used to describe the full visual range of a real-world scene. HDR images can reveal details in extremely dark and extremely bright areas that might be lost by traditional shooting equipment but can be perceived by the human visual system.

[0115] Generally, signals with a dynamic range of image light signal values ​​exceeding 0.01 to 1000 nits are called high dynamic range light signal values; signals with a dynamic range of image light information values ​​less than 0.1 to 400 nits are called SDR light signal values.

[0116] Corresponding to HDR and SDR signals, HDR display devices have display capabilities that meet the dynamic range of HDR image light signal values ​​and support HDR electro-optical conversion functions, while SDR display devices have display capabilities that meet the dynamic range of SDR image light signal values ​​and support SDR photoelectric conversion functions.

[0117] To enable HDR images to be displayed on SDR display devices, SDR images to be displayed on HDR display devices, or HDR images to be displayed on HDR display devices with different HDR display capabilities, and to ensure consistent display effects without issues such as contrast changes or loss of detail, dynamic range adjustment processing is required.

[0118] Taking HDR to SDR dynamic range adjustment as an example, one implementation method, when an HDR image is input and the display device is an SDR display device, employs the following technical solution: the obtained HDR image electrical signal value is used to obtain the final SDR image electrical signal value through dynamic range adjustment. However, the conversion parameters used in the dynamic range adjustment are only related to fixed data such as the maximum or minimum brightness of the SDR display device. This processing method may not guarantee that the SDR image display effect after dynamic range adjustment is consistent with the HDR image display effect, leading to problems such as contrast changes and detail loss, thus affecting the image display quality.

[0119] Based on the above description, such as Figure 3 As shown in the embodiments of this application, the image processing method provided is as follows. This method can be... Figure 1 The terminal device shown can be used for execution, but it can also be executed by other devices with image processing capabilities.

[0120] S301. Determine the maximum value among the primary color values ​​of multiple components of the pixels in the image to be processed.

[0121] In this embodiment, the multiple components of the pixels of the image to be processed refer to the brightness-related components of the pixels.

[0122] For example, in the YUV space, the primary color value can be the luminance value of the Y component in the YUV space.

[0123] In the RGB color space, the R, G, and B components can be used to characterize the brightness of each color component in an image. Optionally, in the RGB color space, the brightness value of the Y component can be calculated based on the color values ​​of the R, G, and B components. For example, it can be calculated using the formula Y = a 11 *R+a 12 *G+a 13 *B, calculates the color value of the Y component. Where, a 11 a 12 a 13 It is a fixed coefficient. Those skilled in the art will understand that a 11 a 12 a 13 The value of Y can be selected from a variety of options, and the embodiments of this application do not limit it. For example, Y = 0.2126*R + 0.7152*G + 0.0722*B or Y = 0.2627*R + 0.6780*G + 0.0593*B.

[0124] In the RGB color space, the R, G, and B components, as well as the Y component in the YUV color space, are all related to the brightness of an image. The primary color values ​​of multiple components of a pixel in the image to be processed can refer to the primary color values ​​of the R, G, B, and Y components of that pixel. Specifically, for the RGB color space, the maximum value among the primary color values ​​of the multiple components of a pixel in the image to be processed is the maximum of the primary color values ​​of the R, G, and B components. Assuming that the primary color values ​​are represented using a normalized method, their maximum value is 1 and their minimum value is 0. If the primary color value of the R component of a pixel in the image to be processed is 0.5, the primary color value of the G component is 0.6, and the primary color value of the B component is 0.7, then 0.7 is determined to be the maximum value among the three primary color values ​​of that pixel. Assuming that the primary color values ​​are fixed-point values, the primary color value of the R component of the pixel in the image to be processed is n1, the primary color value of the G component is n2, and the primary color value of the B component is n3. n1, n2, and n3 are all fixed-point values, and n3 > n2 > n1. Therefore, n3 is the maximum value among the three components of the primary color value of the pixel.

[0125] When a pixel in an image to be processed contains only one applicable component, the maximum value among the primary color values ​​of the multiple components of that pixel is the primary color value of that applicable component. For example, in the YUV color space, the maximum value among the primary color values ​​of the multiple components of the pixel in the image to be processed is the primary color value of the Y component.

[0126] S302. Determine the ratio that has a mapping relationship with the maximum value according to the first lookup table.

[0127] The first lookup table includes or indicates the mapping relationship between preset ratios and preset primary color values.

[0128] The mapping relationship can be determined through the following process: obtain the conversion value of the preset primary color value according to the first conversion function, and use the ratio of the conversion value to the preset primary color value as the preset ratio.

[0129] S303. Based on the ratio determined in S302 that has a mapping relationship with the maximum value, the primary color values ​​of the multiple components of the pixel are dynamically adjusted to obtain the target image.

[0130] Optionally, when the dynamic range of the image to be processed is greater than that of the target image, the primary color values ​​of the multiple components of the pixel are adjusted to reduce the dynamic range according to the above ratio; or, when the dynamic range of the image to be processed is less than that of the target image, the primary color values ​​of the multiple components of the pixel are adjusted to expand the dynamic range according to the above ratio.

[0131] Shrinking can also be described as decreasing or lowering, while expanding can also be described as increasing or raising.

[0132] Optionally, the ratio that maps to the maximum value can be multiplied by the primary color values ​​of multiple components of the pixel to adjust the dynamic range. Other dynamic compression methods can also be applied based on this ratio, as long as they enable dynamic range scaling of multiple components of the pixel in the image to be processed. The goal is to ensure good compatibility with the display devices of the target image; no specific limitations are imposed here.

[0133] Understandably, the image to be processed may consist of multiple pixels, and each pixel can be processed according to... Figure 3 The process shown is followed to obtain the target image.

[0134] Figure 3 In this embodiment, during image conversion, a preset conversion curve is used to achieve image conversion, enabling images with different dynamic ranges to be better compatible with display devices with different display capabilities. For example, it can achieve compatible display of images on SDR display devices and HDR display devices with different display capabilities, effectively ensuring consistent image display effects, helping to maintain contrast, avoid detail loss, and thus improve or maintain the image display effect. Figure 3 Each step of the embodiment can be implemented by the hardware circuit of the terminal device. For example, by determining the ratio that has a mapping relationship with the maximum value through the first lookup table, the processing of integer data can be realized, thereby implementing the execution process of the image processing flow into the hardware circuit and improving the practical application possibility of the image color processing method.

[0135] The following is about Figure 3 Some optional implementations of the embodiments are further described.

[0136] The input data for the first lookup table can be floating-point numbers, integer numbers, or fixed-point numbers. We will use fixed-point numbers as an example for explanation.

[0137] First, let's introduce the possible ways to generate a lookup table.

[0138] The range of input data for the lookup table can be determined based on the bit width of the primary color value. The range of input data can be less than or equal to the range determined by the bit width of the primary color value. When the primary color value is a fixed-point value, it is generally N bits, where N is a positive integer. For example, the primary color value can be 8 bits, 10 bits, 12 bits, 14 bits, or 16 bits. The range of the primary color value is (0~2). N -1) or (1~2) N For example, when the RGB image primary color value is 10 bits, the range of the primary color value is (0~2). 10 -1).

[0139] The lookup table value serves as the input data, and the output data is the value of the lookup table entry. The lookup table includes or indicates the mapping relationship between the entry value and the lookup table value. In this embodiment, the lookup table includes a mapping relationship between a preset ratio and a preset primary color value; that is, the entry value can be considered to represent the preset ratio, and the lookup table value represents the preset primary color value.

[0140] For any lookup value, the transformed value of the lookup value is obtained according to the first transformation function, and the ratio of the transformed value to the lookup value is used as the table entry value corresponding to the lookup value.

[0141] When the lookup table value is a fixed-point value, the lookup table can be generated in the following way.

[0142] The lookup value (i.e., the fixed-point value) is dequantized based on the maximum value within the range determined by the bit width of the primary color value to obtain a floating-point value. For example, if the maximum value within the range determined by the bit width of the primary color value is 2... N -1, the lookup value is M, and the result is obtained by M / (2 N-1) Obtain the floating-point value M1. Based on the first conversion function, convert this floating-point value to a converted value, for example, convert the floating-point value M1 to M2 based on the first conversion function. M2 is a floating-point value. Obtain the ratio M2 / M1 of the converted value M2 and the lookup floating-point value M1, where M2 / M1 is a floating-point value. Quantize the ratio M2 / M1 according to a preset quantization coefficient to obtain the table entry value of the lookup table. The data obtained after quantization of M2 / M1 is a fixed-point value. That is, both the lookup table value and the table entry value can be fixed-point values.

[0143] By traversing the lookup values ​​in the lookup table and following the method described above, the value of the table entry corresponding to each lookup value can be obtained, thereby generating the lookup table.

[0144] The lookup value of a lookup table is the input data used to retrieve the corresponding table entry value. The index value of the lookup table is the ordinal number of the table entry value, typically generated by arranging natural numbers in ascending or descending order. The lookup value can be determined based on the index value and the step size between index values.

[0145] In one possible embodiment, Figure 3 In this embodiment, the range of the first lookup value in the first lookup table is determined by the bit width of the primary color value. For example, the primary color value is N bits, and its range is (0~2). N -1), the maximum value is 2 N -1. The first lookup value can be set to 0 to 2. N The value in -1. The index of the first entry in the first lookup table can be called the index of the first lookup table. For example, if the first lookup table includes L entries, then the index of the entries in the first lookup table is 0 to L-1 or (1 to L), where L is a positive integer. The index of the first lookup table is 0 to L-1 or (1 to L). The step size between any two index values ​​in the lookup table can be 1 or an integer greater than 1. The first lookup value is determined based on the index of the first lookup table and the step size between the index values. When the first lookup value is 2... N In this case, the first lookup value corresponds one-to-one with the index value, and the step size is 1. The step size can also be greater than 1, where the first lookup value = index value × step size.

[0146] For example, the primary color value is 12 bits, and the range of the primary color value is 0 to 4095, with a maximum value of 4095. The index value can be 0 to 4095 or 1 to 4096. Assuming the index value can be 0 to 1023, the step size is 4, and the lookup value M is (0, 4, 8, 12, 16, 20, ..., 4092).

[0147] 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.

[0148] The possible implementations of the above lookup table generation process apply to the first lookup table.

[0149] In another possible embodiment, the range of values ​​determined by the bit width of the primary color value includes a first range and at least one second range. That is, the range of values ​​determined by the bit width of the primary color value may include multiple subsets. Each subset is a range of values, and the union of multiple subsets is the range of values ​​determined by the bit width of the primary color value. Alternatively, the union of multiple subsets may be smaller than the range of values ​​determined by the bit width of the primary color value. Generally, two subsets are used as an example, that is, the range of values ​​determined by the bit width of the primary color value includes a first range and a second range. Figure 3 In this embodiment, the range of values ​​for the lookup table in the first lookup table is a first value range. For example, the primary color value is N bits, and the range of the primary color value is (0~2). N -1), the maximum value is 2 N -1. The second value range is (0~N1), and the first value range is (N1+1~2). N -1), the minimum value in the first range is greater than the maximum value in the second range. The range of values ​​for the lookup table in the first lookup table is (N1+1~2). N -1), the first lookup value can be set to (N1+1~2). N The value in -1). The index of the first entry in the first lookup table can be called the index of the first lookup table. For example, if the first lookup table includes L entries, then the index of the entries in the first lookup table is 0 to L-1 or (1 to L), where L is a positive integer. The index of the first lookup table is 0 to L-1 or (1 to L). The step size between any two index values ​​in the first lookup table can be 1 or an integer greater than 1. The first lookup value is determined based on the index value of the first lookup table and the step size between the index values. The first lookup value can correspond one-to-one with the index value, i.e., the step size is 1. The step size can also be greater than 1. In this case, the first lookup value of the first lookup table is determined 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. For example, the first lookup 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 primary color value includes the first value range and multiple second value ranges, Figure 3 In this embodiment, the range of values ​​for the lookup table in the first lookup table is a first value range, where the first lookup value = index value × step size + N1. N1 is the maximum value of all value ranges preceding the first value range.

[0150] Similar to the first lookup table, a second lookup table can be generated based on the second value range. The range of values ​​for the lookup values ​​in the second lookup table corresponds to the second value range. The range of values ​​for the second lookup table is (0 to N1), and the second lookup value can be set to a value within (0 to N1). The index 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, then the index of the entry values ​​is 0 to L1-1 or (1 to L1), where L1 is a positive integer. The index value of the second lookup table is 0 to L1-1 or (1 to L1). The step size between any two index values ​​in the second lookup table can be 1 or an integer greater than 1. The second lookup value is determined based on the index value and the step size between the index values. The second lookup value can correspond one-to-one with the index value, i.e., 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 size between the index value of the second lookup table and the index value of the second lookup table. For example, the second lookup value = index value × step size.

[0151] Optionally, the step size between the index values ​​of the first lookup table and the step size between the index values ​​of the second lookup table can be the same or different.

[0152] For example, the primary color value is 12 bits, with a range of 0 to 4095 and a maximum value of 4095. The second range is (0 to 255), and the first range is (256 to 4095). The second lookup table has 64 entries, the step size between index values ​​is 256 / 64 = 4, and the entry values ​​are (0, 4, 8, 12, 16, 20, ..., 252). The first lookup table has 128 entries, the step size between index values ​​is (4095-256) / 128 = 30, and the entry values ​​are (256, 286, 316, ..., 4066).

[0153] The index values ​​of the second lookup table can be 0 to 63 or 1 to 64. The index values ​​of the first lookup table can be 0 to 127 or 1 to 128.

[0154] 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.

[0155] The possible implementations of the lookup table generation process described above can be applied to either the first lookup table or the second lookup table.

[0156] When the bit width of the color value determines a range including a first range and at least one second range, the first lookup table corresponds to the first range. In this case, before S302, a first lookup table corresponding to the first range containing the maximum value among the primary color values ​​of the multiple components can also be determined. The maximum value among the primary color values ​​of the multiple components can be simply referred to as the maximum value in the following description. For example, a threshold can be set, and the range containing the maximum value can be determined based on the comparison result between the maximum value and the threshold, and the lookup table corresponding to the range can be further determined. When the maximum value is less than the threshold, the second range containing the maximum value is determined, and the second lookup table corresponding to the second range is determined. Based on the second lookup table, a ratio that has a mapping relationship with the maximum value is determined. When the maximum value is greater than or equal to the threshold, the first range containing the maximum value is determined, and the first lookup table corresponding to the first range is determined. Based on the first lookup table, a ratio that has a mapping relationship with the maximum value is determined. Based on the above example, the primary color value is 12 bits, the range of the primary color value is 0 to 4095, and the maximum value of the range is 4095. The second value range is (0~255), and the first value range is (256~4095). The threshold can be set to 256.

[0157] Of course, the ratio that maps to the maximum value can also be determined using the following comparison method. When the maximum value is less than or equal to the threshold, the second value range in which the maximum value falls is determined, and a second lookup table corresponding to the second value range is determined. Based on the second lookup table, the ratio that maps to the maximum value is determined. When the maximum value is greater than the threshold, the first value range in which the maximum value falls is determined, and a first lookup table corresponding to the first value range is determined. Based on the determined first lookup table, the ratio that maps to the maximum value is determined. Based on the above example, the color value is 12 bits, the color value range is 0 to 4095, and the maximum value is 4095. The second value range is (0 to 255), and the first value range is (256 to 4095). The threshold can be set to 255.

[0158] The following describes a possible implementation of S302 to determine the ratio that has a mapping relationship with the maximum value based on the first lookup table.

[0159] In step S302, based on the first lookup table, the ratio that has a mapping relationship with the maximum value is determined. The first lookup table includes a mapping relationship between preset ratios and preset primary color values. The preset primary color values ​​in the first lookup table may include the maximum value; therefore, the ratio corresponding to the maximum value can be determined based on the mapping relationship.

[0160] However, the maximum value may not be included in the preset primary color values ​​of the first lookup table. Optionally, in this embodiment, the ratio that has a mapping relationship with the maximum value can be determined by interpolation.

[0161] Interpolation, in the field of numerical analysis in mathematics, is a method for estimating unknown data from known discrete data. In the embodiments of this application, the interpolation method used to determine the ratio that has a mapping relationship with the maximum value can be an internal interpolation method or an external interpolation method; it can be a linear interpolation method or a nonlinear interpolation method; or it can be any one of the following: near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation. The specific interpolation method can be selected according to the actual situation.

[0162] Optionally, a first preset primary color value and a second preset primary color value can be determined in a first lookup table. Based on the mapping relationship between the preset ratio and the preset primary color value, a first ratio and a second ratio corresponding to the first preset primary color value and the second preset primary color value are determined respectively. An interpolation operation is performed on the first preset primary color value and the second preset primary color value to obtain a ratio that has a mapping relationship with the maximum value.

[0163] The first preset primary color value and the second preset primary color value can be two primary color values ​​adjacent to the maximum value. For example, if interpolation is used, the maximum value is located between the first preset primary color value and the second preset primary color value, and the maximum value is adjacent to both the first and second preset primary color values ​​in the preset primary color values. Alternatively, if extrapolation is used, both the first preset primary color value and the second preset primary color value are less than the maximum value, and the maximum value, the first preset primary color value, and the second preset primary color value are adjacent in the preset primary color values; or, both the first preset primary color value and the second preset primary color value are greater than the maximum value, and the maximum value, the first preset primary color value, and the second preset primary color value are adjacent in the preset primary color values.

[0164] The following example illustrates the linear interpolation method.

[0165] The step size 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 for lookup table interpolation.

[0166] The first step is to calculate the interpolation index: i_int = ((max >> step));

[0167] The second step is to calculate the interpolation weights: i_dec = ((max&(((1< <step)-1))));

[0168] 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.

[0169] The following example illustrates how to perform linear interpolation on a first lookup table (LUT) with a step size of step, to obtain the ratio corresponding to the maximum value (max).

[0170] 1. The index value A is obtained by dividing the maximum value (max) by the step size (step) and then rounding it down: A = max / step;

[0171] 2. The value of the first lookup table value (data1) corresponding to index value A is the first ratio: data1 = LUT[A];

[0172] 3. The value of the first lookup table value (data2) corresponding to index value A+1 is the second ratio: data2 = LUT[A+1];

[0173] 4. The maximum value (max) modulo the step size (step) is dec, where dec = max % step;

[0174] 5. Final interpolation data3: data3 = (data1 * (step - dec) + data2 * dec) / step. data3 is the ratio that has a mapping relationship with the maximum value.

[0175] The following example illustrates how to perform linear interpolation on the first lookup table (LUT) to obtain a ratio that maps to the maximum value when the bit width of the primary color value is determined to include a first value range and at least one second value range. In this case, the first lookup table corresponds to the first value range.

[0176] 1. Assume the threshold is thres. The value obtained by subtracting thres from the maximum value (max) is max1: max1 = max - thres.

[0177] 2. The index value A is obtained by dividing the value max1 by the step size step and rounding the result: A = max1 / step.

[0178] 3. The index value A corresponds to the lookup table value data1, which is the first ratio: data1 = LUT[A].

[0179] 4. The lookup value data2 corresponding to the index value A+1 is the second ratio: data2 = LUT[A+1].

[0180] 5. The value dec after dividing the value max1 by the step size step: dec = max1%step.

[0181] 6. Final difference data3: data3 = (data1 * (step - dec) + data2 * dec) / step. data3 is the ratio that has a mapping relationship with the maximum value.

[0182] In this embodiment, the process of generating the first lookup table is a software process, which can be implemented in software. The software process can be encapsulated as firmware / software. Figure 3 Each step in the embodiment is a hardware process and can be implemented through hardware circuits.

[0183] Based on this, for example, when a terminal device performs dynamic range adjustment on multiple consecutive frames of images to be processed, the hardware circuit of the terminal device can adjust the dynamic range of each frame of the image to be processed according to... Figure 3 Each step of the embodiment is processed to obtain the target image corresponding to each frame of the image to be processed. Within the interval between every two consecutive frames, the firmware / software of the terminal device can generate a first lookup table. Of course, the terminal device can separate the dynamic range adjustment process of the image into hardware and software, and is not limited to the implementation method exemplified in this paragraph.

[0184] The first transformation function is explained below.

[0185] In this embodiment of the application, before using the first conversion function, the dynamic parameters of the first conversion function can be determined, and the first conversion function after determining the dynamic parameters can be used subsequently.

[0186] Optionally, the dynamic parameters of the first transformation function can be obtained based on at least one of the following: statistical information of the image to be processed; a first reference value for the range of the image to be processed; a second reference value for the range of the image to be processed; a first reference value for the range of the target image; and a second reference value for the range of the target image.

[0187] When the image to be processed and the target image exist in the form of a sequence, the dynamic parameters of the first transformation function can also be obtained based on at least one of the following information: statistical information of the sequence in which the image to be processed is located; a first reference value of the range of the sequence in which the image to be processed is located; a second reference value of the range of the sequence in which the image to be processed is located; a first reference value of the range of the sequence in which the target image is located; and a second reference value of the range of the sequence in which the target image is located.

[0188] In this embodiment, the statistical information of the image to be processed or the sequence containing the image to be processed can refer to information related to the attributes of the image to be processed or the sequence of images to be processed. For example, the maximum, minimum, average, standard deviation, and histogram distribution information of the primary color values ​​of multiple components of the image to be processed or the pixels of the image to be processed. The primary color values ​​can be linear or non-linear. The primary color values ​​can be the luminance component (Y component), and the corresponding primary color value is a non-linear primary color value.

[0189] It should be understood that the information related to the attributes of the image or image sequence to be processed may include other information besides the information listed above. For example, it may also include the variance of the primary color values ​​of multiple components of the image or image sequence to be processed. A certain functional relationship between the information listed above may also be used as statistical information, such as the sum of the mean and standard deviation of the image or image sequence to be processed; specific details are not limited here.

[0190] It should be understood that the average value of the image to be processed or the sequence of images to be processed can specifically refer to: the average value of the R component nonlinear primary color value, or the average value of the G component nonlinear primary color value, or the average value of the B component nonlinear primary color value, or the average value of the Y component nonlinear primary color value of the pixel set of the image to be processed or the sequence of images to be processed.

[0191] Alternatively, the average value of the image to be processed or the sequence of images to be processed can specifically refer to: the average value of the linear primary color values ​​of the R component, or the average value of the linear primary color values ​​of the G component, or the average value of the linear primary color values ​​of the B component, or the average value of the linear primary color values ​​of the Y component of the pixel set of the image to be processed or the sequence of images to be processed.

[0192] It should be understood that for images or image sequences to be processed in different color spaces, the corresponding non-linear primary color values ​​or the average value of linear primary color values ​​can have various specific cases. The above description uses RGB color space and YUV color space as examples. Other color spaces will not be elaborated on.

[0193] In this embodiment of the application, the first reference value of the image to be processed or the range of the image sequence to be processed may include any one of the following:

[0194] The maximum brightness of the display device used to display the image to be processed, wherein the display device is pre-configured or selected as a dynamic parameter for determining the conversion function when displaying the image to be processed;

[0195] Based on the statistical information of the image to be processed or the sequence of images to be processed, find the first reference value obtained from the first preset list;

[0196] The first preset value, for example, is set to 0.85 or 0.53.

[0197] It should be understood that, in the embodiments of this application, the above-mentioned reference value of the range of images to be processed is obtained by means of a first preset list based on the statistical information of the image to be processed or the sequence of images to be processed, as specifically described below.

[0198] In one feasible implementation, it is necessary to use the embodiments of this application to realize the conversion of HDR image to SDR image. The image to be processed is an HDR image. Taking the statistical information of the image to be processed as the sum of the average value and standard deviation of the image to be processed as an example, the first reference value, namely the above-mentioned reference value of the range of the image to be processed, is obtained by looking up the statistical information of the image to be processed through a first preset list. The list information of the first preset list is shown in Table 1:

[0199] Table 1

[0200] The sum of the mean and the standard deviation 0.2 0.5 0.7 Reference values ​​for the range of the image to be processed (HDR) 0.85 0.9 0.92

[0201] As shown in Table 1, for example, when the sum of the mean and standard deviation of the image to be processed is greater than 0.7, the reference value for the range of the image to be processed is 0.92; when the sum of the mean and standard deviation of the image to be processed is less than 0.2, the reference value for the range of the image to be processed is 0.85; when the sum of the mean and standard deviation of the image to be processed is between 0.2 and 0.5, the reference value for the range of the image to be processed can be obtained by interpolation based on the data 0.2 and 0.5. When it is between 0.5 and 0.7, it can also be obtained by interpolation. Among them, linear interpolation, weighted average interpolation, etc. can be used. The specific interpolation method is not limited here and will not be elaborated further.

[0202] In one feasible implementation, it is necessary to use the embodiments of this application to realize the conversion of SDR image to HDR image. The image to be processed is an SDR image. Taking the statistical information of the image to be processed as the sum of the mean and standard deviation of the image to be processed as an example, the first reference value, namely the above-mentioned reference value of the range of the image to be processed, is obtained by looking up the statistical information of the image to be processed through a first preset list. The list information of the first preset list is shown in Table 2:

[0203] Table 2

[0204] The sum of the mean and the standard deviation 0.2 0.5 0.7 Reference values ​​for the range of the image to be processed (SDR) 0.53 0.56 0.58

[0205] As shown in Table 2, for example, when the sum of the mean and standard deviation of the image to be processed is greater than 0.7, the reference value for the range of the image to be processed is 0.58; when the sum of the mean and standard deviation of the image to be processed is less than 0.2, the reference value for the range of the image to be processed is 0.53; when the sum of the mean and standard deviation of the image to be processed is between 0.2 and 0.5, the reference value for the range of the image to be processed can be obtained by interpolation based on the data 0.2 and 0.5. When it is between 0.5 and 0.7, it can also be obtained by interpolation. Among them, linear interpolation, weighted average interpolation, etc. can be used. The specific interpolation method is not limited here and will not be elaborated further.

[0206] In one feasible implementation, it is necessary to use the embodiments of this application to realize the conversion between HDR images with different dynamic ranges. The image to be processed is an HDR image. Taking the statistical information of the image to be processed as the sum of the average value and standard deviation of the image to be processed as an example, the first reference value, namely the above-mentioned reference value of the range of the image to be processed, is obtained by looking up the statistical information of the image to be processed through a first preset list. The list information of the first preset list is shown in Table 3:

[0207] Table 3

[0208] The sum between the mean and the standard deviation 0.2 0.5 0.7 Reference values ​​for the range of the image to be processed (HDR) 0.82 0.85 0.90

[0209] As shown in Table 3, for example: when the sum of the mean and standard deviation of the image to be processed is greater than 0.7, the reference value for the range of the image to be processed is 0.90; when the sum of the mean and standard deviation of the image to be processed is less than 0.2, the reference value for the range of the image to be processed is 0.82; when the sum of the mean and standard deviation of the image to be processed is between 0.2 and 0.5, the reference value for the range of the image to be processed can be obtained by interpolation based on the data 0.2 and 0.5. When it is between 0.5 and 0.7, it can also be obtained by interpolation. Among them, linear interpolation, weighted average interpolation, etc. can be used. The specific interpolation method is not limited here and will not be elaborated further.

[0210] It should be understood that Tables 1 to 3 are pre-configured lists, and the data in Tables 1 to 3 are optimal parameters obtained based on empirical data. Furthermore, it should be understood that Tables 1 to 3 are only used as examples where the statistical information of the image to be processed is the sum of the mean and standard deviation of the image to be processed. Reference values ​​for the range of images to be processed can also be obtained by looking up other statistical information of the image to be processed, or by using statistical information of the image sequence itself. Specific details are not limited here and will not be elaborated further.

[0211] In this embodiment of the application, the second reference value of the image to be processed or the range of the image sequence to be processed may include any one of the following:

[0212] The minimum brightness value of the display device used to display the second image to be processed, wherein the display device is a pre-configured or selected device, which is used to display the image to be processed when determining the dynamic parameters of the conversion function;

[0213] Based on the statistical information of the image to be processed or the sequence of images to be processed, the second reference value is obtained by searching the second preset list.

[0214] The second preset value, for example, is set to 0.05 or 0.12.

[0215] Similarly, in this embodiment, the second reference value for the range of images to be processed is obtained by searching a second preset list using statistical information of the image to be processed or the sequence of images to be processed. The details are as follows.

[0216] In one feasible implementation, it is necessary to use the embodiments of this application to realize the conversion of HDR image to SDR image. The image to be processed is an HDR image. Taking the difference between the average value and standard deviation of the image to be processed as an example, the second reference value, i.e., the range of the image to be processed, is obtained by means of a second preset lookup table based on the statistical information of the image to be processed. The list information of the second preset list is shown in Table 4:

[0217] Table 4

[0218] The difference between the mean and the standard deviation 0.1 0.2 0.35 Second reference value for the range of the image to be processed (HDR) 0 0.005 0.01

[0219] As shown in Table 4, for example, when the difference between the mean and standard deviation of the image to be processed is greater than 0.35, the second reference value for the range of the image to be processed is 0.01; when the sum of the mean and standard deviation of the image to be processed is less than 0.1, the second reference value for the range of the image to be processed is 0; when the sum of the mean and standard deviation of the image to be processed is between 0.1 and 0.2, the value of the second reference value for the range of the image to be processed can be obtained by interpolation based on 0.1 and 0.2. Linear interpolation, weighted average interpolation, etc., can be used, and specific methods are not limited here and will not be elaborated further.

[0220] In one feasible implementation, it is necessary to use the embodiments of this application to realize the conversion of SDR image to HDR image. The image to be processed is an SDR image. Taking the difference between the average value and standard deviation of the image to be processed as an example, the second reference value, i.e., the range of the image to be processed, is obtained by means of a second preset lookup table based on the statistical information of the image to be processed. The list information of the second preset list is shown in Table 5:

[0221] Table 5

[0222] The difference between the mean and the standard deviation 0.1 0.2 0.35 Second reference value for the range of the image to be processed (SDR) 0.1 0.12 0.15

[0223] As shown in Table 5, for example: when the difference between the mean and standard deviation of the image to be processed is greater than 0.35, the second reference value for the range of the image to be processed is 0.15; when the sum of the mean and standard deviation of the image to be processed is less than 0.1, the second reference value for the range of the image to be processed is 0.1; when the sum of the mean and standard deviation of the image to be processed is between 0.1 and 0.2, the value of the second reference value for the range of the image to be processed can be obtained by interpolation based on 0.1 and 0.2. Linear interpolation, weighted average interpolation, etc., can be used, and specific methods are not limited here and will not be elaborated further.

[0224] In one feasible implementation, it is necessary to use the embodiments of this application to realize the conversion between HDR images with different dynamic ranges. The image to be processed is an HDR image. Taking the difference between the average value and the standard deviation of the image to be processed as an example, the second reference value, i.e., the above-mentioned second reference value for the range of the image to be processed, is obtained by means of a second preset lookup table based on the statistical information of the image to be processed. The list information of the second preset list is shown in Table 6:

[0225] Table 6

[0226] The difference between the mean and the standard deviation 0.1 0.2 0.35 Second reference value for the range of the image to be processed (HDR) 0.005 0.01 0.012

[0227] As shown in Table 6, for example: when the difference between the mean and standard deviation of the image to be processed is greater than 0.35, the second reference value for the range of the image to be processed is 0.012; when the sum of the mean and standard deviation of the image to be processed is less than 0.1, the second reference value for the range of the image to be processed is 0.005; when the sum of the mean and standard deviation of the image to be processed is between 0.1 and 0.2, the value of the second reference value for the range of the image to be processed can be obtained by interpolation based on 0.1 and 0.2. Linear interpolation, weighted average interpolation, etc., can be used, and specific methods are not limited here and will not be elaborated further.

[0228] Similarly, it should be understood that Tables 4 to 6 are pre-configured lists, and the data in Tables 4 to 6 are optimal parameters obtained based on empirical data. Furthermore, it should be understood that Tables 4 to 6 are used here only as an example to illustrate the statistical information of the image to be processed, specifically the difference between the mean and standard deviation of the image. Other statistical information of the image to be processed can also be used to obtain a second reference value for the range of the image to be processed by looking up the table; this is not limited here and will not be elaborated further.

[0229] In this embodiment of the application, the first reference value for the target image or the range of target image sequences may include any one of the following:

[0230] The maximum brightness of the display device used to display the target image, wherein the display device is a pre-configured or selected device, and is used to display the target image when determining the dynamic parameters of the conversion function;

[0231] The third preset value, for example, is set to 0.53 or 0.85.

[0232] In the embodiments of this application, the second reference value for the target image or the range of target image sequences may include any one of the following:

[0233] The minimum brightness of the display device used to display the target image, wherein the display device is a pre-configured or selected device, and is used to display the target image when determining the dynamic parameters of the conversion function;

[0234] The fourth preset value, for example, is set to 0.12 or 0.05.

[0235] The first transformation function will be introduced below.

[0236] For example, the first transformation function can be an S-shaped transformation curve or an inverse S-shaped transformation curve.

[0237] like Figure 4 As shown, an S-shaped transition curve can be a curve that initially rises and then falls. An S-shaped transition curve can also be a curve containing one or more segments, with the initial slope rising and then falling. For example... Figure 5 As shown, an S-shaped transition curve consisting of two curve segments is illustrated. Figure 5 In the diagram, the black dots represent the connection points between two curve segments.

[0238] If converting an HDR image to an SDR image, the first conversion function can be an S-shaped conversion curve. If converting an SDR image to an HDR image, the first conversion function can be an inverse S-shaped conversion curve. If converting between HDR images with different dynamic ranges is to be achieved, the first conversion function can be either an S-shaped conversion curve or an inverse S-shaped conversion curve.

[0239] The following describes several S-shaped transition curves applicable to the embodiments of this application through specific examples.

[0240] Method 1: The S-shaped transition curve can conform to the following formula (1):

[0241]

[0242] Where L is the maximum value among the primary color values ​​of multiple components of the pixel in the image to be processed, L' is the transformation value corresponding to the maximum value of the pixel, and a, b, p and m are the dynamic parameters of the S-shaped transformation curve. Among them, p and m are used to control the shape of the curve and the curvature of the curve, and a and b are used to determine the range of the curve, that is, the position of the start and end points of the curve.

[0243] Optionally, the parameters p and m in formula (1) can be obtained in various ways, as illustrated below.

[0244] Example 1: Based on the statistical information of the image to be processed or the sequence of images to be processed, obtain p and m by searching a preset list.

[0245] For ease of description, the statistical information of the image to be processed or the sequence of images to be processed is illustrated by taking the average value of the primary color value of the Y channel of the sequence of images to be processed as an example. Here, it is assumed that the average value of the primary color value of the Y channel of the sequence of images to be processed is y. The information of the preset list described in Example 1 is shown in Table 7a or Table 7b below:

[0246] Table 7a

[0247] y 0.1 0.25 0.3 0.55 0.6 p 6.0 5.0 4.5 4.0 3.2 m 2.2 2.25 2.3 2.35 2.4

[0248] Table 7b

[0249] y 0.1 0.3 0.5 p 34 32 31

[0250] m 18 18 18

[0251] As shown in Table 7a, when the average brightness value y of the Y channel primary color value of the image sequence to be processed is greater than 0.6, the p parameter is 3.2 and the m parameter is 2.4; when y is less than 0.1, the p parameter is 6.0 and the m parameter is 2.2; when y is between 0.55 and 0.6, the values ​​of p and m can be obtained by interpolation.

[0252] The interpolation method can be any method, such as linear interpolation, weighted average interpolation, etc., and there are no specific restrictions here. For example, taking p as an example, when y is between 0.55 and 0.6, the parameters of p can be obtained through the following linear interpolation method:

[0253] p=4.0+(y-0.55) / (0.6-0.55)*(3.2-4.0);

[0254] For other cases, such as when y is between 0.1 and 0.25, the corresponding p and m parameters can be obtained by analogy, which will not be elaborated here.

[0255] As shown in Table 7b, when the average brightness value y of the Y channel primary color value of the image sequence to be processed is greater than 0.5, the p parameter is 31 and the m parameter is 18; when y is less than 0.1, the p parameter is 34 and the m parameter is 18; when y is between 0.3 and 0.5, the values ​​of p and m can be obtained by interpolation.

[0256] The interpolation method can be any method, such as linear interpolation, weighted average interpolation, etc., and there are no specific restrictions here. For example, taking p as an example, when y is between 0.3 and 0.5, the parameters of p can be obtained through the following linear interpolation method:

[0257] P=32+(y-0.3) / (0.5-0.3)*(31-32);

[0258] For other cases, such as when y is between 0.1 and 0.3, the corresponding p and m parameters can be obtained by analogy, which will not be elaborated here.

[0259] It should be understood that Table 7 is a pre-configured list, and the data in Table 7 are parameters obtained based on empirical data. Similarly, the p and m parameters can also be obtained by looking up tables using other statistical information about the image to be processed or the sequence of images to be processed. Specific details are not limited here and will not be elaborated further.

[0260] Example 2: Determine the p and m parameters based on the performance parameters of the target image display device, such as the gamma value, and the statistical information of the image to be processed or the sequence of images to be processed.

[0261] First, the Gamma value of the target image display device can be determined, and the Gamma value of the reference target image display device can be used as the m parameter. For example, the Gamma of a typical SDR display device is 2.4, so the m parameter can be set to 2.4. The p parameter can be obtained by looking up the method in Table 3 above.

[0262] Example 3: It can be embedded in the early production stage, and the colorists can manually adjust the p and m parameters to ensure that the color, saturation, and contrast of the target image are basically consistent with the acquired image to be processed. The p and m parameters adjusted by the colorists can be received.

[0263] It should be understood that, in addition to the methods in Examples 1 to 3 above, the p and m parameters can also be obtained through other means.

[0264] Optionally, the parameters a and b in formula (1) can be obtained in various ways, as illustrated below.

[0265] Once the parameters p and m are determined, the parameters a and b can be determined using the following formulas (2) and (3).

[0266]

[0267]

[0268] Wherein, L1 is the first reference value of the image to be processed or the image sequence range in which the image to be processed is located, L2 is the second reference value of the image to be processed or the image sequence range in which the image to be processed is located, L1 is the first reference value of the target image or the target image sequence range, and L2 is the second reference value of the target image or the target image sequence range.

[0269] Method 2: An S-shaped transformation curve of the following form, consisting of two function segments:

[0270] When L0≤L≤L1, the value of L' is calculated using the following formula (4):

[0271] L'=(2t 3 -3t 2 +1)L'0+(t 3 -2t 2 +t)(L1-L0)k0+(-2t 3 +3t 2 )L'1+(t 3 -t 2 (L1-L0)k1;

[0272] in,

[0273] When L1 < L ≤ L2, the value of L' is calculated using the following formula (5):

[0274] L'=(2t 3 -3t 2 +1)L'1+(t 3 -2t 2 +t)(L2-L1)k1+(-2t 3 +3t 2 )L'2+(t 3 -t 2 (L2-L1)k2;

[0275] in,

[0276] Where L is the maximum value among the primary color values ​​of multiple components of a pixel in the image to be processed, and L' is the transformation value corresponding to the maximum value of that pixel;

[0277] L0, L1, L2, L'0, L'1, L'2, k0, K1, and K2 are dynamic parameters of the S-shaped conversion curve. L0, L'0, and k0 represent the input, output value, and slope of the starting point of the first segment curve; L1, L′1, and K1 represent the input value, output value, and slope of the connection point between the first segment and the second segment curve; L2, L'2, and K2 represent the input value, output value, and slope of the ending point of the second segment curve; k0, K1, and K2 satisfy k0 < K1 and K1 > K2, that is, to ensure that the S-shaped conversion curve in this second method is a curve with a rising slope first and then a falling slope.

[0278] Optionally, L0 is the reference value of the range of the image to be processed or the image sequence to be processed, L2 is the second reference value of the range of the image to be processed or the image sequence to be processed, L'0 is the reference value of the range of the target image or the target image sequence, and L'2 is the second reference value of the range of the target image or the target image sequence;

[0279] Among them, the parameters of L1, L'1, k0, K1, and K2 are obtained by looking up the fourth and fifth preset lists according to the statistical information of the image to be processed or the image sequence to be processed.

[0280] Among them, the fourth preset list includes Table 4 and the fifth preset list includes Table 5. For L1, k0, K1, and K2, they can be obtained by looking up the following Table 8. Here, taking the statistical information of the image to be processed or the image sequence to be processed as the average value of the non-linear primary color values of the Y channel of the image sequence to be processed as an example for description. Here, assume that the average value of the non-linear primary color values of the Y channel of the image sequence to be processed is y, then the corresponding list information is specifically as shown in Table 8 below:

[0281] Table 8

[0282] y 0.1 0.25 0.3 0.55 0.6 <![CDATA[L1]]> 0.13 0.28 0.34 0.58 0.63 <![CDATA[k0]]> 0 0.05 0.1 0.15 0.2 <![CDATA[K1]]> 0.8 1.0 1.2 1.4 1.5 <![CDATA[K2]]> 0 0.05 0.1 0.15 0.2

[0283] As shown in Table 8, for example, when y is 0.1, correspondingly, L1 takes 0.13, k0 takes 0, K1 takes 0.8, and K2 takes 0. When y is other values, the corresponding L1, k0, K1, and K2 parameters can be obtained by analogy according to Table 8, and the details are not repeated here.

[0284] It should be understood here that when y is between the values corresponding to y in Table 8, for example, when y is between 0.5 and 0.55, the corresponding L1, k0, K1, and K2 parameters can be obtained by interpolation method, and the details are not described here.

[0285] For L′1, it can be obtained by looking up Table 9. Here, taking the statistical information of the image to be processed or the image sequence to be processed as the sum of the average value and standard deviation of the non-linear primary color of the Y path of the image to be processed as an example for description. Here, assume that the sum of the average value and standard deviation of the image to be processed is x, and the details are specifically as shown in Table 9 below:

[0286] Table 9

[0287] x 0.2 0.5 0.7 <![CDATA[L′1]]> 0.3 0.4 0.5

[0288] As shown in Table 9, for example, when x is 0.2, L′1 is 0.3, when x is 0.5, L′1 is 0.7, and when x is between 0.2 and 0.5, the corresponding L′1 can be obtained by interpolation. The specific method of obtaining it by interpolation will not be elaborated here.

[0289] It should be understood that in this embodiment, L′1 can be obtained not only by looking up a table, but also by a preset calculation formula. For example, L′1 can be obtained by the following formula (6):

[0290]

[0291] In this embodiment, after obtaining the dynamic parameters of the S-curve, the maximum value of the primary color value of multiple components of the pixel of the image to be processed can be used to process the S-curve. Taking the S-curve described in Method 1 and Method 2 as an example, the maximum value of the primary color value of multiple components of the pixel of the image to be processed can be substituted into the formula shown in Method 1 and Method 2 to obtain the conversion value.

[0292] In one feasible implementation, the transformation function is an inverse S-shaped transformation curve.

[0293] In this embodiment of the application, preferably, the inverse S-shaped transition curve is a curve that first declines and then rises, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of an inverse S-shaped transition curve where the slope decreases and then increases.

[0294] An inverse S-shaped transition curve can be a curve that includes one or more curve segments, with the slope first decreasing and then increasing. Figure 7 The diagram illustrates an inverted S-shaped transformation curve composed of two curve segments, with black dots representing the connection points between the two curve segments.

[0295] For ease of understanding, the inverse S-shaped transition curve preferred in the embodiments of this application is described below in specific form:

[0296] Method 1: The inverse S-shaped transformation curve can conform to the following formula (7).

[0297]

[0298] Where L is the maximum value among the primary color values ​​of multiple components of the pixel in the target image, L' is the converted value of the maximum value among the primary color values ​​of multiple components of the pixel in the target image, and the parameters a, b, p and m are the dynamic parameters of the inverse S-shaped conversion curve. The parameters p and m are used to control the curve shape and the curvature of the curve, and the parameters a and b are used to determine the range of the curve, that is, the position of the start and end points of the curve.

[0299] Optionally, the parameters p and m in formula (7) can be obtained in various ways, as illustrated below.

[0300] 1. Based on the statistical information of the image to be processed or the sequence of images to be processed, obtain the parameters p and m by searching the sixth preset list.

[0301] For ease of description, it is assumed here that the average value of the nonlinear primary color value of the Y channel of the image or image sequence to be processed is y, and the information of the seventh preset list is shown in Table 10 below:

[0302] Table 10

[0303] y 0.1 0.25 0.3 0.55 0.6 p 6.0 5.0 4.5 4.0 3.2 m 2.2 2.25 2.3 2.35 2.4

[0304] As shown in Table 10, when the average brightness value y of the nonlinear primary color value of the Y channel of the image to be processed or the image sequence to be processed is greater than 0.6, the p parameter is 3.2 and the m parameter is 2.4; when y is less than 0.1, the p parameter is 6.0 and the m parameter is 2.2; when y is between 0.55 and 0.6, the p and m parameters can be obtained by interpolation, which is not limited here and will not be elaborated further.

[0305] 2. Obtain the p and m parameters based on the performance parameters of the target image display device, such as the Gamma value, and the statistical information of the image or image sequence to be processed.

[0306] For example, the gamma value of the target image display device can be selected as the m parameter, while the p parameter is obtained by looking up the table in Table 3 above.

[0307] 3. It can be embedded in the early stages of production, allowing colorists to manually adjust the p and m parameters to ensure that the color, saturation, and contrast of the acquired image to be processed are basically consistent with those of the target image. It can also receive the adjusted p and m parameters.

[0308] It should be understood that, in addition to the methods mentioned above (1-3), the p and m parameters can also be obtained through other means.

[0309] Optionally, the parameters a and b in formula (7) can be obtained in various ways, as illustrated below.

[0310] Once the parameters p and m are determined, the parameters a and b can be determined using the following formulas (8) and (9).

[0311]

[0312]

[0313] Wherein, L1 is the first reference value of the image to be processed or the image sequence range in which the image to be processed is located, L2 is the second reference value of the image to be processed or the image sequence range in which the image to be processed is located, L1 is the first reference value of the target image or the target image sequence range, and L2 is the second reference value of the target image or the target image sequence range.

[0314] Method 2: The inverse S-shaped transformation curve is composed of two function segments:

[0315] When L0≤L≤ L1 When L' is calculated, the following formula (10) is used:

[0316] L'=(2t 3 -3t 2 +1)L'0+(t 3 -2t 2 +t)(L1-L0)k0+(-2t 3 +3t 2 )L'1+(t 3 -t 2 (L1-L0)k1;

[0317] in,

[0318] When L1 < L ≤ L2, the value of L' is calculated using the following formula (11):

[0319] L'=(2t 3 -3t 2 +1)L'1+(t 3 -2t 2 +t)(L2-L1)k1+(-2t 3 +3t 2 )L'2+(t 3 -t 2 (L2-L1)k2;

[0320] in,

[0321] Where L is the maximum value among the primary color values ​​of multiple components of the pixel in the target image information, and L' is the converted value of the maximum value among the primary color values ​​of multiple components of the pixel in the target image information.

[0322] L0, L1, L2, L'0, L'1, L'2, k0, K1, and K2 are dynamic parameters of the S-shaped conversion curve. L0, L'0, and k0 represent the input, output value, and slope of the starting point of the first segment of the curve; L1, L′1, and K1 represent the input value, output value, and slope of the connection point between the first segment and the second segment of the curve; L2, L'2, and K2 represent the input value, output value, and slope of the ending point of the second segment of the curve. k0, K1, and K2 satisfy k0 > K1 and K1 < K2, which ensures that the inverse S-shaped conversion curve in this second method is a curve with a slope that first decreases and then increases.

[0323] Optionally, in this embodiment, L0 is a reference value for the range of the image to be processed or the image sequence to be processed, L2 is the second reference value for the range of the image to be processed or the image sequence to be processed, L'0 is a reference value for the range of the target image or the target image sequence, and L'2 is the second reference value for the range of the target image or the target image sequence;

[0324] The parameters L1, L'1, k0, K1, and K2 are obtained by looking up the seventh and eighth preset lists according to the statistical information of the image to be processed or the image sequence to be processed.

[0325] Among them, the seventh preset list includes Table 11 and the eighth preset list includes Table 12. For L1, k0, K1, and K2, they can be obtained by looking up the following Table 11. Here, taking the statistical information of the image to be processed or the image sequence to be processed as the average value of the non-linear primary color values of the Y channel of the image to be processed or the image sequence to be processed as an example for description. Here, it is assumed that the average value of the non-linear primary color values of the Y channel of the image to be processed or the image sequence to be processed is y. The specific content is shown in Table 11 below:

[0326] Table 11

[0327] y 0.1 0.25 0.3 0.55 0.6 <![CDATA[L1]]> 0.13 0.28 0.34 0.58 0.63 <![CDATA[k0]]> 0.8 1.0 1.2 1.4 1.5 <![CDATA[k1]]> 0 0.05 0.1 0.15 0.2 <![CDATA[k2]]> 0.8 1.0 1.2 1.4 1.5

[0328] As shown in Table 11, for example, when y is 0.1, correspondingly, L1 takes 0.13, k0 takes 0.8, K​​​​​​​​​​

[0332] As shown in Table 12, for example, when x is 0.2, L′1 is 0.3, when x is 0.5, L′1 is 0.4, and when x is between 0.2 and 0.5, the corresponding L′1 can be obtained by interpolation. The specific method of obtaining it by interpolation will not be elaborated here.

[0333] It should be understood that in this embodiment, L′1 can be obtained not only by looking up a table, but also by a preset calculation formula. For example, L′1 can be obtained by the following formula (6):

[0334]

[0335] In this embodiment, after obtaining the dynamic parameters of the inverse S-curve, the maximum value of the primary color value of multiple components of the pixel of the image to be processed can be used to process the inverse S-curve. Taking the inverse S-curve described in Method 1 and Method 2 as an example, the maximum value of the primary color value of multiple components of the pixel of the image to be processed can be substituted into the formula shown in Method 1 and Method 2 to obtain the conversion value.

[0336] Based on the above embodiments, in order to further understand the image processing method provided in the embodiments of this application, such as... Figure 8 As shown, taking an RGB format image as an example, an optional implementation method for a specific scenario is introduced. Figure 8 In this embodiment, the processing procedure for any pixel of the image to be processed is described. Each pixel in the image to be processed can be referred to... Figure 8 The method shown will ultimately yield the target image corresponding to the image to be processed.

[0337] S801, obtain the primary color values ​​R, G, and B of the three color components of the pixels of the image to be processed.

[0338] S802, determine the maximum value MAX among the three primary color values ​​of the pixels of the image to be processed.

[0339] S803, substitute the maximum value MAX into the lookup table to obtain the ratio C1 corresponding to the maximum value MAX.

[0340] The concept and generation method of this lookup table value can be referred to the description of the first lookup table value above. Optionally, if the range of values ​​determined by the bit width of the primary color value includes multiple ranges, and each range corresponds to a lookup table, then before substituting the maximum value MAX into the lookup table, it is necessary to determine the range in which the maximum value MAX lies and select the lookup table corresponding to that range. Figure 8 The optional steps are indicated by dashed boxes.

[0341] S804, multiply the primary color values ​​of the R, G, and B components of the pixels in the image to be processed by the ratio C1 respectively to obtain the products R1, G1, and B1.

[0342] S805 uses a preset quantization coefficient A to perform division or shift operations on R1, G1, and B1 to obtain the primary color values ​​of the R, G, and B components of the pixels in the image to be processed after dynamic range adjustment: R', G', and B'.

[0343] In this context, shifting refers to shifting the exponent to the left; for example, when A is 2... R1 Z is 2 R2 Using A to perform a shift operation on a value Z, that is, shifting A to the left by R1 bits, the result is 2. R2-R1 The results of shift operations and division operations are the same.

[0344] It should be understood that, in addition to multiplying the ratio C1 by the primary color values ​​of the R, G, and B components for dynamic compression, other dynamic compression methods can be applied based on the ratio C1. The goal is to enable dynamic scaling of multiple components of the pixels in the image to be processed, with the aim of achieving better compatibility with the display devices of the target image. No specific limitations are imposed here.

[0345] Taking an RGB format image as an example, the value range determined by the bit width of the primary color value includes two value ranges, such as... Figure 9 As shown, an optional embodiment is presented. Figure 9 In this embodiment, the processing procedure for any pixel of the image to be processed is described. Each pixel in the image to be processed can be referred to... Figure 9 The method shown will ultimately yield the target image corresponding to the image to be processed.

[0346] Assume there are two value ranges, a first value range and a second value range. The maximum value in the first value range is less than the minimum value in the second value range. The first value range corresponds to lookup table 1, and the second value range corresponds to lookup table 2. The concepts and generation methods of lookup table 1 and lookup table 2 can be found in the description of the first lookup table value above.

[0347] S901, obtain the primary color values ​​R, G, and B of the three color components of the pixels of the image to be processed.

[0348] S902, determine the maximum value MAX among the three primary color values ​​of the pixels of the image to be processed.

[0349] The following selection of the lookup table is based on the relationship between the maximum value (MAX) and the threshold. For example, it can be determined in the manner of S903.

[0350] S903. Determine if the maximum value MAX is less than the threshold. If so, execute S904 to S906; otherwise, execute S904' to S906'.

[0351] S904, substitute the maximum value MAX into lookup table 1 to obtain the ratio C1 corresponding to the maximum value MAX.

[0352] S905, the primary color values ​​of the R, G, and B components of the pixels in the image to be processed are multiplied by the ratio C1 respectively to obtain the products R1, G1, and B1.

[0353] In this context, shifting refers to shifting the exponent to the left; for example, when A is 2... R1 Z is 2 R2 Using A to perform a shift operation on a value Z, that is, shifting A to the left by R1 bits, the result is 2. R2-R1 The results of shift operations and division operations are the same.

[0354] S906 uses a preset quantization coefficient A1 to perform division or shift operations on R1, G1, and B1 to obtain the primary color values ​​of the R, G, and B components of the pixels in the image to be processed after dynamic range adjustment: R', G', B'.

[0355] S904', substitute the maximum value MAX into lookup table 2 to obtain the ratio C2 corresponding to the maximum value MAX.

[0356] S905', multiply the primary color values ​​of the R, G, and B components of the pixels in the image to be processed by the ratio C2 respectively to obtain the products R2, G2, and B2.

[0357] S906' uses a preset quantization coefficient A2 to perform division or shift operations on R2, G2, and B2 to obtain the primary color values ​​of the R, G, and B components of the pixels in the image to be processed after dynamic range adjustment: R', G', B'.

[0358] In this context, shifting refers to shifting the exponent to the left; for example, when A is 2... R1 Z is 2 R2 Using A to perform a shift operation on a value Z, that is, shifting A to the left by R1 bits, the result is 2. R2-R1 The results of shift operations and division operations are the same.

[0359] It should be understood that, in addition to dynamically compressing the ratio C1 by multiplying it by the primary color values ​​of the R, G, and B components, other dynamic compression methods can be applied based on the ratio C1. Similarly, in addition to dynamically compressing the ratio C2 by multiplying it by the primary color values ​​of the R, G, and B components, other dynamic compression methods can be applied based on the ratio C2. The goal is simply to enable dynamic range scaling of multiple components of the pixels in the image to be processed, ensuring good compatibility with the display devices of the target image. Specific embodiments in this application are not limited to these methods.

[0360] In one possible embodiment, if the primary color value used for dynamic range adjustment in S303 is a non-linear primary color value, the resulting target image is denoted as the first target image. After dynamically adjusting the primary color values ​​of the multiple components of the pixel, the following step may be performed: according to the second conversion function, the non-linear primary color values ​​of the multiple components of the pixel in the first target image are converted into linear primary color values ​​of the corresponding components of the pixel in the second target image.

[0361] To achieve the conversion from HDR to SDR images, the target image information can be electro-optically converted according to the HDR electro-optic conversion function to obtain the linear primary color values ​​of multiple components of each pixel in the SDR image. The target image information includes the non-linear primary color values ​​of multiple components of the pixels of the image to be processed after dynamic range reduction adjustment.

[0362] If HDR image conversion is performed, let's assume the first target image is an HDR image obtained by conversion using a first conversion curve defined by a first standard (also referred to as an image conforming to the first standard in this embodiment). In this step, the second conversion function is the first conversion curve defined by the first standard. That is, according to the first conversion curve, the nonlinear primary color values ​​of multiple components of each pixel in the first target image are converted into linear primary color values ​​of multiple components of the corresponding pixel in the second target image. For example, let's assume the first target image is PQ domain data. The PQ conversion curve converts the nonlinear primary color values ​​of the pixels in the PQ domain of the first target image into linear primary color values ​​of the pixels in the second target image. It should be understood that the conversion curves defined by the high dynamic range image standard include, but are not limited to, PQ conversion curves, SLF conversion curves, and HLG conversion curves, and are not limited thereto.

[0363] In another possible embodiment, after converting the nonlinear primary color values ​​of multiple components of pixels in the first target image into linear primary color values ​​of multiple components of corresponding pixels in the second target image according to the second conversion function, the following step is further included:

[0364] According to the third conversion function, the linear primary color values ​​of multiple components of the corresponding pixel of the second target image are converted into nonlinear primary color values ​​of the multiple components of the corresponding pixel of the second target image;

[0365] If an HDR image is converted to an SDR image, the linear primary color values ​​of multiple components of each pixel in the SDR image are photoelectrically converted according to the SDR photoelectric conversion function to obtain the nonlinear primary color values ​​of multiple components of the output SDR image pixels, which can finally be output to an SDR display device for display.

[0366] If HDR image conversion is performed, let's assume the second target image is an HDR image obtained by conversion using a second conversion curve defined by a second standard. In this embodiment of the invention, it is also referred to as an image conforming to the second standard. Then, in this step, the third conversion function is the second conversion curve defined by the second standard. That is, according to the second conversion curve, the linear primary color values ​​of multiple components of the pixels of the second target image are converted into nonlinear primary color values ​​of multiple components of the corresponding pixels of the second target image. For example, let's assume the second target image is HLG domain data. Then, the HLG conversion curve converts the linear primary color values ​​of the pixels of the second target image into nonlinear primary color values ​​of the pixels of the second target image in the HLG domain. It should be understood that the conversion curves defined by the high dynamic range image standard include, but are not limited to, PQ conversion curves, SLF conversion curves, and HLG conversion curves, and are not limited thereto.

[0367] In another embodiment, after converting the nonlinear primary color values ​​of multiple components of pixels in the first target image into linear primary color values ​​of multiple components of corresponding pixels in the second target image according to the second conversion function, the method further includes the following steps:

[0368] Determine whether the color space of the output second target image display device is the same as the color space corresponding to the nonlinear primary color values ​​of the second target image;

[0369] If they are different, the color space corresponding to the nonlinear primary color value of the second target image is converted to the color space of the display device that outputs the second target image.

[0370] For example, if the color space corresponding to the nonlinear primary color value of the second target image is the BT.2020 color space, and the display device that outputs the second target image is the BT.709 color space, then the color space is converted from the BT.2020 color space to the BT.709 color space, and then step 308 of the above embodiment 12 is executed.

[0371] In the embodiments of this application, the consistency between the display effect of the target image and the display effect of the image to be processed after dynamic range adjustment can be effectively guaranteed, reducing the probability of problems such as contrast changes and loss of details, thereby reducing the impact on the display effect of the image.

[0372] If the maximum value among the primary color values ​​of multiple components of the pixel of the image to be processed is determined in S301, wherein the primary color values ​​of multiple components of the pixel of the image to be processed are nonlinear primary color values, and the image to be processed in S301 is denoted as the first image to be processed, then the following steps are included before S301: according to the fourth conversion function, the linear primary color values ​​of multiple components of the pixel of the second image to be processed are converted into nonlinear primary color values ​​of multiple components of the corresponding pixel of the first image to be processed.

[0373] If an SDR image is converted to an HDR image, after obtaining the values ​​of multiple components of each pixel in the SDR image, the values ​​of multiple components of each pixel in the SDR image are photoelectrically converted according to the HDR photoelectric conversion function to obtain the target image information. The target image is the nonlinear primary color value corresponding to the value of the SDR image after being converted by the HDR photoelectric conversion function.

[0374] If HDR image conversion is performed, let's assume the first image to be processed is an HDR image obtained by conversion using a first conversion curve defined by a first standard. In this embodiment of the invention, it is also referred to as an image conforming to the first standard. Then, in this step, the fourth conversion function is the first conversion curve defined by the first standard. That is, according to the first conversion curve, the linear primary color values ​​of multiple components of pixels in the second image to be processed are converted into nonlinear primary color values ​​of multiple components of corresponding pixels in the first image to be processed. For example, let's assume the first image to be processed is PQ domain data. Then, the PQ conversion curve converts the linear primary color values ​​of pixels in the second image to be processed into nonlinear primary color values ​​of pixels in the PQ domain of the first image to be processed. It should be understood that the conversion curves defined by the high dynamic range image standard include, but are not limited to, PQ conversion curves, SLF conversion curves, and HLG conversion curves, and are not limited thereto.

[0375] In one possible embodiment, before converting the linear primary color values ​​of multiple components of the pixels of the second image to be processed into nonlinear primary color values ​​of multiple components of the corresponding pixels of the first image to be processed according to the fourth conversion function, the method further includes the step of converting the nonlinear primary color values ​​of multiple components of the pixels of the second image to be processed into linear primary color values ​​of multiple components of the corresponding pixels of the second image to be processed according to the fifth conversion function.

[0376] To convert an SDR image to an HDR image, after obtaining the nonlinear primary color values ​​of multiple components of the pixels in the SDR image, the SDR image is electro-optically converted according to the SDR electro-optic conversion function to obtain the values ​​of multiple components of the pixels in the SDR image.

[0377] If HDR image conversion is performed, let's assume the second image to be processed is an HDR image obtained by conversion using the second conversion curve defined by the second standard. In this embodiment, it is also referred to as an image conforming to the second standard. Then, in this step, the fifth conversion function is the second conversion curve defined by the second standard. That is, according to the fifth conversion curve, the nonlinear primary color values ​​of multiple components of each pixel of the second target image are converted into linear primary color values ​​of multiple components of the corresponding pixel of the second target image. For example, let's assume the second target image is HLG domain data. Then, the HLG conversion curve converts the nonlinear primary color values ​​of the pixels of the second target image in the HLG domain into linear primary color values ​​of the pixels of the second target image. It should be understood that the conversion curves defined by the high dynamic range image standard include, but are not limited to, PQ conversion curves, SLF conversion curves, and HLG conversion curves, and are not limited thereto.

[0378] In one possible embodiment, after converting the nonlinear primary color values ​​of multiple components of the pixels of the second image to be processed into linear primary color values ​​of multiple components of the corresponding pixels of the second image to be processed according to the fifth conversion function, the method further includes the following step: determining whether the color space of the display device of the second image to be processed is the same as the color space of the first image to be processed.

[0379] If they are different, the color space of the first image to be processed is converted to the color space of the display device of the second image to be processed.

[0380] For example, if the color space of the first image to be processed is BT.709 color space, and the color space of the display device of the second image to be processed is BT.2020 color space, then the color space is converted from BT.709 color space to BT.2020 color space. Then, according to the fourth conversion function, the linear primary color values ​​of multiple components of the pixels of the second image to be processed are converted into the non-linear primary color values ​​of multiple components of the corresponding pixels of the first image to be processed.

[0381] In this embodiment, the consistency between the display effect of the target image and the display effect of the first image to be processed after dynamic range adjustment can be effectively guaranteed, reducing the probability of problems such as contrast changes and loss of details, thereby reducing the impact on the display effect of the image.

[0382] In one embodiment S1 of this application, the conversion of the linear primary color values ​​of the pixels of the HDR input image to non-linear primary color values ​​is realized.

[0383] For example, HDR input signal sources include floating-point or half-floating-point linear EXR format HDR image data, HDR image data acquired by PQ or Slog-3 (acquisition mode), and SLF HDR image data input.

[0384] For example, the conversion from linear primary color values ​​(R,G,B) to PQ domain nonlinear primary color values ​​(R',G',B') follows the formula:

[0385] R'=PQ_TF(max(0,min(R / 10000,1)))

[0386] G'=PQ_TF(max(0,min(G / 10000,1)))

[0387] B'=PQ_TF(max(0,min(B / 10000,1)))

[0388] in:

[0389]

[0390]

[0391]

[0392]

[0393]

[0394]

[0395] For example, the conversion from linear primary color values ​​(R,G,B) to SLF domain nonlinear primary color values ​​(R',G',B') follows the formula:

[0396] R'=SLF_TF(max(0,min(R / 10000,1)))

[0397] G'=SLF_TF(max(0,min(G / 10000,1)))

[0398] B'=SLF_TF(max(0,min(B / 10000,1)))

[0399] in:

[0400]

[0401] m = 0.14

[0402] p = 2.3

[0403] a = 1.12762

[0404] b = -0.12762

[0405] In another embodiment S2 of this application, the conversion of the non-linear primary color values ​​of the pixels of the HDR input image to linear primary color values ​​is realized.

[0406] For example, HDR input signal sources include floating-point or half-floating-point linear EXR format HDR image data, HDR image data acquired by PQ or Slog-3 (acquisition mode), and SLF HDR image data input.

[0407] For example, the conversion from Slog-3 nonlinear primary color values ​​to SLF domain nonlinear primary color values ​​includes:

[0408] S21. Convert the HDR nonlinear primary color values ​​in the S-Log3 domain to HDR linear primary color values;

[0409] If in>=171.2102946929 / 1023.0

[0410] out=(10.0^((in*1023.0-420.0) / 261.5))*(0.18+0.01)-0.01

[0411] else

[0412] out=(in*1023.0–95.0)*0.01125000 / (171.2102946929–95.0)

[0413] Where in is the input value and out is the output value.

[0414] S22. Convert the HDR linear primary color values ​​into SLF non-linear primary color values ​​according to the method in Example S1.

[0415] For example, the conversion from nonlinear primary color values ​​in the PQ domain to nonlinear primary color values ​​in the SLF domain includes S31 and S32.

[0416] S31. Convert the HDR nonlinear primary color values ​​(R',G',B') in the PQ domain to HDR linear primary color values ​​(R,G,B);

[0417] R = 10000 * inversePQ_TF(R')

[0418] G = 10000 * inversePQ_TF(G')

[0419] B = 10000 * inversePQ_TF(B')

[0420] in:

[0421]

[0422]

[0423]

[0424]

[0425]

[0426]

[0427] S32. Convert the HDR linear primary color values ​​(R,G,B) to SLF domain HDR non-linear primary color values ​​(R',G',B').

[0428] R'=SLF_TF(max(0,min(R / 10000,1)))

[0429] G'=SLF_TF(max(0,min(G / 10000,1)))

[0430] B'=SLF_TF(max(0,min(B / 10000,1)))

[0431] in:

[0432]

[0433] m = 0.14

[0434] p = 2.3

[0435] a = 1.12762

[0436] b = -0.12762

[0437] In another embodiment S3 of this application, the adjustment of HDR nonlinear primary color values ​​for SDR-compatible display is achieved, including:

[0438] HDR nonlinear primary color values ​​are processed by an SDR display compatibility module to obtain SDR nonlinear primary color values, ensuring that SDR nonlinear primary color values ​​can be correctly displayed on SDR devices. The display compatibility module includes dynamic range adjustment, color adjustment, nonlinear-to-linear conversion, and ITU-R BT.1886 EOTF inverse conversion.

[0439] Specifically, SDR display-compatible dynamic range adjustments include:

[0440] The dynamic range adjustment process adjusts the dynamic range of the input HDR nonlinear signals R', G', and B' based on dynamic metadata to obtain signals R1, G1, and B1 suitable for the SDR dynamic range. In this embodiment of the invention, a dynamic range adjustment curve is generated based on the dynamic metadata. The maximum value in the HDR nonlinear signal is used as a reference value, and its dynamic range is adjusted accordingly. The ratio of the reference value before and after adjustment is calculated as the adjustment coefficient c, and this adjustment coefficient is applied to the HDR nonlinear signal.

[0441] The dynamic range adjustment parameter of the curve is used to adjust the dynamic range of the HDR nonlinear signal, which includes, but is not limited to, HDR nonlinear signals in the SLF domain and PQ domain. The specific expressions of the dynamic range adjustment parameters in the SLF and PQ domains are slightly different. Since there is a good correspondence between the HDR nonlinear signals in the SLF and PQ domains, the corresponding PQ domain dynamic range adjustment parameters can be easily derived from the SLF domain dynamic range adjustment parameters. In this embodiment of the invention, the formula corresponding to the dynamic range adjustment curve in the SLF domain is as follows:

[0442]

[0443] The parameters p and m control the curve shape and curvature, generated based on dynamic metadata; the parameters a and b control the curve range, i.e., the positions of the start and end points. Parameter p has a piecewise linear correspondence with the average value y in the image's dynamic metadata, and the key point correspondences for each piecewise correspondence are shown in the table below.

[0444] Table 13

[0445] Average value y 0.1 0.25 0.3 0.55 0.6 Parameter p 6.0 5.0 4.5 4.0 3.2

[0446] When the average value y is greater than 0.6, the parameter p is 3.2; when the average value is less than 0.1, the parameter p is 6.0; when the average value is between two adjacent items in the table, the parameter p can be obtained by linear interpolation.

[0447] For example, when the average value is between 0.55 and 0.6, the parameter p can be obtained through the following linear interpolation method:

[0448] p=4.0+(y-0.55) / (0.6-0.55)*(3.2-4.0)

[0449] The parameter m is the gamma value of the output SDR display device, which is usually 2.4.

[0450] Parameters a and b can be obtained by solving the following system of equations:

[0451]

[0452]

[0453] Wherein, L1 is the maximum nonlinear reference value of the HDR image, L2 is the minimum nonlinear reference value of the HDR image, L1‵ is the maximum nonlinear reference value of the SDR image, and L2‵ is the minimum nonlinear reference value of the SDR image. L1 and L2 are calculated from the mean Y and standard deviation V in the dynamic metadata.

[0454] There is a piecewise linear correspondence between L1 and Y+V, and the key point correspondence of the segments is shown in the table below.

[0455] Table 14

[0456] Sum of mean and standard deviation 0.2 0.5 0.7 HDR image SLF domain reference maximum value 0.85 0.9 0.92

[0457] When Y+V is greater than 0.7, L1 is 0.92; when Y+V is less than 0.2, L1 is 0.85; when Y+V is between two adjacent data in the table, L1 can be obtained by linear interpolation.

[0458] There is a piecewise linear correspondence between L2 and YV, and the key point correspondence of the segments is shown in the table below.

[0459] Table 15

[0460] The difference between the mean and the standard deviation 0.1 0.2 0.35 Minimum value of SLF domain for HDR images 0 0.005 0.01

[0461] As shown in Table 15, for example: when YV is greater than 0.35, L2 is 0.01; when YV is less than 0.1, L2 is 0; when YV is between two adjacent data in the table, L2 can be obtained by linear interpolation.

[0462] L1‵ and L2‵ are obtained by converting the maximum and minimum brightness of the output SDR device through an HDR linear-to-non-linear transformation. For example, the maximum display brightness of a common SDR display device is 300 nits and the minimum display brightness is 0.1 nits, with corresponding non-linear values ​​of L1‵ of 0.64 and L2‵ of 0.12.

[0463] Specifically, color adjustments compatible with SDR displays include:

[0464] Color adjustment processes the dynamic range-adjusted HDR nonlinear signals R1, G1, and B1 based on dynamic metadata and adjustment coefficient c, resulting in processed HDR nonlinear signals R2, G2, and B2.

[0465] The image luminance value Y1 is calculated based on the HDR nonlinear signal values ​​R1, G1, and B1, using the same calculation methods as Rec.709 and Rec.2020. The color adjustment coefficient Alphy1 is calculated from the dynamic range adjustment coefficient c, using the power function F1(c) = c. d The coefficient d has a piecewise linear correspondence with the average value y in the image dynamic metadata, and the correspondence of the key points in each piecewise segment is shown in the table below.

[0466] Table 16

[0467] average value 0.1 0.25 0.3 0.55 0.6 coefficient d 0.15 0.18 0.2 0.22 0.25

[0468] As shown in Table 16, when the average value y is less than 0.1, the coefficient d is 0.15. When the average brightness value y is greater than 0.6, the coefficient d is 0.25. When the average value y is between the two table values, the coefficient d can be calculated by linear interpolation.

[0469] The component adjustment coefficients AlphyR, AlphyG, and AlphyB are obtained by processing the ratios of the luminance value Y1 to the values ​​of R1, G1, and B1 (i.e., Y1 / R1, Y1 / G1, Y1 / B1) using the power function F2. The formula for the power function F2 is F2(x) = x e The coefficient e has a piecewise linear correspondence with the average value y in the image dynamic metadata, and the correspondence of key points in each piecewise segment is shown in the table below:

[0470] Table 17

[0471] average value 0.1 0.25 0.3 0.55 0.6 coefficient e 1.2 1.0 0.8 0.6 0.2

[0472] As shown in Table 17, when the average value y is less than 0.1, the coefficient e can be 1.2; when the average value y is greater than 0.6, the coefficient e can be 0.2; when the average value y is between two adjacent data in the table, the coefficient e can be obtained by linear interpolation.

[0473] In another embodiment S4 of this application, the adjustment of HDR nonlinear primary color values ​​for HDR-compatible display is achieved, including:

[0474] The HDR nonlinear signals R', G', and B' are processed through display adaptation to obtain the HDR nonlinear signals R”, G”, and B”, ensuring that the HDR nonlinear signals can be correctly displayed on different HDR devices. The HDR display compatibility adjustment module includes dynamic range adjustment and color adjustment.

[0475] The dynamic range adjustment processing can be implemented based on the method described in Example S3 by the following adjustments: L1‵ and L2‵ are obtained by transforming the maximum and minimum brightness of the output HDR device through a linear-to-nonlinear HDR transformation. The coefficients p and m need to be obtained through the lookup table method described in Example S3 using the image dynamic metadata. The table entries need to be obtained through experimental calibration based on different HDR display devices.

[0476] The color gamut adjustment process can be implemented based on the method described in embodiment S3 by the following adjustments: the coefficients d and e need to be obtained through a lookup table using image dynamic metadata, and the table entries need to be obtained through experimental calibration according to different HDR display devices.

[0477] It should be noted that the examples in the various application scenarios of this application only illustrate some possible implementation methods, and are intended to provide a better understanding and explanation of the methods in this application. Those skilled in the art can derive examples of some evolved forms based on the image color processing methods provided in this application.

[0478] To achieve the functions of the methods provided in the embodiments of this application, the terminal device may include a hardware structure and / or software modules, implementing the functions in the form of a hardware structure, software modules, or a combination of hardware and software modules. Whether a particular function is executed in the form of a hardware structure, a software module, or a combination of hardware and software modules depends on the specific application and design constraints of the technical solution.

[0479] Based on the same technological concept, such as Figure 10 As shown, this application embodiment also provides an image processing apparatus 1000, which can be a mobile terminal or any device with image processing capabilities. In one design, the image processing apparatus 1000 may include modules that execute each method / operation / step / action in the above method embodiments. These modules may be hardware circuits, software, or a combination of hardware circuits and software. In one design, the image processing apparatus 1000 may include a determining module 1001 and a processing module 1002. The hardware circuit is referred to as hardware or a C-pipe.

[0480] The determining module 1001 is used to determine the maximum value among the primary color values ​​of multiple components of a pixel in the image to be processed; and to determine a ratio that has a mapping relationship with the maximum value according to a first lookup table, wherein the first lookup table includes a mapping relationship between a preset ratio and a preset primary color value. The processing module 1002 dynamically adjusts the primary color values ​​of the multiple components of the pixel according to the ratio that has a mapping relationship with the maximum value to obtain a target image; wherein the determining module 1001 is further used to determine the mapping relationship through the following steps: obtaining a conversion value of the preset primary color value according to a first conversion function; and using the ratio of the conversion value to the preset primary color value as the preset ratio. In this case, the determining module 1001 and the processing module 1002 can be hardware circuits.

[0481] Optionally, when determining the ratio that has a mapping relationship with the maximum value according to the first lookup table, the determining module 1001 is specifically used for: when the preset primary color value includes the maximum value: determining the first ratio corresponding to the maximum value according to the mapping relationship; when the preset primary color value does not include the maximum value: determining the first preset primary color value and the second preset primary color value in the first lookup table; determining the first ratio and the second ratio corresponding to the first preset primary color value and the second preset primary color value respectively according to the mapping relationship; and performing interpolation operation on the first ratio and the second ratio to obtain the ratio corresponding to the maximum value. Here, the determining module 1001 can be a hardware circuit.

[0482] Optionally, the first lookup table value is a fixed-point value; the determining module 1001 is further configured to determine the value of the first table entry by: determining the dynamic parameters of the first conversion function; dequantizing the fixed-point value according to the value range determined by the bit width of the primary color value to obtain a floating-point value; converting the floating-point value into a converted value based on the first conversion function after determining the dynamic parameters; and quantizing the ratio of the converted value to the floating-point value according to a preset quantization coefficient to obtain the value of the first table entry. Here, the determining module 1001 can be software.

[0483] Optionally, the determining module 1001 is further configured to: determine the first lookup table corresponding to the first value range in which the maximum value is located; wherein the value range determined by the bit width of the primary color value includes the first value range and the second value range corresponding to the second lookup table. Here, the determining module 1001 may be a hardware circuit.

[0484] The determining module 1001 and the processing module 1002 can also be used to perform other corresponding steps or operations in the above method embodiments, which will not be described in detail here.

[0485] The module division in this embodiment is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in each embodiment of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0486] Based on the same technological concept, such as Figure 11 As shown in the illustration, this application also provides an image processing apparatus 1100. The image processing apparatus 1100 includes a processor 1101. The processor 1101 is used to invoke a set of programs to execute the above-described method embodiments. The image processing apparatus 1100 also includes a memory 1102, which stores program instructions and / or data executed by the processor 1101. The memory 1102 and the processor 1101 are coupled. The coupling in this application embodiment is an indirect coupling or communication connection between devices, units, or modules, and can be electrical, mechanical, or other forms, used for information interaction between devices, units, or modules. The processor 1101 may operate collaboratively with the memory 1102. The processor 1101 may execute program instructions stored in the memory 1102. The memory 1102 may be included in the processor 1101.

[0487] The image processing device 1100 can be a chip system. In this embodiment, the chip system can 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 processing device 1100 is a cmode emulated by the ASIC chip. The cmode can achieve bit-level consistency with the ASIC chip.

[0488] Processor 1101 is configured to: determine the maximum value among the primary color values ​​of multiple components of a pixel in an image to be processed; and to determine a ratio that has a mapping relationship with the maximum value according to a first lookup table, wherein the first lookup table includes a mapping relationship between a preset ratio and a preset primary color value. Processor 1101 is further configured to dynamically adjust the primary color values ​​of the multiple components of the pixel according to the ratio that has a mapping relationship with the maximum value to obtain a target image; wherein processor 1101 is further configured to determine the mapping relationship through the following steps: obtaining a conversion value of the preset primary color value according to a first conversion function; and using the ratio of the conversion value to the preset primary color value as the preset ratio.

[0489] The processor 1101 can also be used to execute other corresponding steps or operations in the above method embodiments, which will not be described in detail here.

[0490] The processor 1101 can be a general-purpose processor, digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0491] The memory 1102 can be non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as random-access memory (RAM). Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures, and accessible by a computer, but is not limited thereto. The memory in the embodiments of this application can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0492] Some or all of the operations and functions described in the above method embodiments of this application can be implemented using chips or integrated circuits.

[0493] This application also provides a chip, including a processor, for supporting the image processing device in implementing the functions involved in the above-described method embodiments. In one possible design, the chip is connected to a memory or the chip includes a memory for storing necessary program instructions and data for the communication device.

[0494] This application provides a computer-readable storage medium storing a computer program, the computer program including instructions for performing the above-described method embodiments.

[0495] This application provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the above-described method embodiments.

[0496] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0497] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0498] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0499] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0500] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0501] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of the embodiments of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, this application also intends to include these modifications and variations.

Claims

1. An image processing method, characterized in that, include: Determine the maximum value among the primary color values ​​of multiple components of a pixel in the image to be processed; According to the first lookup table, a ratio that has a mapping relationship with the maximum value is determined, wherein the first lookup table includes a mapping relationship between a preset ratio and a preset primary color value; Based on the determined ratio, the primary color values ​​of the multiple components of the pixel are dynamically adjusted to obtain the target image. The determination of the mapping relationship includes: The conversion value of the preset primary color value is obtained according to the first conversion function; The ratio of the conversion value to the preset primary color value is taken as the preset ratio value; The first entry value of the first lookup table is: the ratio of the converted value of the first lookup value obtained by the first conversion function to the first lookup value; the first entry value represents a preset ratio, and the first lookup value represents a preset primary color value; The first lookup value is a fixed-point value; the determination of the value of the first table entry includes: Determine the dynamic parameters of the first transformation function; Based on the value range determined by the bit width of the primary color value, the fixed-point value is dequantized to obtain a floating-point value; the floating-point value is the ratio of the fixed-point value to the maximum value of the value range. Based on the first conversion function after determining the dynamic parameters, the floating-point value is converted into a converted value; The ratio of the converted value to the floating-point value is quantized according to a preset quantization coefficient to obtain the value of the first entry.

2. The method as described in claim 1, characterized in that, Determining the ratio that has a mapping relationship with the maximum value according to the first lookup table includes: When the preset primary color value includes the maximum value: determine the ratio corresponding to the maximum value according to the mapping relationship; When the preset primary color value does not include the maximum value: Determine the first preset primary color value and the second preset primary color value in the first lookup table; Based on the mapping relationship, the first ratio and the second ratio corresponding to the first preset primary color value and the second preset primary color value are determined respectively; Interpolation is performed on the first ratio and the second ratio to obtain the ratio corresponding to the maximum value.

3. The method as described in claim 2, characterized in that, The interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.

4. The method as described in claim 1, characterized in that, The first lookup value is determined based on the index value of the first lookup table and the step size between the index values ​​of the first lookup table; the first lookup value is the product of the index value of the first lookup value and the step size.

5. The method according to any one of claims 1 to 4, characterized in that, The first lookup table is the lookup table corresponding to the first value range in which the maximum value is located; The value range determined by the bit width of the primary color value includes the first value range and the second value range corresponding to the second lookup table.

6. The method as described in claim 5, characterized in that, The second entry value of the second lookup table is the ratio of the converted value of the second lookup value obtained by the first conversion function to the second lookup value.

7. The method as described in claim 5, characterized in that, The minimum value in the first value range is greater than the maximum value in the second value range; Correspondingly, the first lookup value is determined 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.

8. The method as described in claim 5, characterized in that, The step size between index values ​​in the first lookup table is different from the step size between index values ​​in the second lookup table.

9. The method according to any one of claims 1-4 and 6-8, characterized in that, The step of dynamically adjusting the primary color values ​​of the plurality of components of the pixel according to the determined ratio includes: When the dynamic range of the image to be processed is greater than the dynamic range of the target image, the primary color values ​​of the plurality of components of the pixel are adjusted to reduce the dynamic range according to the ratio; or, When the dynamic range of the image to be processed is smaller than the dynamic range of the target image, the primary color values ​​of the multiple components of the pixel are adjusted to expand the dynamic range according to the ratio.

10. The method according to any one of claims 1-4 and 6-8, characterized in that, The step of dynamically adjusting the primary color values ​​of the plurality of components of the pixel according to the determined ratio includes: The product of the ratio and the primary color values ​​of the plurality of components of the pixel is calculated respectively to obtain the adjusted primary color values ​​of the plurality of components of the pixel.

11. The method according to any one of claims 1-4 and 6-8, characterized in that, The image to be processed is located in the image sequence to be processed, and the target image is located in the target image sequence. The determination of the dynamic parameters of the first transformation function includes: The dynamic parameter is determined based on at least one of the following information: The statistical information of the image to be processed or the sequence of images to be processed; the first reference value of the range of the image to be processed or the sequence of images to be processed; the second reference value of the range of the image to be processed or the sequence of images to be processed; the first reference value of the range of the target image or the target image sequence; the second reference value of the range of the target image or the target image sequence.

12. The method as described in claim 11, characterized in that, The statistical information of the image to be processed or the sequence of images to be processed includes at least one of the following: The maximum, minimum, average, standard deviation, and histogram distribution information of the primary color values ​​of at least one component of the pixel points of the image to be processed or the image sequence to be processed.

13. The method as described in claim 11, characterized in that, The first reference value of the range of the image to be processed or the image sequence to be processed includes: The maximum brightness value of the display device used to display the image to be processed; or... Based on the statistical information of the image to be processed or the sequence of images to be processed, the value obtained from the first preset list is searched; or, First preset value.

14. The method as described in claim 11, characterized in that, The second reference value for the range of the image to be processed or the sequence of images to be processed includes: The minimum brightness value of the display device used to display the image to be processed; or... Based on the statistical information of the image to be processed or the sequence of images to be processed, the value obtained from the second preset list is searched; or, Second preset value.

15. The method as described in claim 11, characterized in that, The target image or the first reference value of the target image sequence range includes: The maximum brightness of the display device used to display the target image; or, Third preset value.

16. The method as described in claim 11, characterized in that, The target image or the second reference value of the target image sequence range includes: The minimum brightness value of the display device used to display the target image; or... Fourth preset value.

17. The method according to any one of claims 1-4, 6-8, and 12-16, characterized in that, The first transformation function includes an S-shaped transformation curve or an inverse S-shaped transformation curve.

18. The method as described in claim 17, characterized in that, The S-shaped transition curve is a curve that first rises and then falls.

19. The method as described in claim 17, characterized in that, The S-shaped transition curve conforms to the following formula: ; Among them, the For the maximum value, the The transformation value is defined as a, b, p, and m, which are the dynamic parameters of the S-shaped transformation curve.

20. The method as described in claim 19, characterized in that, The p and m are obtained by searching a first preset list based on statistical information of the image to be processed or the image sequence in which the image to be processed is located; a and b are calculated using the following formula: ; ; Among them, the The first reference value is the image to be processed or the range of the image sequence in which the image to be processed is located. The second reference value is the image to be processed or the range of the image sequence in which the image to be processed is located. The first reference value is the target image or the range of the target image sequence. It is a second reference value for the target image or the range of the target image sequence.

21. The method as described in claim 17, characterized in that, The inverse S-shaped transition curve is a curve that first declines and then rises.

22. The method as described in claim 17, characterized in that, The inverse S-shaped transition curve takes the following form: ; Among them, the The maximum value among the primary color values ​​of multiple components of the pixel in the target image, wherein... The conversion value is the maximum value among the primary color values ​​of multiple components of the pixel of the target image, and the parameters a, b, p and m are the dynamic parameters of the inverse S-shaped conversion curve.

23. The method as described in claim 22, characterized in that, The parameters p and m are obtained by searching the second preset list; The parameters a and b are calculated using the following formula: ; ; Among them, the The first reference value is the image to be processed or the range of the image sequence containing the image to be processed. The second reference value is the image to be processed or the range of the image sequence in which the image to be processed is located. The first reference value is the target image or the range of the target image sequence. The second reference value is the range of the target image or the target image sequence.

24. An image color processing apparatus, characterized in that, include: The determination module is used to determine the maximum value among the primary color values ​​of multiple components of the pixels in the image to be processed; According to the first lookup table, a ratio that has a mapping relationship with the maximum value is determined, wherein the first lookup table includes a mapping relationship between a preset ratio and a preset primary color value; A processing module is configured to dynamically adjust the primary color values ​​of the plurality of components of the pixel according to the determined ratio to obtain a target image; wherein the processing module determines the mapping relationship according to the following operations: obtaining the conversion value of the preset primary color value according to a first conversion function; and taking the ratio of the conversion value to the preset primary color value as the preset ratio. The first entry value of the first lookup table is: the ratio of the converted value of the first lookup value obtained by the first conversion function to the first lookup value; the first entry value represents a preset ratio, and the first lookup value represents a preset primary color value; The first lookup value is a fixed-point value; the determining module is used to perform the following operations to determine the value of the first table entry: Determine the dynamic parameters of the first transformation function; Based on the value range determined by the bit width of the primary color value, the fixed-point value is dequantized to obtain a floating-point value; the floating-point value is the ratio of the fixed-point value to the maximum value of the value range. Based on the first conversion function after determining the dynamic parameters, the floating-point value is converted into a converted value; The ratio of the converted value to the floating-point value is quantized according to a preset quantization coefficient to obtain the value of the first entry.

25. The apparatus as claimed in claim 24, characterized in that, The determining module is used for: When the preset primary color value includes the maximum value: determine the ratio corresponding to the maximum value according to the mapping relationship; When the preset primary color value does not include the maximum value: Determine the first preset primary color value and the second preset primary color value in the first lookup table; Based on the mapping relationship, the first ratio and the second ratio corresponding to the first preset primary color value and the second preset primary color value are determined respectively; Interpolation is performed on the first ratio and the second ratio to obtain the ratio corresponding to the maximum value.

26. The apparatus as claimed in claim 25, characterized in that, The interpolation operation includes any of the following types of operations: linear interpolation, near interpolation, bilinear quadratic interpolation, cubic interpolation, or Lanczos interpolation.

27. The apparatus as claimed in claim 24, characterized in that, The first lookup value is determined based on the index value of the first lookup table and the step size between the index values ​​of the first lookup table; the first lookup value is the product of the index value of the first lookup value and the step size.

28. The apparatus according to any one of claims 24 to 27, characterized in that, The first lookup table is the lookup table corresponding to the first value range in which the maximum value is located; The value range determined by the bit width of the primary color value includes the first value range and the second value range corresponding to the second lookup table.

29. The apparatus as claimed in claim 28, characterized in that, The second entry value of the second lookup table is the ratio of the converted value of the second lookup value obtained by the first conversion function to the second lookup value.

30. The apparatus as claimed in claim 28, characterized in that, The minimum value in the first value range is greater than the maximum value in the second value range; Correspondingly, the first lookup value is determined 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.

31. The apparatus as claimed in claim 28, characterized in that, The step size between index values ​​in the first lookup table is different from the step size between index values ​​in the second lookup table.

32. The apparatus according to any one of claims 24-27 and 29-30, characterized in that, The processing module is used for: When the dynamic range of the image to be processed is greater than the dynamic range of the target image, the primary color values ​​of the multiple components of the pixel are adjusted to reduce the dynamic range according to the ratio. or, When the dynamic range of the image to be processed is smaller than the dynamic range of the target image, the primary color values ​​of the multiple components of the pixel are adjusted to expand the dynamic range according to the ratio.

33. The apparatus according to any one of claims 24-27 and 29-30, characterized in that, The processing module is used for: The product of the ratio and the primary color values ​​of the plurality of components of the pixel is calculated respectively to obtain the adjusted primary color values ​​of the plurality of components of the pixel.

34. The apparatus according to any one of claims 24-27 and 29-30, characterized in that, The image to be processed is located in the image sequence to be processed, and the target image is located in the target image sequence. The processing module is used to perform the following operations to determine the dynamic parameters of the first transformation function: The dynamic parameter is determined based on at least one of the following information: Statistical information of the image to be processed or the sequence of images to be processed; a first reference value for the range of the image to be processed or the sequence of images to be processed; The image to be processed or the range of the image sequence to be processed is a second reference value; the target image or the range of the target image sequence is a first reference value; the target image or the range of the target image sequence is a second reference value.

35. The apparatus as claimed in claim 34, characterized in that, The statistical information of the image to be processed or the sequence of images to be processed includes at least one of the following: The maximum, minimum, average, standard deviation, and histogram distribution information of the primary color values ​​of at least one component of the pixel points of the image to be processed or the image sequence to be processed.

36. The apparatus as claimed in claim 34, characterized in that, The first reference value of the range of the image to be processed or the image sequence to be processed includes: The maximum brightness value of the display device used to display the image to be processed; or... Based on the statistical information of the image to be processed or the sequence of images to be processed, the value obtained from the first preset list is searched; or, First preset value.

37. The apparatus as claimed in claim 34, characterized in that, The second reference value for the range of the image to be processed or the sequence of images to be processed includes: The minimum brightness value of the display device used to display the image to be processed; or... Based on the statistical information of the image to be processed or the sequence of images to be processed, the value obtained from the second preset list is searched; or, Second preset value.

38. The apparatus as claimed in claim 34, characterized in that, The target image or the first reference value of the target image sequence range includes: The maximum brightness of the display device used to display the target image; or, Third preset value.

39. The apparatus as claimed in claim 34, characterized in that, The target image or the second reference value of the target image sequence range includes: The minimum brightness value of the display device used to display the target image; or... Fourth preset value.

40. The apparatus according to any one of claims 24-27, 29-30, and 35-39, characterized in that, The first transformation function includes an S-shaped transformation curve or an inverse S-shaped transformation curve.

41. The apparatus as claimed in claim 40, characterized in that, The S-shaped transition curve is a curve that first rises and then falls.

42. The apparatus as claimed in claim 40, characterized in that, The S-shaped transition curve conforms to the following formula: ; Among them, the For the maximum value, the The transformation value is defined as a, b, p, and m, which are the dynamic parameters of the S-shaped transformation curve.

43. The apparatus as claimed in claim 42, characterized in that, The p and m are obtained by searching a first preset list based on statistical information of the image to be processed or the image sequence in which the image to be processed is located; a and b are calculated using the following formula: ; ; Among them, the The first reference value is the image to be processed or the range of the image sequence in which the image to be processed is located. The second reference value is the image to be processed or the range of the image sequence in which the image to be processed is located. The first reference value is the target image or the range of the target image sequence. It is a second reference value for the target image or the range of the target image sequence.

44. The apparatus as claimed in claim 40, characterized in that, The inverse S-shaped transition curve is a curve that first declines and then rises.

45. The apparatus as claimed in claim 40, characterized in that, The inverse S-shaped transition curve takes the following form: ; Among them, the The maximum value among the primary color values ​​of multiple components of the pixel in the target image, wherein... The conversion value is the maximum value among the primary color values ​​of multiple components of the pixel of the target image, and the parameters a, b, p and m are the dynamic parameters of the inverse S-shaped conversion curve.

46. ​​The apparatus as claimed in claim 45, characterized in that, The parameters p and m are obtained by searching the second preset list; The parameters a and b are calculated using the following formula: ; ; Among them, the The first reference value is the image to be processed or the range of the image sequence containing the image to be processed. The second reference value is the image to be processed or the range of the image sequence in which the image to be processed is located. The first reference value is the target image or the range of the target image sequence. The second reference value is the range of the target image or the target image sequence.

47. An image color processing apparatus, characterized in that, include: A processor coupled to a memory for storing a program or instructions which, when executed by the processor, cause the method as described in any one of claims 1 to 23 to be performed.

48. A computer-readable storage medium, characterized in that, The computer storage medium stores computer-readable instructions, and when the computer-readable instructions are run on the communication device, the method described in any one of claims 1 to 23 is executed.

Citation Information

Patent Citations

  • Image processing method and device

    WO2018035696A1