Image conversion method and device, electronic equipment and storage medium

CN122597576APending Publication Date: 2026-08-18SHENZHEN SKYWORTH DISPLAY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610931752.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-25
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0005]本申请提供了一种图像转换方法、装置、电子设备及存储介质,以解决现有技术中对不同区域应用统一的非线性映射曲线,会导致转换后的图像出现细节丢失、亮度失衡及块状痕迹,转换效果不佳的问题

Benefits of technology

[0023] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application first classifies the pixels in the SDR image into multiple categories according to their physical attributes, and then converts the SDR image to the linear optical signal domain to obtain a linearized image; then, at least two target categories are determined from the multiple categories, and the pixels belonging to the target categories in the linearized image are expanded using different inverse tone mapping strategies to obtain a preliminary HDR image; then, the preliminary HDR image is weighted and fused based on the classification results of multiple categories to obtain a fused HDR image; finally, the fused HDR image is encoded to generate an HDR file. Through the organic combination of the above classification, differentiated expansion and weighted fusion, pixels with different physical attributes can obtain expansion processing that is adapted to them, and visual discontinuities caused by processing differences between regions can be eliminated, thereby effectively avoiding detail loss, brightness imbalance and blocky artifacts, and significantly improving the conversion quality from SDR to HDR.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597576A_ABST
    Figure CN122597576A_ABST
Patent Text Reader

Abstract

The application provides an image conversion method and device, electronic equipment and storage medium. The method comprises: acquiring an input SDR image, classifying pixels in the SDR image into multiple categories according to physical properties; converting the SDR image to a linear light signal domain to obtain a linearized image; determining at least two target categories from the multiple categories, respectively expanding pixels belonging to the target categories in the linearized image to obtain a preliminary HDR image, wherein different target categories use different inverse tone mapping strategies for expansion; based on the multiple categories, performing weighted fusion on the preliminary HDR image to obtain a fused HDR image; and encoding the fused HDR image to generate an HDR file.
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 conversion method, apparatus, electronic device and storage medium. Background Technology

[0002] The peak brightness of a Standard Dynamic Range (SDR) image is approximately 100 cd / m², while the peak brightness of a High Dynamic Range (HDR) display device can reach 1000 cd / m² or even higher. Converting SDR images to HDR images for playback on HDR display devices has become a crucial requirement in the field of image processing. One existing inverse tone mapping method applies a uniform non-linear mapping curve to the entire SDR image, stretching the overall SDR brightness range to the HDR brightness range.

[0003] Existing SDR to HDR conversion methods can be mainly divided into the following categories: The first category is the reverse application of global tone mapping operators, which achieves brightness expansion by inverting operators such as Reinhard and Drago, applying a single mapping to the entire image without distinguishing the physical differences such as self-illumination, specular reflection, and diffuse reflection; The second category is an end-to-end method based on convolutional neural networks, which directly learns the SDR to HDR mapping, relies on large-scale paired training data, has poor interpretability, and requires high inference computing power; The third category is a fixed mapping based on HDR10 static or dynamic metadata, which is only applicable to content with metadata and is completely ineffective for existing SDR; In addition, some implementations directly perform linear multiplication or exponential operations in the sRGB gamma coding domain. Since the gamma domain coding value has a power function relationship with the linear light brightness, the linear operation in this domain will be equivalent to the nonlinear deformation of the linear light domain, which will destroy photometric consistency.

[0004] However, applying a uniform nonlinear mapping curve to different regions can lead to loss of detail, brightness imbalance, and blocky artifacts in the converted image, resulting in poor conversion quality. Summary of the Invention

[0005] This application provides an image conversion method, apparatus, electronic device, and storage medium to solve the problem in the prior art that applying a uniform nonlinear mapping curve to different regions can lead to loss of detail, brightness imbalance, and blocky artifacts in the converted image, resulting in poor conversion quality.

[0006] In a first aspect, this application provides an image conversion method, including: Obtain the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical properties; The SDR image is converted to the linear optical signal domain to obtain a linearized image; At least two target categories are determined from the multiple categories, and the pixels belonging to the target categories in the linearized image are expanded respectively to obtain a preliminary HDR image, wherein different target categories are expanded using different inverse tone mapping strategies; Based on multiple categories, the preliminary HDR image is weighted and fused to obtain the fused HDR image; The fused HDR image is encoded to generate an HDR file.

[0007] In one possible implementation, the expansion of pixels belonging to the target category in the linearized image includes: For pixels belonging to the first target category, a mapping curve is used to expand the pixels. The mapping curve is used to define the correspondence between the input value and the output value of the pixel. Below the preset brightness threshold, the output value is equal to the input value. Above the preset brightness threshold, the output value increases monotonically with the input value and the growth rate gradually slows down, and approaches the preset target peak brightness. For pixels belonging to the second target category, the pixels are converted from the linear optical signal domain to the perceptual color space, the chromaticity components are enhanced, and then the pixels are returned to the linear optical signal domain to expand the pixels. For pixels belonging to the third target category, the pixels are expanded by multiplying the input value of the pixel by a weighting function, wherein the value of the weighting function first increases and then stabilizes as the input value increases.

[0008] In one possible implementation, the step of converting the pixel from the linear optical signal domain to the perceived color space, enhancing the chromaticity components, and then returning it to the linear optical signal domain includes: The pixel is converted from the linear optical signal domain to the gamma coding domain; In the gamma coding domain, the pixel is converted to the perceptual color space, and the chromaticity components are enhanced; The enhanced pixel is converted from the perceptual color space back to the gamma coding domain, and then returned from the gamma coding domain to the linear optical signal domain.

[0009] In one possible implementation, the weighted fusion of the preliminary HDR image based on multiple categories to obtain the fused HDR image includes: For each category, a soft mask corresponding to that category is generated based on the pixels belonging to that category; The intermediate HDR image corresponding to the category is obtained by weighted multiplication of the preliminary HDR image with the soft mask corresponding to the category. The intermediate HDR images are added together to obtain the fused HDR image.

[0010] In one possible implementation, encoding the fused HDR image to generate an HDR file includes: The fused HDR image is decomposed into a base layer and an ultra-white head, wherein the pixel value of the base layer does not exceed the standard dynamic range peak value, and the pixel value of the ultra-white head exceeds the standard dynamic range peak value. Perform smoothing filtering on the base layer; The smoothed base layer is merged with the ultra-white head to obtain a smoothed HDR image; The smoothed HDR image is encoded to generate an HDR file.

[0011] In one possible implementation, encoding the fused HDR image to generate an HDR file includes: The fused HDR image is converted from the standard dynamic range color gamut to the target color gamut, wherein the color gamut range of the target color gamut is larger than that of the standard dynamic range color gamut; Perform absolute brightness scaling on the HDR image after color gamut conversion; Perceptual quantization encoding is performed on the HDR image after brightness scaling; Apply dithering to the encoded HDR image; The HDR image after dithering is quantized to generate an HDR file.

[0012] In one possible implementation, prior to the weighted fusion of the initial HDR image based on the multiple categories, the method further includes: For each pixel in the preliminary HDR image, a gain limit for the pixel is determined based on the pixel's brightness value, and the values ​​of pixels exceeding the gain limit are adjusted to the gain limit. For pixels with brightness values ​​below a preset threshold, the values ​​of the corresponding pixels in the SDR image and the values ​​of the pixels in the preliminary HDR image are weighted and summed according to a preset weight, and the summation result is used to replace the values ​​of the pixels in the preliminary HDR image. For pixels whose chromaticity values ​​exceed a preset multiple of the corresponding pixel chromaticity values ​​in the SDR image, the chromaticity values ​​of the pixels are reduced.

[0013] Secondly, this application provides an image conversion apparatus, comprising: The acquisition module is used to acquire the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical properties. The conversion module is used to convert the SDR image to the linear optical signal domain to obtain a linearized image; An extension module is used to determine at least two target categories from a plurality of categories, and extend the pixels in the linearized image that belong to the target categories respectively to obtain a preliminary HDR image, wherein different target categories are extended using different inverse tone mapping strategies; A fusion module is used to perform weighted fusion on the preliminary HDR image based on multiple categories to obtain a fused HDR image; The encoding module is used to encode the fused HDR image to generate an HDR file.

[0014] In one possible implementation, the extension module is specifically used for: For pixels belonging to the first target category, a mapping curve is used to expand the pixels. The mapping curve is used to define the correspondence between the input value and the output value of the pixel. Below the preset brightness threshold, the output value is equal to the input value. Above the preset brightness threshold, the output value increases monotonically with the input value and the growth rate gradually slows down, and approaches the preset target peak brightness. For pixels belonging to the second target category, the pixels are converted from the linear optical signal domain to the perceptual color space, the chromaticity components are enhanced, and then the pixels are returned to the linear optical signal domain to expand the pixels. For pixels belonging to the third target category, the pixels are expanded by multiplying the input value of the pixel by a weighting function, wherein the value of the weighting function first increases and then stabilizes as the input value increases.

[0015] In one possible implementation, the extension module is further configured to: The pixel is converted from the linear optical signal domain to the gamma coding domain; In the gamma coding domain, the pixel is converted to the perceptual color space, and the chromaticity components are enhanced; The enhanced pixel is converted from the perceptual color space back to the gamma coding domain, and then returned from the gamma coding domain to the linear optical signal domain.

