Image processing method and device, equipment, medium and product

By determining the light type and brightness data of the image, brightness mapping and bit width compression are performed, which solves the problem of poor visual effect of the target area when converting high bit width and high dynamic range images to low bit width and low dynamic range images, and achieves image conversion that is closer to the human eye's observation effect.

CN121600044APending Publication Date: 2026-03-03SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511917433.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

In the process of converting high bit width and high dynamic range images into low bit width and low dynamic range images, the image quality of the target area is particularly important. Existing technologies cannot guarantee the visual quality of the target area under various lighting conditions.

Method used

By acquiring the brightness data of the image to be processed, the light position type of the target area is determined, and the target mapping relationship is determined based on the light position type and brightness data. After brightness mapping processing, bit width compression is performed to ensure the dynamic range and visual effect of the image.

Benefits of technology

It improves the visual effect of the target area, preserves image details, and facilitates storage and display, while adapting to image conversion under different lighting conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121600044A_ABST
    Figure CN121600044A_ABST
Patent Text Reader

Abstract

The invention relates to an image processing method and apparatus, a device, a medium and a product. The method comprises the steps of obtaining a to-be-processed image; determining a light level type of a target area in the to-be-processed image according to the brightness data of the to-be-processed image; determining a target mapping relation according to the light bit type and the brightness data; wherein the target mapping relation is used for mapping the brightness in the first dynamic range to the brightness in the second dynamic range, and the first dynamic range is larger than the second dynamic range; according to the target mapping relation, performing brightness mapping processing on the to-be-processed image to obtain a brightness mapping image; and performing bit width compression on the brightness mapping image to obtain a target image. According to the invention, the visual effect of the face area can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Currently, for images including target regions (e.g., facial regions), the image quality of the target region is particularly important during the conversion from high bit width and high dynamic range images to low bit width and low dynamic range images. For the target region, brightness is mainly adjusted by controlling exposure or electronic gain, but these methods still cannot guarantee the visual quality of the target region under various lighting conditions. Summary of the Invention

[0003] Therefore, it is necessary to provide an image processing method, apparatus, device, medium, and product that can improve the visual effect of the face region in order to address the above-mentioned technical problems.

[0004] In a first aspect, this application provides an image processing method, comprising:

[0005] Obtain the image to be processed;

[0006] Based on the brightness data of the image to be processed, determine the light position type of the target region in the image to be processed;

[0007] Based on the light position type and brightness data, a target mapping relationship is determined; wherein, the target mapping relationship is used to map the brightness in the first dynamic range to the brightness in the second dynamic range, and the first dynamic range is greater than the second dynamic range;

[0008] Based on the target mapping relationship, brightness mapping processing is performed on the image to be processed to obtain a brightness-mapped image;

[0009] The target image is obtained by bit-width compression of the brightness mapping image.

[0010] In one embodiment, determining the target mapping relationship based on the light position type and brightness data includes: determining an initial mapping relationship based on the light position type and brightness data; determining adjustment data corresponding to the initial mapping relationship based on the light position type; and adjusting the initial mapping relationship based on the adjustment data to obtain the target mapping relationship.

[0011] In one embodiment, determining an initial mapping relationship based on light position type and brightness data includes: in response to the light position type being side lighting type, selecting an initial mapping relationship from at least one first candidate mapping relationship based on the average number of pixels; in response to the light position type being non-side lighting type, selecting an initial mapping relationship from at least one second candidate mapping relationship based on the brightness peak value; wherein, the average number of pixels is the average of the extreme values ​​of the number of pixels, the extreme values ​​of the number of pixels are the extreme values ​​of the statistical number of pixels corresponding to different brightness levels in the target area of ​​the image to be processed, and different average values ​​of the number of pixels correspond to different first candidate mapping relationships; the brightness peak value is the peak value in the target brightness range corresponding to the backlighting degree of the target area of ​​the image to be processed.

[0012] In one embodiment, determining the adjustment data corresponding to the initial mapping relationship based on the light position type includes: in response to the light position type being a side-light type, determining the adjustment data as the mapping point pair data of the preset position points in the initial mapping relationship; in response to the light position type being a non-side-light type, determining the adjustment data as the contrast within a preset range to which the brightness peak belongs; accordingly, adjusting the initial mapping relationship based on the adjustment data to obtain the target mapping relationship includes: in response to the light position type being a side-light type, adjusting the mapping brightness in the mapping point pair data of the preset position points to the corresponding desired mapping brightness; in response to the light position type being a non-side-light type, adjusting the contrast within a preset range to which the brightness peak belongs to the desired contrast.

