Image Processing Method, Apparatus, Electronic Device, and Computer-Readable Storage Medium

By determining the image type in tone mapping processing and layer decomposing, acquiring the base layer and detail layer images and performing weighted summing, the problem of image edge halo effect is solved, and the image visual quality is improved.

CN115170413BActive Publication Date: 2025-07-25BEIJING ESWIN COMPUTING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210744777.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-07-25
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

In the prior art, halo effects are easily caused by the image edge during tone mapping processing, affecting the image visual quality.

Method used

By determining multiple sub-images in the image to be processed, the difference between the average pixel value of each sub-image and the central pixel point is calculated, the image type is determined based on the difference value, and layer decomposition is performed, the base layer image and the detail layer image are obtained, and the pixel values are weighted and summed to obtain the target image.

Benefits of technology

It effectively avoids the halo effect at the edge of the image and improves the visual quality of the image after tone mapping.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115170413B_ABST
    Figure CN115170413B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides an image processing method, apparatus, electronic device, and computer-readable storage medium, which relate to the technical field of tone mapping. The method includes: determining a plurality of sub-images in the image to be processed; wherein, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points; for each sub-image, determining the average pixel value of the sub-image, and determining the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value; performing layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain a base layer image and a detail layer image of the image to be processed; performing weighted summation on the pixel values of the base layer image and the detail layer image to obtain a target image. Through the layer decomposition processing according to the image type, the embodiment of the present application accurately identifies the base layer image and the detail layer image of the image to be processed, and effectively improves the visual quality of image display.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of tone mapping. Specifically, this application relates to an image processing method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] In computer graphics and cinematography, High Dynamic Range Imaging (HDR) technology is used to achieve a greater exposure dynamic range than ordinary digital image technology, and tone mapping is an image processing technology for approximately displaying HDR images on a medium with a limited dynamic range; in actual rendering applications, although the display device may not be able to display the entire brightness range of the HDR image, tone mapping can make the real scene of the image match the display scene of the image.

[0003] In the prior art, an image edge-preserving filter (such as a bilateral filter or a guided filter) is usually used for tone mapping processing; among them, the processing steps of the guided filter are: determining a filtering coefficient according to a preset regularization parameter, decomposing the image to be processed into layers according to the filtering coefficient, and then fusing the decomposed image layers to obtain the tone-mapped image; the above method has the problems of poor visual quality of image display and easy occurrence of halo effect (halo effect) at the image edge. Summary of the Invention

[0004] Embodiments of this application provide an image processing method, apparatus, electronic device, and computer-readable storage medium, which can avoid the problem of halo effect at the image edge during tone mapping in the prior art. The technical solution is as follows:

[0005] According to one aspect of the embodiments of this application, an image method is provided, and the method includes:

[0006] Determine a plurality of sub-images in the image to be processed; wherein, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points.

[0007] For each sub-image, determine the average pixel value of the sub-image, and determine the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value.

[0008] Decompose the image to be processed into layers according to the image types of the respective sub-images to obtain a base layer image and a detail layer image of the image to be processed.

[0009] Perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain a target image.

[0010] Optionally, the above determination of the image type of the sub-image includes:

[0011] For each sub-image, the difference between the average pixel value and the pixel value of the central pixel point is used as the pixel change deviation value of the sub-image;

[0012] According to the pixel change deviation value, determine the first filtering coefficient of the sub-image;

[0013] Determine the image type of the sub-image according to the first filtering coefficient.

[0014] Optionally, the above determination of the first filtering coefficient of the sub-image according to the pixel change deviation value includes:

[0015] Obtain a preset filtering scale;

[0016] Weight the filtering scale according to the pixel change deviation value of the sub-image to obtain a weighted filtering scale;

[0017] Determine the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image.

[0018] Optionally, the above average pixel value and pixel value variance of the sub-image are calculated based on the following method:

[0019] Determine the pixel points of all permutation groups in the sub-image, and the permutation group is a row or a column;

[0020] For the pixel points of each permutation group, if the target parameter of the pre-stored permutation group is determined, then call the target parameter of the pre-stored permutation group. If it is determined that the target parameter of the permutation group is not pre-stored, then calculate and store the target parameter of the permutation group according to the target parameters of each pixel point in the permutation group;

[0021] Obtain the average pixel value or pixel value variance of the sub-image according to the target parameters of all permutation groups; where the target parameter is the sum of pixel values and the sum of squares of pixel values.

[0022] Optionally, the above determination of the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image includes:

[0023] Take the sum of the weighted filtering scale and the pixel value variance as the adaptive variance value;

[0024] Take the ratio of the pixel value variance to the adaptive variance value as the first filtering coefficient of the sub-image.

[0025] Optionally, the above first filtering coefficient is calculated based on the following method:

[0026] Shift the adaptive variance value according to a preset shift coefficient to obtain a first shift result, and look up the reciprocal of the first shift result through a preset look-up table;

[0027] Determine the product of the reciprocal of the first shift result and the pixel variance value, shift the product result according to a preset shift coefficient to obtain a second shift result, and use the second shift result as the first filtering coefficient.

[0028] Optionally, the above-mentioned layer decomposition of the image to be processed according to the image type of each sub-image to obtain the base layer image and the detail layer image of the image to be processed includes:

[0029] For each sub-image, weight the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image;

[0030] Perform layer decomposition on the image to be processed according to the first filtering coefficient and the second filtering coefficient of each sub-image to obtain the base layer image and the detail layer image of the image to be processed.

[0031] Optionally, the above-mentioned weighting process of the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image includes:

[0032] Weight the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to obtain the weighted average pixel value;

[0033] Use the difference between the average pixel value of the sub-image and the weighted average pixel value as the second filtering coefficient of the sub-image.

[0034] Optionally, the above-mentioned layer decomposition of the image to be processed according to the first filtering coefficient and the second filtering coefficient of each sub-image to obtain the base layer image and the detail layer image of the image to be processed includes:

[0035] Filter the pixel value of the central pixel point of the sub-image according to the first filtering coefficient and the second filtering coefficient to obtain the target pixel value of the central pixel point of the sub-image;

[0036] Obtain the base layer image of the image to be processed according to the target pixel values of the central pixel points of all sub-images;

[0037] Obtain the detail layer image according to the base layer image and the image to be processed; wherein, the pixel value of the pixel point in the detail layer image is the difference between the pixel value of the pixel point in the image to be processed and the base layer image.

[0038] Optionally, when the filtering scales include a first filtering scale and a second filtering scale, the first filtering coefficients include a first target filtering coefficient determined according to the first filtering scale and a second target filtering coefficient determined according to the second filtering scale;

[0039] The base layer image includes a first base layer image and a second base layer image, and the detail layer image includes a first detail layer image and a second detail layer image; wherein, the first base layer image and the first detail layer image are determined according to the first target filtering coefficient, and the second base layer image and the second detail layer image are determined according to the second target filtering coefficient;

[0040] The above-mentioned weighted summation of the pixel values of the base layer image and the detail layer image to obtain the target image includes:

[0041] Weight the first detail layer image and the second detail layer image respectively according to a preset detail enhancement weight;

[0042] Weight the second base layer image according to a preset contrast weakening weight;

