Image processing method and device, computer readable storage medium and electronic device
By performing block processing and texture histogram fusion on the image, the tone mapping curve is determined, which solves the problem of poor image quality in existing image contrast enhancement algorithms and improves the contrast of image texture areas and overall quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2022-08-22
- Publication Date
- 2026-07-03
AI Technical Summary
Existing image contrast enhancement algorithms may result in poor image quality after processing, especially artifacts and tortuosity in flat areas, and adjusting algorithm parameters cannot completely avoid the problem of reduced contrast in textured areas.
The image to be processed is divided into multiple image blocks, and the grayscale histogram and texture histogram of each image block are determined. The tone mapping curve is determined by combining the texture information, and the image blocks are enhanced. The histogram statistics are optimized by downsampling and target block segmentation, and the histograms are fused for image enhancement.
It effectively enhances the contrast of image texture areas, improves image quality, avoids excessive resource consumption, reduces artifacts and tomography, and adapts to the personalized needs of different image scenes.
Smart Images

Figure CN115471413B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to an image processing method and apparatus, a computer-readable storage medium, and an electronic device. Background Technology
[0002] In the field of image processing technology, image contrast enhancement is an important technique for improving the visual effect of images. It can be applied to the post-processing stage of images captured by electronic devices or other image analysis and processing stages.
[0003] Currently, some image contrast enhancement algorithms can improve image contrast to a certain extent; however, the quality of the processed image may still be poor after implementing these algorithms. Summary of the Invention
[0004] This disclosure provides an image processing method and apparatus, a computer-readable storage medium and an electronic device, thereby overcoming, at least to some extent, the problem of poor image quality after image enhancement processing.
[0005] According to a first aspect of this disclosure, an image processing method is provided, comprising: acquiring an image to be processed; dividing the image to be processed into multiple image blocks; determining a grayscale histogram and a texture histogram for each image block; determining a tone mapping curve for each image block based on the grayscale histogram and texture histogram; and performing image enhancement on the image to be processed using the tone mapping curves of each image block.
[0006] According to a second aspect of this disclosure, another image processing method is provided, comprising: downsampling an image to be processed to obtain an intermediate image, dividing the intermediate image into multiple image blocks according to a target segmentation method, and determining the grayscale histogram of each image block of the intermediate image; extracting texture information of the image to be processed to obtain a texture image, dividing the texture image into multiple image blocks according to a target segmentation method, and determining the grayscale histogram of each image block of the texture image; determining the tone mapping curve of each image block of the image to be processed based on the grayscale histograms of each image block of the intermediate image and the grayscale histograms of each image block of the texture image; wherein, each image block of the image to be processed is obtained by dividing the image to be processed according to the target segmentation method; and performing image enhancement on the image to be processed using the tone mapping curves of each image block of the image to be processed.
[0007] According to a third aspect of this disclosure, an image processing apparatus is provided, comprising: a histogram determination module for acquiring an image to be processed, dividing the image to be processed into multiple image blocks, and determining a grayscale histogram and a texture histogram for each image block; a mapping curve determination module for determining a tone mapping curve for each image block based on the grayscale histogram and texture histogram of each image block; and an image enhancement module for performing image enhancement on the image to be processed using the tone mapping curve of each image block.
[0008] According to a fourth aspect of this disclosure, an image processing apparatus is provided, comprising: a grayscale histogram determination module, configured to downsample an image to be processed to obtain an intermediate image, and divide the intermediate image into multiple image blocks according to a target segmentation method, and determine the grayscale histogram of each image block of the intermediate image; a texture histogram determination module, configured to extract texture information of the image to be processed to obtain a texture image, and divide the texture image into multiple image blocks according to a target segmentation method, and determine the grayscale histogram of each image block of the texture image; a tone mapping curve determination module, configured to determine the tone mapping curve of each image block of the image to be processed based on the grayscale histograms of each image block of the intermediate image and the grayscale histograms of each image block of the texture image; wherein, each image block of the image to be processed is obtained by dividing the image to be processed according to the target segmentation method; and an image enhancement module, configured to enhance the image to be processed using the tone mapping curves of each image block of the image to be processed.
[0009] According to a fifth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements any of the above-described image processing methods.
[0010] According to a sixth aspect of this disclosure, an electronic device is provided, including a processor; and a memory for storing one or more programs, which, when executed by the processor, cause the processor to implement any of the above-described image processing methods.
[0011] In some embodiments of this disclosure, the tone mapping curves of each image block are determined by combining the texture information of the image to be processed, and then image enhancement is performed on the image to be processed based on the tone mapping curves of each image block. Compared with flat areas in the image to be processed, textured areas contribute more to the histogram. Determining the tone mapping curves by combining the texture information of the image to achieve image enhancement can effectively enhance the contrast of textured areas in the image to be processed and improve image quality.
[0012] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0013] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0014] Figure 1 This diagram illustrates the image tortuosity that may occur when some image enhancement techniques are applied.
[0015] Figure 2 A schematic diagram of the image processing stage according to an embodiment of the present disclosure is shown;
[0016] Figure 3 A flowchart illustrating an image processing method according to an exemplary embodiment of the present disclosure is shown schematically;
[0017] Figure 4 A schematic diagram of dividing an image into blocks is shown;
[0018] Figure 5 It shows the relationship with Figure 4 A schematic diagram of the grayscale histograms of each corresponding image block;
[0019] Figure 6 A schematic diagram illustrating the determination of a texture image according to an embodiment of the present disclosure is shown;
[0020] Figure 7 This diagram illustrates a bilinear interpolation of a pixel in an image to be processed, according to an embodiment of the present disclosure.
[0021] Figure 8 A schematic diagram of an interactive interface for adjusting image processing intensity according to an embodiment of the present disclosure is shown;
[0022] Figure 9 The flowchart illustrating the entire process of an image processing method according to an embodiment of the present disclosure is shown in the schematic diagram.
[0023] Figure 10 A flowchart illustrating an image processing method according to another exemplary embodiment of the present disclosure is shown schematically;
[0024] Figure 11 A flowchart illustrating the entire processing procedure of an image processing method according to another embodiment of the present disclosure is shown schematically.
[0025] Figure 12 A block diagram of an image processing apparatus according to an exemplary embodiment of the present disclosure is shown schematically;
[0026] Figure 13A block diagram of an image processing apparatus according to another exemplary embodiment of the present disclosure is shown schematically;
[0027] Figure 14 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown schematically. Detailed Implementation
[0028] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0029] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0030] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0031] While CLAHE (Contrast Limited Adaptive Histogram Equalization) can significantly improve image contrast, it is prone to artifacts in flat areas of the image. (Reference) Figure 1 After processing with the CLAHE algorithm, the contrast was too strong, resulting in obvious tomography.
[0032] The reason for this phenomenon is that the pixel values of the pixels in the image are concentrated. When the CLAHE algorithm is used to calculate the histogram, the concentration of pixel values leads to a steep tone mapping (TM) curve, which results in an image with excessive contrast, artifacts, and tortuosity.
[0033] In some solutions, contrast can be reduced by adjusting algorithm parameters; however, this problem cannot be completely avoided. Furthermore, if an image contains both flat areas and many textured areas, reducing contrast by adjusting algorithm parameters will result in reduced contrast in the textured areas, leading to poor image quality.
[0034] In view of this, the present disclosure provides a new image processing method to enhance the contrast of image texture regions, thereby improving the subjective quality of image contrast.
[0035] The image processing scheme of this disclosure can be implemented by an electronic device. That is, the electronic device can execute each step of the image processing method described below, and the image processing apparatus described below can be configured within the electronic device. For example, the image processing scheme of this disclosure can be implemented by an image signal processor equipped in the electronic device. In addition, this disclosure does not limit the type of electronic device, and may include, but is not limited to, smartphones, tablets, smart wearable devices, personal computers, servers, etc.
[0036] Figure 2 A schematic diagram illustrating the stage at which the image processing scheme of this disclosure embodiment is applied is shown. (Reference) Figure 2 In this embodiment, the input image is the image to be processed, that is, the original image to be enhanced. The input image can be an image captured by a camera module equipped with an electronic device, an image acquired by the electronic device from an external source (i.e., another device), an image generated by the electronic device in response to a user's drawing operation, or an image generated by the electronic device itself in response to other triggering events, etc. This disclosure does not limit the image source, image content, image size, etc. of the input image.
[0037] The image processing procedure of this disclosure can be used to process the input image to obtain an enhanced image corresponding to the input image. Subsequently, the electronic device can store, display, or perform further processing on the enhanced image. Such further processing includes, for example, denoising, object recognition, object tracking, and beautification. This disclosure does not limit the subsequent applications of the enhanced image.
[0038] In addition, the input image can be preprocessed before being processed using the image processing procedure of this disclosure. This disclosure does not limit the type of preprocessing, but may include, for example, denoising and brightness enhancement.
[0039] Since some embodiments of this disclosure focus on enhancing texture information, the input image can be judged before the image processing procedure of this disclosure is applied to determine whether the image processing procedure of this disclosure should be performed on the input image.
[0040] For example, the texture complexity of the input image, a specific image region of the input image, or a designated image region of the input image is determined. If the texture complexity is greater than or equal to a complexity threshold, the image processing procedure of this disclosure is performed. If the texture complexity is less than the complexity threshold, the image processing procedure of this disclosure is skipped.
[0041] For example, if the grayscale histogram of the input image is determined, and the grayscale values are uniformly distributed, the image processing procedure of this disclosure is skipped; if the grayscale values are concentrated, the image processing procedure of this disclosure is executed.
[0042] By using the image filtering methods described above, we can avoid the problem of excessive consumption of electronic device resources caused by processing all images.
[0043] The image processing method of exemplary embodiments of this disclosure will now be described with reference to the accompanying drawings.
[0044] Figure 3 A flowchart illustrating image processing according to an exemplary embodiment of the present disclosure is shown.
[0045] refer to Figure 3 The image processing method may include the following steps:
[0046] S32. Obtain the image to be processed, divide the image to be processed into multiple image blocks, and determine the grayscale histogram and texture histogram of each image block.
[0047] In exemplary embodiments of this disclosure, the image to be processed may be an image captured by a camera module equipped with an electronic device, an image acquired by the electronic device from an external source, an image generated by the electronic device in response to a user's drawing operation, or an image drawn automatically by the electronic device in response to other triggering events, etc. This disclosure does not limit the image source, image content, image size, etc. of the image to be processed.
[0048] Alternatively, the image to be processed can be a region of the original image, such as a region of interest to the user or an image region containing a specified object (such as a face) as determined by the electronic device itself. In this case, foreground segmentation can be performed on the original image to obtain the image to be processed.
[0049] Electronic devices can divide an image to be processed into multiple image blocks. For example, they can divide it into multiple square or rectangular blocks of the same size, or they can divide the image to be processed into image blocks of irregular shapes. This disclosure does not limit this.
[0050] refer to Figure 4 The image to be processed can be divided into 6×8 image blocks of the same size.
[0051] For each image patch, the electronic device can determine the grayscale histogram and texture histogram of the image patch.
[0052] In determining the grayscale histogram of an image patch, the image's grayscale levels can be divided into BIN_NUM levels at equal intervals. For example, for an image with pixel grayscale values from 0 to 255, if BIN_NUM is set to 64, then the step size for each grayscale level is step = 256 / BIN_NUM, i.e., step = 4. In other words, grayscale values 0-3 are counted in the Histogram. luma [0], 4-7 were counted in Hist luma [1], ..., 252-255 were counted in Hist. luma [BIN NUM -1].
[0053] According to some embodiments of this disclosure, the histogram directly calculated for an image block can be used as the grayscale histogram of that image block.
[0054] According to some other embodiments of this disclosure, the directly calculated histogram can also be optimized, and the optimized histogram can be determined as the grayscale histogram of the image block.
[0055] First, the electronic device can perform pixel grayscale statistics on the image block to obtain the original grayscale histogram of the image block.
[0056] Next, the electronic device can apply threshold constraints and / or smoothing to the original grayscale histogram to determine the grayscale histogram of the image patch.
[0057] For threshold constraints, upper and lower thresholds can be pre-configured so that the statistical data represented by the grayscale histogram is constrained between the upper and lower thresholds.
[0058] Smoothing can make histogram transitions more reasonable, avoiding image degradation caused by abnormalities in the image itself or by processing errors. For example, for adjacent gray levels a, b, and c in the histogram, if the statistical values of a and c are large, while the statistical value of b is very small, the histogram curve will not be smooth. In this case, the differences in the values of a, b, and c can be smoothed.
[0059] Figure 5 To and Figure 4 The corresponding grayscale histograms of each image block are obtained using the above histogram statistical method.
[0060] In the process of determining the texture histogram of an image patch, the electronic device can first extract the texture information of the image to be processed to obtain a texture image.
[0061] Specifically, the gradient values in the horizontal and vertical directions of the image to be processed can be calculated separately, as shown in Formulas 1 and 2:
[0062] G x =d x *M (Formula 1)
[0063] G y =d y *M (Formula 2)
[0064] Where M is the image to be processed, G x G y d represents the gradient values in the horizontal and vertical directions of the image M to be processed, respectively. x d y The Sobel convolution factors used to calculate the gradient are the horizontal and vertical directions, respectively, and can be expressed in forms such as Equations 3 and 4:
[0065]
[0066]
[0067] The gradient values of an image are positively correlated with its texture. By determining the gradient values in the horizontal and vertical directions of the image to be processed, the texture image can be determined. The texture image G can be calculated using Formula 5:
[0068]
[0069] In addition, to improve computational efficiency, the texture image G can be approximated using Formula 6 without taking the square root:
[0070] G = |G x |+|G y | (Formula 6)
[0071] It should be understood that the above method of using Sobel convolution factor to determine the texture image is only an example, and this disclosure is not limited thereto. For example, deep learning schemes can also be used to determine the texture image corresponding to the image to be processed.
[0072] After determining the texture image corresponding to the image to be processed, the texture image can be divided into multiple texture image blocks in the same way as the image to be processed.
[0073] Figure 6 A schematic diagram is shown of a method for determining a texture image based on an image to be processed and dividing it into multiple texture image blocks.
[0074] Next, the grayscale histogram of the texture image patch can be determined as the texture histogram of the corresponding image patch on the image to be processed.
[0075] It should be noted that the texture image only includes texture pixels. Therefore, when determining the grayscale histogram of the texture image block, only the grayscale values of the texture pixels are counted. The method of grayscale value counting here is similar to the method of directly counting grayscale values mentioned above, and will not be repeated here.
[0076] The above process of determining the texture image applies to the entire image to be processed. In other embodiments of this disclosure, the texture image corresponding to each image block of the image to be processed can also be determined. The processing method is similar and will not be described again.
[0077] Furthermore, for each image patch, the ratio of the number of texture pixels to the total number of pixels in that patch can be determined as a texture-related weight for use in subsequent processing. If the total number of pixels in the image patch is denoted as Num... total The number of texture pixels in an image block is denoted as Num. texture Then the texture-related weight t r It can be calculated using Formula 7:
[0078]
[0079] S34. Determine the tone mapping curve of each image block based on the grayscale histogram and texture histogram of each image block.
[0080] For each image patch, the electronic device can first fuse the grayscale histogram and texture histogram of the image patch to determine the fused histogram of the image patch.
[0081] If we denote the grayscale histogram of an image patch as Hist luma Let Histtexture be the texture histogram of the image patch. Then Histtexture is the fusion histogram of the image patch. final This can be represented as Formula 8:
[0082] Hist final [i] = w*Hist texture [i]+(1-w)*Hist luma[i] (Formula 8)
[0083] Where i = 0, 1, ..., BIN_NUM, w is a control parameter that is set manually so that the disclosed scheme can be applied to various image scenarios and can achieve the rollback of the scheme to a certain extent.
[0084] Next, the electronic device can perform histogram equalization on the fused histogram of the image patch to generate the tone mapping curve of the image patch.
[0085] Specifically, this can be achieved by utilizing the fused histogram. final Calculate the cumulative distribution function, referring to the formula.
[0086] Equations 9 and 10:
[0087]
[0088]
[0089] Where Max is the maximum grayscale value of the pixels in the image to be processed; s num The number of sampling points used to generate the tone mapping curve, for example, s num =BIN_NUM+1; tmf is the generated tone mapping curve; HistSum can be calculated using formula 11:
[0090]
[0091] S36. Use the tone mapping curves of each image patch to perform image enhancement on the image to be processed.
[0092] It should be understood that the image enhancement process in this embodiment of the disclosure applies to each pixel in the image to be processed. That is, although the process is described below using a single pixel as an example, the following image enhancement process can be performed on each pixel in the image to be processed.
[0093] First, determine the original grayscale value of the pixel and its position in the image block.
[0094] In some embodiments of this disclosure, taking a square image block as an example, the side length of the image block is mapped to 1. Thus, the position of any pixel in the image block can be represented, and after determining the position of the pixel in its own image block, the position of the pixel relative to other image blocks can also be determined.
[0095] Additionally, the set of image blocks associated with the pixel can be determined, and the target mapping curve of the image blocks in the set of image blocks can be obtained.
[0096] An image block set can be a collection of image blocks associated with the location of a pixel. The image block set can include one or more image blocks. For example, it can include only the image block to which the pixel belongs, or it can include multiple image blocks that are adjacent to the pixel.
[0097] The target mapping curve of the image block can be determined based on the tone mapping curve of the image block determined in step S34 above.
[0098] In one embodiment of this disclosure, the tone mapping curve of an image block can be directly determined as the target mapping curve of the image block and applied to the image enhancement process in this step.
[0099] In another embodiment of this disclosure, the tone mapping curve of the image block can be fused with a linear curve, and the fused curve can be used as the target mapping curve of the image block.
[0100] Specifically, the texture information corresponding to the image patch can be used to determine the fusion weights used when fusing the tone mapping curve and the linear curve of the image patch. These fusion weights are then used to fuse the tone mapping curve and the linear curve of the image patch to obtain the target mapping curve for the image patch. Regarding the fusion weights, the texture-related weights t determined in step S32 can be used as a basis. r get.
[0101] As explained in step S34, in this embodiment of the disclosure, a tone mapping curve can be obtained using a sampling method, for example, by utilizing s num The linear curve in this embodiment can be configured as a piecewise function, and the number of sampling points s of the tone mapping curve can be determined based on the number of sampling points s of the tone mapping curve. num And the step size of the gray level of the histogram is constructed.
[0102] For example, a linear curve can be defined using Equation 12:
[0103]
[0104] Where step is the step size of the grayscale level.
[0105] In this case, the target mapping curve tmf final Formula 13 can be used to determine:
[0106] tmf final [i] = g(t) r )*tmf[i]+(1-g(t r ))*f(i) (Formula 13)
[0107] Where i = 0, 1, 2, ..., S num -1, g(t) r) is where the independent variable is t r The transformation function of t has a range of 0-1. Specifically, t r The larger g(t) is, the more r The larger the value, the stronger the positive correlation.
[0108] Additionally, g(t) r It can also be defined as a piecewise linear mapping function, which can be referred to in the form of Equation 14:
[0109]
[0110] Among them, Thr1, Thr0, V1, and V0 are all manually set parameters.
[0111] By combining fusion weights to blend tone mapping curves with linear curves, different image effects can be achieved adaptively according to different scenarios.
[0112] After determining the original grayscale value of a pixel, its position in the image block it belongs to, and the target mapping curve of each image block in the image block set, the processed grayscale value of the pixel can be determined based on these data.
[0113] The following is combined with Figure 7 The process of processing pixel O is illustrated by example.
[0114] For pixel O, the associated set of image blocks is determined as image block A, image block B, image block C, and its associated image block D. Each image block corresponds to a target mapping curve, which may lead to block artifacts. Therefore, bilinear interpolation can be used to eliminate block artifacts.
[0115] Let the original gray value of pixel O be denoted as r0, and the target mapping curves of image blocks A, B, C, and D be denoted as g, respectively. A g B、 g C、 g D Then, the gray value of pixel O after processing, i.e., the result of bilinear interpolation, can be expressed as Equation 15:
[0116] s o = (1-x)*(1-y)*g A (r0)+x*(1-y)*g B (r0)+(1-x)*y*g C (r0)+x*y*g D (r0) (Formula 15)
[0117] The image enhancement methods described above use pixel location-related information as weights. In other embodiments of this disclosure, location information and brightness similarity can also be combined to construct a comprehensive weight.
[0118] Specifically, the location-related weights can be expressed as Equations 16 to 19:
[0119] w DA =(1-x)*(1-y) (Formula 16)
[0120] w DB =x*(1-y) (Formula 17)
[0121] w DC =(1--x)*y (Formula 18)
[0122] w DD =x*y (Formula 19)
[0123] Let S be the difference between the gray value of pixel O and the mean gray values of image blocks A, B, C, and D, respectively. A S B S C S D See formulas 20 to 23:
[0124] S A =|r o -V mean (A)| (Formula 20)
[0125] S B =|r o -V mean (B)| (Formula 21)
[0126] S C =|r o -V mean (C)| (Formula 22)
[0127] S D =|r o -V mean (D)| (Formula 23)
[0128] Among them, V mean (A), V mean (B) V mean (C), V mean (D) represents the mean gray values of image blocks A, B, C, and D, respectively.
[0129] Based on the above differences, weights w related to brightness similarity were determined respectively. SAw SB w SC w SD See formulas 24 to 27:
[0130]
[0131]
[0132]
[0133]
[0134] Therefore, the new grayscale value of a pixel can be determined by combining position-based weights and brightness similarity-based weights, and the corresponding interpolation formula can be expressed as Formula 28:
[0135]
[0136] The above-mentioned contrast enhancement scheme involves some manually adjustable parameters. According to other embodiments of this disclosure, these parameters can be integrated to form a unified adjustment method and presented on the interface of the electronic device so that users can adjust them according to different scenarios to meet their personalized needs.
[0137] refer to Figure 8 On the human-computer interface of electronic devices, there are options to adjust the intensity of contrast enhancement, allowing users to select the level of contrast enhancement.
[0138] The following is for reference. Figure 9 The processing procedure of one embodiment of the image processing method described above will be explained.
[0139] In step S902, the electronic device acquires the image to be processed and divides the image into multiple image blocks.
[0140] In step S904, the electronic device determines the grayscale histogram of each image block.
[0141] In step S906, the electronic device performs texture detection on the image to be processed, obtains a texture image, and determines the texture histogram of each image block. The order in which steps S904 and S906 are executed is not restricted.
[0142] In step S908, the electronic device fuses the grayscale histogram with the texture histogram to determine the fused histogram.
[0143] In step S910, the electronic device generates a tone mapping curve based on the fused histogram and using a histogram equalization algorithm.
[0144] In step S912, the electronic device uses the fusion weight determined based on the texture detection result in step S906 to fuse the tone mapping curve with the linear curve to obtain the target mapping curve.
[0145] In step S914, the electronic device uses the target mapping curve of each image block to interpolate and map the gray values of each pixel in the image to be processed.
[0146] In step S916, the electronic device acquires and outputs the processed image. The processed image can then be stored, displayed, or subjected to further processing.
[0147] Furthermore, to reduce resource overhead and improve histogram statistical efficiency, this disclosure also provides another image processing method. Compared to the image processing method in steps S32 to S36, this other image processing method downsamples the image to be processed and uses the downsampling result to determine the gray-level histogram of the image patch. In the following description, the same terms refer to the same meanings, and the content consistent with the description in steps S32 to S36 will not be repeated.
[0148] Figure 10 A flowchart illustrating another image processing method according to an exemplary embodiment of this disclosure is shown schematically. Reference Figure 10 This alternative image processing method may include the following steps:
[0149] S102. Downsample the image to be processed to obtain an intermediate image, and divide the intermediate image into multiple image blocks according to the target block division method, and determine the grayscale histogram of each image block of the intermediate image.
[0150] In an exemplary embodiment of this disclosure, the electronic device may downsample the image to be processed and record the downsampled image as an intermediate image. It should be understood that the size of the intermediate image is the same as the size of the image to be processed.
[0151] According to one embodiment of this disclosure, an electronic device can perform interlaced sampling on an image to be processed to obtain an intermediate image. Furthermore, the grayscale values of pixels in the intermediate image that are not from rows of the image to be processed can be set to 0, for example, to reduce the amount of subsequent computation.
[0152] According to another embodiment of this disclosure, an electronic device can perform pooling sampling on an image to be processed to obtain an intermediate image. This disclosure does not limit the type of pooling sampling algorithm, such as max pooling, average pooling, random pooling, etc. Similarly, apart from the pixels obtained by the pooling operation, the grayscale values of other pixels in the intermediate image can be set to 0, for example, to reduce the amount of subsequent computation.
[0153] After obtaining the intermediate image, the electronic device can divide the intermediate image into multiple image blocks according to the target segmentation method and determine the grayscale histogram of each image block. The target segmentation method is a pre-defined image segmentation method, such as dividing the image into 6×8 image blocks of the same size, dividing the image into 64×64 image blocks of the same size, and so on.
[0154] Furthermore, the target segmentation method can be a manually defined image segmentation rule or an image segmentation rule determined automatically by the electronic device based on image attributes (such as size, shooting scene, etc.). It is understood that after acquiring the image to be processed, the electronic device can determine the target segmentation method based on user input or image analysis. This disclosure does not limit the specific content included in the target segmentation method.
[0155] S104. Extract the texture information of the image to be processed to obtain a texture image, and divide the texture image into multiple image blocks according to the target block division method, and determine the grayscale histogram of each image block of the texture image.
[0156] After the texture image is determined, the electronic device can divide the texture image into multiple image blocks according to the target block method, that is, obtain multiple texture image blocks, and count the grayscale histogram of each texture image block.
[0157] S106. Based on the grayscale histograms of each image block in the intermediate image and the grayscale histograms of each image block in the texture image, determine the tone mapping curves of each image block in the image to be processed; wherein, each image block in the image to be processed is obtained by dividing the image to be processed according to the target block division method.
[0158] Taking a target image block as an example, the target image block can be any image block in the image. Since the target block method is used and the image size of the image to be processed, the intermediate image, and the texture image are the same, the target image block of the intermediate image, the target image block of the texture image, and the target image block of the image to be processed can be image blocks with the same block position. For example, for the entire image, the center point coordinates of the target image block are all (p, q).
[0159] The grayscale histogram of the target image block in the intermediate image can be fused with the grayscale histogram of the target image block in the texture image, and the fusion result can be determined as the fused histogram of the target image block in the image to be processed.
[0160] Next, histogram equalization can be performed on the fusion histogram of the target image patch of the image to be processed to generate the tone mapping curve of the target image patch of the image to be processed.
[0161] The specific processing procedure has been explained in step S34 and will not be repeated here.
[0162] It is understandable that the above-mentioned processing procedure for the target image block can be performed for each image block in the image to be processed, thereby determining the tone mapping curve of each image block in the image to be processed.
[0163] S108. Use the tone mapping curves of each image patch of the image to be processed to perform image enhancement on the image to be processed.
[0164] Step S108 is the same as the process in step S36 above, and will not be described again here.
[0165] The following is for reference. Figure 11 The processing procedure of one embodiment of the image processing method described above will be explained.
[0166] In step S1102, the electronic device acquires the image to be processed.
[0167] In step S1104, the electronic device downsamples the image to be processed to obtain an intermediate image.
[0168] In step S1106, the electronic device divides the intermediate image into multiple image blocks and determines the grayscale histogram of each image block.
[0169] In step S1108, the electronic device performs texture detection on the image to be processed to obtain a texture image.
[0170] In step S1110, the electronic device uses the same image segmentation method to divide the texture image into multiple image blocks and determines the grayscale histogram of each image block.
[0171] In step S1112, the electronic device fuses the grayscale histograms determined in steps S1106 and S1110 to determine the fused histogram of the image block.
[0172] In step S1114, the electronic device generates a tone mapping curve based on the fused histogram and using a histogram equalization algorithm.
[0173] In step S1116, the electronic device uses the fusion weight determined based on the texture detection result in step S1108 to fuse the tone mapping curve with the linear curve to obtain the target mapping curve.
[0174] In step S1118, the electronic device uses the target mapping curve of each image block to interpolate and map the gray values of each pixel in the image to be processed.
[0175] In step S1120, the electronic device acquires and outputs the processed image. The processed image can then be stored, displayed, or subjected to further processing.
[0176] Furthermore, for input images in RGB, YUV, or Bayer input formats, the input image can be converted to a grayscale image to perform the image processing procedure described above. Moreover, the image processing method of this disclosure is applicable to images with pixel depths of 8 bits, 10 bits, 12 bits, etc., and has universality.
[0177] Through the above processing, it can be understood that the image processing method of the present disclosure can adjust not only the local contrast of the image, but also the local dynamics. The present disclosure does not limit these application scenarios.
[0178] It should be noted that although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0179] Furthermore, this example embodiment also provides an image processing apparatus.
[0180] Figure 12 A block diagram of an image processing apparatus according to an exemplary embodiment of the present disclosure is shown schematically. Reference Figure 12 The image processing apparatus 12 according to an exemplary embodiment of the present disclosure may include a histogram determination module 121, a mapping curve determination module 123, and an image enhancement module 125.
[0181] Specifically, the histogram determination module 121 can be used to acquire the image to be processed, divide the image to be processed into multiple image blocks, and determine the grayscale histogram and texture histogram of each image block; the mapping curve determination module 123 can be used to determine the tone mapping curve of each image block based on the grayscale histogram and texture histogram of each image block; and the image enhancement module 125 can be used to enhance the image to be processed using the tone mapping curve of each image block.
[0182] According to an exemplary embodiment of the present disclosure, the process by which the histogram determination module 121 determines the texture histogram of each image block can be configured to perform: extracting texture information of the image to be processed to obtain a texture image; dividing the texture image into multiple texture image blocks in the same image block division method as dividing the image to be processed; and determining the grayscale histogram of the texture image block as the texture histogram of the corresponding image block on the image to be processed.
[0183] According to an exemplary embodiment of the present disclosure, the mapping curve determination module 123 may be configured to perform: fusing the grayscale histogram and texture histogram of the image patch to determine the fused histogram of the image patch; and performing histogram equalization processing on the fused histogram of the image patch to generate a tone mapping curve of the image patch.
[0184] According to an exemplary embodiment of the present disclosure, the image enhancement module 125 can be configured to perform the following: for each pixel in the image to be processed, determine the original grayscale value of the pixel and the position of the pixel in the image block to which it belongs; determine the set of image blocks associated with the pixel and obtain the target mapping curve of the image block in the set of image blocks, wherein the target mapping curve of the image block is determined based on the tone mapping curve of the image block; and determine the grayscale value of the pixel after processing based on the original grayscale value of the pixel, the position of the pixel in the image block to which it belongs and the target mapping curve of the image block in the set of image blocks.
[0185] According to an exemplary embodiment of the present disclosure, the image enhancement module 125 may also be configured to perform: fusing the tone mapping curve of an image patch with a linear curve to obtain a target mapping curve of the image patch.
[0186] According to an exemplary embodiment of the present disclosure, the image enhancement module 125 may also be configured to perform: determining the fusion weight used when fusing the tone mapping curve of the image block with the linear curve using texture information corresponding to the image block; and fusing the tone mapping curve of the image block with the linear curve using the fusion weight to obtain the target mapping curve of the image block.
[0187] According to an exemplary embodiment of the present disclosure, the process by which the image enhancement module 125 determines the fusion weight can be configured to perform: determining the ratio of the number of texture pixels in an image block to the total number of pixels in the image block; and determining the fusion weight based on the ratio.
[0188] According to an exemplary embodiment of the present disclosure, the process by which the histogram determination module 121 determines the grayscale histogram of each image block can be configured to perform: pixel grayscale statistics on the image block to obtain the original grayscale histogram of the image block; and threshold constraint and / or smoothing processing on the original grayscale histogram to determine the grayscale histogram of the image block.
[0189] Furthermore, another image processing apparatus is also provided in this example embodiment.
[0190] Figure 13 A block diagram of an image processing apparatus according to another exemplary embodiment of the present disclosure is shown schematically. Reference Figure 13The image processing apparatus 13 according to an exemplary embodiment of the present disclosure may include a grayscale histogram determination module 131, a texture histogram determination module 133, a mapping curve determination module 135, and an image enhancement module 137.
[0191] Specifically, the grayscale histogram determination module 131 can be used to downsample the image to be processed to obtain an intermediate image, and divide the intermediate image into multiple image blocks according to the target segmentation method, and determine the grayscale histogram of each image block of the intermediate image; the texture histogram determination module 133 can be used to extract the texture information of the image to be processed to obtain a texture image, and divide the texture image into multiple image blocks according to the target segmentation method, and determine the grayscale histogram of each image block of the texture image; the mapping curve determination module 135 can be used to determine the tone mapping curve of each image block of the image to be processed according to the grayscale histogram of each image block of the intermediate image and the grayscale histogram of each image block of the texture image; wherein, each image block of the image to be processed is obtained by dividing the image to be processed according to the target segmentation method; the image enhancement module 137 can be used to enhance the image to be processed using the tone mapping curve of each image block of the image to be processed.
[0192] According to an exemplary embodiment of this disclosure, the mapping curve determination module 135 can be configured to perform: fusing the grayscale histogram of the target image block of the intermediate image with the grayscale histogram of the target image block of the texture image to determine the fused histogram of the target image block of the image to be processed; wherein the target image block of the intermediate image, the target image block of the texture image, and the target image block of the image to be processed are image blocks with the same block position; and performing histogram equalization processing on the fused histogram of the target image block of the image to be processed to generate a tone mapping curve of the target image block of the image to be processed. The target image block can be any image block in the image.
[0193] According to an exemplary embodiment of the present disclosure, the image enhancement module 137 can be configured to perform the following: for each pixel in the image to be processed, determine the original grayscale value of the pixel and the position of the pixel in its respective image block; determine a set of image blocks associated with the pixel and obtain the target mapping curve of the image block in the set of image blocks, wherein the target mapping curve of the image block is determined based on the tone mapping curve of the image block; and determine the processed grayscale value of the pixel based on the original grayscale value of the pixel, the position of the pixel in its respective image block and the target mapping curve of the image block in the set of image blocks.
[0194] According to an exemplary embodiment of the present disclosure, the image enhancement module 137 may also be configured to perform: for an image patch on the image to be processed, fusing the tone mapping curve of the image patch with a linear curve to obtain a target mapping curve of the image patch.
[0195] According to an exemplary embodiment of the present disclosure, the image enhancement module 137 may also be configured to perform: using texture information corresponding to the image patch to determine the fusion weight used when fusing the tone mapping curve of the image patch with the linear curve; and using the fusion weight to fuse the tone mapping curve of the image patch with the linear curve to obtain the target mapping curve of the image patch.
[0196] According to an exemplary embodiment of the present disclosure, the process of determining the fusion weight by the image enhancement module 137 can be configured to perform: determining the ratio of the number of texture pixels in the image block to the total number of pixels in the image block; and determining the fusion weight based on the ratio.
[0197] According to an exemplary embodiment of the present disclosure, the histogram determination module 131 may be configured to perform: pixel grayscale statistics on the image blocks of the intermediate image to obtain the original grayscale histogram of the image blocks of the intermediate image; and apply threshold constraints and / or smoothing processing to the original grayscale histogram to determine the grayscale histogram of the image blocks of the intermediate image.
[0198] Since the functional modules of the image processing apparatus of this disclosure are the same as those in the above-described method embodiments, they will not be described again here.
[0199] Figure 14 A schematic diagram of an electronic device suitable for implementing exemplary embodiments of the present disclosure is shown. It should be noted that... Figure 14 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0200] The electronic device disclosed herein includes at least a processor and a memory, the memory being used to store one or more programs, which, when executed by the processor, enable the processor to implement the image processing method of the exemplary embodiments of this disclosure.
[0201] Specifically, such as Figure 14As shown, the electronic device 140 may include: a processor 1410, internal memory 1421, external memory interface 1422, Universal Serial Bus (USB) interface 1430, charging management module 1440, power management module 1441, battery 1442, antenna 1, antenna 2, mobile communication module 1450, wireless communication module 1460, audio module 1470, sensor module 1480, display screen 1490, camera module 1491, indicator 1492, motor 1493, buttons 1494, and a Subscriber Identification Module (SIM) card interface 1495, etc. The sensor module 1480 may include a depth sensor, pressure sensor, gyroscope sensor, barometric pressure sensor, magnetic sensor, accelerometer, distance sensor, proximity sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor, and bone conduction sensor, etc.
[0202] It is understood that the structures illustrated in the embodiments of this disclosure do not constitute a specific limitation on the electronic device 140. In other embodiments of this disclosure, the electronic device 140 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0203] Processor 1410 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. Additionally, processor 1410 may include memory for storing instructions and data.
[0204] The electronic device 140 can implement shooting functions through an ISP, a camera module 1491, a video codec, a GPU, a display screen 1490, and an application processor. In some embodiments, the electronic device 140 may include one or N camera modules 1491, where N is a positive integer greater than 1. If the electronic device 140 includes N cameras, one of the N cameras is the main camera.
[0205] Internal memory 1421 can be used to store computer executable program code, including instructions. Internal memory 1421 may include a program storage area and a data storage area. External memory interface 1422 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of electronic device 140.
[0206] This disclosure also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device.
[0207] Computer-readable storage media can be, for example—but not limited to—electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0208] A computer-readable storage medium can be sent, propagated, or transmitted for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.
[0209] A computer-readable storage medium carries one or more programs that, when executed by an electronic device, cause the electronic device to perform the methods described in the embodiments of this disclosure.
[0210] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0211] The units described in the embodiments of this disclosure can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the unit itself.
[0212] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0213] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0214] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0215] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0216] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. An image processing method, characterized in that, include: Obtain the image to be processed, divide the image to be processed into multiple image blocks, and determine the grayscale histogram and texture histogram of each image block; The tone mapping curve of each image block is determined based on the grayscale histogram and texture histogram of each image block; Image enhancement of the image to be processed using the tone mapping curves of each of the image blocks includes: for each pixel in the image to be processed, determining the original grayscale value of the pixel and the position of the pixel in its respective image block; determining a set of image blocks associated with the pixel and obtaining the target mapping curve of the image blocks in the set of image blocks, wherein the target mapping curve of the image block is determined based on the tone mapping curve of the image block; and determining the processed grayscale value of the pixel based on the original grayscale value of the pixel, the position of the pixel in its respective image block, and the target mapping curve of the image blocks in the set of image blocks. Determining the texture histogram of each image block includes: Extract the texture information of the image to be processed to obtain a texture image; The texture image is divided into multiple texture image blocks using the same image block division method as that used to divide the image to be processed. The grayscale histogram of the texture image block is determined and used as the texture histogram of the corresponding image block on the image to be processed.
2. The image processing method according to claim 1, characterized in that, Determining the tone mapping curve of each image patch based on its grayscale histogram and texture histogram includes: The grayscale histogram and texture histogram of the image patch are fused to determine the fused histogram of the image patch; Histogram equalization is performed on the fused histogram of the image patch to generate the tone mapping curve of the image patch.
3. The image processing method according to claim 1, characterized in that, The image processing method further includes: The tone mapping curve of the image patch is fused with a linear curve to obtain the target mapping curve of the image patch.
4. The image processing method according to claim 3, characterized in that, The tonal mapping curve of the image patch is fused with a linear curve to obtain the target mapping curve of the image patch, including: Using the texture information corresponding to the image patch, determine the fusion weight used when fusing the tone mapping curve of the image patch with the linear curve; The tone mapping curve of the image patch is fused with the linear curve using the fusion weight to obtain the target mapping curve of the image patch.
5. The image processing method according to claim 4, characterized in that, Using the texture information corresponding to the image patch, the fusion weights used when fusing the tone mapping curve of the image patch with the linear curve are determined, including: Determine the ratio of the number of texture pixels in the image block to the total number of pixels in the image block; The fusion weight is determined based on the ratio.
6. The image processing method according to claim 1, characterized in that, Determining the grayscale histogram of each of the aforementioned image blocks includes: Perform pixel grayscale statistics on the image block to obtain the original grayscale histogram of the image block; The original grayscale histogram is subjected to threshold constraints and / or smoothing to determine the grayscale histogram of the image block.
7. An image processing method, characterized in that, include: The image to be processed is downsampled to obtain an intermediate image, and the intermediate image is divided into multiple image blocks according to the target block division method, and the grayscale histogram of each image block of the intermediate image is determined. Extract the texture information of the image to be processed to obtain a texture image, and divide the texture image into multiple image blocks according to the target block division method, and determine the grayscale histogram of each image block of the texture image; Based on the grayscale histograms of each image block in the intermediate image and the grayscale histograms of each image block in the texture image, the tone mapping curves of each image block in the image to be processed are determined; wherein, each image block in the image to be processed is obtained by dividing the image to be processed according to the target segmentation method; Image enhancement of the image to be processed using the tone mapping curves of each image block of the image to be processed includes: for each pixel in the image to be processed, determining the original gray value of the pixel and the position of the pixel in its respective image block; determining the set of image blocks associated with the pixel and obtaining the target mapping curve of the image blocks in the set of image blocks, wherein the target mapping curve of the image block is determined based on the tone mapping curve of the image block; and determining the processed gray value of the pixel based on the original gray value of the pixel, the position of the pixel in its respective image block, and the target mapping curve of the image blocks in the set of image blocks.
8. The image processing method according to claim 7, characterized in that, Based on the grayscale histograms of each image patch in the intermediate image and the grayscale histograms of each image patch in the texture image, the tone mapping curves of each image patch in the image to be processed are determined, including: The grayscale histogram of the target image block of the intermediate image is fused with the grayscale histogram of the target image block of the texture image to determine the fused histogram of the target image block of the image to be processed; wherein the target image block of the intermediate image, the target image block of the texture image, and the target image block of the image to be processed are image blocks with the same block position. Histogram equalization is performed on the fusion histogram of the target image patch of the image to be processed to generate the tone mapping curve of the target image patch of the image to be processed.
9. The image processing method according to claim 7, characterized in that, The image processing method further includes: For an image patch in the image to be processed, the tone mapping curve of the image patch is fused with a linear curve to obtain the target mapping curve of the image patch.
10. The image processing method according to claim 9, characterized in that, The tonal mapping curve of the image patch is fused with a linear curve to obtain the target mapping curve of the image patch, including: Using the texture information corresponding to the image patch, determine the fusion weight used when fusing the tone mapping curve of the image patch with the linear curve; The tone mapping curve of the image patch is fused with the linear curve using the fusion weight to obtain the target mapping curve of the image patch.
11. The image processing method according to claim 10, characterized in that, Using the texture information corresponding to the image patch, the fusion weights used when fusing the tone mapping curve of the image patch with the linear curve are determined, including: Determine the ratio of the number of texture pixels in the image block to the total number of pixels in the image block; The fusion weight is determined based on the ratio.
12. The image processing method according to claim 7, characterized in that, Determining the grayscale histogram of each image block in the intermediate image includes: Pixel grayscale statistics are performed on the image blocks of the intermediate image to obtain the original grayscale histogram of the image blocks of the intermediate image; The original grayscale histogram is subjected to threshold constraints and / or smoothing to determine the grayscale histogram of the image block of the intermediate image.
13. An image processing apparatus, characterized in that, include: The histogram determination module is used to acquire the image to be processed, divide the image to be processed into multiple image blocks, and determine the grayscale histogram and texture histogram of each image block; The mapping curve determination module is used to determine the tone mapping curve of each image block based on the grayscale histogram and texture histogram of each image block; An image enhancement module is used to enhance the image to be processed using the tone mapping curves of each of the image blocks, including: enhancing the image to be processed using the tone mapping curves of each of the image blocks, including: for each pixel in the image to be processed, determining the original grayscale value of the pixel and the position of the pixel in its respective image block; determining a set of image blocks associated with the pixel and obtaining the target mapping curve of the image blocks in the set of image blocks, wherein the target mapping curve of the image block is determined based on the tone mapping curve of the image block; and determining the processed grayscale value of the pixel based on the original grayscale value of the pixel, the position of the pixel in its respective image block, and the target mapping curve of the image blocks in the set of image blocks. The process of the histogram determination module determining the texture histogram of each image block is configured as follows: extracting the texture information of the image to be processed to obtain a texture image; dividing the texture image into multiple texture image blocks according to the same image block division method as dividing the image to be processed; and determining the grayscale histogram of the texture image block as the texture histogram of the corresponding image block on the image to be processed.
14. An image processing apparatus, characterized in that, include: The grayscale histogram determination module is used to downsample the image to be processed to obtain an intermediate image, and divide the intermediate image into multiple image blocks according to the target block division method, and determine the grayscale histogram of each image block of the intermediate image. The texture histogram determination module is used to extract the texture information of the image to be processed to obtain a texture image, and divide the texture image into multiple image blocks according to the target block division method, and determine the grayscale histogram of each image block of the texture image. The mapping curve determination module is used to determine the tone mapping curve of each image block of the image to be processed based on the grayscale histogram of each image block of the intermediate image and the grayscale histogram of each image block of the texture image; wherein, each image block of the image to be processed is obtained by dividing the image to be processed according to the target segmentation method; An image enhancement module is used to enhance the image to be processed using the tone mapping curves of each image block of the image to be processed, including: for each pixel in the image to be processed, determining the original grayscale value of the pixel and the position of the pixel in its respective image block; determining a set of image blocks associated with the pixel and obtaining the target mapping curve of the image blocks in the set of image blocks, wherein the target mapping curve of the image block is determined based on the tone mapping curve of the image block; and determining the processed grayscale value of the pixel based on the original grayscale value of the pixel, the position of the pixel in its respective image block, and the target mapping curve of the image blocks in the set of image blocks.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the image processing method as described in any one of claims 1 to 12.
16. An electronic device, characterized in that, include: processor; A memory for storing one or more programs, which, when executed by the processor, cause the processor to implement the image processing method as described in any one of claims 1 to 12.