[0013] In one embodiment, bit-width compression of a brightness mapping image to obtain a target image includes: extracting brightness mapping features and loss detail features of the brightness mapping image at different scales; performing detail enhancement on the brightness mapping features at each scale based on the detail features at that scale to obtain a detail-enhanced image at that scale; performing image reconstruction on the detail-enhanced images at different scales to obtain a reconstructed image; and performing bit-width compression on the reconstructed image to obtain the target image.

[0014] In one embodiment, determining the light position type of a target region in the image to be processed based on the brightness data of the image to be processed includes: determining the number of pixels corresponding to different brightness levels in the target region of the image to be processed based on the brightness data; determining the extreme value of the number of pixels corresponding to different brightness levels in the target region based on the extreme value of the number of pixels; determining the brightness attribute data of the target region based on the extreme value of the number of pixels; and determining the light position type based on the brightness attribute data.

[0015] Secondly, this application provides an image processing apparatus, comprising:

[0016] The first acquisition module is used to acquire the image to be processed;

[0017] The first determining module is used to determine the light position type of the target region in the image to be processed based on the brightness data of the image to be processed.

[0018] The second determining module is used to determine the target mapping relationship based on the light position type and brightness data; wherein, the target mapping relationship is used to map the brightness in the first dynamic range to the brightness in the second dynamic range, and the first dynamic range is greater than the second dynamic range;

[0019] The first mapping module is used to perform brightness mapping processing on the image to be processed according to the target mapping relationship to obtain a brightness mapping image;

[0020] The first compression module is used to perform bit-width compression on the brightness mapping image to obtain the target image.

[0021] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method provided in the first aspect.

[0022] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect.

[0023] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in the first aspect.

[0024] The aforementioned image processing methods, apparatuses, devices, media, and products determine the light position type of the target region in the image to be processed based on the brightness data, thereby understanding the lighting conditions of the target region. Based on the light position type and brightness data, a target mapping relationship is determined to ensure that the target mapping relationship considers the brightness conditions of each pixel in the entire image to be processed, as well as the lighting conditions of the target region. Therefore, after brightness mapping processing of the image to be processed using the target mapping relationship, the dynamic range of the brightness-mapped image can be guaranteed to be within the second dynamic range while capturing as many image details as possible, making the brightness-mapped image closer to the effect observed by the human eye, thereby improving the visual effect of the target region. Finally, the brightness-mapped image undergoes bit-width compression to achieve high-bit-width to low-bit-width conversion, facilitating the storage and display processing of the target image. Attached Figure Description

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

[0026] Figure 1 This is a flowchart illustrating an image processing method in one embodiment;

[0027] Figure 2A This is a flowchart illustrating the steps for determining the light position type in one embodiment;

[0028] Figure 2B This is a schematic diagram of the brightness histogram in one embodiment;

[0029] Figure 3A This is a flowchart illustrating the steps for determining the target mapping relationship in one embodiment;

[0030] Figure 3B This is a schematic diagram showing the distribution of a first number of points in one embodiment;

[0031] Figure 4 This is a flowchart illustrating the bit-width compression step in one embodiment;

[0032] Figure 5 This is a structural block diagram of an image processing device in one embodiment;

[0033] Figure 6 This is an internal block diagram of a computer device in one embodiment. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0035] In one exemplary embodiment, an image processing method is provided, see [link to example]. Figure 1 The method includes:

[0036] S110, Obtain the image to be processed.

[0037] The image to be processed is an image acquired from a sensor or memory. This image is a high bit width and a high dynamic range image, where the high dynamic range is the first dynamic range.

[0038] Understandably, the bit width, the number of binary bits occupied by each pixel value, determines the color accuracy, storage requirements, and computational efficiency of an image.

[0039] As we can understand it, dynamic range refers to the range of differences between the darkest and brightest pixel values. High dynamic range means a relatively wide dynamic range, while low dynamic range means a relatively narrow dynamic range.

[0040] In real-world scenarios, a brightness range can be set based on experience. Subsequent steps are only performed when the overall brightness of the image to be processed is within the brightness range; otherwise, no subsequent steps are performed on the image to be processed, in order to ensure the effect of the target image.

[0041] S120, determine the light position type of the target area in the image to be processed based on the brightness data of the image to be processed.

[0042] The target area can be, for example, the face area, or other important areas, but this is not limited here.

[0043] Among them, the light position type includes side lighting type, backlighting type and front lighting type, and of course it may include other types, which are not limited here.