[0043] Superimpose the weighted second base layer image, the weighted first detail layer image and the weighted second detail layer image to obtain the target image; wherein, the pixel value of a pixel point of the target image is the sum of the pixel values of the pixel point in the weighted second base layer image, the weighted first detail layer image and the weighted second detail layer image.

[0044] According to another aspect of the embodiments of the present application, there is provided an image processing apparatus, and the apparatus includes:

[0045] A first determination module, configured to determine a plurality of sub-images in the image to be processed; wherein, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points;

[0046] A second determination module, configured to, for each sub-image, determine the average pixel value of the sub-image, and determine the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value;

[0047] A decomposition module, configured to perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed;

[0048] A weighting module, configured to perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image.

[0049] Optionally, when the second determination module determines the image type of the sub-image, it is configured to:

[0050] For each sub-image, the difference between the average pixel value and the pixel value of the central pixel point is used as the pixel change deviation value of the sub-image;

[0051] Determine the first filtering coefficient of the sub-image according to the pixel change deviation value;

[0052] Determine the image type of the sub-image according to the first filtering coefficient.

[0053] Optionally, when the second determination module determines the first filtering coefficient of the sub-image according to the pixel change deviation value, it is used for:

[0054] Obtain a preset filtering scale;

[0055] Weight the filtering scale according to the pixel change deviation value of the sub-image to obtain a weighted filtering scale;

[0056] Determine the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image.

[0057] Optionally, the average pixel value and the pixel value variance of the above sub-image are calculated based on the following method:

[0058] Determine the pixel points of all permutation groups in the sub-image, where the permutation group is a row or a column;

[0059] For the pixel points of each permutation group, if the target parameter of the pre-stored permutation group is determined, the target parameter of the pre-stored permutation group is called. If it is determined that the target parameter of the permutation group is not pre-stored, then according to the target parameters of each pixel point in the permutation group, calculate and store the target parameter of the permutation group;

[0060] Obtain the average pixel value or the pixel value variance of the sub-image according to the target parameters of all permutation groups; where the target parameter is the sum of pixel values and the sum of squares of pixel values.

[0061] Optionally, when the second determination module determines the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image, it is used for:

[0062] Take the sum of the weighted filtering scale and the pixel value variance as the adaptive variance value;

[0063] Take the ratio of the pixel value variance to the adaptive variance value as the first filtering coefficient of the sub-image.

[0064] Optionally, the above first filtering coefficient is calculated based on the following method:

[0065] Shift the adaptive variance value according to a preset shift coefficient to obtain a first shift result, and look up the reciprocal of the first shift result through a preset look-up table;

[0066] Determine the product of the reciprocal of the first shift result and the pixel variance value, shift the product result according to a preset shift coefficient to obtain a second shift result, and use the second shift result as the first filtering coefficient.

[0067] Optionally, when the above decomposition module performs layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed, it is used for:

[0068] For each sub-image, perform weighted processing on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image;

[0069] Perform layer decomposition on the image to be processed according to the first filtering coefficient and the second filtering coefficient of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed.

[0070] Optionally, when the above decomposition module performs weighted processing on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image, it is used for:

[0071] Perform weighting on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to obtain the weighted average pixel value;

[0072] Use the difference between the average pixel value of the sub-image and the weighted average pixel value as the second filtering coefficient of the sub-image.

[0073] Optionally, when the above decomposition module performs layer decomposition on the image to be processed according to the first filtering coefficient and the second filtering coefficient of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed, it is used for:

[0074] Filter the pixel value of the central pixel point of the sub-image according to the first filtering coefficient and the second filtering coefficient to obtain the target pixel value of the central pixel point of the sub-image;

[0075] Obtain the base layer image of the image to be processed according to the target pixel values of the central pixel points of all sub-images;

[0076] Obtain the detail layer image according to the base layer image and the image to be processed; wherein, the pixel value of the pixel point in the detail layer image is the difference between the pixel value of the pixel point in the image to be processed and the base layer image.

[0077] Optionally, when the filtering scale includes a first filtering scale and a second filtering scale, the first filtering coefficient includes a first target filtering coefficient determined according to the first filtering scale and a second target filtering coefficient determined according to the second filtering scale;

[0078] The base layer image includes a first base layer image and a second base layer image, and the detail layer image includes a first detail layer image and a second detail layer image; wherein, the first base layer image and the first detail layer image are determined according to a first target filtering coefficient, and the second base layer image and the second detail layer image are determined according to a second target filtering coefficient;

[0079] When the above-mentioned weighting module performs weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image, it is used for:

[0080] Weight the first detail layer image and the second detail layer image respectively according to a preset detail enhancement weight;

[0081] Weight the second base layer image according to a preset contrast weakening weight;

[0082] Superimpose the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image to obtain the target image; wherein, the pixel value of a pixel point of the target image is the sum of the pixel values of the pixel point in the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image.

[0083] According to another aspect of the embodiments of the present application, there is provided an electronic device, which includes: a memory, a processor, and a computer program stored on the memory, and the above-mentioned processor executes the computer program to implement the steps of the method shown in the first aspect of the embodiments of the present application.

[0084] According to still another aspect of the embodiments of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the method shown in the first aspect of the embodiments of the present application.

[0085] According to one aspect of the embodiments of the present application, there is provided a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method shown in the first aspect of the embodiments of the present application.

[0086] The beneficial effects brought by the technical solutions provided by the embodiments of the present application are:

[0087] The embodiments of the present application obtain multiple sub-images in the image to be processed, determine the image type of each sub-image through the difference between the average pixel value of each sub-image and the pixel value of the central pixel point of the sub-image, and then perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed. Then, the pixel values of the base layer image and the detail layer image are weighted and summed to obtain the target image. Since the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points, the embodiments of the present application can determine the image type of the sub-image according to the difference between the average pixel value of each sub-image and the pixel value of the central pixel point, and can effectively distinguish the types of regions where each pixel point in the image to be processed is located. The embodiments of the present application implement layer decomposition processing according to the image type, accurately identify the base layer image and the detail layer image of the image to be processed. Different from the prior art in which the filtering coefficient is determined according to a preset regularization parameter for layer decomposition, the present application improves the layer decomposition effect while improving the visual quality of the image after tone mapping processing, that is, the target image, and effectively avoids the halo effect at the image edge. Description of the Drawings

[0088] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for description in the embodiments of the present application.

[0089] Figure 1 Schematic diagram of an application scenario of an image processing method provided by an embodiment of the present application;

[0090] Figure 2 Schematic diagram of a process of an image processing method provided by an embodiment of the present application;

[0091] Figure 3 Schematic diagram of an overlapping area of adjacent sliding window sub-images in an image processing method provided by an embodiment of the present application;

[0092] Figure 4 Schematic diagram of the update of sub-images based on permutation group data in an image processing method provided by an embodiment of the present application;

[0093] Figure 5 Schematic diagram of a process of an example image processing method provided by an embodiment of the present application;

[0094] Figure 6 Schematic diagram of the structure of an image processing device provided by an embodiment of the present application;

[0095] Figure 7 Schematic diagram of the structure of an image processing electronic device provided by an embodiment of the present application. Detailed Embodiments

[0096] The embodiments of the present application will be described below with reference to the accompanying drawings in the present application. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions of the embodiments of the present application.

