Image processing method and apparatus, computer device, and readable storage medium

By setting the brightness interval in image processing and building the target mapping curve, the problem of details disappearing caused by histogram equalization is solved, and the accuracy and real-time nature of image contrast adjustment are achieved.

WO2025161649A1PCT designated stage Publication Date: 2025-08-07BEIJING MOMENTA TECH CO LTD

Patent Information

Application Number
PCT/CN2024/135347
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-31
Filing Date
2024-11-28
Publication Date
2025-08-07

AI Technical Summary

Technical Problem

In the prior art, the histogram equalization method easily leads to the disappearance of details and information loss when adjusting the image contrast, affecting the accuracy of the image.

Method used

By counting the brightness values of image pixel points, setting multiple brightness intervals, and building a basic mapping curve based on the brightness interval, fusing it into a target mapping curve, and image brightness adjustment.

Benefits of technology

It realizes the accuracy of image contrast adjustment on the basis of retaining the original image information, and is suitable for devices with less computing power, with good real-time and applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024135347_07082025_PF_FP_ABST
    Figure CN2024135347_07082025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in embodiments of the present application are an image processing method and apparatus, a computer device, and a readable storage medium. The method comprises: obtaining an image to be processed; on the basis of brightness values of all pixel points of the image to be processed, counting the number of pixel points in each present brightness range, wherein the total number of the brightness ranges is greater than or equal to 3; on the basis of the number of pixel points in each brightness range, fusing pre-constructed basic mapping curves corresponding to the brightness ranges to obtain a target mapping curve corresponding to the image to be processed; and on the basis of the target mapping curve, performing brightness adjustment on the image to be processed to obtain a processed image. By applying the solution provided in the embodiments of the present application, the target mapping curve matched with a brightness condition of the image to be processed can be obtained, such that after the target mapping curve is used to perform brightness adjustment on the image to be processed, the obtained processed image can retain original image information to the maximum extent, thereby ensuring the accuracy of the processed image.
Need to check novelty before this filing date? Find Prior Art

Description

Image processing method, device, computer equipment and readable storage medium Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, computer device, and readable storage medium. Background Art

[0002] Image contrast measures the difference in brightness between the brightest white and darkest black in an image. A wider range of differences indicates greater contrast, while a smaller range indicates less contrast. Images with varying contrast levels can have significantly different visual effects. Therefore, image contrast can be adjusted—that is, the brightness of each pixel in the original image can be adjusted—to enhance its visual effect.

[0003] In conventional technology, histogram equalization is often used to adjust image contrast. However, direct use of histogram equalization can lead to problems such as loss of detail due to grayscale merging. This can result in loss of original information in the processed image and reduced accuracy. Therefore, improving the accuracy of image contrast adjustment has become a pressing technical issue. Summary of the Invention

[0004] This application provides an image processing method, apparatus, computer device, and readable storage medium to improve the accuracy of image contrast adjustment. The specific technical solution is as follows.

[0005] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:

[0006] Get the image to be processed;

[0007] According to the brightness values ​​of all pixels of the image to be processed, counting the number of pixels located in each preset brightness interval; the total number of the brightness intervals is greater than or equal to 3;

[0008] According to the number of pixels in each brightness interval, the pre-constructed basic mapping curves corresponding to each brightness interval are merged to obtain a target mapping curve corresponding to the image to be processed;

[0009] Based on the target mapping curve, brightness adjustment is performed on the image to be processed to obtain a processed image.

[0010] In the embodiment of the present application, after obtaining the image to be processed, the number of pixels in each brightness interval can be counted based on the brightness value of each pixel in the image. In other words, the overall brightness of the image can be obtained. Furthermore, the pre-constructed mapping curves corresponding to each brightness interval are fused according to the number of pixels in each brightness interval to obtain a target mapping curve that matches the brightness of the image to be processed. Thus, after using the target mapping curve to adjust the brightness of the image to be processed, the processed image obtained can retain the original image information to the maximum extent, ensuring the accuracy of the processed image. In addition, the overall implementation of the algorithm provided in the embodiment of the present application is simple and clear, with a small amount of calculation, and is very suitable for implantation on end devices with less computing power. It has high applicability and can achieve good real-time performance.