[0044] S130, determine the target mapping relationship based on the light position type and brightness data.

[0045] The target mapping relationship is used to map the brightness in the first dynamic range to the brightness in the second dynamic range, where the first dynamic range is larger than the second dynamic range.

[0046] The second dynamic range is the low dynamic range.

[0047] The target mapping relationship can be in the form of a mapping function, where the input of the mapping function is the brightness within a first dynamic range, and the output is the brightness within a second dynamic range, thus mapping the brightness within the first dynamic range to the brightness within the second dynamic range. The mapping function is typically a non-linear function, i.e., a curve function.

[0048] S140, according to the target mapping relationship, perform brightness mapping processing on the image to be processed to obtain a brightness mapping image.

[0049] That is, the brightness of each pixel in the image to be processed is input into the target mapping relationship to obtain the mapped brightness, and the brightness of the pixel is set to the mapped brightness to obtain the brightness mapping image. It can be seen that the brightness mapping image is actually the result of mapping the brightness of each pixel in the image to be processed to the brightness within the second dynamic range.

[0050] S150, perform bit-width compression on the brightness mapping image to obtain the target image.

[0051] That is, by compressing the bit width, the target head image can be made into a low bit width image.

[0052] As can be seen, based on the method provided in this embodiment, the purpose of converting a high bit width and high dynamic range image to be processed into a low bit width and low dynamic range target image is achieved.

[0053] The image processing method described above determines the light position type of the target region in the image to be processed based on the brightness data, thereby understanding the lighting conditions of the target region. Based on the light position type and brightness data, a target mapping relationship is determined to ensure that the target mapping relationship considers the brightness conditions of each pixel in the entire image to be processed, as well as the lighting conditions of the target region. Therefore, after brightness mapping processing of the image to be processed using the target mapping relationship, the dynamic range of the brightness-mapped image is guaranteed to be within the second dynamic range, while capturing as many image details as possible, making the brightness-mapped image closer to the effect observed by the human eye, thus improving the visual effect of the target region. Finally, the brightness-mapped image undergoes bit-width compression to achieve high-bit-width to low-bit-width conversion, facilitating the storage and display processing of the target image.

[0054] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the optical position type determination step in S120 is refined.

[0055] See Figure 2A The steps for determining the type of light position include:

[0056] S210, Based on the brightness data, determine the statistical number of pixels corresponding to different brightness levels in the target area of ​​the image to be processed.

[0057] In practical scenarios, a luminance histogram of the target area can be generated. In the luminance histogram, the horizontal axis represents luminance, and the vertical axis represents the number of pixels corresponding to each luminance level in the target area, thus obtaining the pixel count for different luminance levels. After obtaining the luminance histogram, filtering and smoothing can be applied to it to improve the robustness of subsequent calculations. For example, Figure 2B The smoothed brightness histogram is shown. In this brightness histogram, the positive axis represents brightness, and the vertical axis represents the number of pixels at the corresponding brightness.

[0058] Of course, the brightness histogram of non-target areas can also be calculated. The statistical method can be sparse sampling, and the sampling points can be evenly distributed; or the sampling point density can be gradually reduced from the target area towards the image edge; other sampling methods can also be used, which are not limited here.

[0059] S220: Determine the extreme value of the number of pixels corresponding to different brightness levels in the target area.

[0060] In practical scenarios, an adaptive threshold can be used to segment the brightness histogram of the target region. Maximum values ​​are searched on the side where the value is less than the adaptive threshold, thus obtaining the peak pixel count; minimum values ​​are searched on the side where the value is greater than or equal to the adaptive threshold, thus obtaining the valley pixel count. Therefore, extreme pixel count values ​​can include both peak and valley pixel counts.

[0061] S230 determines the brightness attribute data of the target area based on the extreme value of the number of pixels.

[0062] The brightness and darkness attribute data may include at least one of the following: the difference in location of bright and dark areas, the ratio of bright to dark areas, and the distance between bright and dark areas. Of course, other attributes may also be included, which are not limited here.

[0063] The calculation process for the positional difference between bright and dark areas includes: calculating the distance between the brightness corresponding to the peak value of the number of pixels and the brightness corresponding to the valley value of the number of pixels, and using this distance as the positional difference between bright and dark areas.

[0064] The calculation process for the bright-dark area ratio includes: calculating the sum of the number of pixels corresponding to each brightness within the first brightness range to which the peak pixel count belongs, to obtain the dark area; calculating the sum of the number of pixels corresponding to each brightness within the second brightness range to which the valley pixel count belongs, to obtain the bright area; and using the ratio of the dark area to the bright area as the bright-dark area ratio.