[0097] Those skilled in the art of the present technology can understand that, unless specifically stated, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the terms "comprising" and "including" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude being implemented as other features, information, data, steps, operations, elements, components and / or their combinations supported by the art of the present technology. It should be understood that when we say an element is "connected" or "coupled" to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used here can include wireless connection or wireless coupling. The term "and / or" used here indicates at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or implemented as "B", or implemented as "A and B".

[0098] To make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0099] Since the dynamic range perceived by the real scene and the human eye is very wide, it is impossible to match the human eye perception and the real scene when displaying 12-bit or even 20-bit HDR images or videos on an 8-bit display. Tone mapping is an image processing technology for approximately displaying high-dynamic-range images on a medium with a limited dynamic range. The problem to be solved by tone mapping is to perform a large-scale contrast attenuation to transform the scene brightness into a displayable range, while maintaining information such as image details and colors, so that the scene after tone mapping matches the perception of the real scene.

[0100] In the prior art, tone mapping techniques are divided into global tone mapping and local tone mapping. Among them, the basic idea of local tone mapping is: decompose an image to be processed into a number of windows to be processed with the same size, and the central pixel of the window will perform a series of processing on brightness, contrast, and details, etc. according to the information of the surrounding pixels of the window, and finally complete the local tone mapping operation.

[0101] The inventors have found that since local tone mapping techniques based on layer decomposition usually require low-pass filters for layer decomposition, on the one hand, design defects of the filters will lead to poor layer decomposition quality, and on the other hand, the insufficient ability of the filters to perceive the structure of the image will introduce the halo effect after local tone mapping (which often appears at the edges of the image and appears as a halo-like object), seriously affecting the visual effect of the image after local tone mapping. Therefore, how to perform layer decomposition more effectively and suppress the halo effect while ensuring the local tone mapping effect is particularly important.

[0102] The image processing method, device, electronic device and computer-readable storage medium provided by this application aim to solve the above technical problems in the prior art.

[0103] An embodiment of this application provides an image processing method, which can be implemented by a terminal or a server. The terminal or server involved in the embodiment of this application determines multiple sub-images in the image to be processed, calculates the average pixel value of each sub-image, and then determines the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value; then performs layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed, and further performs weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image. The embodiment of this application realizes layer decomposition processing based on the image type, effectively avoiding the halo effect at the edges of the image while improving the layer decomposition effect.

[0104] The technical solutions of the embodiments of this application and the technical effects produced by the technical solutions of this application will be described below through the description of several exemplary embodiments. It should be noted that the following embodiments can refer to, draw on or combine with each other. For the same terms, similar features and similar implementation steps in different embodiments, they will not be described repeatedly.

[0105] As Figure 1 shown, the image processing method of this application can be applied to Figure 1 the scenario shown. Specifically, the server 102 receives the image to be processed sent by the client 101. The server 102 takes each pixel point of the image to be processed as the central pixel point to determine multiple sub-images; then for each sub-image, determines the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value of the sub-image, and then performs layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed, and further performs weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image after completing tone mapping, and sends the target image to the client 101.

[0106] Figure 1 In the scenario shown above, the above image processing method can be performed on a server. In other scenarios, it can also be performed on a terminal.

[0107] Those skilled in the art of the present technology can understand that the "terminal" used here can be a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a MID (Mobile Internet Device), etc.; the "server" can be implemented by an independent server or a server cluster composed of multiple servers.

[0108] An embodiment of the present application provides an image processing method, as Figure 2 shown, which can be applied to a server or a terminal for image processing. The method includes:

[0109] S201, determining multiple sub-images in the image to be processed.

[0110] Among them, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points.

[0111] Specifically, a server or a terminal for image processing can sequentially scan each pixel point of the image to be processed by using a sliding window. For each pixel point, a sub-image with a preset window size is intercepted with this pixel point as the central pixel point. For the boundary area of the image to be processed, when intercepting the sub-image, the method of mirror filling can be used to supplement the pixel points, so that the size of each sub-image is the same, and the sub-images correspond one by one to the pixel points in the image to be processed.

[0112] In the embodiment of the present application, when the image to be processed is a grayscale image, the grayscale value of each pixel point can be used as the pixel value; when the image to be processed is a multi-channel image, such as an RGB image, the maximum value among the R, G, and B channel values of each pixel point can be used as the pixel value of this pixel point.

[0113] S202, for each sub-image, determining the average pixel value of the sub-image, and determining the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value.

[0114] Among them, the image type includes a flat area, a detailed area, and a structural area.

[0115] Specifically, for each sub-image, the server or terminal for image processing can use the difference between the pixel value of the central pixel of the sub-image and the average pixel of the sub-image as the pixel change deviation value. Among them, the pixel deviation value can characterize the smoothness of the sub-image, that is, the smoothness of the sub-image can be determined according to the above pixel change deviation value: for the sub-image in the flat area or the structural area, its smoothness is high; for the sub-image in the area with rich details, its smoothness is low. Then, the first filtering coefficient can be calculated according to the pixel change deviation value and the pixel variance value of the sub-image, and the type of the sub-image can be determined according to the first filtering coefficient.

[0116] S203. Perform layer decomposition on the image to be processed according to the image types of the respective sub-images, and obtain the base layer image and the detail layer image of the image to be processed.

[0117] Among them, each image type corresponds to a first filtering coefficient; the base layer image and the detail layer image are the same size as the image to be processed.

[0118] Specifically, the server or terminal for image processing can filter the image to be processed according to the first filtering coefficient of each sub-image to complete the layer decomposition of the image, and obtain the base layer image and the detail layer image.

[0119] In the embodiments of the present application, for the flat area, mean filtering can be performed on this area; for the area with rich details, smooth filtering can be performed on this area; for the structural area, no filtering or a small amount of filtering processing can be performed to retain the pixel information of this area as much as possible, that is, retain the edge structure in the image to be processed.

[0120] S204. Perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image.

[0121] Specifically, the server or terminal for image processing can weight the detail layer image based on a preset detail enhancement weight, weight the base layer image based on a preset contrast weakening weight, and superimpose the weighted detail enhancement image and the base layer image to enhance the local contrast and detail change of the image to be processed, and obtain the target image.

[0122] In the embodiments of the present application, after obtaining the target image, linear stretching can also be performed on the target image to further increase the contrast, enhance the visual impact of the image display, and optimize the tone mapping effect.

[0123] In some embodiments, when the image to be processed is a grayscale image, the target image can be directly used as the image after tone mapping processing.

[0124] In some other embodiments, when the image to be processed is a multi-channel image, taking an RGB image as an example, color correction can also be performed on the target image to restore the image color, and the target image after color correction is used as the image after tone mapping processing. Among them, color correction can be performed through the following formula:

[0125]

[0126] Among them, c is the color channel of the image, r is the color correction coefficient, r ∈ (0, 1). Among them, the larger r is, the heavier the color correction degree is, and vice versa, the closer it is to a grayscale image; T is the pixel value of the target image, I is the pixel value of the image to be processed, and src c is the color channel value of the image to be processed, that is, the R, G, or B value. out c is the color channel value of the target image after color correction, that is, the R, G, or B value.