[0011] Optionally, the step of fusing pre-constructed basic mapping curves corresponding to the brightness intervals according to the number of pixels in the brightness intervals to obtain a target mapping curve corresponding to the image to be processed includes:

[0012] Calculating the pixel ratio of each brightness interval according to the number of pixels in each brightness interval;

[0013] According to the pixel ratios of the brightness intervals, the pre-constructed basic mapping curves corresponding to the brightness intervals are fused to obtain a target mapping curve corresponding to the image to be processed.

[0014] Optionally, the step of calculating the pixel ratio of each brightness interval according to the number of pixels in each brightness interval includes:

[0015] Determining the total number of pixels included in the image to be processed;

[0016] For each brightness interval, the ratio of the number of pixels in the brightness interval to the total number of pixels is determined as the pixel ratio of the brightness interval.

[0017] Optionally, the step of fusing pre-constructed basic mapping curves corresponding to the brightness intervals according to the pixel ratios of the brightness intervals to obtain a target mapping curve corresponding to the image to be processed includes:

[0018] Calculate the mapped pixel value map corresponding to any original pixel value in the target mapping curve according to the following formula:

[0019] Where n is the total number of brightness intervals, C i is the pixel ratio of the ith brightness interval, map i is the mapped pixel value of the basic mapping curve corresponding to the original pixel value in the i-th brightness interval.

[0020] Optionally, the process of constructing the basic mapping curve corresponding to each brightness interval includes:

[0021] For each brightness interval, obtaining each basic image corresponding to the brightness interval; wherein the peak value of the brightness histogram of each basic image is located within the brightness interval;

[0022] For each brightness interval, an average value of the mapping curves of all basic images corresponding to the brightness interval is calculated as the basic mapping curve corresponding to the brightness interval.

[0023] Optionally, the method further includes:

[0024] For each brightness interval, a basic mapping curve corresponding to the brightness interval is displayed, an adjustment operation on the basic mapping curve is received, and the basic mapping curve is adjusted according to the adjustment operation.

[0025] In this embodiment, the basic mapping curve can be adjusted autonomously. Since it is smooth enough, it can effectively solve the problems of grayscale merging and grayscale disappearance caused by traditional mapping algorithms.

[0026] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:

[0027] An image acquisition module, used for acquiring an image to be processed;

[0028] A pixel statistics module, configured to count the number of pixels in each preset brightness interval based on the brightness values ​​of all pixels in the image to be processed; the total number of the brightness intervals being greater than or equal to 3;

[0029] a curve fusion module, configured to fuse pre-constructed basic mapping curves corresponding to the respective brightness intervals according to the number of pixels in the respective brightness intervals, to obtain a target mapping curve corresponding to the image to be processed;

[0030] The brightness adjustment module is used to adjust the brightness of the image to be processed based on the target mapping curve to obtain a processed image.

[0031] Optionally, the curve fusion module includes:

[0032] A ratio calculation submodule, configured to calculate the pixel ratio of each brightness interval according to the number of pixels in each brightness interval;

[0033] The curve fusion submodule is used to fuse the pre-constructed basic mapping curves corresponding to the brightness intervals according to the pixel ratios of the brightness intervals to obtain a target mapping curve corresponding to the image to be processed.

[0034] Optionally, the ratio calculation submodule is specifically configured to:

[0035] Determining the total number of pixels included in the image to be processed;

[0036] For each brightness interval, the ratio of the number of pixels in the brightness interval to the total number of pixels is determined as the pixel ratio of the brightness interval.

[0037] Optionally, the curve fusion submodule is specifically used to:

[0038] Calculate the mapped pixel value map corresponding to any original pixel value in the target mapping curve according to the following formula:

[0039] Where n is the total number of brightness intervals, C i is the pixel ratio of the ith brightness interval, map i is the mapped pixel value of the basic mapping curve corresponding to the original pixel value in the i-th brightness interval.

[0040] Optionally, the device further includes:

[0041] A basic image acquisition module is used to acquire, for each brightness interval, each basic image corresponding to the brightness interval; wherein the peak value of the brightness histogram of each basic image is located within the brightness interval;

[0042] The mapping curve calculation module is configured to calculate, for each brightness interval, an average value of the mapping curves of all basic images corresponding to the brightness interval as a basic mapping curve corresponding to the brightness interval.

[0043] Optionally, the device further includes:

[0044] The mapping curve adjustment module is configured to display, for each brightness interval, a basic mapping curve corresponding to the brightness interval, receive an adjustment operation on the basic mapping curve, and adjust the basic mapping curve according to the adjustment operation.

[0045] In a third aspect, an embodiment of the present application provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are coupled;

[0046] The memory is used to store one or more computer instructions;

[0047] The processor is used to execute the one or more computer instructions to implement the image processing method as described in the first aspect.

[0048] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having one or more computer instructions stored thereon, which are executed by a processor to implement the image processing method as described in the first aspect above.

[0049] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the image processing method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] To more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are merely some embodiments of the present application. Those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0051] FIG1 is a schematic diagram of a flow chart of an image processing method provided in an embodiment of the present application;

[0052] FIG2 is an image of different brightness and a corresponding histogram in an embodiment of the present application;

[0053] FIG3 is a mapping curve corresponding to the image shown in FIG2 in an embodiment of the present application;

[0054] FIG4 is a schematic diagram of the overall algorithm architecture of dynamic contrast enhancement according to an embodiment of the present application;

[0055] FIG5 is an enhanced image and a corresponding histogram in an embodiment of the present application;

[0056] FIG6 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;

[0057] FIG7 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0059] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments and drawings of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or device.

[0060] The embodiments of the present application disclose an image processing method, apparatus, computer device, and readable storage medium, which can accurately adjust the contrast of an image. The embodiments of the present application are described in detail below.

[0061] Among known technologies, the most commonly used method for image contrast enhancement is histogram equalization. However, direct use of histogram equalization has certain problems, such as the loss of details due to grayscale merging; or, for certain images with high peaks in the histogram, excessive stretching of the grayscale after contrast processing can lead to noise amplification and over-enhancement of artifacts. Research has found that histogram equalization is essentially mapping the original brightness values ​​based on a mapping curve formed according to the cumulative histogram distribution. Based on this, in the embodiments of the present application, a dynamic mapping curve is formed according to the brightness histogram distribution of the image, thereby dynamically adjusting the brightness of the original image, which can avoid the above problems.

[0062] FIG1 is a flow chart of an image processing method provided in an embodiment of the present application. The method can be applied to electronic devices and includes the following steps:

[0063] S110: Acquire an image to be processed.

[0064] The image to be processed can be a grayscale image or a color image. When the image to be processed is a grayscale image, brightness adjustment is performed on it. The adjustment is made to the pixel value of each pixel, also known as the grayscale value or brightness value. When the image to be processed is a color image, brightness adjustment is performed on the V channel of its HSV (Hue, Saturation, Value) channel, i.e., the brightness value.

[0065] S120: Counting the number of pixels in each preset brightness interval based on the brightness values ​​of all pixels in the image to be processed; the total number of brightness intervals is greater than or equal to 3.

[0066] In an embodiment of the present application, in order to ensure that during the brightness adjustment of the image, problems such as disappearance of details due to grayscale merging are avoided, the image to be processed can be processed according to the brightness distribution characteristics of the pixels included in the image to be processed.

[0067] Specifically, it can be understood that the difference in image brightness is due to the different brightness values ​​of the pixels they contain. When an image contains a large number of pixels with high brightness values, the overall brightness of the image is relatively high; when an image contains a small number of pixels with high brightness values, the overall brightness of the image is relatively low. Therefore, the number of pixels in different brightness ranges in an image can reflect the brightness of the image. In addition, the histograms corresponding to high-brightness images and low-brightness images also have significant differences, such as the location of the histogram peaks being significantly different.

[0068] In the embodiments of the present application, multiple brightness intervals can be pre-set. For example, to ensure the accuracy of brightness distinction, at least three brightness intervals can be set, namely low brightness, medium brightness, and high brightness intervals. Alternatively, to obtain more accurate image processing results, more brightness intervals can be set. This is all possible, and the embodiments of the present application do not limit the number of brightness intervals.

[0069] Taking a grayscale image as an example, the grayscale value range of each pixel in the image is 0-255. When setting three brightness intervals, namely low brightness, medium brightness, and high brightness intervals, specifically, the low brightness interval can be [0, th1], the medium brightness interval can be (th1, th2), and the high brightness interval can be [th2, 255]. The values ​​of th1 and th2 can be set according to actual conditions. For example, th1 can be set to 54, 55, 58, etc., and th2 can be set to 178, 180, 181, etc. This is all possible. The embodiments of this application do not specifically limit the ranges of each interval.