[0065] For example, if the brightness corresponding to the peak number of pixels is 100, then the first brightness range is [95, 105]; if the brightness corresponding to the valley number of pixels is 220, then the second brightness range is [215, 225].

[0066] The calculation process for the distance between bright and dark areas includes: calculating the first centroid corresponding to the first brightness range, calculating the second centroid corresponding to the second brightness range, and taking the difference between the first centroid and the second centroid as the distance between the bright and dark areas.

[0067] The calculation process for the first centroid corresponding to the first brightness range includes: multiplying each brightness level in the first brightness range by the corresponding number of pixels, summing the products, and obtaining the first centroid.

[0068] The calculation process for the second centroid corresponding to the second brightness range includes: multiplying each brightness level in the second brightness range by the corresponding number of pixels, summing the products, and obtaining the second centroid.

[0069] It is understandable that the number of pixels corresponding to the brightness mentioned above is the statistical number of pixels corresponding to that brightness in the brightness histogram of the target area.

[0070] S240, determine the light position type based on the brightness and darkness attribute data.

[0071] For example, if the difference between the positions of the bright and dark areas is greater than a position difference threshold, the ratio of the bright and dark areas is within a preset range, and the distance between the bright and dark areas is greater than a position distance threshold, the light position type is considered to be a side light type; otherwise, it is considered a non-side light type.

[0072] In the above embodiments, the extreme value of the number of pixels corresponding to different brightness levels in the target area is determined. Based on the extreme value of the number of pixels, the brightness and darkness attribute data of the target area can be accurately determined. Furthermore, based on the brightness and darkness attribute data, the lighting conditions of the target area can be accurately determined, that is, the light position type of the target area is obtained.

[0073] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the target mapping relationship determination step in S130 is refined.

[0074] See Figure 3A The steps for determining the target mapping relationship include:

[0075] S310 determines the initial mapping relationship based on the light position type and brightness data.

[0076] The initial mapping relationship can be obtained by filtering candidate mapping relationships based on light position type and brightness data. Of course, other methods can also be used to determine the initial mapping relationship, which are not limited here.

[0077] In one optional implementation, the initial mapping determination step may include:

[0078] (1) In response to the light position type being side light type, an initial mapping relationship is selected from at least one first candidate mapping relationship based on the average number of pixels.

[0079] Among them, the mean number of pixels is the mean of the extreme values ​​of the number of pixels, and the extreme values ​​of the number of pixels are the extreme values ​​of the number of pixels with different brightness in the target area of ​​the image to be processed. Different mean numbers of pixels correspond to different first candidate mapping relationships.

[0080] For example, the average number of pixels is the average of the peak value and the trough value of the aforementioned number of pixels.

[0081] As can be seen, multiple first candidate mapping relationships are pre-set, and each of the multiple first candidate mapping relationships corresponds one-to-one with multiple average pixel counts. Therefore, under the side lighting type, the corresponding first candidate mapping relationship can be found from at least one first candidate mapping relationship based on the average pixel count, and used as the initial mapping relationship.

[0082] Understandably, when the light type is side lighting, the contrast of the target area is high. Therefore, the initial mapping relationship can be selected based on the average of the peak and valley values ​​of the pixel count.

[0083] (2) In response to the light position type being non-side light type, an initial mapping relationship is selected from at least one second candidate mapping relationship based on the brightness peak.

[0084] Among them, the brightness peak is the peak value in the target brightness range corresponding to the backlighting degree of the target area of ​​the image to be processed.

[0085] The process of determining the degree of backlighting in the target area includes:

[0086] Calculate the average brightness of the target area and the average brightness of the non-target area, and determine the ratio of the average brightness of the target area to the average brightness of the non-target area. If the ratio is less than the preset backlight threshold, the target area is considered to be backlit, i.e., the backlight level is high. If the ratio is greater than the preset frontlight threshold, the target area is considered to be frontlit or have close-range lighting, and the backlight level is low. If the ratio is between the preset backlight threshold and the preset frontlight threshold, the target area is considered to be uniformly lit, i.e., the backlight level is moderate.

[0087] When the backlighting is moderate, the target brightness range is the base brightness range, which is set based on experience. When the backlighting is low, the target brightness range is the range shifted to the right of the base brightness range, that is, the brightness range after increasing both the minimum and maximum values ​​of the base brightness range. When the backlighting is high, the target brightness range is the range shifted to the left of the base brightness range, that is, the brightness range after decreasing both the minimum and maximum values ​​of the base brightness range.

