Image processing method, device, electronic device and storage medium
By adaptively determining the high-frequency weight parameters of the target area of the image, the problem of convergence of sharpening effects in image sharpening processing is solved, and a better personalized sharpening effect is achieved.
Patent Information
- Application Number
- CN202210271178.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-03-18
AI Technical Summary
In the existing technology, image sharpening processing uses manually selected fixed weight parameters, which leads to the convergence of sharpening effects, cannot meet the needs of different scenarios, and has a large workload.
By obtaining the image content, high-frequency components and low-frequency components of multiple target areas of the image to be processed, the high-frequency weight parameters are adaptively determined according to the image content of the target area, and the target sharpened image is generated by combining the high-frequency components and the low-frequency components.
It realizes adaptive sharpening processing according to image content, reduces labor costs, improves the personalization and quality of sharpening effects, and avoids the convergence of sharpening effects.
Smart Images

Figure CN114627022B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, electronic device, and storage medium. Background Art
[0002] To make images appear more realistic and natural, they are typically sharpened. Sharpening involves filtering the low-frequency and high-frequency components of an image, adjusting the high-frequency component using preset weighting parameters, and then superimposing the adjusted high-frequency component onto the low-frequency component to create a superimposed image. This superimposed image is known as the sharpened image.
[0003] Typically, when sharpening an image, a manually selected fixed weight parameter is used to adjust the high-frequency components of the image. This is then superimposed on the adjusted high-frequency components and the low-frequency components to produce the sharpened image. However, manually selecting fixed weight parameters is very labor-intensive, and if the same fixed weight parameter is used in all scenarios, the sharpening effect tends to be uniform, resulting in poor image sharpening and failing to meet the needs of different scenarios. Summary of the Invention
[0004] The present disclosure provides an image processing method, device, electronic device and storage medium for improving the sharpening effect of an image.
[0005] The technical solutions of the embodiments of the present disclosure are as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, an image processing method is provided. The method may include: obtaining image content, high-frequency components, and low-frequency components of each target region of a to-be-processed image; determining, for each target region, a high-frequency weight parameter corresponding to the target region based on the image content of the target region; and obtaining a target sharpened image corresponding to the to-be-processed image based on the high-frequency weight parameters and high-frequency components and low-frequency components corresponding to the multiple target regions.
[0007] Optionally, the above-mentioned image content includes pixel values of multiple pixel points, and the above-mentioned method for obtaining the image content of each target area in multiple target sharpened images of the image to be processed specifically includes: controlling the filter kernel of the preset filter to slide on the image to be processed with a preset step size, and when the filter kernel moves to any target area, obtaining the pixel values of multiple pixel points in each sub-area of the multiple sub-areas of the target area, the filter kernel includes multiple sub-filter kernels, and one sub-filter kernel corresponds to one sub-area.
[0008] Optionally, the above-mentioned image processing method also includes: determining a first parameter value corresponding to the sub-area based on the pixel values of multiple pixel points in the sub-area, and the first parameter value includes the variance, standard deviation or average value between the pixel values of multiple pixel points; the above-mentioned method for determining the high-frequency weight parameter corresponding to the target area based on the image content of the target area specifically includes: determining the high-frequency weight parameter corresponding to the target area based on multiple first parameter values corresponding to the target area.
[0009] Optionally, the above method for determining the high-frequency weight parameter corresponding to the target area based on multiple first parameter values corresponding to the target area specifically includes: taking the ratio between the maximum value and the minimum value among the multiple first parameter values corresponding to the target area as the high-frequency weight parameter corresponding to the target area.
[0010] Optionally, the above method for determining the high-frequency weight parameter corresponding to the target area based on multiple first parameter values corresponding to the target area specifically includes: taking the ratio between the maximum value among the multiple first parameter values of the target area and the first value as the high-frequency weight parameter corresponding to the target area, and the first value is the sum of the minimum value among the multiple first parameter values of the target area and a preset value, and the preset value is not 0.
[0011] Optionally, the above-mentioned method for determining the target sharpened image corresponding to the image to be processed based on the high-frequency weight parameters, high-frequency components and low-frequency components corresponding to multiple target areas specifically includes: for each target area, determining the sharpening parameter value of the target area based on the sum of the low-frequency component of the target area and a first component, the first component being the product of the high-frequency weight parameter corresponding to the target area and the high-frequency component; and superimposing the sharpening parameter values of multiple target areas to obtain the target sharpened image.
[0012] Optionally, the above-mentioned method of obtaining the high-frequency component and the low-frequency component of each target area in the multiple target areas of the image to be processed specifically includes: using the filter kernel to obtain the low-frequency component of the target area; determining the high-frequency component of the target area based on the difference between the image information of the target area and the low-frequency component of the target area.
[0013] According to a second aspect of an embodiment of the present disclosure, an image processing device is provided. The device may include: an acquisition unit and a determination unit; the acquisition unit is configured to acquire image content, high-frequency components, and low-frequency components of each of multiple target regions in an image to be processed; for each target region, the determination unit is configured to determine a high-frequency weight parameter corresponding to the target region based on the image content of the target region; the determination unit is further configured to obtain a target sharpened image corresponding to the image to be processed based on the high-frequency weight parameters, high-frequency components, and low-frequency components corresponding to the multiple target regions.
[0014] Optionally, the above-mentioned image content includes pixel values of multiple pixel points, and the acquisition unit is specifically used to control the filter kernel of the budget preset filter to slide on the image to be processed with a preset step size. When the filter kernel moves to any target area, the pixel values of multiple pixel points in each sub-area of the multiple sub-areas of the target area are obtained. The filter kernel includes multiple sub-filter kernels, and one sub-filter kernel corresponds to one sub-area.
[0015] Optionally, the determination unit is also used to determine the first parameter value corresponding to the sub-area based on the pixel values of multiple pixel points in the sub-area, and the first parameter value includes one or more of the variance, standard deviation or average value between the pixel values of multiple pixel points; the determination unit is specifically used to: determine the high-frequency weight parameter corresponding to the target area based on the multiple first parameter values corresponding to the target area.
[0016] Optionally, the determining unit is specifically configured to use a ratio between a maximum value and a minimum value of a plurality of first parameter values corresponding to the target area as a high-frequency weight parameter corresponding to the target area.
[0017] Optionally, the determination unit is specifically used to use the ratio between the maximum value of the multiple first parameter values of the target area and the first value as the high-frequency weight parameter corresponding to the target area, and the first value is the sum of the minimum value of the multiple first parameter values of the target area and a preset value, and the preset value is not 0.
[0018] Optionally, the determination unit is specifically used to determine, for each target area, a sharpening parameter value of the target area based on the sum of the low-frequency component of the target area and a first component, where the first component is the product of the high-frequency weight parameter corresponding to the target area and the high-frequency component; and superimpose the sharpening parameter values of multiple target areas to determine a target sharpened image.
[0019] Optionally, the acquisition unit is specifically configured to acquire a low-frequency component of the target area using a filter kernel; and determine a high-frequency component of the target area according to a difference between image information of the target area and the low-frequency component of the target area.
[0020] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, which may include: a processor and a memory for storing processor-executable instructions; wherein the processor is used to execute the instructions to implement any optional image processing method in the first aspect above.
[0021] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is enabled to perform any one of the optional image processing methods in the first aspect above.
[0022] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes any optional image processing method as described in the first aspect.
[0023] The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:
[0024] Based on any of the above aspects, in the present disclosure, after obtaining the image content, high-frequency components, and low-frequency components of each of the multiple target regions of the image to be processed, a corresponding high-frequency weight parameter can be determined for each target region based on the image content of the target region. Furthermore, a target sharpened image corresponding to the image to be processed is determined based on the high-frequency weight parameters, high-frequency components, and low-frequency components corresponding to the multiple target regions. The target sharpened image is the sharpened image. Compared to manually selecting fixed high-frequency weight parameters to process an image, the technical solution provided by the present disclosure can adaptively determine the high-frequency weight parameter for sharpening processing corresponding to each region of the image to be processed based on the image content of the region, reducing labor costs. Furthermore, the high-frequency weight parameter used for sharpening processing in the present application is related to the image content, rather than using a fixed high-frequency weight parameter. Therefore, the determined high-frequency weight parameter can better match the actual scene of the image to be processed and the specific content of the local region on the image to be processed, resulting in a better and more personalized image sharpening effect, and avoiding the convergence of sharpening effects caused by fixed high-frequency weight parameters.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.
[0027] Figure 1 A schematic diagram of an image to be processed provided by an embodiment of the present disclosure is shown;
[0028] Figure 2 A schematic diagram showing another image to be processed provided by an embodiment of the present disclosure is shown;
[0029] Figure 3 A schematic diagram showing a flow chart of an image processing method provided by an embodiment of the present disclosure is shown;
[0030] Figure 4A schematic diagram showing an image processed by another filter kernel provided by an embodiment of the present disclosure is shown;
[0031] Figure 5 A schematic diagram showing an image processed by another filter kernel provided by an embodiment of the present disclosure is shown;
[0032] Figure 6a A schematic diagram of an image processed by another filter kernel provided by an embodiment of the present disclosure is shown;
[0033] Figure 6b A schematic diagram of an image processed by another filter kernel provided by an embodiment of the present disclosure is shown;
[0034] Figure 7 A schematic diagram of an image processed by another filter kernel provided by an embodiment of the present disclosure is shown;
[0035] Figure 8a A schematic diagram of an image sharpened based on manually specified high-frequency weight parameters provided by an embodiment of the present disclosure is shown;
[0036] Figure 8b A schematic diagram showing an image after sharpening using adaptive high-frequency weight parameters provided by an embodiment of the present disclosure is shown;
[0037] Figure 9a A schematic diagram of an image sharpened based on manually specified high-frequency weight parameters provided by an embodiment of the present disclosure is shown;
[0038] Figure 9b A schematic diagram showing an image after sharpening using adaptive high-frequency weight parameters provided by an embodiment of the present disclosure is shown;
[0039] Figure 10 A schematic diagram showing a flow chart of another image processing method provided by an embodiment of the present disclosure is shown;
[0040] Figure 11 A schematic structural diagram of an image processing device provided by an embodiment of the present disclosure is shown;
[0041] Figure 12 A structural schematic diagram of another image processing device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0042] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0043] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.
[0044] It will also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.
[0045] It should be noted that the user information (including but not limited to user device information, user personal information, user behavior information, etc.) and data (including but not limited to image data) involved in this disclosure may be data authorized by the user or fully authorized by all parties.
[0046] Before introducing the embodiments of the present application, the terms involved in the embodiments of the present application are first explained.
[0047] Image sharpening: Image sharpening is used to highlight the edges, contours, or features of certain target elements in an image. For example, image sharpening can be used to compensate for image contours, enhance image edges, and enhance grayscale transitions to make the image clearer.
[0048] Here, enhancing the edge and grayscale transition portion of the image may refer to enhancing the high-frequency component of the image (also referred to as high-frequency information). Sharpening the image may refer to superimposing the enhanced high-frequency component of the image with the low-frequency component of the image.
[0049] In one possible implementation, low-frequency information from the original image can be extracted through low-frequency filtering, and then the low-frequency information is subtracted from the original image to obtain high-frequency information. The high-frequency information is then superimposed on the original image to achieve image enhancement.
[0050] Low-frequency filtering: This refers to filtering out high-frequency information in an image through a low-frequency filter, thereby extracting the low-frequency information of the image. For example, low-frequency filters can include mean filters (also known as mean convolvers) and Gaussian convolution filters (also known as Gaussian filters).
[0051] Filters: These filters can be used to filter an image. They can include a filter kernel (also called a convolution kernel). A filter can be configured with a filter kernel and a smoothing parameter. Different filters can have different filter kernel sizes and smoothing parameters.
[0052] Among them, the size of the filter kernel can refer to the length × width of the filter kernel. For example, the size of the filter kernel can include 3×3, 5×5, 7×7, 12×12, etc. The size of the filter kernel can be determined by the filter radius. The size of the filter kernel can refer to the width of a filter radius extended in the four directions of the upper, lower, left and right directions of the pixel to be processed with the pixel to be processed as the center. For example, if the filter radius is r, the length and width of the filter kernel are k, then k=2r+1. For another example, if the filter radius is 1, the size of the filter kernel is 3×3; if the filter radius is 2, the size of the filter kernel is 5×5.
[0053] It should be noted that in the embodiments of the present application, the filter kernel may include a numerical matrix consisting of multiple filter weight values. Each value in the numerical matrix corresponds to a pixel of the image to be processed. For example, when the filter kernel size is 12×12, the number of pixels corresponding to the filter kernel may be 144.
[0054] The smoothing parameter of the filter can be used to characterize the filter's ability to filter low-frequency components. The smaller the smoothing parameter of the filter, the weaker the filtering ability, and the closer the filtered image is to the original image.
[0055] Specifically, the filter may perform sharpening processing on the image based on an image augmentation algorithm.
[0056] Image enhancement algorithm: can be used to adjust the brightness, contrast, saturation, hue, etc. of an image to increase its clarity, reduce noise, etc. For example, an image enhancement algorithm may include an edge sharpening algorithm.
[0057] Edge sharpening algorithms, also known as sharpening algorithms, decompose an image into high-frequency and low-frequency components. They then manually select a set of high-frequency weighting parameters to superimpose the high-frequency components on the low-frequency components, thereby sharpening the image. The performance of edge sharpening algorithms depends primarily on filter design. A well-designed filter can provide rich edge information without overly sharpening noise, such as edge whitening and background noise.
[0058] The core technology of the edge sharpening algorithm includes two parts: (1) a filter that separates the high-frequency and low-frequency components of the image; and (2) superimposing the high-frequency component on the low-frequency component with a preset weight to achieve the effect of sharpening the image edges.
[0059] In (1), the process of filtering to separate the high-frequency and low-frequency components of an image can be: Bk = Fk(I), where Fk is the filter kernel, which can include guided filtering, Gaussian filtering, bilateral filtering, etc. Bk is the low-frequency component of the image, and I is the input image information. The high-frequency component (Dk) corresponding to the image can be: Dk = I – Bk.
[0060] In (2), under normal circumstances, the edge sharpening algorithm uses an artificial method to set the high-frequency weight parameters. For example, taking the low-frequency components obtained by the edge sharpening algorithm through filters of three different sizes as an example, the low-frequency components corresponding to each size are B1, B2, and B3, and the corresponding high-frequency components are D1, D2, and D3. The high-frequency weight parameters corresponding to each high-frequency component are manually adjusted, and the adjusted high-frequency weight parameters are w1, w2, and w3. Finally, the high-frequency component is multiplied by the corresponding high-frequency weight parameter and then superimposed with the low-frequency component. The superposition process can be: I'=w1*D1+w2*D2+w3*D3+B1, and I' is the result after sharpening.
[0061] However, when using this edge sharpening algorithm, if the high-frequency weight parameters of high-frequency information are selected manually, the high-frequency weight parameters of the image may need to be manually adjusted due to different sharpening requirements of the image, which is inefficient.
[0062] In one example, different scenes have different sharpening requirements. For example, for images with less texture, such as Figure 1 As shown in the figure, the image including the sky is relatively smooth and does not need to be over-sharpened. Therefore, a smaller high-frequency weight parameter should be selected for the image. For another example, for an image with rich texture, such as Figure 2 The image shown includes a brick wall. In order to increase the texture in the image, the image needs to be properly sharpened. Therefore, a larger high-frequency weight parameter needs to be selected for the image.
[0063] In some scenarios, such as the above Figure 1 and Figure 2 Appearing in the same image (i.e., an image containing both a sky and a brick wall). If a fixed high-frequency weight parameter is manually specified to process each area of the image, the overall sharpening effect of the image will show convergence, that is, the degree of sharpness of each area of the image will be the same. However, the image contains multiple different scenes, and the sharpening requirements of each scene are different. If the image is sharpened by manually specifying a fixed high-frequency weight parameter, it is clear that the optimal sharpening effect cannot be achieved.
[0064] In view of this, an embodiment of the present disclosure provides an image processing method, which includes: obtaining the image content, high-frequency component and low-frequency component of each target area of a plurality of target areas of an image to be processed; for each target area, determining the high-frequency weight parameter corresponding to the target area according to the image content of the target area; and obtaining a target sharpened image corresponding to the image to be processed according to the high-frequency weight parameters and high-frequency components, as well as the low-frequency components corresponding to the plurality of target areas.
[0065] The image processing method, apparatus, electronic device, and storage medium provided by the embodiments of the present disclosure are applicable to scenarios involving image sharpening. When an electronic device responds to an image processing request, it can perform image sharpening according to the method provided by the embodiments of the present disclosure. The image processing request can be used to instruct the image to be sharpened.
[0066] The image processing method provided by the embodiment of the present disclosure is exemplarily described below with reference to the accompanying drawings:
[0067] Exemplarily, the electronic device that executes the image processing method provided by the embodiments of the present disclosure may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, as well as a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) or virtual reality (VR) device, etc., which can install and use content community applications (such as multimedia applications, etc.).
[0068] As another example, the electronic device that executes the image processing method provided in the embodiments of the present disclosure may also be a server or other device. The server may also perform image sharpening processing. In other words, it may also execute the image processing method provided in the embodiments of the present application.
[0069] The server may be a single server, or a server cluster composed of multiple servers. In some implementations, the server cluster may also be a distributed cluster.
[0070] In the embodiment of the present application, the server may include multiple application service platforms, each of which corresponds to a unique application installed on a terminal device. The server is mainly used to store relevant business data of the application.
[0071] The present disclosure does not impose any particular restrictions on the specific form of the electronic device, which can interact with the user through one or more methods such as a keyboard, touchpad, touch screen, remote control, voice interaction, or handwriting device.
[0072] like Figure 3 As shown, the image processing method provided by the embodiment of the present disclosure may include S301-S303.
[0073] S301: The electronic device obtains image content, high-frequency components, and low-frequency components of each target area in a plurality of target areas of an image to be processed.
[0074] The image to be processed may include multiple target regions, and the image content of each target region may be used to represent the actual scene of the target region. For example, the image content may include the pixel values of multiple pixels in the target region. The high-frequency component and low-frequency component of the target region can be referred to the above description and are not further described here.
[0075] In a possible implementation, when the electronic device is a server, the server may perform a sharpening operation on the image to be processed after receiving the image processing request from the mobile device. For example, the above-mentioned S301 may be executed.
[0076] The image processing request may be used to instruct to perform sharpening processing on the image to be processed. The image processing request may include image data of the image to be processed.
[0077] In another possible implementation, when the electronic device is a mobile device, the mobile device may perform a sharpening operation on the image to be processed in response to a click operation by the user. For example, the above S301 may be started.
[0078] For example, the electronic device performing a sharpening operation on the image to be processed may mean that the electronic device may use a preset filter to filter the image to be processed to obtain image content, high-frequency components, and low-frequency components of multiple target areas of the image to be processed.
[0079] The preset filter can be set as needed, for example, it can be a box filter, a guided filter, a bilateral filter, etc., without limitation.
[0080] In one example, Figure 4 As shown, the preset filter can be provided with a filter kernel, and the filter kernel can be installed on the image to be processed with a preset step size sliding. Figure 4In the figure, the arrow indicates the sliding direction of the preset filter, and 12 indicates the size of the filter kernel. The filter kernel may include multiple sub-filter kernels. When the filter kernel moves to a certain area of the image to be processed, the image content, high-frequency components, and low-frequency components of multiple sub-areas of the area can be obtained. One sub-filter kernel corresponds to one sub-area. In this way, the electronic device can use the filter kernel to traverse the image to be processed, thereby obtaining the image content, high-frequency components, and low-frequency components of each area of the image to be processed, which is more comprehensive and avoids the problem of missing local areas.
[0081] The size of the filter kernel can be set as needed, for example, 12×12, or other sizes without limitation. The preset step size can be set as needed, for example, one or more pixels without limitation.
[0082] For example, the electronic device may divide the filter core into multiple sub-filter cores, and the sizes of the multiple sub-filter cores may be the same or different. Figure 5 As shown, the electronic device can divide the filter kernel into four sub-filter kernels. The size of each sub-filter kernel can be 1 / 4 of the size of the filter kernel. For example, if the size of the filter kernel is 12×12, the size of each sub-filter kernel can be 6×6. The number of pixels in the sub-region corresponding to each sub-filter kernel is 36.
[0083] In one example, Figure 6a As shown, when the preset step size is one pixel, when the filter kernel moves to the target area 1, the electronic device can obtain the image content, high-frequency components and low-frequency components of multiple sub-areas of the target area 1. The electronic device controls the filter kernel to move one pixel to the right ( Figure 6a A square in the image represents a pixel point of the image to be processed), moves to the target area 2, and the electronic device can obtain the image content, high-frequency components and low-frequency components of the target area 2.
[0084] Based on the way that electronic devices process images with a preset step size of one pixel, adjacent target areas can have overlapping areas. In this way, the electronic device can perform multiple sharpening processes on the overlapping areas. Since the overlapping areas occupy a larger area of the image to be processed, a sharper image can be obtained. At the same time, the electronic device does not need to use multiple filter kernels to filter the image to be processed, and can perform sharpening processing on the image to be processed, which reduces the number of filters, makes the algorithm simpler, simplifies the image processing process, saves processing resources, and reduces costs.
[0085] In addition, in the embodiment of the present application, the electronic device embeds the determination of the high-frequency weight parameter into the filtering process, thereby improving the efficiency of image sharpening and providing a new process for determining the high-frequency weight parameter of an image.
[0086] In another example, Figure 6b As shown in , when the preset step size is a plurality of pixels, the length of the image corresponding to the plurality of pixels is less than or equal to the length of the filter kernel. For example, if the size of the filter kernel is 4×4, the preset step size can be 4 pixels. Figure 6b In the example, when the filter kernel moves to the target area 1, the electronic device can obtain the image content, high-frequency components and low-frequency components of multiple sub-areas of the target area 1. The electronic device controls the filter kernel to move 4 pixels to the right ( Figure 6b A square in the image represents a pixel point of the image to be processed), moves to the target area 3, and the electronic device can obtain the image content, high-frequency components and low-frequency components of the target area 3.
[0087] Based on the way in which the electronic device processes the image with the multiple pixel points as the preset step size, the electronic device can quickly traverse multiple areas of the entire image and obtain image content, high-frequency components and low-frequency components corresponding to the multiple areas.
[0088] S302: The electronic device determines a high-frequency weight parameter corresponding to the target area according to the image content of the target area.
[0089] The image content of the target area can be used to represent feature information of the target area. For example, the feature information can include pixel values of multiple pixels in the target area.
[0090] In a possible implementation, the electronic device may determine the high-frequency weight parameter corresponding to the target area according to the first parameter value of each sub-area in the multiple sub-areas of the target area.
[0091] The first parameter value may be one or more of the variance, standard deviation, or average value of the pixel values of the multiple pixels in the sub-region. The first parameter value of a sub-region may be determined based on the pixel values of the multiple pixels in the sub-region. Since the pixel values of the pixels can reflect the image changes in the region, the electronic device may accurately determine the high-frequency weight parameter corresponding to the region based on one or more of the variance, standard deviation, or average value of the pixels in the region.
[0092] For example, Figure 7As shown, the size of the filter kernel is 6×6, and the filter kernel includes four sub-filter kernels of the same size (all of size 3×3, namely sub-filter kernel 1, filter kernel 2, filter kernel 3, and filter kernel 4, not shown in the figure). The pixel values of the multiple pixels in sub-region 1 corresponding to sub-filter kernel 1 are 1, 1, 1, 1, 1, 2, 2, 2, 3 respectively; the pixel values of the multiple pixels in sub-region 2 corresponding to sub-filter kernel 2 are 1, 1, 1, 2, 3, 1, 3, 2, 2 respectively; the pixel values of the multiple pixels in sub-region 3 corresponding to sub-filter kernel 3 are 1, 2, 3, 1, 2, 3, 2, 2, 2 respectively; and the pixel values of the multiple pixels in sub-region 4 corresponding to sub-filter kernel 4 are 4, 5, 4, 3, 4, 1, 2, 2, 2 respectively. Taking the first parameter value as the variance as an example, the first parameter value corresponding to sub-region 1 is 0.47, the first parameter value corresponding to sub-region 2 is 0.62, the first parameter value corresponding to sub-region 3 is 0.44, and the first parameter value corresponding to sub-region 4 is 1.56.
[0093] In one example, when multiple first parameter values corresponding to the target area are not 0, the electronic device can determine the high-frequency weight parameter of the target area based on the ratio between the maximum value and the minimum value of the multiple first parameter values corresponding to the target area.
[0094] Since the maximum and minimum values of multiple first parameter values can reflect the variation range / amplitude of the image grayscale / brightness of the target area to a certain extent, using the ratio of the maximum and minimum values among the multiple first parameter values as the high-frequency weight parameter of the target area is simple and convenient, and can also match the image content of the target area as much as possible.
[0095] In another example, when there is a 0 among the multiple first parameter values corresponding to the target area, the electronic device can determine the high-frequency weight parameter of the target area based on the ratio between the maximum value of the multiple first parameter values corresponding to the target area and the first value. In this way, the electronic device can quickly determine the high-frequency weight parameter of the target area.
[0096] The first value may be the sum of a minimum value of the plurality of first parameter values and a preset value. The preset value is not 0. This avoids the problem of being unable to determine the high-frequency weight parameter of the target area based on the maximum and minimum values of the plurality of first parameter values when the minimum value is 0.
[0097] In another example, taking the first parameter value as variance, when there is 0 among the multiple first parameter values corresponding to the target area, the electronic device can also determine the high-frequency weight parameter W of the target area according to the following formula 1: k .
[0098]
[0099] Wherein, k represents the kth target area of the image to be processed, and k is a positive integer. represents the maximum value among multiple first parameter values, represents the minimum value among multiple first parameter values, e represents the preset value, and max represents the maximum value.
[0100] It should be noted that the above method of determining the high-frequency weight parameters corresponding to the target area based on multiple first parameter values of the target area is only exemplary. The electronic device can also determine the high-frequency weight parameters corresponding to the target area according to other methods, for example, based on the mean, variance, standard deviation, etc. of multiple first parameter values of the target area, without limitation.
[0101] S303: The electronic device determines a target sharpened image corresponding to the image to be processed according to the high-frequency weight parameters, high-frequency components, and low-frequency components corresponding to the multiple target areas.
[0102] The target sharpened image is the sharpened image of the image to be processed.
[0103] In one possible implementation, the electronic device can superimpose the sharpening parameter values of multiple target regions to determine a target sharpened image. This allows the electronic device to determine corresponding high-frequency weight parameters for each region. Because different regions may correspond to different high-frequency weight combinations, different regions of the same image to be processed can each determine a high-frequency weight component that matches the image content of that region. This allows the image to be sharpened regionally, avoiding convergence in sharpening across the entire image.
[0104] The sharpening parameter value of the target area may be the sum of a first component of the target area and a low-frequency component of the target area, where the first component is the product of a high-frequency component of the target area and a high-frequency weight parameter of the target area. The electronic device superimposing the sharpening parameter values of multiple target areas to obtain a target sharpened image may mean that the electronic device superimposes the first components of the multiple target areas onto corresponding low-frequency components to obtain the target sharpened image.
[0105] For example, the electronic device may determine the target sharpened image according to the following formula 2.
[0106]
[0107] Where I′ represents the target sharpened image, RB k represents the low-frequency component of the kth target area, w k Represents the high-frequency weight parameter of the k-th target area, RD k represents the high-frequency component of the kth target region. N represents the number of target regions included in the image to be processed. N is a positive integer.
[0108] In one example, Figure 8a As shown in , the image is obtained by sharpening by manually specifying high-frequency weight parameters. Figure 8a The text in the image has obvious white edges and the sharpening effect is poor. Figure 8b As shown, a sharpened image is obtained after processing based on the technical solution provided in the embodiment of the present application. Figure 8b The white edges of the text in the image are not obvious. It can be seen that the image processed based on the technical solution provided in the embodiment of the present application has a better sharpening effect.
[0109] In another example, Figure 9a As shown in FIG, the image is obtained by sharpening by manually specifying high-frequency weight parameters. Figure 9a The hair of the character in the image has obvious burrs and the sharpening effect is poor. Figure 9b As shown, a sharpened image is obtained after processing based on the technical solution provided in the embodiment of the present application. Figure 9b The hair of the character in the image does not have obvious burrs. It can be seen that the image processed based on the technical solution provided in the embodiment of the application has a better sharpening effect.
[0110] The technical solution provided by the above embodiment can at least bring the following beneficial effects: As can be seen from S301-S303, in the embodiment of the present application, after the electronic device obtains the image content, high-frequency component and low-frequency component of each target area in the multiple target areas of the image to be processed, for each target area, it can determine the corresponding high-frequency weight parameter according to the image content of the target area. Furthermore, the target sharpened image corresponding to the image to be processed is determined according to the high-frequency weight parameters, high-frequency components and low-frequency components corresponding to the multiple target areas, and the target sharpened image is the sharpened image. Compared with the use of manually selected fixed high-frequency weight parameters to process the image, in the technical solution provided by the present application, in the process of image sharpening processing, the high-frequency weight parameters for sharpening processing corresponding to each area of the image to be processed can be determined according to the image content of the area, thereby reducing labor costs. At the same time, the high-frequency weight parameters used for sharpening processing in this application are related to the image content, rather than using fixed high-frequency weight parameters. Therefore, the determined high-frequency weight parameters can better match the actual scene of the image to be processed and the specific content of the local area on the image to be processed, so that the image sharpening effect is better and more personalized, and can avoid the convergence of sharpening effects caused by fixed high-frequency weight parameters.
[0111] Combine Figure 3 ,like Figure 10 As shown, in the above S301, for any target area, the method for the electronic device to obtain the low-frequency component and the high-frequency component of the target area may specifically include S3011 and S2012.
[0112] S3011: The electronic device uses a filter kernel of a preset filter to obtain a low-frequency component of the target area.
[0113] The filter kernel can be used to filter the image to obtain the low-frequency component of the image. For example, the filter kernel is a low-frequency filter kernel. The smoothing parameter of the filter kernel can be set as needed, for example, it can be 0.0001, without limitation.
[0114] In one example, when the electronic device uses a filter kernel of a preset filter to slide to a target area on the image to be processed, the electronic device can use the filter kernel to filter the target area to obtain a low-frequency component of the target area.
[0115] S3012: The electronic device determines the high-frequency component of the target area according to the difference between the image information of the target area and the low-frequency component of the target area.
[0116] The image information of the target area can be used to characterize the image content of the target area, such as brightness information or grayscale value information of the image within the target area. For example, the image information of the target area may include a low-frequency component and a high-frequency component of the target area. After determining the low-frequency component, the electronic device can subtract the low-frequency component of the target area from the image information of the target area to obtain the high-frequency component of the target area.
[0117] In this way, through steps S3011 to S3012, the electronic device can obtain the low-frequency component and the high-frequency component of a target area.
[0118] It should be noted that the electronic device can control the preset filter to slide on the image to be processed, thereby traversing each target area of the image to be processed, and repeatedly executing the above S3011 and S3012 to obtain the low-frequency component and high-frequency component corresponding to each target area.
[0119] The technical solution provided by the above embodiment can at least bring the following beneficial effects: As can be seen from S3011-S3012, the electronic device can use the filter kernel to obtain the low-frequency component of the target area and determine the high-frequency component of the target area based on the difference between the image information of the target area and the low-frequency component of the target area. In this way, the electronic device can quickly and accurately determine the low-frequency component and high-frequency component of the target area.
[0120] It is understandable that, in actual implementation, the electronic device described in the embodiment of the present disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding image processing method, and these execution hardware structures and / or software modules may constitute an electronic device. It should be easily appreciated by those skilled in the art that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present disclosure.
[0121] Based on this understanding, the present disclosure also provides an image processing device. Figure 11 FIG. 1 shows a schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure. Figure 11 As shown, the image processing device 11 may include: an acquiring unit 111 and a determining unit 112 .
[0122] The acquisition unit 111 is used to acquire the image content, high frequency component and low frequency component of each target area in the plurality of target areas of the image to be processed. For example, the acquisition unit 111 can be used to perform Figure 3 For each target area, the determination unit 112 is used to determine the high-frequency weight parameter corresponding to the target area according to the image content of the target area. The determination unit is also used to determine the target sharpened image corresponding to the image to be processed according to the high-frequency weight parameters and high-frequency components and low-frequency components corresponding to the multiple target areas. For example, the determination unit 112 can be used to perform Figure 3 S302 and S303 in.
[0123] Optionally, the above-mentioned image content includes pixel values of multiple pixel points, and the acquisition unit 111 is specifically used to control the budget filter kernel to slide on the image to be processed with a preset step size. When the filter kernel moves to any target area, the pixel values of multiple pixel points in each sub-area of the multiple sub-areas of the target area are obtained. The filter kernel includes multiple sub-filter kernels, and one sub-filter kernel corresponds to one sub-area.
[0124] Optionally, the determination unit 112 is also used to determine the first parameter value corresponding to the sub-area based on the pixel values of multiple pixel points in the sub-area, and the first parameter value includes one or more of the variance, standard deviation or average value between the pixel values of multiple pixel points; the determination unit 112 is specifically used to: determine the high-frequency weight parameter corresponding to the target area based on the multiple first parameter values corresponding to the target area.
[0125] Optionally, the determining unit 112 is specifically configured to use a ratio between a maximum value and a minimum value of a plurality of first parameter values corresponding to the target area as a high-frequency weight parameter corresponding to the target area.
[0126] Optionally, the determination unit 112 is specifically used to use the ratio between the maximum value of the multiple first parameter values of the target area and the first value as the high-frequency weight parameter corresponding to the target area, and the first value is the sum of the minimum value of the multiple first parameter values of the target area and a preset value, and the preset value is not 0.
[0127] Optionally, the determination unit 112 is specifically used to determine, for each target area, a sharpening parameter value of the target area based on the sum of the low-frequency component of the target area and a first component, where the first component is the product of the high-frequency weight parameter corresponding to the target area and the high-frequency component; and superimpose the sharpening parameter values of multiple target areas to obtain a target sharpened image.
[0128] Optionally, the acquisition unit 111 is specifically configured to use a filter kernel to acquire the low-frequency component of the target area; and determine the high-frequency component of the target area according to the difference between the image information of the target area and the low-frequency component of the target area. For example, the acquisition unit 111 may be configured to perform Figure 10 S3011 and S3012 in.
[0129] As described above, the embodiment of the present disclosure can divide the image processing device into functional modules according to the above method example. Among them, the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, it should be noted that the division of modules in the embodiment of the present disclosure is schematic and is only a logical functional division. In actual implementation, there may be other division methods. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module.
[0130] Regarding the image processing device in the above embodiment, the specific manner in which each unit performs operations and the beneficial effects thereof have been described in detail in the aforementioned method embodiment and will not be repeated here.
[0131] Figure 12 This is a schematic diagram of the structure of another image processing device provided by the present disclosure. Figure 12 The image processing device 12 may include at least one processor 121 and a memory 123 for storing processor-executable instructions. The processor 121 is configured to execute instructions in the memory 123 to implement the image processing method in the above embodiment.
[0132] In addition, the image processing device 12 may further include a communication bus 122 and at least one communication interface 124 .
[0133] The processor 121 may be a central processing unit (CPU), a microprocessor unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution.
[0134] The communication bus 122 may include a pathway for transmitting information between the aforementioned components.
[0135] The communication interface 124 , which uses any transceiver or other device, is used to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.
[0136] The memory 123 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit via a bus. The memory may also be integrated with the processing unit.
[0137] The memory 123 is used to store instructions for executing the disclosed solution, and the execution is controlled by the processor 121. The processor 121 is used to execute the instructions stored in the memory 123, thereby realizing the functions of the disclosed method.
[0138] In a specific implementation, as an embodiment, the processor 121 may include one or more CPUs, such as Figure 12 CPU0 and CPU1 in.
[0139] In a specific implementation, as an embodiment, the image processing device 20 may include multiple processors, such as Figure 121 and 127. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0140] In a specific implementation, as an embodiment, the image processing apparatus 12 may further include an output device 125 and an input device 126. The output device 125 communicates with the processor 121 and may display information in a variety of ways. For example, the output device 125 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 126 communicates with the processor 121 and may receive user input in a variety of ways. For example, the input device 126 may be a mouse, a keyboard, a touch screen device, or a sensor device.
[0141] Those skilled in the art will understand that Figure 12 The structure shown in the figure does not constitute a limitation on the image processing device 12, and the image processing device 12 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0142] In addition, the present disclosure also provides a computer-readable storage medium including instructions. When the instructions are executed by an electronic device, the electronic device executes the image processing method provided in the above embodiment.
[0143] In addition, the present disclosure also provides a computer program product, including instructions, which, when executed by an electronic device, enable the electronic device to perform the image processing method provided in the above embodiments.
[0144] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
Claims
1. An image processing method, characterized in that: The method comprises: Controlling a filter kernel of a preset filter to slide on the image to be processed with a preset step size, and when the filter kernel moves to any target area of multiple target areas of the image to be processed, obtaining pixel values of multiple pixel points in each of multiple sub-areas of the target area, wherein the filter kernel includes multiple sub-filter kernels, and each sub-filter kernel corresponds to one sub-area; Acquire a high-frequency component and a low-frequency component of each target area in a plurality of target areas of the image to be processed; Determining a first parameter value corresponding to the sub-region according to pixel values of a plurality of pixel points in the sub-region, where the first parameter value includes one or more of a variance, a standard deviation, or an average value among the pixel values of the plurality of pixel points; For each target area in the plurality of target areas, a ratio between a maximum value among the plurality of first parameter values of the target area and a first value is used as a high-frequency weight parameter corresponding to the target area, where the first value is a sum of a minimum value among the plurality of first parameter values of the target area and a preset value, where the preset value is not 0; A target sharpened image corresponding to the image to be processed is obtained according to the high-frequency weight parameters and the high-frequency components, as well as the low-frequency components, corresponding to the multiple target areas.
2. The method according to claim 1, characterized in that The step of determining a target sharpened image corresponding to the image to be processed according to the high-frequency weight parameters, the high-frequency components, and the low-frequency components corresponding to the multiple target areas includes: For each target area, determining a sharpening parameter value of the target area according to the sum of a low-frequency component of the target area and a first component, where the first component is the product of a high-frequency weight parameter corresponding to the target area and the high-frequency component; The sharpening parameter values of the multiple target areas are superimposed to obtain the target sharpened image.
3. The method according to claim 1, characterized in that The obtaining of the high-frequency component and the low-frequency component of each target area in the plurality of target areas of the image to be processed includes: Using a filter kernel of a preset filter to obtain a low-frequency component of the target area; The high-frequency component of the target area is determined according to a difference between the image information of the target area and the low-frequency component of the target area.
4. An image processing device, characterized in that The image processing device includes an acquisition unit and a determination unit; The acquisition unit is used to acquire the high-frequency component and the low-frequency component of each target area in the multiple target areas of the image to be processed; The acquisition unit is further configured to control a filter kernel of a preset filter to slide on the image to be processed with a preset step size, and when the filter kernel moves to any target area of the multiple target areas of the image to be processed, acquire pixel values of multiple pixel points in each of multiple sub-areas of the target area, wherein the filter kernel includes multiple sub-filter kernels, and each sub-filter kernel corresponds to one sub-area; The determining unit is further configured to: determine a first parameter value corresponding to the sub-region based on the multiple pixel points of the sub-region, where the first parameter value includes one or more of a variance, a standard deviation, or an average value between the pixel values of the multiple pixel points; For each target area, the determining unit is configured to use a ratio between a maximum value of a plurality of first parameter values corresponding to the target area and a first value as a high-frequency weight parameter corresponding to the target area, where the first value is a sum of a minimum value of the plurality of first parameter values of the target area and a preset value, where the preset value is not 0; The determining unit is further configured to obtain a target sharpened image corresponding to the image to be processed based on the high-frequency weight parameters and high-frequency components, as well as the low-frequency components, corresponding to the multiple regions.
5. The device according to claim 4, characterized in that The determining unit is specifically configured to: For each target area, determining a sharpening parameter value of the target area according to the sum of a low-frequency component of the target area and a first component, where the first component is the product of a high-frequency weight parameter corresponding to the target area and the high-frequency component; The sharpening parameter values of the multiple target areas are superimposed to obtain the target sharpened image.
6. The device according to claim 4, characterized in that The acquisition unit is specifically configured to: Using a filter kernel of a preset filter to obtain a low-frequency component of the target area; The high-frequency component of the target area is determined according to a difference between the image information of the target area and the low-frequency component of the target area.
7. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image processing method according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is enabled to perform the image processing method according to any one of claims 1 to 3.
9. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the image processing method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Image enhancement method and mobile terminal
CN105303543A
Method and device for determining image detection result
CN113763302A