[0127] In the embodiments of the present application, multiple sub-images in the image to be processed are obtained. By the difference between the average pixel value of each sub-image and the pixel value of the central pixel point of the sub-image, the image type of each sub-image is determined. Then, according to the image types of each sub-image, the image to be processed is decomposed into layers, and the base layer image and the detail layer image of the image to be processed are obtained. Then, the pixel values of the base layer image and the detail layer image are weighted and summed to obtain the target image. Since the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points, in the embodiments of the present application, the image type of the sub-image can be determined according to the difference between the average pixel value of each sub-image and the pixel value of the central pixel point, and the types of regions where each pixel point in the image to be processed is located can be effectively distinguished. The embodiments of the present application realize layer decomposition processing according to the image type, accurately identify the base layer image and the detail layer image of the image to be processed. Different from the prior art in which the filtering coefficient is determined according to a preset regularization parameter for layer decomposition, the present application improves the layer decomposition effect while improving the visual quality of the image after tone mapping processing, that is, the target image, and effectively avoids the halo effect at the image edge.

[0128] A possible implementation manner is provided in the embodiments of the present application. Determining the image type of the sub-image includes:

[0129] S301, for each sub-image, the difference between the average pixel value and the pixel value of the central pixel point is used as the pixel change deviation value of the sub-image.

[0130] Specifically, for each sub-image, a server or a terminal for image processing can calculate the average pixel value of the sub-image according to the pixel values of all pixel points in the sub-image; then, the difference between the average pixel value and the pixel value of the central pixel point is used as the pixel change deviation value.

[0131] Among them, the pixel change deviation of each sub-image can be calculated based on the following formula:

[0132]

[0133] is the average pixel value of the θ-th sub-image, and I(x, y) is the pixel value of the central pixel point of this sub-image. is the pixel change deviation value of this sub-image.

[0134] S302. Determine the first filtering coefficient of the sub-image according to the pixel change deviation value.

[0135] Specifically, the first filtering coefficient of the sub-image can be determined according to the pixel change deviation value of the sub-image, the pixel variance value of this sub-image, and a preset filtering scale.

[0136] In the embodiments of the present application, the number of filtering scales can be two. Furthermore, two first filtering coefficients can be obtained, and the image to be processed can be decomposed into multiple scales based on the two first filtering coefficients, further improving the layer decomposition effect of the image.

[0137] Among them, the specific calculation process of the first filtering coefficient will be described in detail below.

[0138] S303. Determine the image type of the sub-image according to the first filtering coefficient.

[0139] Specifically, a correspondence between the data range of the first filtering coefficient and the image type can be established in advance, and the image type of the sub-image can be determined according to the above correspondence.

[0140] In the embodiments of the present application, for each sub-image, the first filtering coefficient is determined based on the difference between the average pixel value and the pixel value of the central pixel point; furthermore, the image type of the sub-image can be determined according to the correspondence between the data range of the first filtering coefficient and the image type, realizing the distinction between the flat area, the area with rich details, and the structural area of the sub-image. Subsequently, the image to be processed can be filtered according to the image type to improve the layer decomposition effect of the image to be processed.

[0141] A possible implementation manner is provided in the embodiments of the present application. Determining the first filtering coefficient of the sub-image according to the pixel change deviation value includes:

[0142] S401. Obtain a preset filtering scale.

[0143] Among them, the number of filtering scales can be one or multiple. When there are two filtering scales, two first filtering coefficients can be obtained, and then the image to be processed can be decomposed into multiple scales based on the two first filtering coefficients, further improving the image decomposition effect.

[0144] The process of determining different first filtering coefficients based on different filtering scales is the same, which will not be elaborated here. Below, a specific example with one filtering scale will be used for illustration.

[0145] S402. Weight the filtering scale according to the pixel change deviation value of the sub-image to obtain a weighted filtering scale; determine the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image.

[0146] In the embodiment of the present application, based on the preset filtering scale and the pixel change deviation value of the sub-image, the first filtering coefficient is determined, and then the image type of each sub-image can be determined according to the first filtering coefficient:

[0147] The calculation can be based on the following formula:

[0148]

[0149] Among them, is the pixel value variance of the sub-image, is the pixel change deviation value of the sub-image, a is the first filtering coefficient, ε is the filtering scale, and ε is a non-zero positive number.

[0150] When the type of the sub-image belongs to the flat area, then the first filtering coefficient a≈0;

[0151] When the type of the sub-image belongs to the area with rich details, then LVD θ >0, the first filtering coefficient a∈(0,1);

[0152] When the type of the sub-image belongs to the structural area, then the first filtering coefficient a≈1.

[0153] It can be seen that the image type of each sub-image can be determined according to the numerical range of the first filtering coefficient, laying a good foundation for subsequent image layer decomposition.

[0154] In the embodiment of the present application, a possible implementation manner is provided. The average pixel value and pixel value variance of the sub-image are calculated based on the following method:

[0155] S501. Determine all the pixel points of the permutation groups in the sub-image, and the permutation group is a row or a column.

[0156] Specifically, taking the size of the sub-image as 7×7 as an example for illustration, there are 7 rows and 7 columns of pixel points in each sub-image. At this time, the arrangement group can be one row or one column, and no specific limitation is made in the embodiments of the present application.

[0157] In the embodiments of the present application, the average pixel value and the pixel value variance of the sub-image can be obtained by the following formulas:

[0158]

[0159]

[0160] where I θ (i, j) is the pixel value of each pixel point in the sub-image, and N is the number of pixel points in the sub-image. Taking a 7×7 sub-image as an example, the calculations of formulas (4) and (5) require 49 multiplications and 98 addition operations, and the hardware implementation cost is high.

[0161] As shown by Figure 3 , for a 7×7 processing window, 42 pixel points in the sub-images where two adjacent central pixels are located overlap. The mean operation in formulas (4) and (5) is a relatively independent operation for each pixel point. Dividing the sub-image into independent arrangement groups, summing and accumulating respectively to find the mean, the result is the same. Therefore, for two adjacent central pixels, the processing processes of the middle 42 pixel points are all repeated. Therefore, the embodiments of the present application can simplify the calculation and save the hardware implementation cost in the following way:

[0162] S502. For the pixel points of each arrangement group, if it is determined that the target parameter of the pre-stored arrangement group, then call the target parameter of the pre-stored arrangement group; if it is determined that the target parameter of the arrangement group is not pre-stored, then calculate and store the target parameter of the arrangement group according to the target parameters of each pixel point in the arrangement group.

[0163] S503. Obtain the average pixel value or the pixel value variance of the sub-image according to the target parameters of all arrangement groups.

[0164] Independently calculate the sum of pixel values and the sum of products of pixel values for each arrangement group:

[0165] sum mean [7] = {sum1, sum2, sum3, sum4, sum5, sum6, sum7} (6)

[0166] sum corr [7] = {sum11, sum22, sum33, sum44, sum55, sum66, sum77} (7)

[0167] Among them, sum1 is the sum of the pixel values of the pixel points in the first permutation group, and sum11 is the sum of the squares of the pixel values of the pixel points in the first permutation group. sum mean [7] and sum corr [7] is the target parameter array of the pixel values composed of 7 permutation groups in the sub-image; among them, the target parameter is the sum of the pixel values and the sum of the squares of the pixel values.