[0016] In one possible implementation, the fusion module is specifically used for: For each category, a soft mask corresponding to that category is generated based on the pixels belonging to that category; The intermediate HDR image corresponding to the category is obtained by weighted multiplication of the preliminary HDR image with the soft mask corresponding to the category. The intermediate HDR images are added together to obtain the fused HDR image.

[0017] In one possible implementation, the encoding module is specifically used for: The fused HDR image is decomposed into a base layer and an ultra-white head, wherein the pixel value of the base layer does not exceed the standard dynamic range peak value, and the pixel value of the ultra-white head exceeds the standard dynamic range peak value. Perform smoothing filtering on the base layer; The smoothed base layer is merged with the ultra-white head to obtain a smoothed HDR image; The smoothed HDR image is encoded to generate an HDR file.

[0018] In one possible implementation, the encoding module is further configured to: The fused HDR image is converted from the standard dynamic range color gamut to the target color gamut, wherein the color gamut range of the target color gamut is larger than that of the standard dynamic range color gamut; Perform absolute brightness scaling on the HDR image after color gamut conversion; Perceptual quantization encoding is performed on the HDR image after brightness scaling; Apply dithering to the encoded HDR image; The HDR image after dithering is quantized to generate an HDR file.

[0019] In one possible implementation, the device further includes a protection module for: For each pixel in the preliminary HDR image, a gain limit for the pixel is determined based on the pixel's brightness value, and the values ​​of pixels exceeding the gain limit are adjusted to the gain limit. For pixels with brightness values ​​below a preset threshold, the values ​​of the corresponding pixels in the SDR image and the values ​​of the pixels in the preliminary HDR image are weighted and summed according to a preset weight, and the summation result is used to replace the values ​​of the pixels in the preliminary HDR image. For pixels whose chromaticity values ​​exceed a preset multiple of the corresponding pixel chromaticity values ​​in the SDR image, the chromaticity values ​​of the pixels are reduced.

[0020] Thirdly, this application provides an electronic device, including: a processor and a memory, wherein the processor is configured to execute an image conversion program stored in the memory to implement the image conversion method described in any one of the first aspects.

[0021] Fourthly, this application provides a storage medium storing one or more programs that can be executed by one or more processors to implement the image conversion method described in any one aspect.

[0022] Fifthly, this application provides a computer program product containing instructions that, when run on a computer, causes the computer to perform any of the image conversion methods described above.

[0023] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application first classifies the pixels in the SDR image into multiple categories according to their physical attributes, and then converts the SDR image to the linear optical signal domain to obtain a linearized image; then, at least two target categories are determined from the multiple categories, and the pixels belonging to the target categories in the linearized image are expanded using different inverse tone mapping strategies to obtain a preliminary HDR image; then, the preliminary HDR image is weighted and fused based on the classification results of multiple categories to obtain a fused HDR image; finally, the fused HDR image is encoded to generate an HDR file. Through the organic combination of the above classification, differentiated expansion and weighted fusion, pixels with different physical attributes can obtain expansion processing that is adapted to them, and visual discontinuities caused by processing differences between regions can be eliminated, thereby effectively avoiding detail loss, brightness imbalance and blocky artifacts, and significantly improving the conversion quality from SDR to HDR. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0027] Figure 1 A flowchart illustrating an embodiment of an image conversion method provided in this application; Figure 2 A flowchart illustrating an embodiment of another image conversion method provided in this application; Figure 3 A flowchart illustrating another embodiment of the image conversion method provided in this application; Figure 4 This is a schematic diagram of the overall process of the image conversion method provided in the embodiments of this application; Figure 5 A block diagram illustrating an embodiment of an image conversion apparatus provided in this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0030] To address the technical problem in existing technologies where applying a uniform nonlinear mapping curve to different regions leads to loss of detail, brightness imbalance, and blocky artifacts in the converted image, resulting in poor conversion quality, this application provides an image conversion method that enables pixels with different physical properties to receive appropriate extended processing and eliminates visual discontinuities caused by processing differences between regions. This effectively avoids loss of detail, brightness imbalance, and blocky artifacts, significantly improving the conversion quality from SDR to HDR.

[0031] Figure 1 This is a flowchart illustrating an embodiment of an image conversion method provided in this application. Figure 1 As shown, the method includes the following steps: Step 101: Obtain the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical attributes.

[0032] SDR (Standard Dynamic Range): refers to an image format with a peak brightness of approximately 100 cd / m², using sRGB or BT.709 gamma transfer function, 8-bit quantization, and Rec.709 color gamut.

[0033] Pixel: refers to the smallest image unit that makes up a digital image. Each pixel has a corresponding color value and brightness value.

[0034] Physical properties refer to the light-emitting or reflective characteristics of objects in the image area corresponding to a pixel, including three categories: self-illumination, material reflection, and ordinary diffuse reflection. Self-illumination refers to the object itself generating light, such as lamps, screens, and flames; material reflection refers to the specular reflection of light by the object's surface, such as the highlights of metals and glass; ordinary diffuse reflection refers to the uniform diffuse reflection of light by the object's surface, such as paper, cloth, and walls.

[0035] Category: Refers to the region type obtained after dividing pixels based on physical properties, including Type I self-illuminating region, Type II material reflection region, and Type III ordinary diffuse reflection region.

[0036] In this embodiment of the application, after acquiring the input SDR image, the pixels in the image are automatically classified into Type I self-illuminating regions, Type II material reflection regions, and Type III ordinary diffuse reflection regions by using a semantic detection and physical feature fusion method.

[0037] First, the identification of Type I self-illuminating regions is performed. This application employs a dual-channel fusion method combining semantic detection and constrained neighborhood brightness enhancement. Channel 1 is semantic detection: the input SDR image is subjected to object detection model inference to extract target boxes belonging to the semantic category of self-illuminating objects, including keyword matching categories such as lamps, screens, televisions, mobile phones, laptops, flames, and candles. The pixels within the detection boxes are filled as semantic candidate masks. Channel 2 is constrained brightness feature enhancement: the brightness threshold is increased to 0.95 (in the V channel of the HSV color space), and the saturation S is required to be less than 0.25, because light sources are usually white with low saturation characteristics. If the semantic detection result is empty (i.e., no self-illuminating objects are detected), the brightness enhancement channel is not effective, and brightness feature enhancement is not performed in this case; if a self-illuminating object is detected semantically, a 31×31 elliptical morphological dilation is performed on the semantic mask to obtain the neighborhood. The brightness candidate mask only intersects with this neighborhood to expand the real self-illuminating extension areas such as lampshade halos and screen edge light leakage, avoiding misjudgments in the entire image. Subsequently, 5×5 elliptic morphological closing and opening operations are applied to filter connected regions with an area of ​​less than 100 pixels. Finally, the intersection with the brightness threshold of 0.85 is taken, and the pixels that meet the above conditions are marked as Type I self-illuminating regions.

[0038] Secondly, the identification of Type II material reflection areas is performed. This application adopts a fusion detection method of multi-feature complementarity plus local contrast protection. Feature 1 is the brightness threshold, with pixels V greater than 0.7 as candidates. Feature 2 is high brightness and low saturation plus local contrast protection: the physical characteristics of specular reflection are "high brightness plus low saturation", but the sky and white walls also meet this condition. Therefore, this application requires that the pixels must be close to saturation or have significant local protrusions (the difference from the 9×9 Gaussian local mean is greater than the threshold), and smooth bright backgrounds will no longer be misjudged. Feature 3 is local maxima plus local contrast: a 15×15 maximum value filter is applied to the YCbCr brightness channel, requiring pixels to be close to the local maximum value and to be close to saturation or have obvious local contrast. The fusion strategy is: after averaging the three feature masks, binarization is performed with a threshold of 0.5. Pixels that "more than half of the features are satisfied" are marked as candidates, which is robust to false positives of a single feature. Pixels that meet the above conditions and are not marked as Type I are marked as Type II material reflection areas.

[0039] Finally, the remaining pixels outside the Type I and Type II regions are marked as Type III ordinary diffuse reflection regions.

[0040] After classification, since candidate regions generated by methods such as semantic detection, constrained brightness enhancement, and multi-feature reflection detection may overlap, it is necessary to determine the final category of each pixel according to priority rules. The priority rules set in this application are as follows: Type I self-illuminating regions have the highest priority, Type II material reflection regions have the second highest priority, and Type III ordinary diffuse reflection regions have the lowest priority. Specifically, pixels that simultaneously meet the self-illuminating candidate condition and have a brightness greater than 0.85 are identified as Type I; pixels that meet the reflection candidate condition and have a brightness greater than 0.7 but are not identified as Type I are identified as Type II; and the remaining pixels are identified as Type III.

[0041] To avoid burrs and small holes at the classification boundaries, the classification results are smoothed. This application employs the following method: A 3×3 elliptic morphological closing operation (i.e., dilation followed by erosion) is performed independently on each of the Type I, Type II, and Type III regions to fill the small holes within each region and connect breakpoints. After the closing operation, the classification map is written sequentially in ascending order of priority: Type III region first, then Type II region, and finally Type I region. By using a low-priority region first and high-priority region last, pixels in the later-written high-priority region will cover pixels in the earlier-written low-priority region. This ensures that while filling small holes and smoothing boundaries, elongated high-priority regions such as filaments and screen highlights are not eroded by the morphological operations on low-priority regions.