[0088] Understandably, the peak brightness is the peak value within the target brightness range.

[0089] In the above implementation method, the initial mapping relationship is selected from the candidate mapping relationships according to different parameters under different light position types, which can ensure the effectiveness of the initial mapping relationship.

[0090] In real-world scenarios, this initial mapping relationship may not be entirely suitable for the image to be processed, so it is necessary to adjust the initial mapping relationship.

[0091] S320, determine the adjustment data corresponding to the initial mapping relationship based on the light position type.

[0092] In real-world scenarios, adjusting the data can be used to identify key locations in the initial mapping relationship.

[0093] For example, if the light type is side lighting, the average of the aforementioned peak and valley values ​​of the pixel count is considered when selecting the initial mapping relationship. This does not mean that the initial mapping relationship is suitable for the peak and valley values ​​of the pixel count. That is, the expected mapped brightness of the brightness corresponding to the peak value of the pixel count in the brightness histogram is different from the mapped brightness corresponding to the peak value of the pixel count in the brightness histogram in the initial mapping relationship; or, the expected mapped brightness of the brightness corresponding to the valley value of the pixel count in the brightness histogram is different from the mapped brightness corresponding to the valley value of the pixel count in the brightness histogram in the initial mapping relationship. That is, the expected mapped brightness of the key point is different from the actual mapped brightness determined according to the initial mapping relationship. Therefore, the goal of adjusting the initial mapping relationship is to adjust the actual mapped brightness determined according to the initial mapping relationship to the expected mapped brightness.

[0094] As can be seen, the light type is side lighting, and the adjustment data is the mapping point pair of the preset position points in the initial mapping relationship. The preset position points are the key points.

[0095] Understandably, when the light position type is not side-lit, adjusting the brightness peak to a suitable level through the target mapping relationship can enhance the contrast near the brightness peak. Therefore, the contrast of the target area can be calculated, and the initial mapping relationship can be adjusted using the contrast of the target area. The process of determining the contrast of the target area includes: determining the dispersion of the number of pixels at each brightness level within a preset range where the brightness peak is located; and determining the contrast based on the dispersion. For example, the brightness peak is 150, and the preset range is [140, 160].

[0096] The process of determining the degree of dispersion includes: calculating the mean of the number of pixels corresponding to each brightness level within a preset range; and summing the absolute values ​​of the differences between the number of pixels corresponding to each brightness level within the preset range and this mean value, which is taken as the degree of dispersion. The degree of dispersion is negatively correlated with contrast; that is, the greater the degree of dispersion, the lower the contrast.

[0097] For example, if the light position type is non-side lighting, the contrast ratio within the preset range of the brightness peak in the initial mapping relationship differs from the desired contrast ratio. Therefore, the adjustment target is to adjust the contrast ratio within the preset range of the brightness peak in the initial mapping relationship to the desired contrast ratio. Thus, the adjustment data is the contrast ratio within the preset range of the brightness peak.

[0098] As can be seen, the adjustment data determination step in S320 may include: in response to the light position type being side lighting type, determining the adjustment data as the mapping point pair data of the preset position points in the initial mapping relationship; in response to the light position type being non-side lighting type, determining the adjustment data as the contrast within the preset range to which the brightness peak belongs.

[0099] S330, based on the adjustment data, adjust the initial mapping relationship to obtain the target mapping relationship.

[0100] In an optional implementation, the initial mapping adjustment steps in S330 include:

[0101] In response to a side-light type light position, the mapped brightness in the mapping point pair data of the preset position point is adjusted to the corresponding desired mapped brightness; in response to a non-side-light type light position, the contrast within the preset range to which the brightness peak belongs is adjusted to the desired contrast.

[0102] In practical scenarios, the initial mapping relationship can be gradually adjusted iteratively to achieve the desired adjustment. To reduce the computational burden, calculations can typically be performed on a small number of evenly distributed points within the input brightness range, such as 4 or 8 points. The approximate mapped brightness or contrast values ​​are obtained from the values ​​and slopes of these points. Adjustments are then made based on the mapped brightness value and the desired mapped brightness, or the mapped contrast and the desired contrast. As long as the slope of each segment of the initial mapping relationship curve is not negative, the original relative brightness relationship can be preserved.

[0103] After adjusting and obtaining the target mapping relationship, since the target mapping relationship is usually a curve and the calculation process is relatively complex, the target mapping relationship can be converted into the form of a target mapping table, and then it is only necessary to look up in the target mapping table.