[0168] As Figure 4 shown, the left figure is an original sub-image, which includes 7*7 pixel points. By taking each column of pixel points as a permutation group, the pixel set including 7 permutation groups shown in the middle figure of Figure 4 can be obtained; when implemented in hardware, each running clock only processes one permutation group, and there are only 7 multiplications and 14 addition operations in one permutation group. After seven clocks, the first sub-image is calculated. Then, by calculating the mean value of sum mean [7] and sum corr [7], the average pixel value of the current sub-image is calculated The mean value of the pixel squares and the pixel value variance When calculating the next sub-image, due to the overlapping part in the middle, as shown in the right figure of Figure 4 , only the middle result of the leftmost permutation group of the first sub-image needs to be discarded, and the middle result of the last permutation group of the second sub-image is updated:

[0169] sum mean [7] = {sum2, sum3, sum4, sum5, sum6, sum7, sum8} (8)

[0170] sum corr [7] = {sum22, sum33, sum44, sum55, sum66, sum77, sum88} (9)

[0171] Thus, only the data of one permutation group needs to be updated for every two adjacent sub-images, which not only avoids repeated operations but also avoids a large number of addition and multiplication operations in one sub-image, greatly saving the hardware implementation cost.

[0172] In an embodiment of the present application, a possible implementation manner is provided. According to the weighted filtering scale and the pixel value variance of the sub-image, the first filtering coefficient of the sub-image is determined, including:

[0173] S601, taking the sum of the weighted filtering scale and the pixel value variance as the adaptive variance value.

[0174] S602, use the ratio of the pixel value variance to the adaptive variance value as the first filtering coefficient of the sub-image.

[0175] Specifically, it can be calculated based on the following formula:

[0176]

[0177] Where, is the pixel value variance of the sub-image, is the pixel change deviation value of the sub-image, a is the first filtering coefficient, ε is the filtering scale, and ε is a non-zero positive number; x is the adaptive variance value.

[0178] In the embodiments of the present application, in order to simplify the calculation cost of the hardware and reduce the complexity of the hardware implementation, when calculating the first filtering coefficient a, the division operation can be converted into a lookup table method for calculation. The specific process is as follows:

[0179] A possible implementation manner is provided in the embodiments of the present application. The first filtering coefficient is calculated based on the following manner:

[0180] Shift the adaptive variance value according to the preset shift coefficient to obtain the first shift result, and look up the reciprocal of the first shift result through the preset lookup table;

[0181] Determine the product of the reciprocal of the first shift result and the pixel variance value, shift the product result according to the preset shift coefficient to obtain the second shift result, and use the second shift result as the first filtering coefficient.

[0182] In the embodiments of the present application, it can be known from the operation rules of division that when the denominator is not 0, dividing both the numerator and denominator by a non-zero number, the result remains the same. For hardware implementation:

[0183]

[0184] Where rshift is a right shift coefficient.

[0185] The lookup table can be preset The length of the table can be 32 or 64. Taking the table length of 64 as an example for specific illustration: when x is 100, in order to limit x within the range of the lookup table length, x can be shifted one bit to the right (i.e., divided by 2), so that x >> rshift is limited within the range of the table length, and then look up the table based on x >> rshift to obtain The value, thus converting the division into a multiplication calculation, avoiding the use of a divider in hardware implementation, and saving the hardware implementation cost.

[0186] In an embodiment of the present application, a possible implementation manner is provided. The image to be processed is decomposed into layers according to the image types of each sub-image, and the base layer image and the detail layer image of the image to be processed are obtained, including:

[0187] S701. For each sub-image, the average pixel value of the sub-image is weighted according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image.

[0188] Specifically, a server or a terminal for image processing may pre-construct a mapping relationship between the first filtering coefficient, the average pixel value, and the second filtering coefficient, and determine the second filtering coefficient of the sub-image according to the above mapping relationship.

[0189] S702. The image to be processed is decomposed into layers according to the first filtering coefficient and the second filtering coefficient of each sub-image to obtain the base layer image and the detail layer image of the image to be processed.

[0190] Specifically, the pixel values of each pixel point in the image to be processed may be filtered according to the first filtering coefficient and the second filtering coefficient to obtain the base layer image of the image to be processed, and then the detail layer image is determined based on the base layer image. The specific layer decomposition process will be described in detail below.

[0191] In an embodiment of the present application, a possible implementation manner is provided. The average pixel value of the sub-image is weighted according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image, including:

[0192] The average pixel value of the sub-image is weighted according to the first filtering coefficient corresponding to the image type to obtain the weighted average pixel value; the difference between the average pixel value of the sub-image and the weighted average pixel value is used as the second filtering coefficient of the sub-image.

[0193] Specifically, the second filtering coefficient of each sub-image may be calculated according to the following formula:

[0194]

[0195] where is the average pixel value of the sub-image, a is the first filtering coefficient of the sub-image, and b is the second filtering coefficient of the sub-image.

[0196] In an embodiment of the present application, a possible implementation manner is provided. The image to be processed is decomposed into layers according to the first filtering coefficient and the second filtering coefficient of each sub-image to obtain the base layer image and the detail layer image of the image to be processed, including:

[0197] S801. Filter the pixel value of the central pixel of the sub-image according to the first filtering coefficient and the second filtering coefficient to obtain the target pixel value of the central pixel of the sub-image; obtain the base image of the image to be processed according to the target pixel values of the central pixels of all sub-images.

[0198] Specifically, the target pixel value of the central pixel in each sub-image can be calculated respectively based on the following formula:

[0199] B = a×I + b (13)

[0200] Wherein, I is the pixel value of the central pixel of the sub-image, a is the first filtering coefficient corresponding to the sub-image, b is the second filtering coefficient corresponding to the sub-image, and B is the target pixel value of the central pixel of the sub-image.

[0201] S802. Obtain the detail layer image according to the base image and the image to be processed.

[0202] Wherein, the pixel value of the pixel in the detail layer image is the difference between the pixel values of the pixel in the image to be processed and the base image.

[0203] Specifically, the pixel values of the pixels in the detail layer image can be obtained based on the following formula:

[0204] D = I - B (14)

[0205] Wherein, I is the pixel value of the pixel of the image to be processed, B is the pixel value of each pixel of the base image, and D is the pixel value of the pixel in the detail layer image.

[0206] The above describes the layer decomposition of the image by taking a single filtering scale as an example. On the other hand, in the embodiments of the present application, the layer decomposition of the image to be processed can be combined with multiple scales, and the following will take two filtering scales as an example for specific description.

[0207] In the embodiments of the present application, a possible implementation manner is provided. When the filtering scale includes the first filtering scale and the second filtering scale, the first filtering coefficient includes the first target filtering coefficient determined according to the first filtering scale and the second target filtering coefficient determined according to the second filtering scale;

[0208] The base image includes a first base image and a second base image, and the detail layer image includes a first detail layer image and a second detail layer image; wherein, the first base image and the first detail layer image are determined according to the first target filtering coefficient, and the second base image and the second detail layer image are determined according to the second target filtering coefficient.

[0209] In the embodiments of the present application, the first filtering scale ε1 and the second filtering scale ε2 can be used to implement the multi-scale image layer decomposition. Specifically, the average pixel values of the sub-images at two different scales Pixel variance value of the sub-image There is no need for repeated calculation. Only by setting different filtering scales in formula (3), the corresponding first target filtering coefficients a1 and a2 can be obtained; at the same time, the corresponding two second filtering coefficients: b1 and b2 can be obtained according to formula (12).

[0210] The specific image layer decomposition process is as follows:

[0211]

[0212]

[0213] Among them, B1 is the first basic layer image and B2 is the second basic layer image.

