Image processing method and apparatus, and electronic device and storage medium
By generating a local contrast map and adjusting the sharpening intensity, combined with texture details for image processing, the problem of over-sharpening and aliasing deepening in existing sharpening technology is solved, and the sharpening effect and clarity of the image are improved.
Patent Information
- Application Number
- PCT/CN2024/077434
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2024-02-18
- Publication Date
- 2024-09-06
AI Technical Summary
Existing sharpening technology has problems such as over-sharpening and deepening of jaggies after part of the text is sharpened, which affects the image sharpening effect.
By generating local contrast maps, local image processing parameters are obtained, the sharpening intensity is adjusted according to areas with different contrasts, and alpha blending is used to fuse texture details and sharpening intensity maps to generate target images to avoid over-sharpening.
It improves the image sharpening effect, reduces the occurrence of text aliasing, solves the problems of over-sharpening and deepening aliasing, and improves the clarity and visual experience of the image.
Smart Images

Figure CN2024077434_06092024_PF_FP
Abstract
Description
Image processing method, device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese application with application number 202310200291.8 and application date February 28, 2023, and claims its priority. The disclosed content of the Chinese application is hereby introduced as a whole into this application. Technical Field
[0003] The present disclosure relates to image processing technology, and more particularly to an image processing method, apparatus, electronic device, and storage medium. Background Art
[0004] Sharpening is an image processing method that improves image clarity by enhancing texture details in the image.
[0005] High-pass filtering is usually used to extract texture details from the original image, and the texture details are fused into the original image or the low-pass filter image of the original image through alpha blending to obtain a sharpened image of the original image.
[0006] Summary of the Invention
[0007] The embodiments of the present disclosure provide an image processing method, device, electronic device, and storage medium, which can improve the image sharpening effect.
[0008] In a first aspect, an embodiment of the present disclosure provides an image processing method, comprising:
[0009] Generate a local contrast map based on the original image;
[0010] Acquiring local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image;
[0011] The original image is processed according to the local image processing parameters to generate a target image.
[0012] In a second aspect, an embodiment of the present disclosure further provides an image processing device, the device comprising:
[0013] a generating module, configured to generate a local contrast map according to an original image;
[0014] an acquisition module configured to acquire local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image;
[0015] The image processing module is configured to process the original image according to the local image processing parameters to generate a target image.
[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0017] one or more processors;
[0018] a storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described in the embodiment of the present disclosure.
[0020] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the image processing method as described in the embodiment of the present disclosure is implemented.
[0021] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product comprising instructions, which, when executed by a processor, result in the implementation of the image processing method as described in the embodiment of the present disclosure.
[0022] In a sixth aspect, an embodiment of the present disclosure further provides a computer program, comprising a program code, which, when executed by a processor, causes the image processing method as described in the embodiment of the present disclosure to be implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0024] FIG1 is a schematic diagram of an image processing flow provided by an embodiment of the present disclosure;
[0025] FIG2 is a schematic diagram of a receptive field provided by an embodiment of the present disclosure;
[0026] FIG3 is a schematic diagram of another receptive field provided by an embodiment of the present disclosure;
[0027] FIG4 is a schematic diagram of another image processing flow provided by an embodiment of the present disclosure;
[0028] FIG5 is a schematic diagram of another image processing flow provided by an embodiment of the present disclosure;
[0029] FIG6 is a schematic diagram of another image processing flow provided by an embodiment of the present disclosure;
[0030] FIG7 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure;
[0031] FIG8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0033] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0034] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0035] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0036] It should be noted that the modifications of "one", "multiple" and "several" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise clearly indicated in the context, they should be understood as "one or more", "one or several".
[0037] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0038] However, the sharpening methods in the related art have at least some problems, such as over-sharpening and increased jaggedness after sharpening of text parts, which affect the sharpening effect. In view of this, the present disclosure proposes an improved image processing.
[0039] Figure 1 is a schematic diagram of an image processing flow provided by an embodiment of the present disclosure. The embodiment of the present disclosure is applicable to situations where image sharpening is performed. The method can be performed by an image processing device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, which can be a mobile terminal, a PC or a server, etc.
[0040] As shown in FIG1 , the method may include:
[0041] S110 , generating a local contrast map according to the original image.
[0042] The original image may be an image that requires image processing, which may include sharpening, saturation, and contrast processing. For example, the original image may be an image captured by a camera. Alternatively, the original image may be an image from the internet. Specifically, the image may be a single photo or a video.
[0043] The local contrast map may be an image obtained by performing a contrast estimation on the original image. The local contrast map may represent the contrast of different local regions in the original image. Depending on the contrast, the original image may include low local contrast regions, medium local contrast regions, and high local contrast regions. For example, low local contrast regions, medium local contrast regions, and high local contrast regions may be distinguished based on a variable g, where the variable g may be a specific quadratic function. For example, regions with a local contrast less than g may be determined as low local contrast regions, regions with a local contrast equal to g may be determined as medium local contrast regions, and regions with a local contrast greater than g may be determined as high local contrast regions.
[0044] The original image will be contaminated to varying degrees by various noises during the acquisition and transmission process, resulting in the original image containing texture details and image noise. Among them, the texture details are the image content, and the image noise may affect the user's correct understanding of the image content.
[0045] Since sharpening is performed on the Y (luminance) channel, you can first convert the input image from a non-YUV format to a YUV format. Taking an RGB input image as an example, before sharpening, convert the RGB input image to a YUV format, and then extract the Y channel data as the original image.
[0046] In the embodiment of the present disclosure, generating a local contrast map based on the original image specifically includes: determining the local contrast of the original image within at least one receptive field, and generating a local contrast map based on the local contrast corresponding to each receptive field. The receptive field can be the size of the area on the original image mapped back to the pixel points on the feature map output by each layer of the convolutional neural network. For example, the size of the original image is 5*5, and after the original image is convolved twice with a 3*3 convolution kernel, the receptive field size is 5*5. The local contrast can be the contrast of each receptive field. The contrast of the receptive field can be determined based on the pixel values of all pixels in the receptive field. The local contrast of each receptive field constitutes a local contrast map.
[0047] Specifically, the original image is traversed according to the set convolution kernel according to the preset step size to obtain at least one receptive field corresponding to the original image; for each receptive field, the contrast of the central pixel in the current receptive field is determined according to the pixel value in the current receptive field, as the local contrast of the original image in the current receptive field; and a local contrast map is generated according to the contrast of the central pixel in each receptive field.
[0048] The convolution result of a set convolution kernel and the original image is calculated, and at least one receptive field is determined based on the convolution result. The brightness of each pixel within the receptive field can be obtained. For each receptive field, the contrast of the central pixel within the current receptive field can be calculated based on the brightness of all pixels, which serves as the local contrast of the current receptive field. A local contrast map is generated based on the local contrast of at least one receptive field. By calculating the local contrast of all pixels within each receptive field, compared to related solutions that adjust parameters in the x- and y-directions separately and calculate contrast, redundant calculations are avoided, thereby improving the robustness of the contrast calculation.
[0049] It should be noted that there are many ways to calculate the local contrast of each receptive field, which is not specifically limited in the embodiments of the present disclosure.
[0050] FIG2 is a schematic diagram of a receptive field provided by an embodiment of the present disclosure. In some embodiments, taking the 3*3 receptive field shown in FIG2 as an example, the local contrast C can be calculated using the following formula: C = ((A0-A8) 2 +(A1-A7) 2 +(A2-A6) 2 +(A3-A5) 2 ) / 4
[0051] Among them, A0, A1, A2, A3, A5, A6, A7, and A8 are the brightness of the pixels around the central pixel A4 in the receptive field.
[0052] FIG3 is a schematic diagram of another receptive field provided by an embodiment of the present disclosure. Taking the cross receptive field shown in FIG3 as an example, the local contrast C can be calculated using the following formula: C = ((B0-B4) 2 +(B1-B3) 2 ) / 2
[0053] Among them, B0, B1, B3, and B4 are the brightness of the pixels around the central pixel B2 in the receptive field.
[0054] A local contrast map C0 is constructed according to the local contrast C of at least one receptive field.
[0055] S120: Acquire local image processing parameters according to the local contrast map.
[0056] Among them, the local image processing parameters are used to represent the target parameters for setting the processing of local areas with different contrasts in the original image. For example, the local image processing parameters may include a local sharpening intensity map. The local sharpening intensity map is used to represent the target sharpening intensity of local areas with different contrasts in the original image. Since the sharpness of the original image is usually positively correlated with its local contrast, the sharpness is often relatively high in areas with high local contrast. If these areas are sharpened, it is easy to make the image areas that are already sharp enough appear too sharp. Therefore, it is necessary to adjust the sharpening intensity of the corresponding areas in the original sharpening intensity map based on the local contrast map, so as to reduce the sharpening intensity of areas with high local contrast and enhance the sharpening intensity of areas with low local contrast and medium local contrast, thereby reducing oversharpening and alleviating the problem of deepening jaggies after sharpening of text.
[0057] It should be noted that the image processing method involved in the embodiments of the present disclosure is not limited to sharpening processing, and other image processing methods applicable to the implementation scheme of the present disclosure should also be regarded as belonging to the same inventive concept as the present disclosure.
[0058] In an embodiment of the present disclosure, obtaining a local sharpening intensity map based on a local contrast map includes: determining a first local contrast region and a second local contrast region of the original image based on the local contrast map, wherein the contrast of the first local contrast region is smaller than that of the second local contrast region; and obtaining a local sharpening intensity map based on the local contrast within the first local contrast region and the second local contrast region.
[0059] The first local contrast region may include a low local contrast region and a medium local contrast region in the original image, and the second local contrast region may include a high local contrast region in the original image. The disclosed embodiment further describes how the low local contrast region, the medium local contrast region, and the high local contrast region of the original image can be distinguished based on the variable g.
[0060] Furthermore, a local sharpening intensity map is obtained based on the local contrast within the first local contrast area and the second local contrast area, including: obtaining the local contrast of each receptive field within the first local contrast area and the second local contrast area; determining the target sharpening intensity of each receptive field based on the local contrast, and obtaining the local sharpening intensity map based on the target sharpening intensity.
[0061] After determining the first local contrast area and the second local contrast area of the original image, the local contrast C of each receptive field within the first local contrast area and the second local contrast area is obtained. According to the local contrast C within each receptive field, the target sharpening intensity T corresponding to each receptive field is calculated using the following formula:
[0062] A local sharpening intensity map T0 is constructed according to the target sharpening intensity T of at least one receptive field.
[0063] S130: Process the original image according to the local image processing parameters to generate a target image.
[0064] The target image is an image obtained by processing the original image. For example, the target image may be a sharpened image, which is an image obtained by sharpening the original image.
[0065] In an embodiment of the present disclosure, the original image is processed according to local image processing parameters, including: obtaining a texture detail map corresponding to the original image; fusing the local sharpening intensity map and the texture detail map into the original image to generate a first sharpening result; and generating a sharpened image based on the first sharpening result, wherein the local sharpening intensity map is determined based on the local contrast map.
[0066] In some embodiments, by filtering the data of the Y channel in the original image using a high-pass filter operator, high-frequency details in the original image can be filtered out to obtain a texture detail map.
[0067] In other embodiments, after learning the sharpening effect through machine learning, the sharpening effect image output by the model is subtracted from the original image to obtain a texture detail image.
[0068] The local sharpening intensity map and the texture detail map are fused into the original image using alpha blending to generate a first sharpening result. A Y channel sharpening result is generated based on the first sharpening result. A sharpened image in YUV format is obtained based on the Y channel sharpening result and UV channel data. The sharpened image in YUV format is converted into a sharpened image in RGB format, and the sharpened image in RGB format is output.
[0069] The technical solution of the embodiment of the present disclosure generates a local contrast map of the original image, obtains local image processing parameters based on the local contrast map, processes the original image according to the target parameters for processing each local area contained in the local image processing parameters, generates a target image, and adjusts the sharpening intensity based on the local contrast, thereby avoiding over-sharpening after sharpening the areas with larger sharpness in the original image, reducing the generation of text jagged edges, and solving the problems of over-sharpening and deepening of jagged edges after sharpening of text parts in current sharpening solutions, which affect the sharpening effect, thereby improving the image sharpening effect.
[0070] FIG4 is a schematic diagram of another image processing process provided by an embodiment of the present disclosure. The technical solution of the embodiment of the present disclosure adds an overshoot control step based on the above embodiment. As shown in FIG4, the method includes:
[0071] S201: Acquire an original image.
[0072] S202: traverse the original image according to the set convolution kernel and a preset step size to obtain at least one receptive field corresponding to the original image.
[0073] S203 : For each receptive field, determine the contrast of a central pixel in the current receptive field according to pixel values in the current receptive field, as the local contrast of the original image in the current receptive field.
[0074] S204: Generate a local contrast map according to the contrast of the central pixel in each receptive field.
[0075] S205 : Determine a first local contrast region and a second local contrast region of the original image according to the local contrast map.
[0076] S206: Obtain the local contrast of each receptive field in the first local contrast area and the second local contrast area.
[0077] S207 , determining a target sharpening intensity of the corresponding receptive field according to the local contrast of each receptive field, and obtaining a local sharpening intensity map according to the target sharpening intensity of each receptive field.
[0078] S208: Obtain a texture detail map corresponding to the original image.
[0079] S209: Fusing the local sharpening intensity map and the texture detail map into the original image to generate a first sharpening result.
[0080] S210 , determining a first adjustment map and a second adjustment map according to the pixel values within each of the receptive fields.
[0081] The first adjustment map and the second adjustment map are used to adjust the sharpening intensity of pixels in the first sharpening result.
[0082] In the disclosed embodiment, for each receptive field, the pixel values within the current receptive field are compared, and the upper and lower pixel value limits of the current receptive field are determined based on the comparison results. A first adjustment map is determined based on the upper pixel value limits of each receptive field. A second adjustment map is determined based on the lower pixel value limits of each receptive field.
[0083] It should be noted that there are many ways to determine the upper and lower limits of the pixel value of the receptive field, and the embodiments of the present disclosure do not specifically limit them. For example, the maximum pixel value within the receptive field can be directly used as the upper limit of the pixel value, and the minimum pixel value can be used as the lower limit of the pixel value. Alternatively, the average value of the n pixels adjacent to the maximum pixel value within the receptive field can be calculated as the upper limit of the pixel value; the average value of the n pixels adjacent to the minimum pixel value within the receptive field can be calculated as the lower limit of the pixel value, etc.
[0084] In some embodiments, the maximum pixel value and the minimum pixel value in each receptive field are obtained respectively, and the first adjustment map is determined based on the maximum pixel value in all receptive fields, and the second adjustment map is determined based on the minimum pixel value in all receptive fields.
[0085] S211. Adjust the sharpening intensity of the first sharpening result according to the first adjustment map, the second adjustment map and the set parameters to obtain a second sharpening result, and generate a sharpened image according to the second sharpening result.
[0086] The setting parameter may be artificially set ratio data, which is used to suppress the problem of over-sharpening by controlling the pixel value increased or decreased by sharpening.
[0087] In the embodiment of the present disclosure, the second sharpening result is calculated according to the following formula based on the first sharpening result, the texture detail map, the first adjustment map, the second adjustment map, and the set parameters:
[0088] Among them, P represents the second sharpening result data, F represents the first sharpening result data, D represents texture detail data, minv represents the first adjustment map data, maxv represents the second adjustment map data, ratio represents the setting parameter, MAX(*,*) represents the larger value in the brackets as the second sharpening result, and MIN(*,*) represents the smaller value in the brackets as the second sharpening result.
[0089] In an embodiment of the present disclosure, a sharpened image may be generated based on the second sharpening result and the original image. For example, the second sharpening result may be combined with the original image, such as combining a channel corresponding to the sharpening result with other channels of the original image. As an example, a Y channel sharpening result may be generated based on the second sharpening result, and a sharpened image in YUV format may be obtained based on the Y channel sharpening result and UV channel data. The YUV format sharpened image may be converted to an RGB format sharpened image, and the RGB format sharpened image may be output.
[0090] The technical solution of the embodiment of the present disclosure determines the first adjustment map and the second adjustment map by the pixel values within each receptive field, and performs oversharpening control based on the first adjustment map and the second adjustment map to further reduce the occurrence of oversharpening.
[0091] FIG5 is a schematic diagram of another image processing process provided by an embodiment of the present disclosure. The technical solution of the embodiment of the present disclosure, based on the above embodiment, specifically defines the method for generating the target image. As shown in FIG5, the method includes:
[0092] S301: Acquire an original image.
[0093] S302: traverse the original image according to the set convolution kernel and a preset step size to obtain at least one receptive field corresponding to the original image.
[0094] S303 : For each receptive field, determine the contrast of a central pixel in the current receptive field according to pixel values in the current receptive field, as the local contrast of the original image in the current receptive field.
[0095] S304: Generate a local contrast map according to the contrast of the central pixel in each receptive field.
[0096] S305: Determine a first local contrast region and a second local contrast region of the original image according to the local contrast map.
[0097] S306: Obtain the local contrast of each receptive field in the first local contrast area and the second local contrast area.
[0098] S307 , determining a target sharpening intensity of the corresponding receptive field according to the local contrast of each receptive field, and obtaining a local sharpening intensity map according to the target sharpening intensity of each receptive field.
[0099] S308: Obtain a texture detail map corresponding to the original image.
[0100] S309: Fusing the local sharpening intensity map and the texture detail map into the original image to generate a first sharpening result.
[0101] S310: Determine a first adjustment map and a second adjustment map according to the pixel values within each receptive field.
[0102] S311. Adjust the sharpening intensity of the first sharpening result according to the first adjustment map, the second adjustment map and the set parameters to obtain a second sharpening result, and generate a sharpened image according to the second sharpening result.
[0103] S312: Obtain a texture mask corresponding to the original image.
[0104] The texture mask is used to filter out non-texture details. For example, the texture mask can be used to filter out non-texture details such as quantization noise in the original image. A threshold value can be used to distinguish between texture details and non-texture details in the original image. In some embodiments, the non-texture details may correspond to flat areas or quantization noise areas in the original image. The texture mask can be used to filter out quantization noise and other non-texture details, thereby avoiding the situation where some areas that require sharpening enhancement are not sharpened due to the inability to distinguish between quantization noise and non-quantization noise texture details.
[0105] In the disclosed embodiment, after extracting the texture details of the original image, a set threshold is obtained and the value of the texture detail is compared with the set threshold. If the value of the texture detail is greater than the set threshold, the corresponding position is set to 1; if the value of the texture detail is less than or equal to the set threshold, the corresponding position is set to 0, thereby obtaining a texture mask.
[0106] S313: Generate a sharpened image according to the second sharpening result, the texture mask, and the original image.
[0107] In some embodiments, the sharpened image is generated according to the second sharpening result, the texture mask and the original image in the following manner: S0 = M0*P0+(1-M0)*I0
[0108] Among them, S0 represents the sharpened image, M0 represents the texture mask, P0 represents the second sharpening result, and I0 represents the original image.
[0109] FIG6 is a schematic diagram of another image processing process provided by an embodiment of the present disclosure. FIG6 shows a specific image processing process, including:
[0110] S401: Obtain input image RGB0.
[0111] S402 : Perform an RGB format conversion operation on the input image RGB0 to obtain the input image YUV0.
[0112] S403 : Using the Y channel data of the input image YUV0 as the original image I0 , performing high-pass filtering on the original image I0 to obtain a texture detail image D0 .
[0113] S404 , performing threshold filtering on the texture detail image D0 to obtain a texture mask M0 .
[0114] S405 , perform local contrast estimation on the original image I0 to obtain a local contrast map C0 .
[0115] For example, the local contrast of the original image I0 within at least one receptive field is determined, and a local contrast map C0 is generated according to the local contrast corresponding to each receptive field.
[0116] S406 , performing local sharpening intensity estimation based on the local contrast map C0 to obtain a local sharpening intensity map T0 .
[0117] For example, based on the local contrast map C0, high local contrast regions and medium and low local contrast regions in the original image are determined. For medium and low local contrast regions, the original sharpening intensity is maintained unchanged. For high local contrast regions, the target sharpening intensity is determined by setting a function and local contrast.
[0118] S407 , performing alpha blending on the original image I0 , the texture detail map D0 , and the local sharpening intensity map T0 to generate a first sharpening result F0 .
[0119] S408 . Count the maximum and minimum pixel values within each receptive field according to the original image I0 , generate a first adjustment map maxv0 according to the maximum pixel value within each receptive field, and generate a second adjustment map minv0 according to the minimum pixel value within each receptive field.
[0120] S409 , performing oversharpening control according to the first sharpening result F0 , the texture detail map D0 , the first adjustment map maxv0 , the second adjustment map minv0 and the set parameters to obtain a second sharpening result P0 .
[0121] S410 , filtering non-texture detail contents such as quantization noise in the original image I0 according to the texture mask M0 , fusing the filtered image with the second sharpening result P0 , and obtaining a Y channel sharpening result S0 .
[0122] S411 , based on the UV channel data of the input image YUV0 and the Y channel sharpening result S0 , a YUV to RGB conversion method is used to obtain a sharpened image of the input image RGB0 .
[0123] The technical solution of the embodiment of the present disclosure distinguishes texture details and non-texture detail content in the original image through texture mask, and can filter out non-texture detail content, thereby avoiding the problem of incomplete sharpening caused by the inability to distinguish quantization noise and non-noise texture details in related technologies.
[0124] Figure 7 is a schematic diagram of the structure of an image processing device provided in an embodiment of the present disclosure. This device can be implemented using software and / or hardware and can be configured in an electronic device, typically a mobile terminal, a PC, or a server. As shown in Figure 7, the image processing device provided in this embodiment includes a generation module 510, an acquisition module 520, and an image processing module 530.
[0125] A generating module 510 is configured to generate a local contrast map according to the original image;
[0126] an acquisition module 520 configured to acquire local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image;
[0127] The image processing module 530 is configured to process the original image according to the local image processing parameters to generate a target image.
[0128] An image processing device provided by an embodiment of the present disclosure generates a local contrast map of an original image, obtains local image processing parameters based on the local contrast map, processes the original image according to target parameters for processing each local area included in the local image processing parameters, generates a target image, and adjusts the sharpening intensity based on the local contrast. This avoids oversharpening after sharpening areas with larger sharpening intensity in the original image, reduces the generation of text aliasing, solves the problems of oversharpening in current sharpening solutions and deepening of aliasing after sharpening of text parts, which affect the sharpening effect, and improves the image sharpening effect.
[0129] In the above solution, the generation module 510 is specifically configured to:
[0130] The local contrast of the original image in at least one receptive field is determined, and a local contrast map is generated according to the local contrast corresponding to each receptive field.
[0131] Furthermore, the generation module 510 is specifically configured to:
[0132] Traversing the original image according to the set convolution kernel and a preset step size to obtain at least one receptive field corresponding to the original image;
[0133] For each receptive field, determining the contrast of a central pixel in the current receptive field according to pixel values in the current receptive field as the local contrast of the original image in the current receptive field;
[0134] A local contrast map is generated according to the contrast of the central pixels in each of the receptive fields.
[0135] In the above solution, the acquisition module 520 is specifically configured to:
[0136] determining a first local contrast region and a second local contrast region of the original image according to the local contrast map, wherein the contrast of the first local contrast region is smaller than that of the second local contrast region;
[0137] A local sharpening intensity map is acquired according to the local contrast within the first local contrast area and the second local contrast area.
[0138] Furthermore, the acquisition module 520 is specifically configured to:
[0139] Obtaining the local contrast of each receptive field in the first local contrast area and the second local contrast area;
[0140] The target sharpening intensity of the corresponding receptive field is determined according to the local contrast of each receptive field, and a local sharpening intensity map is obtained according to the target sharpening intensity of each receptive field.
[0141] In the above solution, the image processing module 530 is specifically configured as follows:
[0142] Obtaining a texture detail map corresponding to the original image;
[0143] The local sharpening intensity map and the texture detail map are fused into the original image to generate a first sharpening result, wherein the local sharpening intensity map is determined based on the local contrast map.
[0144] Furthermore, the device also includes:
[0145] a determination module configured to, after fusing the local sharpening intensity map and the texture detail map into the original image to generate a first sharpening result, determine a first adjustment map and a second adjustment map according to the pixel values within each of the receptive fields, wherein the first adjustment map and the second adjustment map are used to adjust the sharpening intensity of the pixels in the first sharpening result;
[0146] An adjustment module is configured to adjust the first sharpening result according to the first adjustment map, the second adjustment map, and set parameters to obtain a second sharpening result. It should be noted that, alternatively, the determination module and the adjustment module may also be included in the image processing module, or even be located outside the device and interact with the device in any appropriate manner.
[0147] Furthermore, the image processing module 530 is further specifically configured to:
[0148] A sharpened image is generated according to the second sharpening result.
[0149] Furthermore, the image processing module 530 is further specifically configured to:
[0150] Obtaining a texture mask corresponding to the original image, wherein the texture mask is used to filter non-texture details;
[0151] A sharpened image is generated according to the second sharpening result, the texture mask and the original image.
[0152] The image processing device provided in the embodiments of the present disclosure can execute the image processing method provided in any embodiment of the present disclosure, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the image processing method provided in any embodiment of the present disclosure.
[0153] FIG8 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Referring to FIG8 , a schematic diagram of the structure of an electronic device 800 suitable for implementing an embodiment of the present disclosure is shown. The terminal device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, servers, etc. The electronic device shown in FIG8 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0154] As shown in FIG8 , the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An edit / output (I / O) interface 805 is also connected to the bus 804.
[0155] Typically, the following devices may be connected to the I / O interface 805: an input device 806 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although FIG8 shows the electronic device 800 with various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0156] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0157] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0158] The electronic device provided by the embodiment of the present disclosure and the image processing method provided by the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, please refer to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0159] An embodiment of the present disclosure provides a computer storage medium having a computer program stored thereon. When the program is executed by a processor, the image processing method provided by the above embodiment is implemented.
[0160] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0161] In some embodiments, the client and server can communicate using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.
[0162] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0163] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0164] Generate a local contrast map based on the original image;
[0165] Acquiring local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image;
[0166] The original image is processed according to the local image processing parameters to generate a target image.
[0167] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0168] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0169] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0170] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0171] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0172] The present disclosure may be embodied in any form described herein, including but not limited to the illustrative examples listed below, which describe the structure, features, and functions of some parts of the present disclosure. However, it should be understood that various modifications may be made without departing from the spirit and scope of the present disclosure.
[0173] According to one or more embodiments of the present disclosure, Example 1 provides an image processing method, comprising:
[0174] include:
[0175] Generate a local contrast map based on the original image;
[0176] Acquiring local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image;
[0177] The original image is processed according to the local image processing parameters to generate a target image.
[0178] According to one or more embodiments of the present disclosure, Example 2 is the method according to Example 1, wherein generating a local contrast map according to the original image includes:
[0179] The local contrast of the original image in at least one receptive field is determined, and a local contrast map is generated according to the local contrast corresponding to each receptive field.
[0180] According to one or more embodiments of the present disclosure, Example 3 is the method according to Example 2, wherein determining the local contrast of the original image within at least one receptive field and generating a local contrast map according to the local contrast corresponding to each receptive field includes:
[0181] Traversing the original image according to the set convolution kernel and a preset step size to obtain at least one receptive field corresponding to the original image;
[0182] For each receptive field, determining the contrast of a central pixel in the current receptive field according to pixel values in the current receptive field as the local contrast of the original image in the current receptive field;
[0183] A local contrast map is generated according to the contrast of the central pixels in each of the receptive fields.
[0184] According to one or more embodiments of the present disclosure, Example 4, according to the method of any one of Examples 1-3, obtaining a local image processing parameter according to the local contrast map includes:
[0185] determining a first local contrast region and a second local contrast region of the original image according to the local contrast map, wherein the contrast of the first local contrast region is smaller than that of the second local contrast region;
[0186] A local sharpening intensity map is acquired according to the local contrast within the first local contrast area and the second local contrast area.
[0187] According to one or more embodiments of the present disclosure, Example 5, according to the method of Example 4, obtaining a local sharpening intensity map based on the local contrast within the first local contrast area and the second local contrast area, includes:
[0188] Obtaining the local contrast of each receptive field in the first local contrast area and the second local contrast area;
[0189] The target sharpening intensity of the corresponding receptive field is determined according to the local contrast of each receptive field, and a local sharpening intensity map is obtained according to the target sharpening intensity of each receptive field.
[0190] According to one or more embodiments of the present disclosure, Example 6, according to the method of any one of Examples 1-5, processing the original image according to the local image processing parameters includes:
[0191] Obtaining a texture detail map corresponding to the original image;
[0192] The local sharpening intensity map and the texture detail map are fused into the original image to generate a first sharpening result, wherein the local sharpening intensity map is determined based on the local contrast map.
[0193] According to one or more embodiments of the present disclosure, Example 7 is the method according to Example 6, and further includes, after fusing the local sharpening intensity map and the texture detail map to the original image to generate a first sharpening result:
[0194] Determining a first adjustment map and a second adjustment map according to the pixel values within each of the receptive fields, wherein the first adjustment map and the second adjustment map are used to adjust the sharpening intensity of the pixels in the first sharpening result;
[0195] The first sharpening result is adjusted according to the first adjustment map, the second adjustment map and the set parameters to obtain a second sharpening result.
[0196] According to one or more embodiments of the present disclosure, Example 8 is the method according to Example 7, wherein generating the target image includes:
[0197] A sharpened image is generated according to the second sharpening result.
[0198] According to one or more embodiments of the present disclosure, Example 9 is the method according to Example 7, wherein generating the target image includes:
[0199] Obtaining a texture mask corresponding to the original image, wherein the texture mask is used to filter non-texture details;
[0200] A sharpened image is generated according to the second sharpening result, the texture mask and the original image.
[0201] According to one or more embodiments of the present disclosure, Example 10 provides an image processing device, comprising
[0202] include:
[0203] A generation module, used for generating a local contrast map according to the original image;
[0204] an acquisition module, configured to acquire local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image;
[0205] The image processing module is used to process the original image according to the local image processing parameters to generate a target image.
[0206] According to one or more embodiments of the present disclosure, Example 11 provides an electronic device, the electronic device including:
[0207] one or more processors;
[0208] a storage device for storing one or more programs,
[0209] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described in any one of Examples 1-9.
[0210] According to one or more embodiments of the present disclosure, Example 12 provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image processing method described in any one of Examples 1-9.
[0211] According to one or more embodiments of the present disclosure, Example 13 provides a computer program product comprising instructions that, when executed by a processor, result in the implementation of the image processing method described in any one of Examples 1-9.
[0212] According to one or more embodiments of the present disclosure, Example 14 provides a computer program, comprising program code, which, when executed by a processor, causes the image processing method as described in any one of Examples 1-9 to be implemented.
[0213] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0214] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0215] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. An image processing method, include: Generate a local contrast map based on the original image; Acquire local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image; The original image is processed according to the local image processing parameters to generate a target image.
2. The method according to claim 1, in, The generating of a local contrast map according to the original image comprises: The local contrast of the original image in at least one receptive field is determined, and a local contrast map is generated according to the local contrast corresponding to each receptive field.
3. The method according to claim 2, in, The determining of the local contrast of the original image within at least one receptive field and generating a local contrast map according to the local contrast corresponding to each receptive field includes: Traversing the original image according to the set convolution kernel and the preset step size to obtain at least one receptive field corresponding to the original image; For each of the receptive fields, determining the contrast of a central pixel in the current receptive field according to a pixel value in the current receptive field as a local contrast of the original image in the current receptive field; A local contrast map is generated according to the contrast of the central pixel in each of the receptive fields.
4. The method according to any one of claims 1 to 3, in, The acquiring of local image processing parameters according to the local contrast map comprises: Determine a first local contrast region and a second local contrast region of the original image according to the local contrast map, wherein the contrast of the first local contrast region is smaller than that of the second local contrast region; According to the local contrast in the first local contrast area and the second local contrast area Get the local sharpening strength map.
5. The method according to claim 4, in, The step of acquiring a local sharpening intensity map according to the local contrast within the first local contrast region and the second local contrast region comprises: Acquire the local contrast of each receptive field in the first local contrast area and the second local contrast area; The target sharpening intensity of the corresponding receptive field is determined according to the local contrast of each receptive field, and the local sharpening intensity map is obtained according to the target sharpening intensity of each receptive field.
6. The method according to any one of claims 1 to 5, in, The processing of the original image according to the local image processing parameters includes: Obtaining a texture detail map corresponding to the original image; The local sharpening intensity map and the texture detail map are fused to the original image to generate a first sharpening result, wherein the local sharpening intensity map is determined based on the local contrast map.
7. The method according to claim 6, in, After fusing the local sharpening intensity map and the texture detail map to the original image to generate a first sharpening result, the method further includes: Determine a first adjustment map and a second adjustment map according to the pixel values in each of the receptive fields, wherein the first adjustment map and the second adjustment map are used to adjust the sharpening intensity of the pixels in the first sharpening result; The first sharpening result is adjusted according to the first adjustment map, the second adjustment map and the set parameters to obtain a second sharpening result.
8. The method according to claim 7, in, The generating of the target image comprises: A sharpened image is generated according to the second sharpening result as the target image.
9. The method according to claim 7, in, The generating of the target image comprises: Acquire a texture mask corresponding to the original image, wherein the texture mask is used to filter non-texture details; A sharpened image is generated according to the second sharpening result, the texture mask and the original image as the target image.
10. An image processing device, include: A generating module, configured to generate a local contrast map according to an original image; an acquisition module, configured to acquire local image processing parameters according to the local contrast map, wherein the local image processing parameters are used to represent target parameters for setting processing for local areas with different contrasts in the original image; The image processing module is configured to process the original image according to the local image processing parameters to generate a target image.
11. The device according to claim 10, in, The build module is configured as: The local contrast of the original image in at least one receptive field is determined, and a local contrast map is generated according to the local contrast corresponding to each receptive field.
12. The device according to claim 10 or 11, in, The build module is configured as: Traversing the original image according to the set convolution kernel and the preset step size to obtain at least one receptive field corresponding to the original image; For each of the receptive fields, determining the contrast of a central pixel in the current receptive field according to a pixel value in the current receptive field as a local contrast of the original image in the current receptive field; A local contrast map is generated according to the contrast of the central pixel in each of the receptive fields.
13. The device according to any one of claims 10 to 12, in, The acquisition module is configured as: Determine a first local contrast region and a second local contrast region of the original image according to the local contrast map, wherein the contrast of the first local contrast region is smaller than that of the second local contrast region; A local sharpening intensity map is acquired according to the local contrast within the first local contrast area and the second local contrast area.
14. The device according to claim 13, in, The acquisition module is configured as: Acquire the local contrast of each receptive field in the first local contrast area and the second local contrast area; The target sharpening intensity of the corresponding receptive field is determined according to the local contrast of each receptive field, and the local sharpening intensity map is obtained according to the target sharpening intensity of each receptive field.
15. The device according to any one of claims 10 to 14, in, The image processing module is configured as follows: Obtaining a texture detail map corresponding to the original image; The local sharpening intensity map and the texture detail map are fused to the original image to generate a first sharpening result, wherein the local sharpening intensity map is determined based on the local contrast map.
16. The device according to claim 15, further comprising: include: A determination module is configured to determine a first adjustment map and a second adjustment map according to pixel values in each of the receptive fields after fusing the local sharpening intensity map and the texture detail map to the original image to generate a first sharpening result, wherein the first adjustment map and the second adjustment map are used to adjust the sharpening intensity of the pixels in the first sharpening result; The adjustment module is configured to adjust the first sharpening result according to the first adjustment map, the second adjustment map and set parameters to obtain a second sharpening result.
17. The device according to claim 16, in, The image processing module is configured as follows: Acquire a texture mask corresponding to the original image, wherein the texture mask is used to filter non-texture details; A sharpened image is generated according to the second sharpening result, the texture mask and the original image as a target image.
18. The device according to claim 16, in, The image processing module is configured as follows: A sharpened image is generated according to the second sharpening result as a target image.
19. An electronic device, include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described in any one of claims 1 to 9.
20. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the image processing method according to any one of claims 1 to 9 when executed by a computer processor.
21. A computer program product comprising instructions, which, when executed by a processor, lead to the implementation of the image processing method according to any one of claims 1 to 9.
22. A computer program comprising a program code, which, when executed by a processor, causes the image processing method according to any one of claims 1 to 9 to be implemented.
Citation Information
Patent Citations
Local contrast ratio-based image sharpening method
CN107256539A
Image processing method and related product
CN111683192A
Human image sharpening method and device based on Hessian filter, equipment and medium
CN114494066A
Image processing method and device, electronic equipment and computer readable storage medium
CN114913084A
Image processing method and device, electronic equipment and storage medium
CN116188314A