[0104] The process of converting target mapping relationships into target mapping tables may include:

[0105] S1, determine a first number of points (input brightness, mapped brightness) based on the target mapping relationship, the first number, for example, 256.

[0106] In practical scenarios, to simplify calculations, a piecewise linear approximation method is used to approximate the curve. Piecewise linear approximation is relatively accurate when the slope change is small, but it is prone to large errors at locations with significant slope changes. The rate of change of the curve's slope is the second derivative of the curve. Therefore, the density of the point endpoints of the piecewise linear approximation is rearranged based on the magnitude of the second derivative. For example, the 256 points are not uniformly distributed; instead, the distribution density of different segments is adjusted according to the second derivative of the curve.

[0107] S2, use a second number of points to divide the curve corresponding to the target mapping relationship into multiple segments. For example, use 16 points to divide the curve into 15 segments, calculate the second derivative values ​​of the remaining 14 points excluding the first and last 2 points, and normalize these second derivative values ​​as the density coefficients of the adjustment point segments.

[0108] S3. Select a predetermined proportion of points (referred to as "first points" for distinction) from the first number of points. These first points are evenly distributed across the segments. Then, multiply the remaining points (all points from the first number of points except the first points) by the density coefficient of each segment to obtain the points assigned to the corresponding segment (referred to as "second points" for distinction). Distribute all points (including the first and second points) obtained from each visible segment evenly within that segment. For example, determine the distribution of 256 points. See [example for details]. Figure 3B The distribution is shown.

[0109] S4. Interpolation is performed on the points whose locations have been determined (e.g., 256 points) to obtain a distribution with more points.

[0110] S5, construct a target mapping table based on the location of each point.

[0111] In this embodiment, after determining the initial mapping relationship based on the light position type and brightness data, the adjustment data corresponding to the initial mapping relationship is determined based on the light position type. The adjustment data is then used to adjust the initial mapping relationship, thereby obtaining a target mapping relationship that better meets the mapping requirements.

[0112] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the bit width compression step in S150 is refined.

[0113] See Figure 4 The bit-width compression steps include:

[0114] S410 extracts the brightness mapping features of the brightness mapping image at different scales and the loss detail features at the corresponding scales.

[0115] Among them, the loss of detail features can be understood as the intensity of image details lost during the extraction process.

[0116] S420 performs detail enhancement on the brightness mapping features at each scale based on the detail features at that scale, resulting in a detail-enhanced image at that scale.

[0117] In real-world scenarios, multiple enhancement processes can be cascaded. Each enhancement process can include: using a low-pass filter to perform low-pass filtering and downsampling on the first-scale image to obtain brightness mapping features; performing high-pass filtering on the first image to obtain lost detail features; converting the lost detail features into corresponding mapped detail features according to a preset detail mapping relationship; and fusing the mapped detail features and brightness mapping features to achieve detail enhancement processing of the brightness mapping features, resulting in the second-scale image, i.e., the detail-enhanced image.

[0118] In the initial extraction process, the first-scale image is a brightness-mapped image; in subsequent extraction processes, the first-scale image is the second-scale image from the previous extraction process.

[0119] The preset detail mapping relationship can be obtained by adjusting the function curves such as y=a / (x+a), y=x / exp(x), y=ln(x) / x, y=a^(x), y=1-tanh(x), and y=sech(x).

[0120] When adjusting local details, based on the preset detail mapping relationship, differentiated enhancement is achieved for details of different intensities: weaker details are enhanced to a greater extent, while stronger details are left unchanged or enhanced to a lesser extent.

[0121] The fitting process for the preset detail mapping relationship can refer to the adjustment process for the target mapping relationship.

[0122] The intensity of detail varies at different scales. Generally speaking, the intensity of detail at large scales is weaker than that at small scales. Adjusting details at large scales is more likely to cause problems such as abnormal brightness and unnaturalness. Therefore, the preset detail mapping relationship for each scale also needs to be relatively different.

[0123] S430 performs image reconstruction on detail-enhanced images at different scales to obtain reconstructed images.

[0124] That is, after undergoing multiple enhancement processes, the detailed enhanced image obtained from the last enhancement process is cascaded and upsampled multiple times to achieve reconstruction and obtain the reconstructed image.