[0214] Specifically, the first detail layer image can be obtained according to the image to be processed and the first basic layer image, and the second detail layer image can be obtained according to the first basic layer image and the second basic layer image. The pixel value of the pixel point of the first detail layer image is the difference between the pixel value of the pixel point in the image to be processed and the first basic layer image, and the pixel value of the pixel point of the second detail layer image is the difference between the pixel value of the pixel point in the first basic layer image and the second basic layer image.

[0215] D1 = I - B1 (17)

[0216] D2 = B1 - B2 (18)

[0217] Among them, D1 is the first detail layer image and D2 is the second detail layer image.

[0218] Perform weighted summation on the pixel values of the basic layer image and the detail layer image to obtain the target image, including:

[0219] S901, weight the first detail layer image and the second detail layer image respectively according to the preset detail enhancement weight.

[0220] S902, weight the second basic layer image according to the preset contrast weakening weight; that is, perform global tone mapping on the second basic layer image;

[0221] S903, superimpose the weighted second basic layer image, the weighted first detail layer image and the weighted second detail layer image to obtain the target image; among them, the pixel value of the pixel point of the target image is the sum of the pixel values of the pixel point in the weighted second basic layer image, the weighted first detail layer image and the weighted second detail layer image.

[0222] The specific implementation formula is as follows:

[0223] T = k1×B2 + k2×D2 + k3×D1 (19)

[0224] Among them, T is the target image, k1 is the contrast weakening weight, and both k2 and k3 are detail enhancement weights; k1 ∈ (0, 1), k2 ≥ 1, k3 ≥ 1.

[0225] After obtaining the target image, the target image can also be linearly stretched to enhance the contrast of the luminance channel to optimize the tone mapping effect of the image.

[0226] To better understand the above image processing method, the following combines Figure 5 A detailed example of the image processing method of this application is elaborated below. This method includes the following steps:

[0227] S1001, Determine multiple sub-images in the image to be processed.

[0228] Among them, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points.

[0229] Specifically, the average pixel value and pixel value variance of the sub-image can be obtained in the following way:

[0230] (1) Determine the pixel points of all permutation groups in the sub-image. The permutation group is a row or a column;

[0231] (2) For the pixel points of each permutation group, if the target parameter of the pre-stored permutation group is determined, then call the target parameter of the pre-stored permutation group. If it is determined that the target parameter of the permutation group is not pre-stored, then calculate and store the target parameter according to the target parameters of each pixel point in the permutation group; among them, the target parameter is the sum of pixel values and the sum of squares of pixel values;

[0232] (3) Obtain the average pixel value or pixel value variance of the sub-image according to the target parameters of all permutation groups.

[0233] S1002, For each sub-image, take the difference between the average pixel value and the pixel value of the central pixel point as the pixel change deviation value of the sub-image.

[0234] S1003, According to the pixel change deviation value of the sub-image, weight the preset first filtering scale and second filtering scale respectively to obtain the first weighted filtering scale and the second weighted filtering scale.

[0235] S1004, Determine the first target filtering coefficient of the sub-image according to the first weighted filtering scale and the pixel value variance of the sub-image; determine the second target filtering coefficient of the sub-image according to the second weighted filtering scale and the pixel value variance of the sub-image.

[0236] Specifically, the process of determining the first target filtering coefficient is as follows:

[0237] Sum the first weighted filtering scale and the pixel value variance as the adaptive variance value;

[0238] Take the ratio of the pixel value variance to the adaptive variance value as the first target filtering coefficient of the sub-image.

[0239] When calculating the ratio of the pixel value variance to the adaptive variance value, the division operation can be replaced by a look-up table method to improve the operation efficiency. The specific process is as follows:

[0240] Shift the adaptive variance value according to the preset shift coefficient to obtain the first shift result, and look up the reciprocal of the first shift result through the preset look-up table; determine the product of the reciprocal of the first shift result and the pixel variance value, shift the product result according to the preset shift coefficient to obtain the second shift result, and take the second shift result as the first target filtering coefficient.

[0241] The process of calculating the second target filtering coefficient is the same as the above process and will not be elaborated here.

[0242] S1005. For each sub-image, weight the average pixel value of the sub-image according to the first target filtering coefficient corresponding to the image type to determine the third target filtering coefficient of the sub-image; weight the average pixel value of the sub-image according to the second target filtering coefficient corresponding to the image type to determine the fourth target filtering coefficient of the sub-image.

[0243] S1006. According to the first target filtering coefficient and the third target filtering coefficient of each sub-image, perform layer decomposition on the image to be processed to obtain the first base layer image and the first detail layer image of the image to be processed. At the same time, according to the second target filtering coefficient and the fourth target filtering coefficient of each sub-image, perform layer decomposition on the image to be processed to obtain the second base layer image and the second detail layer image of the image to be processed.

[0244] S1007. Weight the first detail layer image and the second detail layer image respectively according to the preset detail enhancement weight; weight the second base layer image according to the preset contrast weakening weight.

[0245] S1008. Superimpose the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image to obtain the target image; where the pixel value of the pixel point of the target image is the sum of the pixel values of the pixel point in the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image.

[0246] The embodiments of the present application obtain multiple sub-images in the image to be processed, determine the image type of each sub-image through the difference between the average pixel value of each sub-image and the pixel value of the central pixel point of the sub-image, and then perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed. Then, the pixel values of the base layer image and the detail layer image are weighted and summed to obtain the target image. Since the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points, the embodiments of the present application can determine the image type of the sub-image according to the difference between the average pixel value of each sub-image and the pixel value of the central pixel point, and can effectively distinguish the types of regions where each pixel point in the image to be processed is located. The embodiments of the present application implement layer decomposition processing according to the image type, accurately identify the base layer image and the detail layer image of the image to be processed. Different from the prior art in which the filtering coefficient is determined according to a preset regularization parameter for layer decomposition, the present application improves the layer decomposition effect while improving the visual quality of the image after tone mapping processing, that is, the target image, and effectively avoids the halo effect at the image edge.

[0247] The embodiments of the present application provide an image processing device, as Figure 6 shown. The image processing device 60 may include: a first determination module 601, a second determination module 602, a decomposition module 603, and a weighting module 604;

[0248] Among them, the first determination module 601 is configured to determine multiple sub-images in the image to be processed; among them, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points;

[0249] The second determination module 602 is configured to, for each sub-image, determine the average pixel value of the sub-image, and determine the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value;

[0250] The decomposition module 603 is configured to perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed;

[0251] The weighting module 604 is configured to perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image.

[0252] In a possible implementation manner provided in the embodiments of the present application, when the second determination module 602 determines the image type of the sub-image, it is configured to:

[0253] For each sub-image, use the difference between the average pixel value and the pixel value of the central pixel point as the pixel change deviation value of the sub-image;

[0254] Determine a first filtering coefficient of the sub-image according to the pixel change deviation value;

[0255] Determine the image type of the sub-image according to the first filtering coefficient.

[0256] In an embodiment of the present application, a possible implementation manner is provided. When the second determination module 602 determines the first filtering coefficient of the sub-image according to the pixel change deviation value, it is used for:

[0257] Obtain a preset filtering scale;

[0258] Weight the filtering scale according to the pixel change deviation value of the sub-image to obtain a weighted filtering scale;

[0259] Determine the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image.