[0042] Step 102: Convert the SDR image to the linear optical signal domain to obtain a linearized image.

[0043] Linear optical signal domain: refers to the signal space in which the pixel value and physical brightness are linearly related. In this space, a pixel value of 1.0 corresponds to a physical brightness of 100 cd / m². When the brightness doubles, the pixel value also doubles.

[0044] Linearized image: refers to the image obtained by converting the non-linear pixel values ​​of an SDR image that have been encoded with gamma into linear light values.

[0045] In this embodiment, before all inverse tone mapping processes, the SDR image obtained in step 101 is precisely converted to the linear optical signal domain to obtain a linearized image. Specifically, a segmented sRGB EOTF (electro-optical conversion function) defined by the IEC 61966-2-1 standard is applied to the input SDR image. The conversion rules are as follows: when the pixel value is less than or equal to 0.04045, the linear light value is equal to the pixel value divided by 12.92; when the pixel value is greater than 0.04045, the linear light value is equal to ((pixel value + 0.055) / 1.055) raised to the power of 2.4. Through this conversion, the original gamma-coded pixel value is restored to a linear light value, where a linear light value of 1.0 corresponds to a physical brightness of 100 cd / m². This linearization step is explicitly placed before all inverse tone mapping processes to ensure that subsequent operations such as brightness expansion and color space conversion are performed in the physically correct linear optical domain. Meanwhile, parameter control is provided when implementing the color space conversion interface to avoid repeated EOTF conversion in the color gamut conversion step at the end of the pipeline, thereby avoiding the luminance square error caused by double linearization.

[0046] Step 103: Determine at least two target categories from the multiple categories, and expand the pixels belonging to the target categories in the linearized image to obtain a preliminary HDR image. Different target categories are expanded using different inverse tone mapping strategies.

[0047] HDR (High Dynamic Range): refers to an image format with a peak brightness of 1000 cd / m² or higher, using the SMPTE ST 2084 PQ transfer function, quantization of 10 bits or more, and the ITU-R BT.2020 color gamut.

[0048] Extended range: refers to the process of upscaling the brightness and color values ​​of SDR pixels from the SDR range (peak value of about 100 cd / m²) to the HDR range (peak value of more than 1000 cd / m²).

[0049] Inverse Tone Mapping (ITM) refers to the reverse process of mapping the brightness values ​​of a low dynamic range image to high dynamic range brightness values, which is the opposite of the traditional tone mapping process of compressing HDR to SDR.

[0050] In this embodiment, firstly, at least two target categories are determined from the multiple categories obtained in step 101. Specifically, based on the actual application scenario and computational resource constraints, this application uses any of the following methods to determine the target categories that need to be expanded: Method 1 (Complete Processing): All three categories—Type I, Type II, and Type III—are determined as target categories, and corresponding expansion strategies are applied to the three types of regions to obtain the best HDR conversion quality. Method 2 (Self-Emitting Priority Processing): When computational resources are limited or there are high requirements for processing speed, only the Type I self-emitting region and the Type III ordinary diffuse reflection region are determined as target categories. A specular expansion strategy is applied to Type I, and a mild gain strategy is applied to Type III. The Type II material reflection region is not specifically expanded to reduce computational complexity. Method 3 (Reflection Priority Processing): When the proportion of material reflection regions in the image is large (such as images with metal products or glassware as the main body), only the Type II material reflection region and the Type III ordinary diffuse reflection region are determined as target categories. A chroma enhancement strategy is applied to Type II, and a mild gain strategy is applied to Type III. The above three methods can be selected based on the scene classification results of the input image or the parameters specified by the user.

[0051] Then, a specialized inverse tone mapping strategy is applied to the pixels belonging to each target category in the linearized image obtained in step 102 to expand them, resulting in a preliminary HDR image. Different inverse tone mapping strategies are used for different target categories. Specifically, this application designs specialized expansion strategies for three types of regions with different physical properties: for self-illuminating regions, a specular expansion strategy is used to infer and expand the truncated highlight regions in SDR to a higher HDR brightness range; for material reflection regions, a chromaticity enhancement strategy is used to enhance color saturation and color levels while increasing brightness; for ordinary diffuse reflection regions, a mild gain strategy is used to moderately brighten midtones while preserving details in dark areas. Through the above differentiated inverse tone mapping strategies, specialized expansion algorithms are applied to the physical nature of self-illumination, material reflection, and diffuse reflection, respectively, improving the dynamic range while maintaining the visual realism of various regions.

[0052] Step 104: Based on multiple categories, perform weighted fusion on the preliminary HDR image to obtain the fused HDR image.

[0053] Weighted fusion: refers to the process of summing the results of different regions after differential processing according to their weights and merging them into a complete HDR image.

[0054] In this embodiment, the differentiated processing results of each region obtained in step 103 are weighted and fused based on the classification information obtained in step 101 to obtain a fused HDR image. Specifically, firstly, a corresponding weight map is generated according to the pixel distribution of each category. This weight map is smoothed by taking a value of 1 inside the category and a value of 0 outside the category to obtain a soft weight map. Then, the extended results of each category are weighted and multiplied with the corresponding soft weight map to obtain intermediate HDR images for each category. Finally, all intermediate HDR images are added together to obtain the fused HDR image. Through the above weighted fusion method, the results of independently processed regions are smoothly merged into a complete HDR image, avoiding abrupt transitions at region boundaries. The specific generation method of the weight map will be described in detail in subsequent embodiments.

[0055] Step 105: Encode the fused HDR image to generate an HDR file.

[0056] Encoding: refers to the process of converting the fused HDR image data into a specific file format and writing the necessary color metadata, so that the HDR player can correctly parse and display it.

[0057] In this embodiment of the application, the fused HDR image obtained in step 104 is encoded to generate an HDR file that can be correctly displayed by an HDR player.

[0058] Specifically, the encoding process includes the following sub-steps: First, the fused HDR image undergoes color gamut conversion, transforming it from the standard dynamic range (DVR) color gamut to the target color gamut, where the target color gamut has a wider range than the DVR. Second, the DVR image undergoes absolute luminance scaling, scaling its peak luminance from the luminance value corresponding to the DVR to the luminance value corresponding to the high dynamic range. Then, the luminance-scaled HDR image undergoes perceptual quantization encoding, converting linear luminance into perceptually uniform digital encoded values. Next, dithering is applied to the encoded HDR image to eliminate periodic stripes that may occur during quantization. Subsequently, the dithered HDR image undergoes quantization, outputting integer data with a specified bit depth. Finally, the quantized HDR image data is encoded into the target file format, and the necessary color metadata is written to generate the HDR file. Through these encoding steps, the output HDR file can be correctly recognized and displayed in HDR-supporting rendering environments.

[0059] The technical solution provided in this application first classifies the pixels in the SDR image into multiple categories according to their physical attributes, and then converts the SDR image to the linear optical signal domain to obtain a linearized image. Next, at least two target categories are determined from the multiple categories, and pixels belonging to each target category in the linearized image are expanded using different inverse tone mapping strategies to obtain a preliminary HDR image. Then, based on the classification results of multiple categories, the preliminary HDR image is weighted and fused to obtain a fused HDR image. Finally, the fused HDR image is encoded to generate an HDR file. Through the organic combination of the above classification, differentiated expansion, and weighted fusion, pixels with different physical attributes can receive appropriate expansion processing, and visual discontinuities caused by processing differences between regions can be eliminated. This effectively avoids detail loss, brightness imbalance, and blocky artifacts, significantly improving the conversion quality from SDR to HDR.

[0060] Figure 2 A flowchart illustrating an embodiment of another image conversion method provided in this application. Figure 2 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 201: For pixels belonging to the first target category, the pixels are expanded using a mapping curve. The mapping curve is used to define the correspondence between the input value and the output value of the pixel. Below the preset brightness threshold, the output value is equal to the input value. Above the preset brightness threshold, the output value increases monotonically with the input value and the growth rate gradually slows down, and approaches the preset target peak brightness.

[0061] First target category: refers to Type I self-illuminating region, which is the set of pixels in the image that belong to self-illuminating objects, such as lamps, screens, flames, etc.

[0062] Mapping curve: refers to the function that defines the correspondence between input luminance values ​​and output luminance values. In this application, the knee-reinhard curve is used to extend SDR luminance to the HDR range.

[0063] Preset brightness threshold: refers to the inflection point in the knee-Reinhard mapping curve, with a default value of 0.7 (in the linear optical domain, 1.0 corresponds to 100 cd / m²). Below this threshold, the output value equals the input value; above the threshold, expansion begins. Target peak brightness: refers to the target HDR expansion factor, with a default value of 1.3x. The mapping curve smoothly approaches this value.