[0125] Understandably, after adjusting the overall brightness using the target mapping relationship, the overall brightness of the image reaches the desired brightness, ensuring the overall brightness and darkness distribution of the input image. However, in the spatial domain, some areas with inherently low contrast still have a lower contrast value after mapping, requiring further local enhancement. When adjusting an image in the spatial domain, adjustments at a single scale can easily produce regular and unnatural effects; generally, adjustments at two or more scales are used to reduce abnormal image appearances.

[0126] S440 performs bit-width compression on the reconstructed image to obtain the target image.

[0127] In this embodiment, the image to be processed undergoes global brightness mapping and local multi-scale detail enhancement, and is then reduced to a low bit width target image. In this way, the brightness, contrast, details, etc. of the target area retain the information in the image to be processed, the details are clearer, and the brightness and dark levels are more distinct.

[0128] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0129] Based on the same inventive concept, this application also provides an image processing apparatus for implementing the image processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more image processing apparatus embodiments provided below can be found in the limitations of the image processing method described above, and will not be repeated here.

[0130] In one exemplary embodiment, an image processing apparatus is provided, see [link to relevant documentation]. Figure 5 It includes a first acquisition module 510, a first determination module 520, a second determination module 530, a first mapping module 540, and a first compression module 550, wherein:

[0131] The first acquisition module 510 is used to acquire the image to be processed;

[0132] The first determining module 520 is used to determine the light position type of the target region in the image to be processed based on the brightness data of the image to be processed.

[0133] The second determining module 530 is used to determine the target mapping relationship based on the light position type and brightness data; wherein, the target mapping relationship is used to map the brightness in the first dynamic range to the brightness in the second dynamic range, and the first dynamic range is greater than the second dynamic range;

[0134] The first mapping module 540 is used to perform brightness mapping processing on the image to be processed according to the target mapping relationship to obtain a brightness mapping image;

[0135] The first compression module 550 is used to perform bit-width compression on the brightness mapping image to obtain the target image.

[0136] In one embodiment, the second determining module includes: a first determining unit, configured to determine an initial mapping relationship based on light position type and brightness data; a second determining unit, configured to determine adjustment data corresponding to the initial mapping relationship based on light position type; and a first adjusting unit, configured to adjust the initial mapping relationship based on the adjustment data to obtain a target mapping relationship.

[0137] In one embodiment, the first determining unit is specifically configured to: in response to the light position type being side lighting, select an initial mapping relationship from at least one first candidate mapping relationship based on the average number of pixels; in response to the light position type being non-side lighting, select an initial mapping relationship from at least one second candidate mapping relationship based on the brightness peak value; wherein, the average number of pixels is the average of the extreme values ​​of the number of pixels, the extreme values ​​of the number of pixels are the extreme values ​​of the statistical number of pixels corresponding to different brightness levels in the target area of ​​the image to be processed, and different average numbers of pixels correspond to different first candidate mapping relationships; the brightness peak value is the peak value in the target brightness range corresponding to the backlighting degree of the target area of ​​the image to be processed.

[0138] In one embodiment, the second determining unit is specifically configured to: in response to the light position type being side-light type, determine the adjustment data as the mapping point pair data of the preset position points in the initial mapping relationship; in response to the light position type being non-side-light type, determine the adjustment data as the contrast within the preset range to which the brightness peak belongs; the first adjusting unit is specifically configured to: in response to the light position type being side-light type, adjust the mapped brightness in the mapping point pair data of the preset position points to the corresponding desired mapped brightness; in response to the light position type being non-side-light type, adjust the contrast within the preset range to which the brightness peak belongs to the desired contrast.

[0139] In one embodiment, the first compression module is specifically used to: extract the brightness mapping features of the brightness mapping image at different scales and the loss detail features at the corresponding scales; for the brightness mapping features at each scale, perform detail enhancement on the brightness mapping features at the scale according to the detail features at the scale to obtain a detail-enhanced image at the scale; perform image reconstruction on the detail-enhanced images at different scales to obtain a reconstructed image; and perform bit-width compression on the reconstructed image to obtain the target image.

[0140] In one embodiment, the first determining module is specifically used to: determine the number of pixels corresponding to different brightness levels in the target area of ​​the image to be processed based on the brightness data; determine the extreme value of the number of pixels corresponding to different brightness levels in the target area based on the number of pixels corresponding to different brightness levels in the target area; determine the brightness attribute data of the target area based on the extreme value of the number of pixels; and determine the light position type based on the brightness attribute data.

[0141] Each module in the aforementioned image processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0142] In one exemplary embodiment, a computer device is provided, the internal structure of which can be as shown in the figure. Figure 6 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements an image processing method.