[0260] In an embodiment of the present application, a possible implementation manner is provided. The average pixel value and the pixel value variance of the sub-image are calculated based on the following method:

[0261] Determine the pixel points of all permutation groups in the sub-image, where the permutation group is a row or a column;

[0262] For the pixel points of each permutation group, if the target parameter of the pre-stored permutation group is determined, then call the target parameter of the pre-stored permutation group. If it is determined that the target parameter of the permutation group is not pre-stored, then calculate and store the target parameter of the permutation group according to the target parameters of each pixel point in the permutation group;

[0263] Obtain the average pixel value or the pixel value variance of the sub-image according to the target parameters of all permutation groups; wherein, the target parameter is the sum of pixel values and the sum of squares of pixel values.

[0264] In an embodiment of the present application, a possible implementation manner is provided. When the second determination module 602 determines the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image, it is used for:

[0265] Take the sum of the weighted filtering scale and the pixel value variance as the adaptive variance value;

[0266] Take the ratio of the pixel value variance to the adaptive variance value as the first filtering coefficient of the sub-image.

[0267] In an embodiment of the present application, a possible implementation manner is provided. The first filtering coefficient is calculated based on the following method:

[0268] Shift the adaptive variance value according to a preset shift coefficient to obtain a first shift result, and look up the reciprocal of the first shift result through a preset look-up table;

[0269] Determine the product of the reciprocal of the first shift result and the pixel variance value, shift the product result according to a preset shift coefficient to obtain a second shift result, and use the second shift result as the first filtering coefficient.

[0270] In an embodiment of the present application, a possible implementation is provided. When the decomposition module 603 performs layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed, it is used for:

[0271] For each sub-image, perform weighted processing on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image;

[0272] Perform layer decomposition on the image to be processed according to the first filtering coefficient and the second filtering coefficient of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed.

[0273] In an embodiment of the present application, a possible implementation is provided. When the decomposition module 603 performs weighted processing on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image, it is used for:

[0274] Perform weighting on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to obtain the weighted average pixel value;

[0275] Use the difference between the average pixel value of the sub-image and the weighted average pixel value as the second filtering coefficient of the sub-image.

[0276] In an embodiment of the present application, a possible implementation is provided. When the decomposition module 603 performs layer decomposition on the image to be processed according to the first filtering coefficient and the second filtering coefficient of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed, it is used for:

[0277] Filter the pixel value of the central pixel point of the sub-image according to the first filtering coefficient and the second filtering coefficient to obtain the target pixel value of the central pixel point of the sub-image;

[0278] Obtain the base layer image of the image to be processed according to the target pixel values of the central pixel points of all sub-images;

[0279] Obtain the detail layer image according to the base layer image and the image to be processed; wherein, the pixel value of the pixel point in the detail layer image is the difference between the pixel value of the pixel point in the image to be processed and the base layer image.

[0280] In an embodiment of the present application, a possible implementation is provided. When the filtering scale includes a first filtering scale and a second filtering scale, the first filtering coefficient includes a first target filtering coefficient determined according to the first filtering scale and a second target filtering coefficient determined according to the second filtering scale;

[0281] The base layer image includes a first base layer image and a second base layer image, and the detail layer image includes a first detail layer image and a second detail layer image; wherein, the first base layer image and the first detail layer image are determined according to the first target filtering coefficient, and the second base layer image and the second detail layer image are determined according to the second target filtering coefficient;

[0282] When the above-mentioned weighting module 604 performs weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image, it is used for:

[0283] Weight the first detail layer image and the second detail layer image respectively according to a preset detail enhancement weight;

[0284] Weight the second base layer image according to a preset contrast weakening weight;

[0285] Superimpose the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image to obtain the target image; wherein, the pixel value of a pixel point of the target image is the sum of the pixel values of the pixel point in the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image.

[0286] The device in the embodiment of the present application can execute the method provided in the embodiment of the present application, and its implementation principle is similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed function description of each module of the device, reference can be specifically made to the description in the corresponding method shown above, and details are not described herein again.

[0287] The embodiments of the present application obtain multiple sub-images in the image to be processed, determine the image type of each sub-image through the difference between the average pixel value of each sub-image and the pixel value of the central pixel point of the sub-image, and then perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed. Then, the pixel values of the base layer image and the detail layer image are weighted and summed to obtain the target image. Since the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points, the embodiments of the present application can determine the image type of the sub-image according to the difference between the average pixel value of each sub-image and the pixel value of the central pixel point, and can effectively distinguish the types of regions where each pixel point in the image to be processed is located. The embodiments of the present application implement layer decomposition processing according to the image type, accurately identify the base layer image and the detail layer image of the image to be processed. Different from the prior art in which the filtering coefficient is determined according to a preset regularization parameter for layer decomposition, the present application improves the layer decomposition effect while improving the visual quality of the image after tone mapping processing, that is, the target image, and effectively avoids the halo effect at the image edge.

[0288] In an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory. The processor executes the above computer program to implement the steps of the image processing method. Compared with the related art, it can be achieved that: the embodiments of the present application obtain multiple sub-images in the image to be processed, determine the image type of each sub-image through the difference between the average pixel value of each sub-image and the pixel value of the central pixel point of the sub-image, and then perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed. Then, the pixel values of the base layer image and the detail layer image are weighted and summed to obtain the target image. Since the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points, the embodiments of the present application can determine the image type of the sub-image according to the difference between the average pixel value of each sub-image and the pixel value of the central pixel point, and can effectively distinguish the types of regions where each pixel point in the image to be processed is located. The embodiments of the present application implement layer decomposition processing according to the image type, accurately identify the base layer image and the detail layer image of the image to be processed. Different from the prior art in which the filtering coefficient is determined according to a preset regularization parameter for layer decomposition, the present application improves the layer decomposition effect while improving the visual quality of the image after tone mapping processing, that is, the target image, and effectively avoids the halo effect at the image edge.

[0289] In an alternative embodiment, an electronic device is provided, as Figure 7 shown Figure 7The electronic device 700 shown includes: a processor 701 and a memory 703. Among them, the processor 701 and the memory 703 are connected, such as connected through a bus 702. Optionally, the electronic device 700 may further include a transceiver 704, and the transceiver 704 can be used for data interaction between this electronic device and other electronic devices, such as data sending and / or data receiving, etc. It should be noted that in practical applications, the transceiver 704 is not limited to one, and the structure of the electronic device 700 does not constitute a limitation to the embodiments of the present application.

[0290] The processor 701 may be a CPU (Central Processing Unit, central processor), a general-purpose processor, a DSP (Digital Signal Processor, data signal processor), an ASIC (Application Specific Integrated Circuit, application-specific integrated circuit), an FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in connection with the disclosure of the present application. The processor 701 may also be a combination that realizes computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0291] The bus 702 may include a path for transmitting information between the above components. The bus 702 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture, extended industry standard structure) bus, etc. The bus 702 may be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 7 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.

[0292] The memory 703 can be a ROM (Read Only Memory), or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory), or other types of dynamic storage devices that can store information and instructions. It can also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store a computer program and can be read by a computer, which is not limited herein.

[0293] The memory 703 is used to store the computer program for implementing the embodiments of the present application and is controlled by the processor 701 to execute. The processor 701 is used to execute the computer program stored in the memory 703 to implement the steps shown in the foregoing method embodiments.