[0064] In this embodiment, for pixels belonging to the first target category (Type I self-emissive region), a knee-Reinhard mapping curve is used for highlight extension. The physical basis is that the true physical brightness of a self-emissive object far exceeds the SDR peak (100 cd / m²). In SDR, these areas have been truncated to 1.0, and HDR conversion needs to infer its original higher brightness based on content characteristics. Specifically, a segmented mapping is applied to the BT.709 weighted brightness of the pixel in the linear light domain: a preset brightness threshold (inflection point L_knee) is set to 0.7. Below the preset brightness threshold, the output value equals the input value, that is, it is completely transparent below the inflection point and does not affect the midtones; above the preset brightness threshold, the output value monotonically increases with the input value and the growth rate gradually slows down, that is, a Reinhard asymptotic roll-off is applied to smoothly approach the preset target peak multiple highlight_extension (default 1.3). This mapping curve possesses four key properties: monotonicity preservation (no brightness reversal), complete transparency below the inflection point (no impact on midtones), smooth asymptotic approach without abrupt changes, and allows output exceeding 1.0 (HDR ultra-white). After expansion, each RGB channel is scaled according to a linear brightness ratio to maintain tonal relationships.

[0065] In a preferred embodiment, after the above expansion is completed, CLAHE local contrast enhancement and bilateral detail preservation can be applied to the expansion result. Finally, differential mixing is performed according to strength (default 1.5), which only applies to the Type I region. CLAHE (Limited Contrast Adaptive Histogram Equalization) only supports integer type input. In this application, the L channel of LAB is mapped proportionally to uint16 (65536 levels) before being fed to CLAHE, reducing quantization noise by 256 times compared to the traditional uint8 (256 levels) method.

[0066] Step 202: For pixels belonging to the second target category, the pixels are converted from the linear light signal domain to the perceptual color space, the chromaticity components are enhanced, and then the pixels are returned to the linear light signal domain to expand the pixels.

[0067] Second target category: refers to the Type II material reflection area, that is, the set of highlight pixels in the image that belong to specular reflective materials such as metal and glass.

[0068] Linear optical signal domain: refers to the signal space in which the pixel value and physical brightness are linearly related, with a pixel value of 1.0 corresponding to a physical brightness of 100 cd / m².

[0069] Perceptual color space: refers to the color space designed according to the characteristics of human eye perception, including HSV space (hue H, saturation S, brightness V) and LAB space (CIE L*a*b*, one dimension is brightness and two dimensions are chromaticity).

[0070] Chromaticity components: These refer to the channels that represent color information in the perceived color space. In the HSV space, they are the saturation S channel, and in the LAB space, they are the a channel and the b channel.

[0071] In this embodiment, for pixels belonging to the second target category (Type II material reflection area), a color space round-trip method is used for chromaticity expansion. The physical basis is that materials such as metal and glass, in an HDR environment, not only exhibit increased brightness but also stronger color saturation and color gradation. The technical challenge lies in the fact that OpenCV's LAB / HSV cvtColor function internally assumes that the input is an sRGB gamma-encoded signal; directly passing in linear light data will lead to perceptual errors in chromaticity calculation. This application's solution is a "color space round trip": First, the pixel is converted from the linear optical signal domain to the gamma-coded domain (applying sRGB OETF, photoelectric conversion function), because OpenCV's cvtColor function expects a gamma-coded signal as input; then, in the gamma-coded domain, the pixel is converted to the perceptual color space (HSV or LAB), and the chroma components are enhanced (multiplying the HSV saturation channel by material_enhancement by a default of 1.1, and scaling the LAB a / b channels by color_volume times centered on neutral gray by a default of 1.2); finally, the enhanced pixel is returned from the perceptual color space to the linear optical signal domain (first converted back to the gamma-coded domain, then sRGB EOTF is applied to restore it to the linear optical domain). Throughout the process, float32 floating-point precision is maintained (precision improved by approximately 260,000 times compared to uint8), rather than being converted to uint8 (256 levels), thus eliminating the 8-bit color banding caused by LAB / HSV conversion.

[0072] In a preferred embodiment, the above color space round-trip operation maintains float32 floating-point precision throughout. For the CLAHE operation, the L channel of LAB is further mapped to uint16 (65536 levels) proportionally before being fed to CLAHE, reducing quantization noise by 256 times compared to uint8. All bilateralFilter calls directly use float32 data in CV_32FC3 format, and the sigmaColor parameter is set to 0.08 to 0.3 on a scale of [0,1], fully preserving floating-point precision.

[0073] Step 203: For pixels belonging to the third target category, the pixels are expanded by multiplying the input value of the pixel by a weighting function, wherein the value of the weighting function first increases and then stabilizes as the input value increases.

[0074] Third target category: Refers to the Type III ordinary diffuse reflection area, that is, the pixel set in the image belonging to uniformly diffusely reflecting objects such as paper, cloth, and walls.

[0075] Weighting function: Refers to the function used to construct the gain factor. In this application, it is implemented by multiplying two smoothstep (S-shaped smooth transition function of Hermite interpolation) weights, and its value first increases and then stabilizes as the input value (brightness) increases.

[0076] In the embodiments of this application, for pixels belonging to the third target category (Type III ordinary diffuse reflection area), a smoothstep double-weighted gentle gain strategy is adopted for expansion. The physical basis is that the diffuse reflection area accounts for most pixels in the image, and HDR processing should be conservative - the dark part basically remains the original film (to avoid black blocks and dirty skin tones), and the middle tones are slightly brightened to cooperate with the Type I highlight expansion to maintain the global contrast. Specifically, the pixels are expanded by multiplying the input value of the pixels by the weighting function, where the value of the weighting function first increases and then stabilizes as the input value increases. The algorithm implementation is as follows: After calculating the linear light brightness L, two smoothstep weights are multiplied to construct the gain factor. The first weight is the dark part weight, defined as smoothstep(0.08, 0.22, L), so that the weight is 0 when L < 0.08 and 1 when L > 0.22; the second weight is the highlight weight, defined as smoothstep(0.22, 0.85, L), so that the weight is 0 when L < 0.22 and 1 when L > 0.85. The final gain factor = 1 + maximum gain (default 0.12) × dark part protection weight × highlight attenuation weight. This weighting function makes the gain of the dark part (L < 0.08) equal to 1, completely maintaining the original film; the dark middle tones (0.08 < L < 0.22) have a gradual transition; the medium-high brightness (0.22 < L < 0.85) is gently brightened by up to 12%; the extremely bright end (L > 0.85) has a stable upper limit of gain, avoiding overlapping with the expansion result of the Type I self-luminous area. This gain curve is consistent with the human eye's sensitivity to middle tone contrast and the need to protect dark part details.

[0077] By Figure 2The process described above demonstrates that, for self-illuminating areas, the knee-Reinhard mapping curve fully preserves the original brightness below a preset brightness threshold and smoothly expands above the threshold, approaching the target peak brightness. This achieves natural extension of highlights and allows for output of HDR super white values ​​exceeding 1.0. For material reflection areas, by converting pixels from the linear light signal domain to the perceived color space for chroma enhancement before returning to the linear light signal domain, chroma operations are ensured to be performed in the correct perceived signal domain, enhancing the color saturation and color gradation of the material reflection areas. For ordinary diffuse reflection areas, by multiplying the input value by a weighting function that first increases and then stabilizes with the input value, shadow protection, moderate brightening of midtones, and a stable upper limit for extreme brightness are achieved. These three strategies work together to achieve targeted expansion effects within their respective areas, maintaining the visual realism and naturalness of various regions overall.

[0078] Specifically, to achieve chroma enhancement from the linear optical signal domain to the perceived color space and back, step 202 may include the following steps: converting the pixel from the linear optical signal domain to the gamma coding domain; in the gamma coding domain, converting the pixel to the perceived color space and enhancing the chroma components; converting the enhanced pixel back from the perceived color space to the gamma coding domain, and returning from the gamma coding domain to the linear optical signal domain.

[0079] Gamma coding domain: refers to the nonlinear signal space of image data after gamma correction. In this space, the encoded value has a power function relationship with the display brightness. OpenCV's LAB / HSV color space conversion function (cvtColor) internally assumes that the input signal is in this domain.

[0080] In this embodiment, to achieve chroma enhancement from the linear optical signal domain to the perceptual color space and back, step 202 specifically includes the following sub-steps: First, the pixel is converted from the linear optical signal domain to the gamma-coded domain, specifically by applying sRGB OETF (electro-optical conversion function). This is because the OpenCV LAB / HSV cvtColor function internally assumes that the input is an sRGB gamma-coded signal, and directly passing in linear optical data will lead to perceptual errors in chroma calculation. Then, in the gamma-coded domain, the pixel is converted to the perceptual color space (HSV or LAB), and the chroma components are enhanced. Specifically, the HSV saturation channel is multiplied by material_enhancement (default 1.1), or the LAB a / b channels are scaled by color_volume (default 1.2) with neutral gray as the center. Finally, the enhanced pixel is converted back from the perceptual color space to the gamma-coded domain, and then returned from the gamma-coded domain to the linear optical signal domain. This is specifically achieved by first converting back to the gamma-coded domain and then applying sRGB EOTF (electro-optical conversion function) to restore it to the linear optical domain.

[0081] Through the aforementioned color space round-trip process, this application achieves the following beneficial effects: First, by converting pixels from the linear optical signal domain to the gamma coding domain before entering the perceptual color space, chroma operations are performed in the correct signal domain assumed by OpenCV functions, avoiding perceptual chroma calculation errors caused by directly performing LAB / HSV conversion in the linear optical domain; second, by enhancing the chroma components in the gamma coding domain and then returning to the linear optical signal domain through the gamma coding domain, it ensures that the chroma-expanded data can seamlessly connect to subsequent linear optical domain processing flows; finally, by maintaining float32 floating-point precision throughout, the color banding caused by uint8 conversion in existing technologies is eliminated, and the color saturation and color gradation of reflective areas of materials such as metal and glass are realistically and effectively enhanced.