[0070] When processing an image to be processed, the brightness value of each pixel can be determined, and the predetermined brightness range within which the pixel value falls can be determined. The number of pixels in each brightness range can then be counted. Alternatively, a brightness histogram of the image to be processed can be determined, and the number of pixels in each brightness range can be counted based on the brightness histogram.

[0071] S130: According to the number of pixels in each brightness interval, the pre-constructed basic mapping curves corresponding to each brightness interval are merged to obtain a target mapping curve corresponding to the image to be processed.

[0072] When contrast enhancement is performed on an image, the mapping curve can represent the corresponding relationship between the brightness values ​​before and after the image processing. It is understood that images of different brightnesses will have significantly different corresponding mapping curves. In the embodiments of the present application, mapping curves corresponding to multiple brightness ranges can be pre-constructed, which can be referred to as basic mapping curves, so that contrast enhancement can be performed on images of any brightness.

[0073] Specifically, when constructing the basic mapping curve, we can first obtain each basic image corresponding to each brightness interval for each brightness interval; wherein the peak value of the brightness histogram of each basic image is located within the brightness interval; then, for each brightness interval, calculate the average value of the mapping curves of all basic images corresponding to the brightness interval as the basic mapping curve corresponding to the brightness interval.

[0074] For each brightness interval, the number of basic images obtained can be set according to actual conditions, such as 800, 900, 1200, etc., which are all possible, and the embodiments of this application do not limit their specific values. For any brightness interval, when calculating the average value of the mapping curves of all basic images corresponding to the brightness interval, for example, for each brightness value, the corresponding mapping brightness value can be found in the mapping curve corresponding to each basic image, and the mean of all mapped brightness values ​​can be solved.

[0075] Optionally, after obtaining the basic mapping curve corresponding to each brightness range, the basic mapping curve may be smoothed. For example, the basic mapping curve corresponding to each brightness range may be displayed, and an adjustment operation on the basic mapping curve may be received and adjusted accordingly.

[0076] In other words, the mapping curve can be manually smoothed. Specifically, for any brightness range, a corresponding basic mapping curve can be displayed, and then the less smooth parts can be manually adjusted. During the adjustment process, the basic mapping curve is used to contrast enhance the basic image in that brightness range. The mapping curve is further adjusted based on the enhancement effect. After multiple adjustments, when the contrast enhancement effect on the basic image meets the requirements, the final basic mapping curve is obtained.

[0077] In this embodiment, the basic mapping curve can be adjusted autonomously. Since it is smooth enough, it can effectively solve the problems of grayscale merging and grayscale disappearance caused by traditional mapping algorithms.

[0078] When contrast enhancement is performed on an image to be processed, after counting the number of pixels in each brightness interval, the pre-constructed basic mapping curves corresponding to each brightness interval can be fused according to the number of pixels in each brightness interval to obtain the target mapping curve corresponding to the image to be processed.

[0079] It can be understood that the number of pixels in each brightness interval can reflect the overall brightness of the image. When there are fewer pixels in any brightness interval, it means that the brightness of the image does not match that brightness interval well. When there are more pixels in any brightness interval, it means that the brightness of the image does match that brightness interval well. Therefore, based on the number of pixels in each brightness interval, the degree of match between the image to be processed and each brightness interval can be determined, or it can be called the weight of the image to be processed corresponding to each brightness interval. Moreover, the number of pixels in any brightness interval of the image to be processed is proportional to the weight of the image to be processed corresponding to that brightness interval.

[0080] For example, the number of pixels in each brightness interval can be directly used as the weight of the image to be processed corresponding to the brightness interval; or the number of pixels in each brightness interval can be normalized, and the normalized result can be used as the weight of the image to be processed corresponding to each brightness interval.

[0081] In one implementation, the pixel ratio of each brightness interval can be calculated based on the number of pixels in each brightness interval; then, based on the pixel ratio of each brightness interval, the pre-constructed basic mapping curves corresponding to each brightness interval are fused to obtain the target mapping curve corresponding to the image to be processed.

