Image processing method and device, electronic equipment and readable storage medium
By performing region segmentation and masking on SDR images, combined with glare suppression technology, the problems of insufficient dark details and glare interference in HDR images are solved, improving the image display effect, especially significantly improving the display of dark details in starry sky scenes.
Patent Information
- Application Number
- CN202511322778.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-16
- Publication Date
- 2025-12-19
AI Technical Summary
Existing HDR image display technologies are insufficient in processing details in dark areas, resulting in poor display quality of generated HDR images, especially noticeable in starry sky scenes. Furthermore, glare interference and long exposure noise are difficult to handle effectively.
By segmenting the SDR image into regions, mask images of different regions are generated. AI segmentation technology is used to divide the image into starry sky and background regions, and corresponding display enhancement data are calculated for each region. Combined with glare suppression technology, the image processing flow is optimized to improve the display effect.
It achieves targeted processing for different regions, improving the display effect of HDR images, especially significantly improving the display of dark details in starry sky scenes, while effectively reducing glare interference and noise impact.
Smart Images

Figure CN121169770A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of image processing, and particularly relates to an image processing method and device, electronic equipment and a readable storage medium. BACKGROUND
[0002] With the gradual improvement and unification of High Dynamic Range (HDR) standard specifications, and the continuous popularity of devices supporting HDR display, electronic devices supporting HDR technology are increasingly favored by consumers due to their high dynamic range, rich colors and excellent detail rendering capabilities.
[0003] In the related art, an electronic device supporting HDR technology will perform dynamic rendering on a Standard Dynamic Range (SDR) image corresponding to an HDR image according to enhanced image data, i.e., a gain matrix, so that the electronic device can display the HDR image. The enhanced image data is determined according to the luminance difference between the original SDR image and the HDR image.
[0004] However, the enhanced image data usually mainly acts on the middle and high light parts of the image, so that the enhanced image data is insufficient in processing dark details when performing dynamic rendering on the original SDR image, thereby resulting in poor display effect of the generated HDR image. SUMMARY
[0005] The purpose of the embodiments of the present application is to provide an image processing method and device, electronic equipment and a readable storage medium, which can improve the display effect of the HDR image generated by the electronic device.
[0006] In a first aspect, the embodiments of the present application provide an image processing method, which comprises: obtaining an HDR image and a corresponding SDR image; obtaining first display enhancement data based on a first mask image corresponding to the SDR image, the HDR image and the SDR image; the first mask image is obtained by performing mask processing on a first region in the SDR image; obtaining second display enhancement data based on a second mask image corresponding to the SDR image, the HDR image and the SDR image; the second mask image is obtained by performing mask processing on a second region in the SDR image; and obtaining third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data.
[0007] In a second aspect, an embodiment of the present application provides an image processing apparatus, comprising: an obtaining module and a processing module; the obtaining module is configured to obtain an HDR image and a corresponding SDR image; the processing module is configured to obtain first display enhancement data based on a first mask image corresponding to the SDR image, the HDR image and the SDR image obtained by the obtaining module; the first mask image is obtained by performing mask processing on a first region in the SDR image; the processing module is further configured to obtain second display enhancement data based on a second mask image corresponding to the SDR image, the HDR image and the SDR image obtained by the obtaining module; the second mask image is obtained by performing mask processing on a second region in the SDR image; and the processing module is further configured to obtain third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the method according to the first aspect.
[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, wherein the readable storage medium stores programs or instructions, and the programs or instructions are executed by a processor to implement the steps of the method according to the first aspect.
[0010] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is configured to run programs or instructions to implement the method according to the first aspect.
[0011] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium, and the program product is executed by at least one processor to implement the method according to the first aspect.
[0012] In the embodiment of the present application, an HDR image and a corresponding SDR image are acquired; first display enhancement data is obtained based on a first mask image corresponding to the SDR image, the HDR image, and the SDR image; the first mask image is obtained by performing mask processing on a first region in the SDR image; second display enhancement data is obtained based on a second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second mask image is obtained by performing mask processing on a second region in the SDR image; and third display enhancement data corresponding to the SDR image is obtained based on the first display enhancement data and the second display enhancement data. In this scheme, the electronic device performs mask processing on different regions of the SDR image to obtain mask images corresponding to the different regions, realizes region segmentation of the SDR image, and enables the electronic device to perform corresponding image processing on different regions to obtain various image data, thereby ensuring the image display effect of each kind of image data and improving the display effect of the finally generated HDR image. BRIEF DESCRIPTION OF DRAWINGS
[0013] Figure 1 is a schematic diagram of an image processing method provided by an embodiment of the present application;
[0014] Figure 2 is a schematic diagram of an image of a photographed starry sky scene provided by an embodiment of the present application;
[0015] Figure 3 is a mask image obtained by performing mask processing on a starry sky region provided by an embodiment of the present application;
[0016] Figure 4 is a mask image obtained by performing mask processing on a background region provided by an embodiment of the present application;
[0017] Figure 5 is a mask image obtained by performing mask processing on a non-glare region provided by an embodiment of the present application;
[0018] Figure 6 is a schematic diagram of an S-shaped curve of a luminance value provided by an embodiment of the present application;
[0019] Figure 7 is a luminance histogram provided by an embodiment of the present application;
[0020] Figure 8 is a flowchart of an image processing method provided by an embodiment of the present application;
[0021] Figure 9 is a schematic diagram of an effect of contrast enhancement processing on a starry sky region provided by an embodiment of the present application;
[0022] Figure 10This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application;
[0023] Figure 11 This is a schematic diagram of the structure of an image processing device provided in an embodiment of this application;
[0024] Figure 12 This is one of the hardware structure diagrams of an electronic device provided in the embodiments of this application;
[0025] Figure 13 This is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0027] The following explains some terms and nouns used in the embodiments of this application.
[0028] 1) SDR: refers to traditional image display technology, which has limited brightness range and color performance capabilities.
[0029] 2) HDR: refers to an image technology that can capture and display a wider range of brightness. Compared with traditional SDR images, HDR images can retain more highlight and shadow details.
[0030] 3) HDR display: HDR display technology significantly expands the brightness range and color performance, while preserving details in highlights and shadows, presenting a visual effect that is closer to the real scene.
[0031] Currently supported HDR photo standards on electronic devices include the International Organization for Standardization (ISO) HDR standard and the Android Ultra HDR standard. Both utilize enhanced image data, also known as a gain matrix, which is a layer that records the brightness differences between the original SDR image and the HDR image. Its working principle is to analyze the brightness distribution of the HDR image to generate an enhanced layer that reflects the differences between the HDR and SDR images. HDR images are stored as two parts: a regular SDR image and an enhanced image data layer.
[0032] 4) Enhanced Image Data: A layer that records the brightness gain coefficients between the original SDR image and the HDR image, used to reproduce the visual effects of the HDR image on HDR display devices.
[0033] Enhanced image data provides a solution for consistent adaptive display of HDR images, compatible with various display devices. When the display device supports HDR, the original SDR image can be adjusted based on this enhancement layer to correctly reproduce the visual effects of the HDR image. When the display device does not support HDR, only the regular SDR photo is displayed. This enhanced image data approach achieves backward compatibility, greatly expanding the adaptability of HDR photos.
[0034] 5) Starry sky scene: Image scenes containing stars usually have large dark areas and scattered bright spots, such as stars, and the brightness distribution is significantly different from ordinary scenes.
[0035] 6) Glare: A light scattering phenomenon caused by factors such as internal camera reflection and external light source interference. In long exposure images, it appears as a halo or blurred area around a bright spot.
[0036] 7) Glare suppression factor: A coefficient that quantifies the gain value that needs to be reduced in the glare area.
[0037] 8) Artificial Intelligence (AI) segmentation technology: Image segmentation technology based on artificial intelligence can accurately divide different regions in an image, such as the sky, ground, and buildings.
[0038] 9) Image Mask: An image mask is a technique that uses a selected binary or Boolean template, such as a 0 / 1 or True / False matrix, to partially occlude an image in order to control the processing area or the scope of operation.
[0039] 10) The terms “first,” “second,” etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by “first,” “second,” etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification, “and / or” indicates at least one of the connected objects, and the character “ / ” generally indicates that the preceding and following objects are in an “or” relationship.
[0040] 11) The terms "at least one," "at least one of," etc., used in the specification and claims of this application refer to any one, any two, or a combination of two or more of the included items. For example, at least one of a, b, and c can mean: "a," "b," "c," "a and b," "a and c," "b and c," and "a, b, and c," where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more, and its meaning is similar to that of "at least one."
[0041] 12) The identifiers in this application are text, symbols, images, etc. used to indicate information, and may be used as carriers for displaying information in the form of identifiers or other containers, including but not limited to text identifiers, image identifiers, symbol identifiers, etc.
[0042] It should be noted that the image processing method provided in this application can be executed by electronic devices such as mobile phones, tablets, laptops, PDAs, and in-vehicle electronic devices. Some embodiments of this application use electronic devices as the executing entity to illustrate the image processing method provided in this application.
[0043] Despite significant advancements in HDR image enhancement techniques, existing HDR photo enhancement image data still exhibits some limitations. For example:
[0044] Global Gain Mapping: Current HDR images, such as High Efficiency Image Format with Gain Map (HEIC), use a globally uniform algorithm to generate enhanced image data, lacking the ability to differentiate processing for specific scenes. This globally uniform processing approach cannot meet the differentiated needs of enhanced image data for different regions and scenes.
[0045] For example, let's define the enhanced image data as G, and the calculation of the enhanced image data as a global calculation function, typically a quotient calculation. Among them, Y SDR Y represents the brightness value of a pixel in an SDR image. HDR This represents the brightness value of a pixel in an HDR image.
[0046] The processing of mid-highlight areas is biased: In related technologies, image data enhancement mainly affects the mid-highlight areas of the image, while insufficient processing of shadow details, which is particularly noticeable in starry sky scenes. This processing bias results in the display effect of starry sky scenes not reaching its optimal level.
[0047] Lack of scene specificity: Among related technologies, image enhancement techniques do not consider processing starry sky scenes separately, failing to meet the unique brightness distribution and visual requirements of starry sky scenes. Since starry sky scenes typically encompass a wide brightness range from extremely dark to extremely bright, current technologies struggle to fully capture their details.
[0048] The following section uses a starry sky scene captured in an HDR image as an example to explain in detail the problems existing in current methods for generating enhanced image data.
[0049] The core challenge: displaying starry scenes requires brightening faint starscapes without affecting the display of other elements, such as the ground. Because the brightness range of starry scenes typically exceeds the dynamic range of ordinary cameras and monitors, current technology struggles to preserve highlight details while simultaneously showcasing stars in darker areas.
[0050] Glare interference: Astrophotography often requires long exposures; however, even faint stray light can cause glare blurring, severely impacting the quality of astrophotography images. For example, it can interfere with HDR processing, causing glare to be misinterpreted as protected highlights, limiting overall gain; or it can over-enhance glare, producing an unnatural "glowing" effect; or it can be confused with real stars, ruining the visual experience of the starry sky.
[0051] Long exposure noise amplification problem: Although long exposure can capture more starlight, it also amplifies noise and stray light, making it difficult for traditional display enhancement methods to handle effectively.
[0052] The image processing method, apparatus, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0053] The image processing method provided in this application can be executed by an image processing device. Exemplarily, the image processing device can be an electronic device, or a component within that electronic device, such as an integrated circuit or a chip. The image processing method provided in this application will be described executively below using an electronic device as an example.
[0054] This application provides an image processing method. Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this application is shown, which can be applied to electronic devices. Figure 1 As shown, the image processing method provided in this application embodiment may include the following steps 201 to 204.
[0055] Step 201: The electronic device acquires the HDR image and the corresponding SDR image.
[0056] In some embodiments of this application, the HDR images described above are images captured by an electronic device using a camera.
[0057] In one example, if an electronic device uses a long exposure mode to capture an image, it will obtain multiple HDR images. In this case, the electronic device will combine the multiple HDR images into the aforementioned HDR image.
[0058] In some embodiments of this application, the electronic device compresses the high brightness range of an HDR image to the brightness range of an SDR image to obtain an SDR image corresponding to the HDR image.
[0059] In some embodiments of this application, the electronic device generates an SDR image from an HDR image through tone mapping.
[0060] In some embodiments of this application, the SDR image described above may include at least a first region and a second region.
[0061] In some embodiments of this application, different regions in the above-described SDR image contain different objects.
[0062] In some embodiments of this application, the electronic device may employ AI segmentation technology to segment the SDR image into different regions.
[0063] For example, an electronic device assigns different tag values to pixels in different regions to distinguish between them.
[0064] For example, such as Figure 2 As shown, the first region in this SDR image contains the starry sky, i.e., stars and the night sky, while the second region contains the background, i.e., trees, mountains, or rivers, etc.
[0065] It is understandable that the image content in the HDR and SDR images mentioned above is exactly the same. Therefore, the regional content of the image area in the SDR image is the same as that in the HDR image.
[0066] Step 202: The electronic device obtains first display enhancement data based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image.
[0067] In some embodiments of this application, the first mask image is obtained by masking a first region in an SDR image.
[0068] For example, the first mask image is obtained by masking the first region in the SDR image using Boolean values or a Boolean matrix.
[0069] For example, the electronic device marks each pixel in the first region with a mask value, such as a mask value of 0, so that the first region is covered up and cannot be recognized.
[0070] For example, taking the starry sky region as the first region, refer to... Figure 2 ,like Figure 3 As shown, the electronic device performs masking on the starry sky area, obtaining only a masked image containing the background area, namely the first masked image mentioned above.
[0071] In some embodiments of this application, the first display enhancement data mentioned above is the brightness difference data of the image region corresponding to the second region in the HDR image and the SDR image.
[0072] For example, the first display enhancement data mentioned above can be understood as matrix data composed of brightness difference values corresponding to multiple pixels in the second region. That is, the gain matrix mentioned above.
[0073] In some embodiments of this application, the electronic device determines the image region to be processed in the SDR image and the HDR image, i.e. the image region corresponding to the second region mentioned above, based on the first mask image, and then calculates the first display enhancement data based on the brightness value of each pixel in the determined two image regions.
[0074] Step 203: The electronic device obtains second display enhancement data based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image.
[0075] In some embodiments of this application, the second mask image is obtained by masking a second region in an SDR image.
[0076] In some embodiments of this application, the second mask image is obtained by masking a second region in an SDR image.
[0077] For example, the second mask image described above is obtained by masking the second region in the SDR image using Boolean values or a Boolean matrix.
[0078] For example, the electronic device marks each pixel in the second region with a mask value, such as a mask value of 0, so that the second region is covered up and cannot be recognized.
[0079] For example, taking the background area as the first area, refer to... Figure 2 ,like Figure 4 As shown, the electronic device performs masking on the background area to obtain only the masked image containing the starry sky area, which is the second masked image mentioned above.
[0080] In some embodiments of this application, the second display enhancement data is the brightness difference data of the image region corresponding to the first region in the HDR image and the SDR image.
[0081] For example, the aforementioned second display enhancement data can be understood as matrix data composed of brightness difference values corresponding to multiple pixels in the first region. That is, the aforementioned gain matrix.
[0082] In some embodiments of this application, the electronic device determines the image regions to be processed in the SDR image and the HDR image based on the second mask image, namely the image regions corresponding to the first region mentioned above, and then calculates the second display enhancement data based on the brightness value of each pixel in the determined two image regions.
[0083] Step 204: The electronic device obtains the third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data.
[0084] In some embodiments of this application, the electronic device merges the matrix data corresponding to the first display enhancement data and the matrix data corresponding to the second display enhancement data into a single matrix data to obtain the third display enhancement data corresponding to the SDR image.
[0085] In some embodiments of this application, the electronic device uses formula (1) or formula (2) to integrate the first display enhancement data and the second display enhancement data to generate the third display enhancement data.
[0086] For example, taking the mask value of the first region as 1 and the mask value of the second region as 0, the above formula (1) is as follows:
[0087] G 合并 =M1*G1+(1-M2)*G2 (1)
[0088] Among them, G 合并 The third display enhancement data is M1, which is the mask value of the first region, G1 is the first display enhancement data, M2 is the mask value of the second region, and G2 is the second display enhancement data.
[0089] For example, taking the mask value of the first region as 1 and the mask value of the second region as 1, the above formula (2) is as follows:
[0090] G 合并 =M1*G1+M2*G2 (2)
[0091] Among them, G 合并 The third display enhancement data is M1, which is the mask value of the first region, G1 is the first display enhancement data, M2 is the mask value of the second region, and G2 is the second display enhancement data.
[0092] In the image processing method provided in this application embodiment, an HDR image and its corresponding SDR image are acquired; first display enhancement data is obtained based on a first mask image corresponding to the SDR image, the HDR image, and the SDR image; the first mask image is obtained by masking a first region in the SDR image; second display enhancement data is obtained based on a second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second mask image is obtained by masking a second region in the SDR image; and third display enhancement data corresponding to the SDR image is obtained based on the first and second display enhancement data. In this solution, the electronic device performs masking processing on different regions of the SDR image to obtain mask images corresponding to different regions, thereby achieving region segmentation of the SDR image. This allows the electronic device to perform targeted image processing on different regions to obtain multiple image data, thus ensuring the image display effect corresponding to each image data, and ultimately improving the display effect of the final generated HDR image.
[0093] Optionally, in some embodiments of this application, after step 204 above, the image processing method provided in this application embodiment further includes step 301.
[0094] Step 301: The electronic device dynamically renders the SDR image based on the third display enhancement data to obtain the target HDR image and displays the target HDR image.
[0095] In some embodiments of this application, after obtaining the aforementioned third display enhancement data, the electronic device will package and store the third display enhancement data and the corresponding SDR image in the electronic device.
[0096] For example, the electronic device may use JPEG format to package the aforementioned third display enhancement data and the SDR image corresponding to the third display enhancement data.
[0097] In some embodiments of this application, the electronic device simultaneously reads an SDR image and the corresponding third display enhancement data. Based on the color and brightness of the SDR image, the third display enhancement data, namely the brightness difference value, is used to adjust the pixel value of each pixel in the SDR image, so that the electronic device can dynamically render the SDR image to obtain the aforementioned target HDR image.
[0098] It is understandable that the target HDR image and the SDR image, as well as the image content in the HDR image, are exactly the same, but the pixel values of the pixels may be different.
[0099] Thus, since the enhanced image data used to generate the target HDR image is generated by processing the image features of different regions, the display effect of the target HDR image is more in line with the user's desired effect.
[0100] Optionally, in some embodiments of this application, after step 204 above, the image processing method provided in the embodiments of this application further includes steps 401 to 404.
[0101] Step 401: The electronic device acquires the glare mask image corresponding to the HDR image.
[0102] In some embodiments of this application, the glare mask image is obtained by masking the non-glare areas in an HDR image.
[0103] In some embodiments of this application, the aforementioned non-glare area refers to an area unaffected by glare. Conversely, if an area outside the non-glare area is a glare area, then that glare area is an area affected by glare.
[0104] For example, the aforementioned flare may include, but is not limited to, at least one of the following: lens flare, stray light, halo, etc.
[0105] In some embodiments of this application, the electronic device uses a glare recognition model, such as MobileNetV3, to perform glare recognition on HDR images and locate glare areas in the HDR images.
[0106] In some embodiments of this application, after the electronic device identifies the glare area, it performs masking processing on the non-glare area to obtain the aforementioned glare mask image.
[0107] For example, refer to Figure 2 ,like Figure 5 As shown, the aforementioned glare mask image is obtained by masking the non-glare areas in the SDR image using Boolean values or Boolean matrices.
[0108] For example, the electronic device marks each pixel in the non-glare area with a mask value, such as a mask value of 0, so that the non-glare area is covered up and cannot be recognized.
[0109] It is understandable that in the above glare mask image, since the non-glare areas are masked, the electronic device will only perform glare suppression processing on the glare areas in the glare mask image.
[0110] Step 402: The electronic device obtains the glare intensity value of each pixel in the glare area based on the glare mask image.
[0111] In some embodiments of this application, the above-mentioned glare intensity value is used to characterize the degree to which a pixel is affected by glare.
[0112] In some embodiments of this application, the electronic device determines each pixel in the glare area based on the glare mask image, obtains the glare intensity value corresponding to each pixel through a model, and obtains the glare intensity table corresponding to the HDR image, as shown in Table 1 below.
[0113] 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0.8 0.6 0 0 0 0 0 0 1 0.8 0.6 0.5 0.5 0 0 0 0 0 0 0.6 0.3 0.3 0.3 0.3 0 0 0 0 0 0.5 0.5 0.1 0.1 0.1 0 0 0 0 0 0.3 0.3 0.3 0 0 0 0 0 0 0 0.1 0.1 0.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[0114] Table 1
[0115] In the table, each cell represents a pixel, and the value in each cell represents the glare intensity of that pixel.
[0116] Step 403: The electronic device obtains the suppressed glare intensity value based on the suppression factor and the glare intensity value.
[0117] In some embodiments of this application, the electronic device obtains a suppressed glare intensity value by multiplying a suppression factor by the glare intensity value.
[0118] In some embodiments of this application, the above-mentioned suppression factor is the gain value coefficient that needs to be reduced in the quantized glare region.
[0119] In some embodiments of this application, the above-mentioned suppression factor is either the default setting of the electronic device or a user-defined setting.
[0120] For example, the above-mentioned inhibition factor is usually set to [0.3, 0.7], but it can be determined according to the specific circumstances, and this application does not impose any restrictions.
[0121] In some embodiments of this application, the electronic device uses formula (3) to multiply the suppression factor by the glare intensity value to obtain the suppressed glare intensity value.
[0122] For example, the above formula (3) is shown below:
[0123] H = α * H glare (3)
[0124] Step 404: The electronic device dynamically renders the SDR image based on the third display enhancement data and the suppressed glare intensity value to obtain the target HDR image and displays the target HDR image.
[0125] In some embodiments of this application, the electronic device uses formula (4) to integrate the third display enhancement data with the suppressed glare intensity value to obtain the third display enhancement data after glare suppression.
[0126] For example, the above formula (4) is shown below:
[0127] G 合并且炫光抑制后=G 合并 *(1-α*H glare (4)
[0128] Among them, G 合并且炫光抑制后 This is the third display enhancement data after glare suppression, obtained through 1-α*H glare This can reduce the impact of glare to a greater extent.
[0129] In some embodiments of this application, after obtaining the third display enhancement data after glare suppression, the electronic device packages and stores the third display enhancement data after glare suppression along with the corresponding SDR image in the electronic device.
[0130] For example, the electronic device can use JPEG format to package the third display enhancement data after glare suppression and the SDR image corresponding to the third display enhancement data after glare suppression.
[0131] In some embodiments of this application, the electronic device simultaneously reads an SDR image and the corresponding third display enhancement data after glare suppression. Based on the color and brightness of the SDR image, the third display enhancement data after glare suppression, i.e., the brightness difference value, is used to adjust the pixel value of each pixel in the SDR image, so that the electronic device can dynamically render the SDR image to obtain the aforementioned target HDR image.
[0132] It is understandable that the target HDR image and the SDR image, as well as the image content in the HDR image, are exactly the same, but the pixel values of the pixels may be different.
[0133] In this way, by segmenting the glare area, subsequent processing can accurately locate and address the glare problem, thereby improving the ability of electronic devices to eliminate glare.
[0134] Optionally, in some embodiments of this application, when the SDR image includes a first region and a second region, step 202 can be implemented by step 202a, and step 203 can be implemented by step 203a.
[0135] Step 202a: The electronic device uses a first enhancement algorithm to calculate first display enhancement data based on the first mask image, HDR image and SDR image corresponding to the SDR image.
[0136] In some embodiments of this application, the first enhancement algorithm described above is determined based on image features of the second region.
[0137] For example, the first enhancement algorithm described above is determined based on the image features of the image region to be processed.
[0138] For example, when the second region is a background region with little difference in brightness value, the first enhancement algorithm can be an algorithm that calculates the brightness ratio between the image region in the HDR image corresponding to the second region and the image region in the corresponding SDR image to obtain the first display enhancement data.
[0139] In some embodiments of this application, the electronic device determines the image region where the second region is located in the HDR image and the SDR image based on the first mask image, and calculates the first display enhancement data based on the brightness value ratio of each pixel in each image region.
[0140] For example, the image region containing the second region in an HDR image contains pixels 1 to 10, while the image region containing the second region in an SDR image contains pixels 1' to 10'. The electronic device calculates the ratios between pixels 1 and 1', pixels 2 and 2', ..., pixels 10 and 10' respectively, and finally arranges the ratios of all pixels according to the matrix of the image regions to obtain the aforementioned first display enhancement data.
[0141] Step 203a: The electronic device uses a second enhancement algorithm to calculate the second display enhancement data based on the second mask image, HDR image and SDR image corresponding to the SDR image.
[0142] In some embodiments of this application, the second enhancement algorithm described above is determined based on image features of the first region.
[0143] For example, the second enhancement algorithm described above is determined based on the image features of the image region to be processed.
[0144] For example, when the first region is a starry sky region with a low brightness value, the second enhancement algorithm can be an algorithm that first uses a contrast enhancement algorithm to enhance the contrast value of the image region in the SDR image corresponding to the first region, and then calculates the brightness ratio between the image region with enhanced contrast value and the image region in the HDR image corresponding to the first region to obtain the second display enhancement data.
[0145] For example, the image region containing the first region in an HDR image contains pixels 1 to 10, while the image region containing the first region in an SDR image contains pixels 1' to 10'. The electronic device first enhances the contrast values of pixels 1' to 10' to obtain pixels 1" to 10", and then calculates the ratios between pixels 1 and 1", pixels 2 and 2"... pixels 10 and 10". Finally, the ratios of all pixels are arranged according to the matrix of the image region to obtain the second display enhancement data mentioned above.
[0146] It is worth noting that the first and second enhancement algorithms mentioned above are different; the enhancement algorithm is determined based on the image features of the image region to be processed.
[0147] In this way, the electronic device performs targeted processing on different regions based on the region segmentation results, which ensures that while a region is fully enhanced, the background region maintains a natural display effect.
[0148] Optionally, in some embodiments of this application, when the first region is a starry sky region and the second region is a background region, the above step 202 "the electronic device obtains the first display enhancement data based on the first mask image, HDR image and SDR image corresponding to the SDR image" can be specifically implemented by the following steps 202a1 to 202a2.
[0149] Step 202a1: The electronic device determines the first image region and the second image region based on the first mask image.
[0150] In some embodiments of this application, the first image region is the background region in the HDR image.
[0151] In some embodiments of this application, the second image region is the background region in the SDR image.
[0152] For example, the electronic device determines the first image region and the second image region based on the unmasked background region in the first mask image.
[0153] Step 202a2: The electronic device generates first display enhancement data based on the ratio between the brightness value of each pixel in the first image region and the brightness value of each pixel in the second image region.
[0154] In some embodiments of this application, the electronic device uses formula (5) to generate the first display enhancement data described above.
[0155]
[0156] Among them, Y HDR图像背景区域 Y represents the brightness value of the background pixels in an HDR image. SDR图像背景区域 G represents the brightness value of the background pixels in an SDR image. 背景 The first display enhancement data is ε, which is a small constant used to prevent division by zero errors.
[0157] Optionally, in some embodiments of this application, when the first region is a starry sky region and the second region is a background region, the above step 203 "the electronic device obtains second display enhancement data based on the second mask image, HDR image and SDR image corresponding to the SDR image" can be specifically implemented by the following steps 203a1 to 203a3.
[0158] Step 203a1: The electronic device determines the third image region and the fourth image region based on the second mask image.
[0159] In some embodiments of this application, the aforementioned third image region is the starry sky region in an HDR image.
[0160] In some embodiments of this application, the aforementioned fourth image region is the starry sky region in the SDR image.
[0161] For example, the electronic device determines the third and fourth image regions based on the unmasked starry sky region in the second mask image.
[0162] Step 203a2: The electronic device performs contrast enhancement processing on the third image region to obtain the enhanced third image region.
[0163] In some embodiments of this application, the electronic device employs a contrast enhancement algorithm to perform contrast enhancement processing on the third image region.
[0164] For example, the contrast enhancement algorithm described above can be applied to S-curves, such as... Figure 6 The S-shaped curve shown.
[0165] For example, the above contrast enhancement process enhances the brightness value of pixels in the highlight area and reduces the brightness value of pixels in the dark area, thereby improving the contrast of the starry sky area while preserving the details of the highlight area and reducing the excessive brightening of the dark area of the deep sky.
[0166] Step 203a3: The electronic device generates second display enhancement data based on the ratio between the brightness value of each pixel in the enhanced third image region and the brightness value of each pixel in the fourth image region.
[0167] In some embodiments of this application, the electronic device uses formula (6) to generate the second display enhancement data described above.
[0168]
[0169] Among them, Y HDR图像星空区域并且应用S型曲线处理 Y represents the brightness value of pixels in the starry sky region of an HDR image after contrast enhancement processing. SDR图像星空区域G represents the brightness value of pixels in the starry sky region of an SDR image. 星空 The first display enhancement data is ε, which is a small constant used to prevent division by zero errors.
[0170] For example, the above formula (6) processes the entire image as a matrix. The following example uses a bright pixel containing a star and a dark pixel containing a deep space to illustrate this. It can be seen that the bright pixel containing the star is fully brightened after processing, and the blurring of the deep space is reduced. Assume that the value range of the SDR image is [0.1, 100], and the value range of the HDR image is [0-4000].
[0171]
[0172] In this way, the electronic device performs targeted processing on the background and starry sky regions based on the segmentation results. This ensures that the starry sky region is sufficiently enhanced while the background region maintains a natural display effect. Compared with traditional global processing methods, this embodiment can significantly improve the visibility of the starry sky while maintaining a natural background.
[0173] Optionally, in some embodiments of this application, the above step 201 "the electronic device acquires the SDR image corresponding to the HDR image" can be specifically implemented by the following step 201a.
[0174] Step 201a: When the HDR image meets the first condition, the electronic device acquires the HDR image and the corresponding SDR image.
[0175] In some embodiments of this application, the first condition described above includes at least one of the following:
[0176] The target object was detected in the HDR image;
[0177] The shooting scene is determined as the target scene based on the shooting parameters of the HDR image.
[0178] For example, the target objects mentioned above include, but are not limited to: stars, trees, human figures, and rocks.
[0179] For example, the target scenes mentioned above include, but are not limited to: starry sky, forest, desert, sea, lake, and blue sky.
[0180] In some embodiments of this application, an electronic device can identify objects in an HDR image through an artificial intelligence model, and if the object is a target object, acquire the HDR image and the corresponding SDR image.
[0181] In some embodiments of this application, the electronic device can also acquire HDR images and corresponding SDR images by analyzing shooting parameters or the shooting scene of the image parameters of the image, when the shooting scene is the target scene.
[0182] In one possible embodiment, when the target scene is a starry sky scene, the electronic device determines the shooting scene as the target scene based on the shooting parameters of the HDR image, and the electronic device considers the current shooting scene to be a starry sky scene when the shooting parameters meet the following second condition.
[0183] For example, the second condition specifically includes: the shooting parameters of the HDR image meet the preset parameter threshold, the brightness histogram of the HDR image has a bimodal distribution, the first peak value of the brightness histogram is within the first preset threshold, and the second peak value of the brightness histogram is within the second preset threshold.
[0184] For example, the aforementioned preset parameter thresholds may include, but are not limited to: exposure time greater than a preset time, such as 5s, and ISO sensitivity (International Standards Organization, ISO) less than a preset ISO threshold, such as 1600.
[0185] In some embodiments of this application, the bimodal distribution described above is used to characterize the brightness histogram having two peaks.
[0186] For example, the electronic device converts each pixel value of the HDR image into a grayscale value to generate a grayscale image corresponding to the HDR image. Then, the electronic device iterates through the brightness values of each pixel in the grayscale image and counts the frequency of each brightness value to obtain a brightness histogram.
[0187] For example, such as Figure 7 As shown, taking an HDR image that includes a starry sky region as an example, the electronic device generates data based on this HDR image. Figure 7 The brightness histogram shown has the following characteristics: the main peak on the left is the dark peak, corresponding to the night sky and landscape, with a gray level of 30; the secondary peak is located in the mid-tone, corresponding to the main star, with a gray level of 115.
[0188] In some embodiments of this application, after an electronic device acquires an HDR image, if the shooting parameters of the HDR image are within a preset parameter threshold range, and the corresponding brightness histogram is a bimodal distribution, with the first peak value within a first preset threshold and the second peak value of the brightness histogram within a second preset threshold, the electronic device determines that the HDR image meets the first condition and executes the image processing method of this application embodiment.
[0189] In some embodiments of this application, the preset duration, the preset ISO threshold, the first preset threshold, and the second preset threshold may be set by default by the electronic device or by the user. This application does not limit these settings.
[0190] It is worth noting that the second condition mentioned above is the condition for electronic devices to determine that an HDR image includes a starry sky region. In other words, if an HDR image meets the first condition mentioned above, it means that the HDR image includes a starry sky, that is, the image content of the HDR image is a starry sky scene.
[0191] It should be noted that the first condition mentioned above can be replaced with detection conditions for other scenarios, such as the brightness difference value being greater than a preset threshold.
[0192] In this way, electronic devices can use different enhancement algorithms to perform targeted processing on images by region when specific conditions are met, while traditional processing methods are still used under normal circumstances, thus avoiding the unnecessary consumption of using a region-based processing method for each image.
[0193] The following specific examples illustrate the image processing method provided in the embodiments of this application.
[0194] Example 1:
[0195] In this embodiment, taking a starry sky scene captured by HDR imagery as an example, the first region is the starry sky region, and the second region is the background region; as shown Figure 8 As shown, the image processing method may include steps 101 to 110 as described below.
[0196] Step 101: The electronic device runs the camera application to capture the starry sky scene.
[0197] For example, the electronic device receives input from the user to open the camera application and select the starry sky / night mode option in the camera menu bar. At this time, the camera switches to the starry sky mode shooting page.
[0198] For example, when taking photos of starry sky scenes on an electronic device, the user needs to hold the phone steady or place it on a tripod. After the electronic device receives the user's input of clicking the photo control, the camera application automatically executes the exposure program to take the photo.
[0199] It should be noted that starry sky scenes are generally captured using long exposure techniques. For example, users can hold their phones steady at a campsite or use a tripod to stabilize the phone when taking photos of the starry sky and the Milky Way. The camera's exposure time was set to 30 seconds, and the ISO to 3200.
[0200] Step 102: Electronic devices acquire HDR and SDR photos.
[0201] For example, the electronic device first uses a multi-frame algorithm to process and synthesize a high-bit (e.g., 12-bit) HDR image, and then maps the HDR image to an SDR image through tone mapping.
[0202] For example, the SDR image mentioned above can be an 8-bit standard dynamic range image, and the electronic device mentioned above is an electronic device compatible with conventional display devices.
[0203] It should be noted that electronic devices with HDR display capabilities and compatibility with traditional display devices can display both HDR and SDR images simultaneously, while electronic devices with only traditional display capabilities can only display SDR images.
[0204] Step 103: The electronic device detects whether the image content of the HDR image is a starry sky scene. If it is a starry sky scene, then proceed to step 104; otherwise, output the enhanced image data based on global brightness statistics, which is the image data of the SDR image mentioned above.
[0205] For example, the electronic device determines whether the input image meets the first condition mentioned above in order to determine whether the image content of the HDR image is a starry sky scene.
[0206] Understandably, the main task of the aforementioned starry sky scene detection is to identify whether the input image is a starry sky scene, providing a basis for decision-making in subsequent processing.
[0207] For example, an electronic device can determine whether the first condition is met by judging the exposure information, i.e., the shooting parameters mentioned above, and analyzing the brightness histogram, so as to determine whether the image content of the HDR image is a starry sky scene.
[0208] For example, the above exposure information is obtained by obtaining the shooting parameters set when taking the picture, such as exposure time and ISO value, from the Exchangeable Image File Format (IFS), i.e., the camera shooting file.
[0209] For example, the above exposure information is determined by the electronic device to determine whether the acquired shooting parameters meet the shooting parameters used in typical astrophotography, such as a combination of long exposure and low ISO, and can preliminarily determine whether the input image is a long exposure and low ISO astrophotography scene.
[0210] Long exposure can be understood as an exposure time of ≥5 seconds, with an adjustable threshold; low ISO can be understood as ISO <1600, with an adjustable threshold.
[0211] For example, the above brightness histogram is obtained as follows: The electronic device first converts the HDR color image into a grayscale image, iterates through all pixels of the image, establishes 256 statistical containers (corresponding to grayscale levels 0-255), and counts the frequency of each brightness value, thus obtaining the brightness histogram distribution.
[0212] The brightness value of each pixel is calculated as follows: Brightness Y = 0.299 × R + 0.587 × G + 0.114 × B.
[0213] For example, the above-mentioned determination of the brightness histogram: The electronic device analyzes the brightness histogram distribution of the input image to detect whether there are typical starry sky brightness features. For example, the histogram feature of a typical starry sky image is a bimodal distribution, and the peak values of both peaks are within the above-mentioned preset threshold. For example, the left main peak is the dark peak, corresponding to the night sky and landscape, with a gray level range of 5%-15%, that is, a gray level of 13-40 gray level; the secondary peak is located in the mid-tone, corresponding to the main star, with a gray level range of 18%-50%, that is, a gray level of 48-128 gray level.
[0214] For example, the electronic device uses a preset threshold to determine whether the scene is a starry sky by combining the exposure information and the brightness histogram analysis results. That is, whether the first condition is met.
[0215] For example, consider an HDR image of the starry sky with an exposure time of 6 seconds and an ISO of 450. Assuming the preset threshold for exposure information in a starry sky scene is an exposure time ≥ 5 seconds and an ISO < 1600, this image meets the exposure time and ISO requirements. Next, the image's brightness histogram is determined to have a bimodal distribution, with the left main peak having a gray level of 30 (within the 5%-15% range) and the secondary peak having a gray level of 115 (within the 18%-50% range). Therefore, this image also meets the brightness histogram requirements for a starry sky scene. Thus, this image is identified as a starry sky scene, and step 104 is executed. Otherwise, the image is processed according to the standard HDR workflow.
[0216] Step 104: The electronic device performs AI segmentation on the SDR image to generate mask images corresponding to the background and starry sky regions, and performs glare recognition on the SDR image to generate mask images corresponding to the glare regions.
[0217] Among them, the mask image corresponding to the background area is the first mask image, the mask image corresponding to the starry sky area is the second mask image, and the mask image corresponding to the glare area is the glare mask image.
[0218] For example, the electronic device uses an existing AI image segmentation model, such as the U-Net model, to perform semantic segmentation on an SDR image of a starry sky scene, dividing the image into a starry sky region and a background region, and generating mask images corresponding to the starry sky region and the background region respectively. This allows the electronic device to use pixel-level precise segmentation, providing a foundation for subsequent region-specific processing.
[0219] Existing glare detection models, such as MobileNetV3, perform glare detection on HDR images, locating glare regions within the image. These models can identify glare caused by various factors, such as lens flare and stray light. They then generate mask images corresponding to the glare regions, clearly marking the areas affected by glare in the image. This allows for precise localization and handling of glare issues in subsequent processing.
[0220] Step 105: The electronic device generates background area enhancement image data, namely the first display enhancement data mentioned above.
[0221] For example, based on the mask image of the starry sky region obtained in step 104, i.e. the first mask image mentioned above, enhanced image data corresponding to the background region is generated.
[0222] For example, the electronic device applies a basic HDR enhancement image data algorithm, namely the first enhancement algorithm described above, to the background region to generate enhanced image data G for the background region. 背景 The basic HDR enhancement data algorithm is the above formula (5).
[0223] Step 106: The electronic device generates enhanced image data of the starry sky region, namely the second display enhancement data mentioned above.
[0224] For example, based on the mask image obtained in step 104 that masks the background area, i.e. the second mask image mentioned above, enhanced image data corresponding to the starry sky area is generated.
[0225] For example, the electronic device generates enhanced image data corresponding to the starry sky region in two steps.
[0226] Step 1: Apply a specialized S-curve to the starry sky region of the HDR image, namely the contrast enhancement algorithm mentioned above. This focuses on improving the contrast of the starry sky region while preserving details in the highlights and reducing over-brightening of the dark areas in the deep sky. Figure 9 As shown, Figure 9 for Figure 4 Image showing the starry sky area after contrast enhancement.
[0227] Step 2: The electronic device applies an improved HDR enhancement image data algorithm, namely the second enhancement algorithm mentioned above, to the starry sky region of the processed HDR image and the starry sky region of the SDR image to generate enhanced image data G of the starry sky region. 星空 .
[0228] Step 107: The electronic device merges the enhanced image data corresponding to the background area and the starry sky area.
[0229] For example, the electronic device integrates the optimized enhanced image data of the background area and the enhanced image data of the starry sky area to generate enhanced image data corresponding to the merged SDR image, i.e., the third display enhancement data mentioned above. The specific process can be found in the description of step 204 above.
[0230] Step 108: The electronic device generates enhanced image data with glare reduction function.
[0231] For example, the electronic device obtains a glare mask image based on step 104, generates a glare intensity table, and adaptively adjusts the attenuation gain value α according to this glare intensity table, i.e., Table 1 above, for different glare intensities. Here, α∈[0.3,0.7] is a suppression factor, which is an adjustable parameter. Then, the electronic device obtains the suppressed glare intensity value based on the glare intensity value and the suppression factor in the glare intensity table, and then integrates the suppressed glare intensity value with the aforementioned merged enhanced image data to obtain enhanced image data with glare gain suppression function.
[0232] Step 109: The electronic device packages and outputs the SDR image and enhanced image data.
[0233] For example, the electronic device uses the standard JPEG format to package and output SDR images and enhanced image data.
[0234] Step 110: The electronic device renders and displays the image packaged and output in step 109 through the HDR display device.
[0235] For example, an electronic device reads an HDR image packaged in standard JPEG format through an HDR display device and displays it on an HDR display. This step can be referred to the standard display steps of HDR display devices in related technologies, and will not be repeated here.
[0236] For example, an electronic device simultaneously reads the original SDR image and the optimized enhanced image data through an HDR display device, and dynamically renders the original SDR image based on the enhanced image data to enhance the display effect of the starry sky area. The SDR image provides basic color and brightness information, while the enhanced data provides the basis for adjustments.
[0237] Thus, after the above processing, users will see a separately enhanced HDR display effect in the starry sky area, while glare and blurring are effectively eliminated. The brightness and contrast of the starry sky are significantly improved, stars in dark areas are more clearly visible, and details in bright areas are preserved.
[0238] Each of the above-described method embodiments, or various possible implementations of each method embodiment, can be executed individually or in combination of any two or more. The specific implementation can be determined according to actual usage requirements, and this application does not impose any restrictions on this.
[0239] The image processing method provided in this application can be executed by an electronic device or an image processing apparatus. This application uses an image processing apparatus to execute the image processing method as an example to illustrate the image processing apparatus provided in this application.
[0240] Figure 10 A schematic diagram of a possible structure of the image processing apparatus involved in an embodiment of this application is shown. For example... Figure 10 As shown, the image processing device 700 may include: an acquisition module 701 and a processing module 702;
[0241] The acquisition module 701 is used to acquire an HDR image and a corresponding SDR image. The processing module 702 is used to obtain first display enhancement data based on the first mask image corresponding to the SDR image acquired by the acquisition module 701, the HDR image, and the SDR image acquired by the acquisition module 701. The first mask image is obtained by masking a first region in the SDR image. The processing module 702 is also used to obtain second display enhancement data based on the second mask image corresponding to the SDR image acquired by the acquisition module 701, the HDR image, and the SDR image acquired by the acquisition module 701. The second mask image is obtained by masking a second region in the SDR image. The processing module 702 is also used to obtain third display enhancement data corresponding to the SDR image based on the first and second display enhancement data.
[0242] Optionally, in some embodiments of this application, combined with Figure 10 ,like Figure 11 As shown, the above-mentioned device 700 also includes: a rendering module 703;
[0243] The rendering module 703 is used to dynamically render the SDR image based on the third display enhancement data corresponding to the SDR image obtained by the processing module 702 based on the first display enhancement data and the second display enhancement data, thereby obtaining the target HDR image.
[0244] Optionally, in some embodiments of this application, the processing module 702 is specifically used to employ a first enhancement algorithm to calculate first display enhancement data based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image; the first enhancement algorithm is determined based on the image features of the second region; the processing module 702 is specifically used to employ a second enhancement algorithm to calculate second display enhancement data based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second enhancement algorithm is determined based on the image features of the first region; wherein the first enhancement algorithm and the second enhancement algorithm are different.
[0245] Optionally, in some embodiments of this application, the first region is a starry sky region and the second region is a background region;
[0246] The aforementioned processing module 702 is specifically used for:
[0247] Based on the first mask image, a first image region and a second image region are determined. The first image region is the image region of the background region in the HDR image, and the second image region is the image region of the background region in the SDR image.
[0248] The first display enhancement data is generated based on the ratio between the brightness value of each pixel in the first image region and the brightness value of each pixel in the second image region.
[0249] Optionally, in some embodiments of this application, the first region is a starry sky region and the second region is a background region;
[0250] The aforementioned processing module 702 is specifically used for:
[0251] Based on the second mask image, a third image region and a fourth image region are determined. The third image region is the image region of the starry sky region in the HDR image, and the fourth image region is the image region of the starry sky region in the SDR image.
[0252] The third image region is subjected to contrast enhancement processing to obtain the enhanced third image region.
[0253] The second display enhancement data is generated based on the ratio between the brightness value of each pixel in the enhanced third image region and the brightness value of each pixel in the fourth image region.
[0254] Optionally, in some embodiments of this application, the acquisition module 701 is specifically used to acquire the HDR image and the corresponding SDR image when the HDR image meets the first condition.
[0255] The first condition mentioned above includes at least one of the following:
[0256] The target object was identified in the aforementioned HDR image;
[0257] Based on the shooting parameters of the aforementioned HDR image, the shooting scene was determined as the target scene.
[0258] Optionally, in some embodiments of this application, the acquisition module 701 is further configured to: after the processing module 702 obtains the third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data, acquire the glare mask image corresponding to the HDR image, wherein the glare mask image is obtained by masking the non-glare areas in the HDR image; the acquisition module 701 is further configured to: acquire the glare intensity value of each pixel in the glare area based on the glare mask image; the processing module 702 is further configured to: obtain the suppressed glare intensity value based on the suppression factor and the glare intensity value; and the rendering module 703 is configured to: dynamically render the SDR image based on the third display enhancement data and the suppressed glare intensity value to obtain the target HDR image.
[0259] In the image processing apparatus provided in this application embodiment, the image processing apparatus acquires an HDR image and a corresponding SDR image; based on a first mask image corresponding to the SDR image, the HDR image, and the SDR image, it obtains first display enhancement data; the first mask image is obtained by masking a first region in the SDR image; based on a second mask image corresponding to the SDR image, the HDR image, and the SDR image, it obtains second display enhancement data; the second mask image is obtained by masking a second region in the SDR image; based on the first display enhancement data and the second display enhancement data, it obtains third display enhancement data corresponding to the SDR image. In this solution, the image processing apparatus performs masking processing on different regions of the SDR image to obtain mask images corresponding to different regions, thereby achieving region segmentation of the SDR image. This allows the electronic device to perform targeted image processing on different regions to obtain multiple image data, thus ensuring the image display effect corresponding to each image data, and further improving the display effect of the finally generated HDR image.
[0260] The image processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0261] The image processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.
[0262] The image processing apparatus provided in this application embodiment can implement the various processes implemented in the image processing method embodiment and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0263] Optionally, such as Figure 12 As shown, this application embodiment also provides an electronic device 800, including a processor 801 and a memory 802. The memory 802 stores a program or instructions that can run on the processor 801. When the program or instructions are executed by the processor 801, they implement the various steps of the above-described image processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0264] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0265] Figure 13 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0266] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.
[0267] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 13 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0268] The processor 110 is configured to acquire an HDR image and a corresponding SDR image; the processor 110 is further configured to obtain first display enhancement data based on a first mask image corresponding to the SDR image, the HDR image, and the SDR image; the first mask image is obtained by masking a first region in the SDR image; the processor 110 is further configured to obtain second display enhancement data based on a second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second mask image is obtained by masking a second region in the SDR image; the processor 110 is further configured to obtain third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data.
[0269] Optionally, in some embodiments of this application, the processor 110 is further configured to, after obtaining the third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data, dynamically render the SDR image based on the third display enhancement data to obtain a target HDR image.
[0270] Optionally, in some embodiments of this application, the processor 110 is specifically used to employ a first enhancement algorithm to calculate first display enhancement data based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image; the first enhancement algorithm is determined based on the image features of the second region; the processor 110 is specifically used to employ a second enhancement algorithm to calculate second display enhancement data based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second enhancement algorithm is determined based on the image features of the first region; wherein the first enhancement algorithm and the second enhancement algorithm are different.
[0271] Optionally, in some embodiments of this application, the first region is a starry sky region and the second region is a background region;
[0272] The aforementioned processor 110 is specifically used for:
[0273] Based on the first mask image, a first image region and a second image region are determined. The first image region is the image region of the background region in the HDR image, and the second image region is the image region of the background region in the SDR image.
[0274] The first display enhancement data is generated based on the ratio between the brightness value of each pixel in the first image region and the brightness value of each pixel in the second image region.
[0275] Optionally, in some embodiments of this application, the first region is a starry sky region and the second region is a background region;
[0276] The aforementioned processor 110 is specifically used for:
[0277] Based on the second mask image, a third image region and a fourth image region are determined. The third image region is the image region of the starry sky region in the HDR image, and the fourth image region is the image region of the starry sky region in the SDR image.
[0278] The third image region is subjected to contrast enhancement processing to obtain the enhanced third image region.
[0279] The second display enhancement data is generated based on the ratio between the brightness value of each pixel in the enhanced third image region and the brightness value of each pixel in the fourth image region.
[0280] Optionally, in some embodiments of this application, the processor 110 is specifically used to acquire the HDR image and the corresponding SDR image when the HDR image meets the first condition.
[0281] The first condition mentioned above includes at least one of the following:
[0282] The target object was identified in the aforementioned HDR image;
[0283] Based on the shooting parameters of the aforementioned HDR image, the shooting scene was determined as the target scene.
[0284] Optionally, in some embodiments of this application, the processor 110 is further configured to: obtain a glare mask image corresponding to the HDR image after obtaining the third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data; the glare mask image is obtained by masking the non-glare areas in the HDR image; the processor 110 is further configured to: obtain the glare intensity value of each pixel in the glare area based on the glare mask image; obtain the suppressed glare intensity value based on the suppression factor and the glare intensity value; and dynamically render the SDR image based on the third display enhancement data and the suppressed glare intensity value to obtain a target HDR image.
[0285] In the electronic device provided in this application embodiment, the electronic device acquires an HDR image and a corresponding SDR image; based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image, it obtains first display enhancement data; the first mask image is obtained by masking a first region in the SDR image; based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image, it obtains second display enhancement data; the second mask image is obtained by masking a second region in the SDR image; based on the first display enhancement data and the second display enhancement data, it obtains third display enhancement data corresponding to the SDR image. In this solution, the electronic device performs masking processing on different regions of the SDR image to obtain mask images corresponding to different regions, thereby achieving region segmentation of the SDR image. This allows the electronic device to perform targeted image processing on different regions to obtain multiple image data, thus ensuring the image display effect corresponding to each image data, and improving the display effect of the finally generated HDR image.
[0286] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0287] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0288] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.
[0289] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.
[0290] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0291] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0292] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0293] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described image processing method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0294] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0295] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0296] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An image processing method, characterized in that, The method includes: Acquire high dynamic range (HDR) images and their corresponding standard dynamic range (SDR) images; Based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image, first display enhancement data is obtained; the first mask image is obtained by masking a first region in the SDR image. Second display enhancement data is obtained based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second mask image is obtained by masking a second region in the SDR image. Based on the first and second display enhancement data, the third display enhancement data corresponding to the SDR image is obtained.
2. The method according to claim 1, characterized in that, After obtaining the third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data, the method further includes: Based on the third display enhancement data, the SDR image is dynamically rendered to obtain the target HDR image.
3. The method according to claim 1, characterized in that, The first display enhancement data is obtained based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image, including: A first enhancement algorithm is used to calculate first display enhancement data based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image; the first enhancement algorithm is determined based on the image features of the second region. The second display enhancement data is obtained based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image, including: A second enhancement algorithm is used to calculate second display enhancement data based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image; the second enhancement algorithm is determined based on the image features of the first region. The first enhancement algorithm and the second enhancement algorithm are different.
4. The method according to claim 1 or 3, characterized in that, The first area is the starry sky area, and the second area is the background area; The first display enhancement data is obtained based on the first mask image corresponding to the SDR image, the HDR image, and the SDR image, including: Based on the first mask image, a first image region and a second image region are determined, wherein the first image region is the image region of the background region in the HDR image, and the second image region is the image region of the background region in the SDR image; The first display enhancement data is generated based on the ratio between the brightness value of each pixel in the first image region and the brightness value of each pixel in the second image region.
5. The method according to claim 1 or 3, characterized in that, The first area is the starry sky area, and the second area is the background area; The second display enhancement data is obtained based on the second mask image corresponding to the SDR image, the HDR image, and the SDR image, including: Based on the second mask image, a third image region and a fourth image region are determined. The third image region is the image region of the starry sky region in the HDR image, and the fourth image region is the image region of the starry sky region in the SDR image. The third image region is subjected to contrast enhancement processing to obtain the enhanced third image region; The second display enhancement data is generated based on the ratio between the brightness value of each pixel in the enhanced third image region and the brightness value of each pixel in the fourth image region.
6. The method according to claim 1, characterized in that, The acquisition of the HDR image and the corresponding SDR image includes: If the HDR image meets the first condition, acquire the HDR image and the corresponding SDR image; The first condition includes at least one of the following: The target object was identified in the HDR image; The shooting scene is determined as the target scene based on the shooting parameters of the HDR image.
7. The method according to claim 1, characterized in that, After obtaining the third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data, the method further includes: Obtain the glare mask image corresponding to the HDR image, wherein the glare mask image is obtained by masking the non-glare areas in the HDR image; Based on the glare mask image, obtain the glare intensity value of each pixel in the glare region; Based on the suppression factor and the glare intensity value, the suppressed glare intensity value is obtained; Based on the third display enhancement data and the suppressed glare intensity value, the SDR image is dynamically rendered to obtain the target HDR image.
8. An image processing apparatus, characterized in that, The image processing device includes: an acquisition module and a processing module; The acquisition module is used to acquire high dynamic range (HDR) images and corresponding standard dynamic range (SDR) images; The processing module is used to obtain first display enhancement data based on the first mask image corresponding to the SDR image obtained by the acquisition module, the HDR image, and the SDR image obtained by the acquisition module; the first mask image is obtained by performing mask processing on a first region in the SDR image; The processing module is further configured to obtain second display enhancement data based on the second mask image corresponding to the SDR image obtained by the acquisition module, the HDR image, and the SDR image obtained by the acquisition module; the second mask image is obtained by performing mask processing on a second region in the SDR image; The processing module is further configured to obtain third display enhancement data corresponding to the SDR image based on the first display enhancement data and the second display enhancement data.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the image processing method as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the image processing method as described in any one of claims 1 to 7.