[0082] In one embodiment, to ensure the fidelity of the extended result, the following steps may be included before step 104: for each pixel in the preliminary HDR image, determine the upper limit of the gain of the pixel based on the brightness value of the pixel, and adjust the values ​​of pixels exceeding the upper limit of the gain to the upper limit of the gain; for pixels with brightness values ​​lower than a preset threshold, perform a weighted summation of the value of the corresponding pixel in the SDR image and the value of the pixel in the preliminary HDR image according to a preset weight, and replace the value of the pixel in the preliminary HDR image with the summation result; for pixels with chroma values ​​exceeding a preset multiple of the chroma value of the corresponding pixel in the SDR image, reduce the chroma value of the pixel.

[0083] Gain cap: refers to the maximum allowable gain multiplier dynamically determined based on the pixel brightness value, used to prevent excessive expansion results.

[0084] Preset threshold: refers to the brightness boundary value used to determine the dark pixels. In this application, it is set to 0.025 (in the linear light domain, 1.0 corresponds to 100 cd / m²).

[0085] Preset weight: refers to the weighting coefficient between the original SDR pixel value and the initial HDR pixel value when restoring dark areas. In this application, it is set to 0.85, which means that 85% of the components after restoration come from the original SDR image.

[0086] Preset multiplier: refers to the upper limit of the chroma safety limit ratio. In this application, it is set to 1.82 times plus 0.03 margin, that is, the HDR chroma is required to be no more than 1.82 times plus 0.03 times the SDR chroma.

[0087] In this embodiment, to ensure the fidelity of the extended results, the following fidelity guard processing is applied to the preliminary HDR image obtained in step 103 before step 104 (weighted fusion). First, maximum gain segmented limiting is performed: for each pixel in the preliminary HDR image, its gain upper limit is determined based on the pixel's brightness value, and pixel values ​​exceeding the gain upper limit are adjusted to that upper limit. Specifically, the maximum allowable gain for dark areas (lower brightness), midtones, and highlights is limited to approximately 3%, 16%, and 75%, respectively. A smooth step interpolation is used between the three segments to obtain a pixel-by-pixel max_boost. If the HDR output exceeds the original SDR value multiplied by max_boost, it is proportionally reduced to prevent any region algorithm from over-brightening dark areas. Secondly, the original image is restored to its original dark areas: For extremely dark pixels with brightness values ​​below a preset threshold (L<0.025), the value of the corresponding pixel in the SDR image and the value of the same pixel in the preliminary HDR image are weighted and summed according to a preset weight (0.85), and the sum is used to replace the value of the same pixel in the preliminary HDR image. That is, after restoration, 85% of the original SDR image is restored, preventing any area algorithm from generating blocky faults in the dark areas. Finally, chroma safety limiting is performed: For pixels whose chroma values ​​exceed a preset multiple (1.82 times plus 0.03 margin) of the corresponding pixel chroma value in the SDR image, the chroma value of the pixel is reduced. Specifically, the chroma modulus of the original SDR and the processed HDR are measured. If the HDR chroma exceeds 1.82 times plus 0.03 of the SDR chroma, it is pushed back towards the brightness axis, compressing only the abnormally inflated chroma, and retaining the original saturated key hues such as green light sources and neon lights.

[0088] In the above scheme, firstly, by dynamically determining the gain upper limit based on the pixel brightness value and suppressing pixel values ​​exceeding the upper limit, the expansion intensity of each brightness area (dark areas, midtones, and highlights) is effectively limited, preventing visual distortion caused by excessive enhancement. Secondly, for extremely dark pixels with brightness values ​​below a preset threshold, the original SDR image value and the preliminary HDR image value are weighted and summed according to preset weights, and the mixed result is used to replace the original image, making the dark areas closer to the appearance of the original image and avoiding the dark areas being compressed into pure black blocks. Finally, by performing chroma reduction processing on pixels with chroma values ​​exceeding a preset multiple of the original SDR chroma, the abnormally inflated chroma is pushed back towards the brightness axis, effectively preventing color oversaturation while preserving the integrity of normal colors. These three layers of fidelity protection work together to improve the dynamic range while ensuring the visual quality of the expanded result.

[0089] Figure 3 This is a flowchart illustrating another embodiment of an image conversion method provided in this application. Figure 3 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 301: For each category, generate a soft mask corresponding to the category based on the pixels belonging to the category; Step 302: After performing a weighted multiplication of the preliminary HDR image and the soft mask corresponding to the category, the intermediate HDR image corresponding to the category is obtained; Step 303: Add the intermediate HDR images together to obtain the fused HDR image.

[0090] For ease of understanding, steps 301-303 will be explained uniformly below: Soft mask: refers to the mask obtained by converting a binary classification mask into continuous weight values ​​through low-pass filtering. Its edges have the characteristics of smooth transition, rather than hard boundaries of 0 and 1. In this application, a large kernel Gaussian filter is used to implement it.

[0091] Weighted multiplication: This refers to performing pixel-by-pixel multiplication between the initial HDR image and the soft mask, where the weight values ​​of the soft mask serve as multipliers, so that the processing results of different regions are mixed according to their weight ratios.

[0092] Intermediate HDR image: refers to the image obtained by multiplying the expanded result of a certain category by the soft mask of that category in a weighted manner. It represents the portion of the processing result of that category that is contributed to the final fused image according to the soft mask weight.

[0093] In this embodiment, based on the multiple categories obtained in step 101, the preliminary HDR image obtained in step 103 is weighted and fused to obtain a fused HDR image. Specifically, firstly, a soft mask corresponding to each category is generated according to the pixel distribution of each category. The soft mask is generated as follows: based on the binary mask of the category (values ​​are 1 inside the category and 0 outside), a large-kernel Gaussian filter is used for blurring to obtain a soft weight map with smooth edge transitions. The Gaussian filter kernel size is set to greater than or equal to 15×15 (preferably 31×31), and the sigma value is adaptive to the kernel size. Then, the preliminary HDR image obtained in step 103 is multiplied pixel-by-pixel with the soft mask corresponding to the category to obtain the intermediate HDR image of the category, so that the processing result of the category contributes to the intermediate result according to the weight ratio of the soft mask. Finally, the intermediate HDR images of all categories are added pixel-by-pixel to obtain the fused HDR image. Through the above weighted fusion method, the results of independently processed regions are smoothly merged into a complete HDR image. By using a large-kernel Gaussian filter of 15×15 or greater to generate a soft mask, compared with the existing technology that uses small-kernel feathering of 3×3 or 7×7, this application can ensure that the intensity transition at the region boundary is completely smooth and invisible when the Type I expansion intensity (e.g., 1.5 times) is much greater than the Type III expansion intensity (e.g., 1.12 times), thereby eliminating polygonal color block artifacts caused by intensity differences between regions.

[0094] Figure 3 The process described above firstly involves generating a soft mask and then summing the weighted multiplications of the expansion results for each category to smoothly merge the independently processed results of each region into a complete HDR image, avoiding harsh transitions at region boundaries. Secondly, a large-kernel Gaussian filter (≥15×15) is used to generate the soft mask. Compared to the small-kernel feathering method, this method can still ensure smooth boundary transitions even when there are large differences in expansion intensity between regions, completely eliminating polygonal color blocks and halo artifacts. Finally, the pixel-by-pixel weighted fusion method preserves the integrity of the processing results for each category, allowing the highlight expansion of self-illuminating regions, the chromaticity enhancement of material reflection regions, and the gentle gain of ordinary diffuse reflection regions to be naturally integrated into one, resulting in a continuous and unified overall visual effect.

[0095] In one embodiment, to achieve boundary smoothing for the separation of HDR and LDR layers, step 105 may specifically include the following steps: decomposing the fused HDR image into a base layer and a super white head, wherein the pixel value of the base layer does not exceed the standard dynamic range peak value, and the pixel value of the super white head exceeds the standard dynamic range peak value; performing smoothing filtering on the base layer; merging the smoothed base layer and the super white head to obtain a smoothed HDR image; and encoding the smoothed HDR image to generate an HDR file.

[0096] The base layer refers to the portion of the pixel values ​​separated from the fused HDR image that do not exceed the standard dynamic range peak (i.e., 1.0, corresponding to 100 cd / m²), and includes the normal brightness information within the SDR range.

[0097] Super white head: refers to the portion of pixel values ​​separated from the fused HDR image that exceed the standard dynamic range peak (i.e., greater than 1.0), including high dynamic range brightness information higher than the SDR peak generated after the self-emissive area is expanded.

[0098] Standard dynamic range peak: refers to the maximum luminance value that the SDR format can represent, which corresponds to 1.0 in the linear light domain and has a physical luminance of 100 cd / m².

[0099] Smoothing filtering: refers to the filtering operation used to eliminate image noise and boundary artifacts. In this application, a float32 bilateral filter is used on the base layer, and the sigmaColor parameter is set to 0.08 to 0.3 on the scale of [0,1] to fully preserve floating-point precision.