[0082] Specifically, when calculating the pixel ratios for each brightness interval, the total number of pixels in the image to be processed can be determined. For each brightness interval, the ratio of the number of pixels in that brightness interval to the total number of pixels can be used as the pixel ratio for that brightness interval. In other words, the ratio of the number of pixels in each brightness interval to the total number of pixels can be used as the weight for each brightness interval in the image to be processed.

[0083] When calculating the target mapping curve corresponding to the image to be processed based on the pixel ratio of each brightness interval and the pre-built basic mapping curve corresponding to each brightness interval, the mapped brightness value map corresponding to any original brightness value in the target mapping curve can be calculated according to the following formula:

[0084] Where n is the total number of brightness intervals, C i is the pixel ratio of the ith brightness interval, map i is the mapped brightness value of the basic mapping curve corresponding to the original brightness value in the i-th brightness interval.

[0085] S140: Based on the target mapping curve, brightness adjustment is performed on the image to be processed to obtain a processed image.

[0086] In the target mapping curve, each point's horizontal axis represents the original brightness value, while its vertical axis represents the mapped brightness value, also known as the adjusted brightness value. For each pixel in the image to be processed, the corresponding mapped brightness value is found in the target mapping curve and adjusted to the mapped brightness value. This yields a contrast-enhanced image, referred to as the processed image.

[0087] In the embodiment of the present application, after obtaining the image to be processed, the number of pixels in each brightness interval can be counted based on the brightness value of each pixel in the image. In other words, the overall brightness of the image can be obtained. Furthermore, the pre-constructed mapping curves corresponding to each brightness interval are fused according to the number of pixels in each brightness interval to obtain a target mapping curve that matches the brightness of the image to be processed. Thus, after using the target mapping curve to adjust the brightness of the image to be processed, the processed image obtained can retain the original image information to the maximum extent, ensuring the accuracy of the processed image. In addition, the overall implementation of the algorithm provided in the embodiment of the present application is simple and clear, with a small amount of calculation, and is very suitable for implantation on end devices with less computing power. It has high applicability and can achieve good real-time performance.

[0088] The image processing method provided by the embodiment of the present application is described below with reference to a specific embodiment. In this embodiment, a grayscale image is taken as an example, and three brightness intervals are pre-set, which does not constitute a limitation to the solution of the present application.

[0089] Assume that common, typical images can be roughly divided into three categories: low-brightness, medium-brightness, and high-brightness images. Figure 2 shows these, along with their corresponding histograms. The horizontal axis of the histogram represents the grayscale value, and the vertical axis represents the number of pixels corresponding to any grayscale value. As can be seen from Figure 2, the peak distributions of the histograms for these three image categories exhibit distinct characteristics, with peaks located in the low-brightness, medium-brightness, and high-brightness regions, respectively. This creates a very distinct characteristic.

[0090] An optimized fixed mapping curve can be designed for each of the three typical images. When processing an actual image, its histogram distribution contains the characteristics of the histogram distribution of the three types of images. Therefore, the three curves can be fused according to the proportion of the histogram in different intervals and with a certain weight, to obtain an adaptive mapping curve.

[0091] Figure 3 shows three basic mapping curves corresponding to the three typical images shown in Figure 2. These three curves are derived from conventional histogram mapping with slight manual adjustments. This results in a smoother image, avoiding overexposure or loss of grayscale in actual use.

[0092] Now that the preparations are complete, let's introduce the overall algorithm architecture for dynamic contrast enhancement. As shown in Figure 4, the algorithm can include the following steps:

[0093] Step 1: Count the distribution of the histogram of the original image in the range of 0-255.

[0094] Step 2: Calculate the weights of the histogram distribution in the three basic areas (low brightness area [0, th1], medium brightness area [th1, th2] and high brightness area [th2, 255]). Among them, th1 and th2 can be set according to empirical values, that is, Ci = Ni / T

[0095] Where i=1, 2, 3, Ni represents the number of pixels in the i-th bright area, and T represents the number of all pixels in the image.

[0096] Step 3: According to the weights C1, C2, and C3, the three basic mapping curves are weighted and summed to obtain a new dynamic mapping curve map.

[0097] Step 4: Map the grayscale [0-255] of the original image according to the dynamic mapping curve map to obtain the final enhancement result: Y = map(x)x∈[0,255]

[0098] Figure 5 shows the enhanced image and its corresponding histogram. As can be seen from Figure 5, the enhanced image has a better visual effect, and the histogram shows that its grayscale values ​​are evenly distributed.