[0294] Among them, the electronic device includes but is not limited to: mobile terminals such as mobile phones, laptop computers, PADs, etc. and fixed terminals such as digital TVs, desktop computers, etc.

[0295] The embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps and corresponding content of the foregoing method embodiments can be implemented.

[0296] The embodiments of the present application provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device implements the following when executed:

[0297] Determine a plurality of sub-images in the image to be processed; wherein, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points;

[0298] For each sub-image, determine the average pixel value of the sub-image, and determine the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value;

[0299] Perform layer decomposition on the image to be processed according to the image types of each sub-image, and obtain the base layer image and the detail layer image of the image to be processed;

[0300] Perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image.

[0301] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification, claims and the above-mentioned drawings of this application are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than the illustrated or textually described order.

[0302] It should be understood that although the flowchart of the embodiments of this application indicates each operation step by an arrow, the execution order of these steps is not limited to the order indicated by the arrow. Unless there is a clear description in this article, in some implementation scenarios of the embodiments of this application, the implementation steps in each flowchart can be executed in other orders according to requirements. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage of these sub-steps or stages can also be executed at different times respectively. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and the embodiments of this application do not limit this.

[0303] The above are only optional implementation manners of some implementation scenarios of this application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the technical concept of the solution of this application, using other similar implementation means based on the technical idea of this application also belongs to the protection scope of the embodiments of this application.

Claims

1. An image processing method, characterized in that, Including: Determine multiple sub-images in the image to be processed; wherein, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points; For each sub-image, determine the average pixel value of the sub-image, and determine the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value; Perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed; Perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain the target image; The determining multiple sub-images in the image to be processed includes: Successively scan each pixel point of the image to be processed by using a sliding window, and for each pixel point, intercept a sub-image with a preset window size with the pixel point as the central pixel point; For the sub-images located in the boundary region of the image to be processed, use the mirror filling method to supplement the pixel points of the sub-images.

2. The method according to claim 1, wherein The determining the image type of the sub-image includes: For each sub-image, use the difference between the average pixel value and the pixel value of the central pixel point as the pixel change deviation value of the sub-image; Determine the first filtering coefficient of the sub-image according to the pixel change deviation value; Determine the image type of the sub-image according to the first filtering coefficient.

3. The method according to claim 2, characterized in that, The determining the first filtering coefficient of the sub-image according to the pixel change deviation value includes: Obtain a preset filtering scale; Weight the filtering scale according to the pixel change deviation value of the sub-image to obtain a weighted filtering scale; Determine the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image.

4. The method according to claim 3, wherein The average pixel value and the pixel value variance of the sub-image are calculated based on the following method: Determine the pixel points of all permutation groups in the sub-image, and the permutation group is a row or a column; For the pixel points of each permutation group, if the target parameter of the permutation group stored in advance is determined, then call the target parameter of the permutation group stored in advance, and if it is determined that the target parameter of the permutation group is not stored in advance, then calculate and store the target parameter of the permutation group according to the target parameters of each pixel point in the permutation group; Obtain the average pixel value or the pixel value variance of the sub-image according to the target parameters of all permutation groups; wherein, the target parameter is the sum of pixel values and the sum of squares of pixel values.

5. The method according to claim 3, characterized in that, The determining the first filtering coefficient of the sub-image according to the weighted filtering scale and the pixel value variance of the sub-image includes: Use the sum of the weighted filtering scale and the pixel value variance as the adaptive variance value; Use the ratio of the pixel value variance to the adaptive variance value as the first filtering coefficient of the sub-image.

6. The method according to claim 5, wherein The first filtering coefficient is calculated based on the following method: Shift the adaptive variance value according to a preset shift coefficient to obtain a first shift result, and look up the reciprocal of the first shift result through a preset look-up table; Determine the product of the reciprocal of the first shift result and the pixel value variance, shift the product result according to a preset shift coefficient to obtain a second shift result, and use the second shift result as the first filtering coefficient.

7. The method according to claim 3, characterized in that, The layer decomposition of the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed includes: For each sub-image, perform weighted processing on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image; Perform layer decomposition on the image to be processed according to the first filtering coefficients and the second filtering coefficients of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed.

8. The method according to claim 7, wherein The performing weighted processing on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to determine the second filtering coefficient of the sub-image includes: Perform weighting on the average pixel value of the sub-image according to the first filtering coefficient corresponding to the image type to obtain a weighted average pixel value; Use the difference between the average pixel value of the sub-image and the weighted average pixel value as the second filtering coefficient of the sub-image.

9. The method according to claim 7, wherein The performing layer decomposition on the image to be processed according to the first filtering coefficients and the second filtering coefficients of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed includes: Filter the pixel value of the central pixel point of the sub-image according to the first filtering coefficient and the second filtering coefficient to obtain the target pixel value of the central pixel point of the sub-image; Obtain the base layer image of the image to be processed according to the target pixel values of the central pixel points of all sub-images; Obtain the detail layer image according to the base layer image and the image to be processed; wherein, the pixel value of a pixel point in the detail layer image is the difference between the pixel value of the pixel point in the image to be processed and the base layer image.

10. The method according to claim 7, wherein When the filtering scale includes a first filtering scale and a second filtering scale, the first filtering coefficient includes a first target filtering coefficient determined according to the first filtering scale and a second target filtering coefficient determined according to the second filtering scale; The base layer image includes a first base layer image and a second base layer image, and the detail layer image includes a first detail layer image and a second detail layer image; wherein, the first base layer image and the first detail layer image are determined according to the first target filtering coefficient, and the second base layer image and the second detail layer image are determined according to the second target filtering coefficient; The weighted summation of the pixel values of the base layer image and the detail layer image to obtain a target image includes: Perform weighting on the first detail layer image and the second detail layer image respectively according to a preset detail enhancement weight; Perform weighting on the second base layer image according to a preset contrast weakening weight; Superimpose the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image to obtain a target image; wherein, the pixel value of a pixel point in the target image is the sum of the pixel values of the pixel point in the weighted second base layer image, the weighted first detail layer image, and the weighted second detail layer image.

11. An image processing apparatus, characterized in that, Including: A first determination module, configured to determine multiple sub-images in the image to be processed; wherein, the central pixel point of each sub-image uniquely corresponds to a pixel point in the image to be processed, and the number of sub-images is the same as the number of pixel points; A second determination module, configured to, for each sub-image, determine the average pixel value of the sub-image, and determine the image type of the sub-image according to the difference between the pixel value of the central pixel point of the sub-image and the average pixel value; A decomposition module, configured to perform layer decomposition on the image to be processed according to the image types of the respective sub-images to obtain the base layer image and the detail layer image of the image to be processed; A weighting module, configured to perform weighted summation on the pixel values of the base layer image and the detail layer image to obtain a target image; The determination of multiple sub-images in the image to be processed includes: Sequentially scan each pixel point of the image to be processed by using a sliding window, and for each pixel point, intercept a sub-image with a preset window size centered on the pixel point; For the sub-images located in the boundary region of the image to be processed, use the mirror filling method to complete the pixel points of the sub-images.

12. An electronic device, comprising a memory, a processor, and a computer program stored on the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Image processing method, image processing device, and unmanned aerial vehicle

    CN111344736A

  • Method of complexing digital multispectral half-tone images

    RU2342701C1