[0100] In this embodiment, to achieve boundary smoothing for HDR and LDR dual-layer separation, step 105 specifically includes the following sub-steps: First, the fused HDR image is decomposed into a base layer and a super-white head, where the pixel value of the base layer does not exceed the standard dynamic range peak value (i.e., ≤1.0), and the pixel value of the super-white head exceeds the standard dynamic range peak value (i.e., >1.0). Through separation operation, the regular brightness information belonging to the SDR range and the highlight super-white information belonging to the HDR range in the HDR image are processed separately. Then, a smoothing filter is performed on the base layer, specifically using a float32 bilateral filter, with the sigmaColor parameter set to 0.08 to 0.3 on a scale of [0,1] to fully preserve floating-point precision, thereby eliminating boundary halos and artifacts in the base layer while maintaining edge sharpness. If the super-white head participates in the bilateral filter, its extreme brightness value will disturb the filter kernel, causing the highlight peak to be flattened and destroying the result of the highlight expansion of the Type I self-emissive region. Therefore, in this application, the super-white head does not participate in the filtering operation, and its peak brightness is completely preserved. Next, the smoothed base layer is merged with the ultra-white head, and recombined into a smoothed HDR image. Finally, the smoothed HDR image is encoded to generate an HDR file.

[0101] In the above scheme, firstly, the HDR image is separated into the base layer and the super-white head. Smoothing filtering is performed only on the base layer, avoiding the problem of the super-white head being disturbed by extreme brightness values ​​and causing the highlight peak to be flattened when it participates in filtering. This fully preserves the results of the highlight expansion of the Type I self-illuminating region. Secondly, a float32 bilateral filter is used on the base layer to fully preserve floating-point precision. Compared with the existing technology that directly converts the HDR image to uint8 for bilateral filtering, resulting in quantization faults (each LSB corresponds to a brightness change of about 0.005, producing polygonal color blocks), this application completely eliminates the artifacts caused by quantization errors. Finally, the smoothed and filtered base layer is merged back with the unfiltered super-white head. While eliminating boundary halos and artifacts, the integrity of the HDR super-white peak is maintained, so that the final output HDR image is smooth and natural on the base layer and the super-white head retains its original highlight brightness.

[0102] In another embodiment, to achieve standardized encoded output of the HDR image, step 105 may further include the following steps: converting the fused HDR image from the standard dynamic range color gamut to a target color gamut, wherein the color gamut range of the target color gamut is larger than that of the standard dynamic range color gamut; performing absolute brightness scaling on the HDR image after color gamut conversion; performing perceptual quantization encoding on the brightness-scaled HDR image; applying dithering processing to the encoded HDR image; and performing quantization processing on the dithered HDR image to generate an HDR file.

[0103] Standard dynamic range color gamut: refers to the sRGB color gamut, which is the standard color space commonly used in SDR images.

[0104] Target color gamut: refers to the ITU-R BT.2020 color gamut, which has a larger color gamut range than the sRGB color gamut and is the standard color space for HDR images.

[0105] Absolute brightness scaling: refers to the operation of scaling the brightness value of an HDR image from the brightness range corresponding to SDR to the brightness range corresponding to HDR. Specifically, it multiplies the SDR linear light value of 1.0 (corresponding to 100 cd / m²) by the scaling factor peak_luminance / 10000 (the default target peak of 1000 cd / m² corresponds to 0.1), so that the SDR white is correctly mapped to the target HDR display peak.

[0106] Perceptual quantization encoding refers to applying the PQ (Perceptual Quantizer) transfer function defined by the SMPTE ST 2084 standard to convert linear brightness into a perceptibly uniform digital encoded value. In another embodiment, the HLG (Hybrid Log-Gamma) transfer function can be used instead of PQ to accommodate different HDR standard requirements.

[0107] Dithering: A technique that adds tiny noise to the digital signal before quantization to break the periodic structure of quantization errors and eliminate quantization stripes.

[0108] Quantization processing: refers to the process of mapping a continuously valued signal or a high-precision digital signal to a finite number of discrete levels. In this application, the jittered PQ encoded value is quantized into a 16-bit integer (uint16, range 0-65535), and the output is an integer data that can be stored and transmitted.

[0109] In this embodiment of the application, to achieve standardized encoded output of the HDR image, step 105 may further include the following sub-steps: First, the fused HDR image is converted from the standard dynamic range color gamut (sRGB color gamut) to the target color gamut (ITU-R BT.2020 color gamut). Specifically, this is achieved through matrix multiplication using the CIE XYZ intermediate space. The BT.2020 color gamut has a larger color gamut range than the sRGB color gamut, and can cover a richer range of colors. During the color gamut conversion process, if pixels with negative channels appear after conversion, minimal desaturation is performed along the direction pointing to the neutral gray of the target color gamut until the negative channels are zero, in order to avoid color jumps caused by hard truncation. Next, the HDR image after color gamut conversion undergoes absolute luminance scaling. Since an SDR linear light value of 1.0 corresponds to a physical luminance of 100 cd / m², and the SMPTE ST 2084 PQ transfer function uses 10000 cd / m² as the maximum reference luminance, it is explicitly multiplied by a scaling factor peak_luminance / 10000. The default peak_luminance is 1000 cd / m², corresponding to a scaling factor of 0.1. This step ensures that SDR white is correctly mapped to the target HDR display peak, avoiding the disastrous result of the entire image being too dark on an HDR display. Then, the luminance-scaled HDR image undergoes perceptual quantization encoding, applying the PQ OETF (photoelectric conversion function) defined by the SMPTE ST 2084 standard to convert linear light luminance into a perceptually uniform digital encoded value. In another embodiment, the above perceptual quantization encoding can also use the HLG (Hybrid Log-Gamma) transfer function instead of PQ to adapt to different HDR standard requirements. Next, dithering is applied to the encoded HDR image, specifically using a dual dithering approach of Bayer-8 and TPDF (triangular probability density function): First, the PQ encoded value is multiplied by 65535 and entered into a 16-bit quantization domain. Then, a composite dithering of ±1 LSB is superimposed within this quantization domain. This composite dithering is synthesized from a Bayer 8×8 ordered matrix (deterministic dithering, used to disrupt low-frequency stripe structures) and TPDF-style random noise (statistical dithering, used to disrupt the regularity of the Bayer matrix itself). Simultaneously, different Bayer matrix phase shifts are applied to the R / G / B channels to decorrelate the dithering modes of the three channels, avoiding the generation of color textures. Finally, the dithered HDR image is quantized, converting the PQ encoded value into a 16-bit integer (uint16, range 0-65535) to generate the HDR file.

[0110] In the above scheme, firstly, by converting the color gamut from sRGB to BT.2020, the output image can cover a richer color range, meeting the requirements of the HDR display standard; secondly, by using absolute brightness scaling, SDR white (100 cd / m²) is correctly mapped to the target HDR display peak (e.g., 1000 cd / m²), avoiding the catastrophic error of the entire image being too dark due to the lack of a scaling step; then, by using perceptual quantization encoding, linear brightness is converted into perceptually uniform PQ encoded values, conforming to the SMPTE ST 2084 standard; finally, by using Bayer-8 and TPDF dual dithering and three-channel phase decorrelation, the visually visible periodic stripes generated by 16-bit quantization in the darkest part of the PQ curve are effectively eliminated, and the dithering level is completely invisible to the eye.

[0111] To facilitate understanding of the technical solution of this application, the following will be combined with Figure 4 The image conversion method provided in one embodiment of this application will be described in general.

[0112] Figure 4 This is a schematic diagram illustrating the overall flow of an image conversion method provided in an embodiment of this application. Figure 4 As shown, the method includes the following steps: input SDR image, region detection, linearization, differential ITM (including differential processing of three types of regions: Type I, Type II, and Type III), region fusion, boundary smoothing, fidelity guardrail, color gamut conversion, PQ encoding, quantization dithering, JXL encoding, and finally output HDR file.

[0113] Step 1: Input SDR image. Obtain the input SDR image, where SDR refers to an image format with a peak brightness of approximately 100 cd / m², using sRGB or BT.709 gamma transfer function, 8-bit quantization, and Rec.709 color gamut.

[0114] Step 2: Region Detection. Pixels in the input SDR image are automatically classified into Type I self-illuminating regions, Type II material reflection regions, and Type III ordinary diffuse reflection regions according to their physical properties. Specifically, a dual-channel fusion method combining semantic detection and constrained neighborhood brightness enhancement is used to identify Type I self-illuminating regions: Channel 1 is semantic detection, which performs object detection model inference on the input SDR image to extract target boxes whose semantic category belongs to self-illuminating objects (such as lamps, screens, flames, etc.); Channel 2 is constrained brightness feature enhancement, which raises the brightness threshold to 0.95 and requires the saturation S to be less than 0.25. The brightness candidate mask only intersects with the neighborhood of the semantic detection box to avoid misjudgment in the whole image. A fusion detection method combining multi-feature complementarity and local contrast protection is used to identify Type II material reflection regions: Feature 1 is the brightness threshold (V>0.7), Feature 2 is high brightness and low saturation with local contrast protection, and Feature 3 is local maxima with local contrast. The average of the three feature masks is taken and then binarized with a threshold of 0.5. Pixels that meet the above conditions but are not labeled as Type I are labeled as Type II, and the remaining pixels are labeled as Type III. After classification, the final category is determined according to the priority rule of Type I being the highest, Type II being the second highest, and Type III being the lowest. The classification results are then smoothed by performing a 3×3 elliptical morphological closing operation on each region independently, and writing them into the classification map in order of priority from low to high, ensuring that slender high-priority regions are not eroded.