[0099] As shown in FIG6 , it shows a schematic structural diagram of an image processing device provided in an embodiment of the present application, the device comprising:

[0100] An image acquisition module 610 is used to acquire an image to be processed;

[0101] A pixel statistics module 620 is configured to count the number of pixels in each preset brightness interval based on the brightness values ​​of all pixels in the image to be processed; the total number of the brightness intervals is greater than or equal to 3;

[0102] The curve fusion module 630 is configured to fuse the pre-constructed basic mapping curves corresponding to the respective brightness intervals according to the number of pixels in the respective brightness intervals to obtain a target mapping curve corresponding to the image to be processed;

[0103] The brightness adjustment module 640 is configured to perform brightness adjustment on the image to be processed based on the target mapping curve to obtain a processed image.

[0104] In the embodiment of the present application, after obtaining the image to be processed, the number of pixels in each brightness interval can be counted based on the brightness value of each pixel in the image. In other words, the overall brightness of the image can be obtained. Furthermore, the pre-constructed mapping curves corresponding to each brightness interval are fused according to the number of pixels in each brightness interval to obtain a target mapping curve that matches the brightness of the image to be processed. Thus, after using the target mapping curve to adjust the brightness of the image to be processed, the processed image obtained can retain the original image information to the maximum extent, ensuring the accuracy of the processed image. In addition, the overall implementation of the algorithm provided in the embodiment of the present application is simple and clear, with a small amount of calculation, and is very suitable for implantation on end devices with less computing power. It has high applicability and can achieve good real-time performance.

[0105] Optionally, the curve fusion module 630 includes:

[0106] A ratio calculation submodule, configured to calculate the pixel ratio of each brightness interval according to the number of pixels in each brightness interval;

[0107] The curve fusion submodule is used to fuse the pre-constructed basic mapping curves corresponding to the brightness intervals according to the pixel ratios of the brightness intervals to obtain a target mapping curve corresponding to the image to be processed.

[0108] Optionally, the ratio calculation submodule is specifically configured to:

[0109] Determining the total number of pixels included in the image to be processed;

[0110] For each brightness interval, the ratio of the number of pixels in the brightness interval to the total number of pixels is determined as the pixel ratio of the brightness interval.

[0111] Optionally, the curve fusion submodule is specifically used to:

[0112] Calculate the mapped pixel value map corresponding to any original pixel value in the target mapping curve according to the following formula:

[0113] Where n is the total number of brightness intervals, C i is the pixel ratio of the ith brightness interval, map i is the mapped pixel value of the basic mapping curve corresponding to the original pixel value in the i-th brightness interval.

[0114] Optionally, the device further includes:

[0115] A basic image acquisition module is used to acquire, for each brightness interval, each basic image corresponding to the brightness interval; wherein the peak value of the brightness histogram of each basic image is located within the brightness interval;

[0116] The mapping curve calculation module is configured to calculate, for each brightness interval, an average value of the mapping curves of all basic images corresponding to the brightness interval as a basic mapping curve corresponding to the brightness interval.

[0117] Optionally, the device further includes:

[0118] The mapping curve adjustment module is configured to display, for each brightness interval, a basic mapping curve corresponding to the brightness interval, receive an adjustment operation on the basic mapping curve, and adjust the basic mapping curve according to the adjustment operation.

[0119] The above device embodiment corresponds to the method embodiment and has the same technical effects as the method embodiment. For detailed description, please refer to the method embodiment. The device embodiment is obtained based on the method embodiment. For detailed description, please refer to the method embodiment part and will not be repeated here.

[0120] Next, a computer device provided in an embodiment of the present application is described. Please refer to FIG7 , which is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device includes:

[0121] one or more processors 40;

[0122] The processor 40 is coupled to a storage device 41, and the storage device 41 is used to store one or more programs.

[0123] When the one or more programs are executed by the one or more processors 40 , the electronic device implements a technical solution of an image processing method as described in FIG. 1 to FIG. 5 .

[0124] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the technical solution of an image processing method as described in Figures 1 to 5 is implemented.

[0125] The present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the technical solution of an image processing method as described in Figures 1 to 5.

[0126] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application.