[0143] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0144] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the image processing methods provided in the above embodiments.

[0145] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the image processing methods provided in the above embodiments.

[0146] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the image processing methods provided in the above embodiments.

[0147] The methods provided in the above embodiments can be executed by a chip or a chip module; the devices provided in the above embodiments can be chips or chip modules. Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all included modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, all included modules / units can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.

[0148] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0149] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0150] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0151] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. An image processing method, characterized in that, include: Obtain the image to be processed; Based on the brightness data of the image to be processed, determine the light position type of the target region in the image to be processed; A target mapping relationship is determined based on the light position type and the brightness data; wherein, the target mapping relationship is used to map the brightness in a first dynamic range to the brightness in a second dynamic range, and the first dynamic range is greater than the second dynamic range; According to the target mapping relationship, the image to be processed is subjected to brightness mapping processing to obtain a brightness mapping image; The brightness mapping image is compressed to obtain the target image.

2. The method according to claim 1, characterized in that, The step of determining the target mapping relationship based on the light position type and the brightness data includes: Determine the initial mapping relationship based on the light position type and the brightness data; Based on the light position type, determine the adjustment data corresponding to the initial mapping relationship; Based on the adjusted data, the initial mapping relationship is adjusted to obtain the target mapping relationship.

3. The method according to claim 2, characterized in that, The step of determining the initial mapping relationship based on the light position type and the brightness data includes: In response to the light type being a side-light type, the initial mapping relationship is selected from at least one first candidate mapping relationship based on the average number of pixels; In response to the light position type being a non-side light type, the initial mapping relationship is selected from at least one second candidate mapping relationship based on the brightness peak value; Wherein, the average number of pixels is the average of the extreme values ​​of the number of pixels, and the extreme values ​​of the number of pixels are the extreme values ​​of the statistical number of pixels corresponding to different brightness levels in the target area of ​​the image to be processed. Different average values ​​of the number of pixels correspond to different first candidate mapping relationships. The peak value of brightness is the peak value in the target brightness range corresponding to the backlighting degree of the target area of ​​the image to be processed.

4. The method according to claim 2, characterized in that, The step of determining the adjustment data corresponding to the initial mapping relationship based on the light position type includes: In response to the light position type being a side light type, the adjustment data is determined to be the mapping point pair data of the preset position points in the initial mapping relationship; In response to the light position type being non-side lighting, the adjustment data is determined to be the contrast within a preset range to which the brightness peak belongs; Accordingly, adjusting the initial mapping relationship based on the adjustment data to obtain the target mapping relationship includes: In response to the light position type being side light type, the mapping brightness in the mapping point pair data of the preset position point is adjusted to the corresponding desired mapping brightness; In response to the light position type being non-side lighting, the contrast within the preset range to which the brightness peak belongs is adjusted to the desired contrast.

5. The method according to any one of claims 1 to 4, characterized in that, The step of performing bit-width compression on the brightness mapping image to obtain the target image includes: Extract the brightness mapping features of the brightness mapping image at different scales and the loss detail features at the corresponding scales; For each scale of brightness mapping features, detail enhancement is performed on the brightness mapping features at the scale based on the detail features at the scale to obtain a detail-enhanced image at the scale. Image reconstruction is performed on detail-enhanced images at different scales to obtain reconstructed images; The reconstructed image is then compressed in bit width to obtain the target image.

6. The method according to any one of claims 1 to 4, characterized in that, Determining the light position type of the target region in the image to be processed based on the brightness data of the image to be processed includes: Based on the brightness data, determine the statistical number of pixels corresponding to different brightness levels in the target area of ​​the image to be processed; Based on the statistical count of pixels corresponding to different brightness levels in the target area, determine the extreme value of the number of pixels in the target area; Based on the extreme values ​​of the number of pixels, determine the brightness and darkness attribute data of the target area; The light position type is determined based on the brightness attribute data.

7. An image processing apparatus, characterized in that, include: The first acquisition module is used to acquire the image to be processed; The first determining module is used to determine the light position type of the target region in the image to be processed based on the brightness data of the image to be processed; The second determining module is used to determine a target mapping relationship based on the light position type and the brightness data; wherein the target mapping relationship is used to map the brightness in a first dynamic range to the brightness in a second dynamic range, and the first dynamic range is greater than the second dynamic range; The first mapping module is used to perform brightness mapping processing on the image to be processed according to the target mapping relationship to obtain a brightness mapping image; The first compression module is used to perform bit-width compression on the brightness mapping image to obtain the target image.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.