[0115] Step 3: Linearization. The SDR image is converted to the linear optical signal domain to obtain a linearized image. Specifically, before all inverse tone mapping processing, a segmented sRGB EOTF (electro-optical conversion function) defined by the IEC 61966-2-1 standard is applied to the input SDR image: when the pixel value is less than or equal to 0.04045, the linear light value is equal to the pixel value divided by 12.92; when the pixel value is greater than 0.04045, the linear light value is equal to ((pixel value + 0.055) / 1.055) raised to the power of 2.4. Through this conversion, the original gamma-coded pixel values ​​are restored to linear light values, where a linear light value of 1.0 corresponds to a physical brightness of 100 cd / m². This linearization step ensures that subsequent brightness expansion, color space conversion, and other operations are performed in the physically correct linear optical domain, while avoiding the brightness square error caused by double linearization through parameter control.

[0116] Step 4: Differentiated ITM. From multiple categories, at least two target categories are identified. Pixels belonging to each target category in the linearized image are then expanded using distinct inverse tone mapping strategies to obtain a preliminary HDR image. This includes the following three types of differential strategies: For the Type I self-luminous region, a knee-Reinhard mapping curve is used for highlight extension. A piecewise mapping is applied to the BT.709 weighted luminance of pixels in the linear light domain: Set the preset luminance threshold (knee point L_knee) to 0.7. Below the preset luminance threshold, the output value is equal to the input value (completely transparent, not affecting the midtones); above the preset luminance threshold, the output value increases monotonically with the input value and the growth rate gradually slows down, applying a Reinhard-style asymptotic roll-off and smoothly approaching the preset target peak multiple highlight_extension (default 1.3). This mapping curve allows the output of HDR super-white values exceeding 1.0. In a preferred embodiment, CLAHE local contrast enhancement and bilateral detail retention can also be applied to the extended result. Among them, CLAHE maps the L channel of LAB to uint16 (65536 levels) proportionally and then processes it, reducing the quantization noise by 256 times compared to the traditional uint8 method.

[0117] For the Type II material reflection region, a color space round-trip method is used for chromaticity extension. Specifically, it includes: First, convert the pixels from the linear light signal domain to the gamma-encoded domain (applying the sRGB OETF); then, in the gamma-encoded domain, convert the pixels to the perceptual color space (HSV or LAB), and enhance the chromaticity components (multiply the HSV saturation channel by the material_enhancement default 1.1, and scale the a / b channels of LAB by the color_volume times default 1.2 centered on neutral gray); finally, return the enhanced pixels from the perceptual color space to the linear light signal domain (first convert back to the gamma-encoded domain, and then apply the sRGB EOTF to restore to the linear light domain). The float32 floating-point precision is maintained throughout the process to eliminate the 8-bit color break caused by the LAB / HSV conversion.

[0118] For the Type III ordinary diffuse reflection region, a smoothstep double-weighted gentle gain strategy is adopted. After calculating the linear light luminance L, a gain factor is constructed by multiplying two smoothstep weights: the dark weight is smoothstep(0.08, 0.22, L), and the highlight weight is smoothstep(0.22, 0.85, L). The final gain factor = 1 + maximum gain (default 0.12) × dark weight × highlight weight. This weighting function keeps the gain of the dark part (L < 0.08) at 1 and completely preserves the original film, has a gradual transition in the dark midtones (0.08 < L < 0.22), applies a gradually increasing gentle brightening (up to about 12%) in the medium to high brightness (0.22 < L < 0.85), and keeps the gain of the extremely bright end (L > 0.85) at a stable upper limit.

[0119] Step 5: Region Fusion. Based on the classification results of multiple categories, the preliminary HDR images are weighted and fused to obtain the fused HDR image. Specifically, firstly, based on the pixel distribution of each category, a soft mask is generated by blurring using a large-kernel Gaussian filter (kernel size ≥ 15×15, preferably 31×31) using the binary mask of that category; then, the expansion results of each category are weighted and multiplied with the corresponding soft mask to obtain intermediate HDR images for each category; finally, all intermediate HDR images are summed to obtain the fused HDR image. Because a large-kernel Gaussian filter is used to generate the soft mask, compared with the small-kernel feathering method, it can ensure a completely smooth boundary transition and eliminate polygonal color block artifacts when there are large differences in expansion intensity between regions.

[0120] Step 6: Boundary Smoothing. To achieve boundary smoothing for HDR and LDR dual-layer separation, the fused HDR image is decomposed into a base layer and a super-white head. The pixel values ​​of the base layer do not exceed the standard dynamic range peak value (≤1.0), while the pixel values ​​of the super-white head exceed the standard dynamic range peak value (>1.0). Smoothing filtering is performed only on the base layer (using float32 bilateral filtering, with the sigmaColor parameter set to 0.08 to 0.3 on a scale of [0,1]). The super-white head is not involved in the filtering operation to avoid its extreme brightness values ​​disturbing the filter kernel and causing the highlight peaks to be flattened. Then, the smoothed base layer and the super-white head are merged to obtain the smoothed HDR image. This method fully preserves the results of the highlight expansion of the Type I self-illuminating region while eliminating polygonal color block artifacts caused by quantization errors.

[0121] Step 7: Fidelity Protection. After Step 6 (Boundary Smoothing) and before Step 8 (Gamut Conversion), fidelity protection processing is applied to the smoothed HDR image obtained in Step 6 to prevent over-expansion. Specifically, this includes: First, maximum gain segmented limiting: dynamically determining the upper limit of gain based on pixel brightness values ​​(approximately 3% for shadows, approximately 16% for midtones, and approximately 75% for highlights), and pushing back pixel values ​​exceeding the upper limit; Second, shadow re-pasting: for extremely dark pixels with brightness values ​​below a preset threshold (L<0.025), the SDR image value and the initial HDR image value are weighted and summed according to a preset weight (0.85) and then replaced; Third, chroma safety limiting: for pixels with chroma values ​​exceeding a preset SDR chroma multiple (1.82 times plus a 0.03 margin), pushing them back towards the brightness axis to reduce chroma. This triple fidelity protection effectively prevents problems such as dark patches, dirty skin tones, and oversaturated colors.

[0122] Step 8: Color Gamut Conversion. The smoothed HDR image obtained in Step 6 is converted from the standard dynamic range color gamut (sRGB color gamut) to the target color gamut (ITU-R BT.2020 color gamut). This is specifically achieved through matrix multiplication using the CIE XYZ intermediate space. During the color gamut conversion process, if pixels with negative channels appear after conversion, minimal desaturation is performed along the direction pointing to the neutral gray of the target color gamut until the negative channels are zero, in order to avoid color jumps caused by hard truncation.

[0123] Step 9: PQ Encoding. The HDR image after color gamut conversion undergoes absolute luminance scaling. The SDR linear luminance value of 1.0 (corresponding to 100 cd / m²) is multiplied by a scaling factor peak_luminance / 10000 (the default target peak of 1000 cd / m² corresponds to 0.1), ensuring that SDR white is correctly mapped to the target HDR display peak. Then, perceptual quantization encoding is performed on the luminance-scaled HDR image, applying the PQ OETF (photoelectric conversion function) defined by the SMPTE ST 2084 standard to convert linear luminance into a perceptually uniform digital encoded value. In another embodiment, the HLG transfer function can be used instead of PQ to adapt to different HDR standard requirements.

[0124] Step 10: Quantization Dithering. Apply Bayer-8 and TPDF dual dithering to the PQ-encoded image: First, multiply the PQ encoded value by 65535 to map it to a 16-bit quantization domain. Then, superimpose ±1 LSB composite dithering within this quantization domain. This composite dithering is synthesized from a Bayer 8×8 ordered matrix (deterministic dithering, used to disrupt low-frequency fringe structures) and TPDF-style random noise (statistical dithering, used to disrupt the regularity of the Bayer matrix itself). Simultaneously, apply different Bayer matrix phase shifts to the R / G / B channels to decorrelate the dithering modes of the three channels, avoiding the generation of color textures. This dithering scheme effectively eliminates the visually visible periodic stripes generated by 16-bit quantization in the steepest dark areas of the PQ curve. After dithering, quantize the PQ encoded value into a 16-bit integer (uint16, range 0-65535).

[0125] Step 11: JXL Encoding. Encode the 16-bit PQ-encoded Rec.2020 data into JPEG XL format, and write complete Rec.2020 primary colors, D65 white point, and PQ transfer function ICC metadata into the data, ultimately generating a JXL HDR file carrying complete color metadata.

[0126] Step 12: Output HDR file. Output the generated JXL HDR file, which can be correctly recognized in HDR-enabled rendering environments (such as macOS Quick Look, Chrome 109+ browser in Windows HDR mode, etc.), mapping pixel values ​​to the physical brightness range of the HDR display.

[0127] Through the above overall process, this application achieves physically correct SDR to HDR upconversion, outputting HDR images that conform to the SMPTEST 2084 + ITU-R BT.2020 standard. Typical artifacts are eliminated in key areas such as sky, skin, and specular reflection. Furthermore, no SDR-HDR training pair is required, making it highly interpretable, with adjustable parameters, and easy to fine-tune for specific video sources.