[0127] Those skilled in the art will appreciate that the modules in the apparatuses of the embodiments may be distributed in the apparatuses of the embodiments as described in the embodiments, or may be located in one or more apparatuses different from the embodiments with corresponding changes. The modules in the above embodiments may be combined into one module or further divided into multiple sub-modules.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An image processing method, characterized in that: The method comprises: Get the image to be processed; According to the brightness values of all pixels of the image to be processed, counting the number of pixels located in each preset brightness interval; the total number of the brightness intervals is greater than or equal to 3; According to the number of pixels in each brightness interval, the pre-constructed basic mapping curves corresponding to each brightness interval are merged to obtain a target mapping curve corresponding to the image to be processed; Based on the target mapping curve, brightness adjustment is performed on the image to be processed to obtain a processed image.

2. The method according to claim 1, characterized in that The step of fusing pre-constructed basic mapping curves corresponding to the brightness intervals according to the number of pixels in the brightness intervals to obtain a target mapping curve corresponding to the image to be processed includes: Calculating the pixel ratio of each brightness interval according to the number of pixels in each brightness interval; According to the pixel ratios of the brightness intervals, the pre-constructed basic mapping curves corresponding to the brightness intervals are fused to obtain a target mapping curve corresponding to the image to be processed.

3. The method according to claim 2, characterized in that The step of calculating the pixel ratio of each brightness interval according to the number of pixels in each brightness interval includes: Determining the total number of pixels included in the image to be processed; For each brightness interval, the ratio of the number of pixels in the brightness interval to the total number of pixels is determined as the pixel ratio of the brightness interval.

4. The method according to claim 2, characterized in that The step of fusing pre-constructed basic mapping curves corresponding to the brightness intervals according to the pixel ratios of the brightness intervals to obtain a target mapping curve corresponding to the image to be processed includes: Calculate the mapped pixel value map corresponding to any original pixel value in the target mapping curve according to the following formula: Where n is the total number of brightness intervals, C i is the pixel ratio of the ith brightness interval, map i is the mapped pixel value of the basic mapping curve corresponding to the original pixel value in the i-th brightness interval.

5. The method according to any one of claims 1 to 4, characterized in that The process of constructing the basic mapping curve corresponding to each brightness interval includes: For each brightness interval, obtaining each basic image corresponding to the brightness interval; wherein the peak value of the brightness histogram of each basic image is located within the brightness interval; For each brightness interval, an average value of the mapping curves of all basic images corresponding to the brightness interval is calculated as the basic mapping curve corresponding to the brightness interval.

6. The method according to claim 5, characterized in that The method further comprises: For each brightness interval, a basic mapping curve corresponding to the brightness interval is displayed, an adjustment operation on the basic mapping curve is received, and the basic mapping curve is adjusted according to the adjustment operation.

7. An image processing device, characterized in that The device comprises: An image acquisition module, used for acquiring an image to be processed; A pixel statistics module, configured to count the number of pixels in each preset brightness interval based on the brightness values of all pixels in the image to be processed; the total number of the brightness intervals being greater than or equal to 3; a curve fusion module, configured to fuse pre-constructed basic mapping curves corresponding to the respective brightness intervals according to the number of pixels in the respective brightness intervals, to obtain a target mapping curve corresponding to the image to be processed; The brightness adjustment module is used to adjust the brightness of the image to be processed based on the target mapping curve to obtain a processed image.

8. The device according to claim 7, characterized in that The curve fusion module includes: A ratio calculation submodule, configured to calculate the pixel ratio of each brightness interval according to the number of pixels in each brightness interval; The curve fusion submodule is used to fuse the pre-constructed basic mapping curves corresponding to the brightness intervals according to the pixel ratios of the brightness intervals to obtain a target mapping curve corresponding to the image to be processed.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are coupled; The memory is used to store one or more computer instructions; The processor is configured to execute the one or more computer instructions to implement the image processing method according to any one of claims 1 to 6.

10. A readable storage medium having one or more computer instructions stored thereon, characterized in that: The instruction is executed by a processor to implement the image processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image processing method and device, computer readable storage medium and terminal equipment

    CN115239578A

  • Thermal imaging image enhancement method and device, medium and equipment

    CN116309085A

  • Information processing apparatus, information processing method, and program

    US20230345132A1

Cited By

  • Image brightness adjusting method based on specified histogram and electronic equipment

    CN120725940A