[0128] Figure 5 This is a block diagram illustrating an embodiment of an image conversion apparatus provided in this application. (See diagram below.) Figure 5 As shown, the device includes: The acquisition module 51 is used to acquire the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical properties. Conversion module 52 is used to convert the SDR image to the linear optical signal domain to obtain a linearized image; The extension module 53 is used to determine at least two target categories from the multiple categories, and to extend the pixels in the linearized image that belong to the target categories respectively to obtain a preliminary HDR image, wherein different target categories are extended using different inverse tone mapping strategies; The fusion module 54 is used to perform weighted fusion on the preliminary HDR image based on multiple categories to obtain a fused HDR image; The encoding module 55 is used to encode the fused HDR image to generate an HDR file.

[0129] In one possible implementation, the extension module is specifically used for: For pixels belonging to the first target category, a mapping curve is used to expand the pixels. The mapping curve is used to define the correspondence between the input value and the output value of the pixel. Below the preset brightness threshold, the output value is equal to the input value. Above the preset brightness threshold, the output value increases monotonically with the input value and the growth rate gradually slows down, and approaches the preset target peak brightness. For pixels belonging to the second target category, the pixels are converted from the linear optical signal domain to the perceptual color space, the chromaticity components are enhanced, and then the pixels are returned to the linear optical signal domain to expand the pixels. For pixels belonging to the third target category, the pixels are expanded by multiplying the input value of the pixel by a weighting function, wherein the value of the weighting function first increases and then stabilizes as the input value increases.

[0130] In one possible implementation, the extension module is further configured to: The pixel is converted from the linear optical signal domain to the gamma coding domain; In the gamma coding domain, the pixel is converted to the perceptual color space, and the chromaticity components are enhanced; The enhanced pixel is converted from the perceptual color space back to the gamma coding domain, and then returned from the gamma coding domain to the linear optical signal domain.

[0131] In one possible implementation, the fusion module is specifically used for: For each category, a soft mask corresponding to that category is generated based on the pixels belonging to that category; The intermediate HDR image corresponding to the category is obtained by weighted multiplication of the preliminary HDR image with the soft mask corresponding to the category. The intermediate HDR images are added together to obtain the fused HDR image.

[0132] In one possible implementation, the encoding module is specifically used for: The fused HDR image is decomposed into a base layer and an ultra-white head, wherein the pixel value of the base layer does not exceed the standard dynamic range peak value, and the pixel value of the ultra-white head exceeds the standard dynamic range peak value. Perform smoothing filtering on the base layer; The smoothed base layer is merged with the ultra-white head to obtain a smoothed HDR image; The smoothed HDR image is encoded to generate an HDR file.

[0133] In one possible implementation, the encoding module is further configured to: The fused HDR image is converted from the standard dynamic range color gamut to the target color gamut, wherein the color gamut range of the target color gamut is larger than that of the standard dynamic range color gamut; Perform absolute brightness scaling on the HDR image after color gamut conversion; Perceptual quantization encoding is performed on the HDR image after brightness scaling; Apply dithering to the encoded HDR image; The HDR image after dithering is quantized to generate an HDR file.

[0134] In one possible implementation, the device further includes a protection module for: For each pixel in the preliminary HDR image, a gain limit for the pixel is determined based on the pixel's brightness value, and the values ​​of pixels exceeding the gain limit are adjusted to the gain limit. For pixels with brightness values ​​below a preset threshold, the values ​​of the corresponding pixels in the SDR image and the values ​​of the pixels in the preliminary HDR image are weighted and summed according to a preset weight, and the summation result is used to replace the values ​​of the pixels in the preliminary HDR image. For pixels whose chromaticity values ​​exceed a preset multiple of the corresponding pixel chromaticity values ​​in the SDR image, the chromaticity values ​​of the pixels are reduced.

[0135] like Figure 6 As shown in the figure, this application provides a device including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114. Memory 113 is used to store computer programs; In one embodiment of this application, when the processor 111 executes the program stored in the memory 113, it implements the image conversion method provided in any of the foregoing method embodiments, including: Obtain the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical properties; The SDR image is converted to the linear optical signal domain to obtain a linearized image; At least two target categories are determined from the multiple categories, and the pixels belonging to the target categories in the linearized image are expanded respectively to obtain a preliminary HDR image, wherein different target categories are expanded using different inverse tone mapping strategies; Based on multiple categories, the preliminary HDR image is weighted and fused to obtain the fused HDR image; The fused HDR image is encoded to generate an HDR file.

[0136] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the image conversion method provided in any of the foregoing method embodiments.

[0137] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the image conversion methods described in the above embodiments.

[0138] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0139] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0140] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0141] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. An image conversion method, characterized in that, The method includes: Obtain the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical properties; The SDR image is converted to the linear optical signal domain to obtain a linearized image; At least two target categories are determined from the multiple categories, and the pixels belonging to the target categories in the linearized image are expanded respectively to obtain a preliminary HDR image, wherein different target categories are expanded using different inverse tone mapping strategies; Based on multiple categories, the preliminary HDR image is weighted and fused to obtain the fused HDR image; The fused HDR image is encoded to generate an HDR file.

2. The method according to claim 1, characterized in that, The step of expanding the pixels belonging to the target category in the linearized image includes: For pixels belonging to the first target category, a mapping curve is used to expand the pixels. The mapping curve is used to define the correspondence between the input value and the output value of the pixel. Below the preset brightness threshold, the output value is equal to the input value. Above the preset brightness threshold, the output value increases monotonically with the input value and the growth rate gradually slows down, and approaches the preset target peak brightness. For pixels belonging to the second target category, the pixels are converted from the linear optical signal domain to the perceptual color space, the chromaticity components are enhanced, and then the pixels are returned to the linear optical signal domain to expand the pixels. For pixels belonging to the third target category, the pixels are expanded by multiplying the input value of the pixel by a weighting function, wherein the value of the weighting function first increases and then stabilizes as the input value increases.

3. The method according to claim 2, characterized in that, The step of converting the pixel from the linear optical signal domain to the perceived color space, enhancing the chromaticity components, and then returning it to the linear optical signal domain includes: The pixel is converted from the linear optical signal domain to the gamma coding domain; In the gamma coding domain, the pixel is converted to the perceptual color space, and the chromaticity components are enhanced; The enhanced pixel is converted from the perceptual color space back to the gamma coding domain, and then returned from the gamma coding domain to the linear optical signal domain.

4. The method according to claim 1, characterized in that, The step of weighted fusion of the preliminary HDR image based on multiple categories to obtain the fused HDR image includes: For each category, a soft mask corresponding to that category is generated based on the pixels belonging to that category; The intermediate HDR image corresponding to the category is obtained by weighted multiplication of the preliminary HDR image with the soft mask corresponding to the category. The intermediate HDR images are added together to obtain the fused HDR image.

5. The method according to claim 1, characterized in that, The step of encoding the fused HDR image to generate an HDR file includes: The fused HDR image is decomposed into a base layer and an ultra-white head, wherein the pixel value of the base layer does not exceed the standard dynamic range peak value, and the pixel value of the ultra-white head exceeds the standard dynamic range peak value. Perform smoothing filtering on the base layer; The smoothed base layer is merged with the ultra-white head to obtain a smoothed HDR image; The smoothed HDR image is encoded to generate an HDR file.

6. The method according to claim 1, characterized in that, The step of encoding the fused HDR image to generate an HDR file includes: The fused HDR image is converted from the standard dynamic range color gamut to the target color gamut, wherein the color gamut range of the target color gamut is larger than that of the standard dynamic range color gamut; Perform absolute brightness scaling on the HDR image after color gamut conversion; Perceptual quantization encoding is performed on the HDR image after brightness scaling; Apply dithering to the encoded HDR image; The HDR image after dithering is quantized to generate an HDR file.

7. The method according to claim 1, characterized in that, Before encoding the fused HDR image, the method further includes: For each pixel in the preliminary HDR image, a gain limit for the pixel is determined based on the pixel's brightness value, and the values ​​of pixels exceeding the gain limit are adjusted to the gain limit. For pixels with brightness values ​​below a preset threshold, the values ​​of the corresponding pixels in the SDR image and the values ​​of the pixels in the preliminary HDR image are weighted and summed according to a preset weight, and the summation result is used to replace the values ​​of the pixels in the preliminary HDR image. For pixels whose chromaticity values ​​exceed a preset multiple of the corresponding pixel chromaticity values ​​in the SDR image, the chromaticity values ​​of the pixels are reduced.

8. An image conversion device, characterized in that, The device includes: The acquisition module is used to acquire the input SDR image and classify the pixels in the SDR image into multiple categories according to their physical properties. The conversion module is used to convert the SDR image to the linear optical signal domain to obtain a linearized image; An extension module is used to determine at least two target categories from a plurality of categories, and extend the pixels in the linearized image that belong to the target categories respectively to obtain a preliminary HDR image, wherein different target categories are extended using different inverse tone mapping strategies; A fusion module is used to perform weighted fusion on the preliminary HDR image based on multiple categories to obtain a fused HDR image; The encoding module is used to encode the fused HDR image to generate an HDR file.

9. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute an image conversion program stored in the memory to implement the image conversion method according to any one of claims 1-7.

10. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the image conversion method according to any one of claims 1-7.