Method, device, medium and mobile terminal for obtaining clear images

Through contrast enhancement and low-frequency filtering, difference images are obtained and superimposed and linearly mixed, which solves the universality problem of clear image acquisition solutions in mobile devices and improves the overall clarity of the image and the clarity of the edge area.

CN118446940BActive Publication Date: 2025-09-19WEILAI MOBILE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310098838.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-02
Publication Date
2025-09-19
Estimated Expiration
2043-02-02

AI Technical Summary

Technical Problem

Existing clear image acquisition solutions in mobile devices have poor universality and are difficult to maintain clarity when the environment or shooting conditions change.

Method used

By performing contrast enhancement, low-frequency filtering and difference image processing on the original image, a difference image between the filtered image and the contrast enhanced image is obtained, and then superimposed and linearly blended to improve the clarity of edge and non-edge areas.

Benefits of technology

It improves the contrast between light and dark in the image, enhances the clarity of the edge area, ensures the image clarity in different environments and conditions, and realizes the universality of clear image acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118446940B_ABST
    Figure CN118446940B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image technology, and specifically provides a method, device, medium and mobile terminal for obtaining a clear image, aiming to improve the effect of obtaining a clear image. To this end, the method provided by the present invention includes: enhancing the contrast of an original image to obtain a contrast-enhanced image, performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image, wherein the grayscale of the difference image is greater than a preset grayscale threshold. The difference image and the contrast-enhanced image are superimposed to obtain an initial clear image with improved edge area clarity, and the initial clear image and the contrast-enhanced image are linearly mixed according to the filtered image to obtain a final clear image with improved non-edge area and edge area clarity. Through the above method, the difference image is superimposed on the contrast-enhanced image to improve edge clarity, and then the initial clear image and the contrast-enhanced image are linearly mixed to improve overall clarity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image technology, and in particular to a method, device, medium and mobile terminal for acquiring a clear image. Background Art

[0002] With the development of science and technology, people use mobile devices such as mobile phones more and more frequently, and the demand for taking photos with mobile devices is also increasing. When users take photos with mobile devices, the photos taken by users may appear blurry due to factors such as ambient light and movement of the photographed object.

[0003] To improve the blurriness of photos taken by users, mobile devices often use a clear image acquisition solution to improve the clarity of photos taken by users. However, these clear image acquisition solutions implemented in mobile devices are not universally applicable. When the environment or shooting conditions change, existing clear image acquisition solutions are ineffective and fail to meet user needs.

[0004] Accordingly, a new solution is needed in this field to solve the above problems. Summary of the Invention

[0005] In order to overcome the above-mentioned defects, the present invention is proposed to provide a solution or at least partially solve the technical problem of poor universality of the solution for obtaining clear images.

[0006] In a first aspect, a method for obtaining a clear image is provided, the method comprising:

[0007] performing contrast enhancement on the original image to obtain a contrast enhanced image;

[0008] Performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image, wherein the grayscale of the difference image is greater than a preset grayscale threshold;

[0009] The difference image and the contrast-enhanced image are superimposed to obtain an initial clear image with enhanced edge area clarity;

[0010] According to the filtered image, the initial clear image and the contrast enhanced image are linearly mixed to obtain a final clear image that improves the clarity of both non-edge areas and edge areas.

[0011] In one technical solution of the above-mentioned method for obtaining a clear image, the step of "performing a low-frequency filter on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image" specifically includes:

[0012] Step S1: obtaining initial filtering parameters of low-frequency filtering;

[0013] Step S2: performing low-frequency filtering on the original image according to the initial filtering parameters to obtain a filtered image;

[0014] Step S3: obtaining a difference image between the filtered image and the contrast-enhanced image;

[0015] Step S4: determining whether the grayscale of the difference image is greater than a preset grayscale threshold;

[0016] If yes, stop low-frequency filtering the original image and output the difference image;

[0017] If not, the filtering parameters are adjusted and the process goes to step S2 to perform low-frequency filtering on the original image again according to the adjusted filtering parameters to obtain a filtered image.

[0018] In one technical solution of the above method for obtaining a clear image, before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold”, the method further includes:

[0019] Count the number of times low-frequency filtering is performed on the original image;

[0020] Determine whether the number of times is greater than a preset number threshold;

[0021] If yes, stop low-frequency filtering the original image and output the difference image;

[0022] If not, continue to execute the step of "determining whether the grayscale of the difference image is greater than a preset grayscale threshold value".

[0023] In one technical solution of the above method for obtaining a clear image, before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold”, the method further includes:

[0024] Get the grayscale of each pixel on the difference image respectively;

[0025] The grayscale of all pixels is summed up and the result of the summation is used as the grayscale of the difference image.

[0026] In one technical solution of the above-mentioned method for obtaining a clear image, the step of "superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity" specifically includes:

[0027] Perform enhancement processing on the difference image to obtain a high-contrast image;

[0028] The high-contrast image and the contrast-enhanced image are superimposed to obtain an initial clear image with improved edge area clarity.

[0029] In one technical solution of the above-mentioned method for obtaining a clear image, the step of "enhancing the difference image to obtain a high-contrast image" specifically includes:

[0030] Get the enhancement coefficient, which is greater than or equal to 1;

[0031] According to the enhancement coefficient and the following formula, the difference image is enhanced:

[0032] Idiff2=k*Idiff1

[0033] Where k represents the enhancement coefficient, Idiff1 represents the difference image, and Idiff2 represents the high-contrast image.

[0034] In one technical solution of the above-mentioned method for obtaining a clear image, the step of "linearly blending the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image that improves the clarity of both the non-edge area and the edge area" specifically includes:

[0035] According to the grayscale of the pixels in the filtered image, the weights of the initial clear image and the contrast enhanced image are determined respectively;

[0036] According to the weights, a linear weighted sum is calculated for the initial clear image and the contrast-enhanced image to obtain the final clear image.

[0037] In one technical solution of the above-mentioned method for obtaining a clear image, the step of "determining the weights of the initial clear image and the contrast-enhanced image according to the grayscale of the pixels in the filtered image" specifically includes:

[0038] Obtaining the grayscale difference between the grayscale of each pixel in the filtered image and a preset grayscale upper limit value;

[0039] The grayscale difference corresponding to each pixel in the filtered image is used as the weight of each pixel in the initial clear image;

[0040] The grayscale of each pixel in the filtered image is used as the weight of each pixel in the contrast enhanced image.

[0041] In one technical solution of the above-mentioned method for obtaining a clear image, after the step of “linearly blending the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image that improves the clarity of both the non-edge area and the edge area”, the method further includes:

[0042] Add random noise to the final clear image.

[0043] In a second aspect, a computer device is provided, which includes a processor and a storage device, wherein the storage device is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the clear image acquisition method described in any one of the technical solutions of the above-mentioned clear image acquisition method.

[0044] In a third aspect, a computer-readable storage medium is provided, which stores a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the method for obtaining a clear image as described in any one of the technical solutions of the above-mentioned method for obtaining a clear image.

[0045] In a fourth aspect, a mobile terminal is provided, wherein the mobile terminal includes the computer device described in the above-mentioned computer device technical solution.

[0046] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:

[0047] In the technical solution of the present invention, by increasing the contrast of the original image, the light and dark contrast of the original image is enhanced, and the subjective visual effect of the image is improved. By performing low-frequency filtering on the original image, a filtered image in which the edge area of ​​the image is filtered can be obtained. A difference image is obtained between a filtered image with a grayscale greater than a preset grayscale threshold and a contrast-enhanced image, ensuring that the edge area of ​​the original image is included in the difference image, thereby avoiding the problem of not being able to obtain the edge area of ​​the original image due to various factors, which ultimately leads to the inability to obtain a clear image. The difference image containing the edge area of ​​the original image is then superimposed with the contrast-enhanced image to obtain an initial clear image with improved clarity of the edge area. The initial clear image is then linearly mixed with the contrast-enhanced image, so that the final clear image obtained can simultaneously improve the clarity of both the non-edge area and the edge area, thereby ensuring the universality of the method for obtaining a clear image.

[0048] Solution 1. A method for obtaining a clear image, characterized in that the method comprises:

[0049] performing contrast enhancement on the original image to obtain a contrast enhanced image;

[0050] Performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image, wherein the grayscale of the difference image is greater than a preset grayscale threshold;

[0051] Superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity;

[0052] According to the filtered image, the initial clear image and the contrast-enhanced image are linearly mixed to obtain a final clear image that improves the clarity of both the non-edge area and the edge area.

[0053] Solution 2. The method for obtaining a clear image according to Solution 1 is characterized in that the step of "performing a low-frequency filter on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image" specifically includes:

[0054] Step S1: obtaining initial filtering parameters of low-frequency filtering;

[0055] Step S2: performing low-frequency filtering on the original image according to the initial filtering parameters to obtain a filtered image;

[0056] Step S3: obtaining a difference image between the filtered image and the contrast-enhanced image;

[0057] Step S4: determining whether the grayscale of the difference image is greater than a preset grayscale threshold;

[0058] If yes, stop performing low-frequency filtering on the original image and output the difference image;

[0059] If not, the filtering parameters are adjusted, and the process goes to step S2 to perform low-frequency filtering on the original image again according to the adjusted filtering parameters to obtain a filtered image.

[0060] Solution 3. The method for obtaining a clear image according to Solution 2 is characterized in that, before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold,” the method further comprises:

[0061] Counting the number of times low-frequency filtering is performed on the original image;

[0062] Determining whether the number of times is greater than a preset number threshold;

[0063] If yes, stop performing low-frequency filtering on the original image and output the difference image;

[0064] If not, continue to execute the step of "determining whether the grayscale of the difference image is greater than a preset grayscale threshold."

[0065] Solution 4. The method for obtaining a clear image according to Solution 2 is characterized in that, before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold,” the method further comprises:

[0066] Obtaining the grayscale of each pixel on the difference image respectively;

[0067] The grayscales of all pixels are summed up, and the summation result is used as the grayscale of the difference image.

[0068] Solution 5. The method for obtaining a clear image according to Solution 1 is characterized in that the step of "superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity" specifically comprises:

[0069] Performing enhancement processing on the difference image to obtain a high-contrast image;

[0070] The high-contrast image and the contrast-enhanced image are superimposed to obtain an initial clear image with improved edge area clarity.

[0071] Solution 6. The method for obtaining a clear image according to Solution 5 is characterized in that the step of "enhancing the difference image to obtain a high-contrast image" specifically includes:

[0072] Obtaining an enhancement coefficient, where the enhancement coefficient is greater than or equal to 1;

[0073] The difference image is enhanced according to the enhancement coefficient and the following formula:

[0074] Idiff2=k*Idiff1

[0075] Where k represents the enhancement coefficient, Idiff1 represents the difference image, and Idiff2 represents the high-contrast image.

[0076] Solution 7. The method for obtaining a clear image according to Solution 1 is characterized in that the step of “linearly blending the initial clear image with the contrast-enhanced image based on the filtered image to obtain a final clear image that improves the clarity of both the non-edge area and the edge area” specifically comprises:

[0077] Determining weights of the initial clear image and the contrast-enhanced image respectively according to the grayscale of pixels in the filtered image;

[0078] According to the weights, a linear weighted sum calculation is performed on the initial clear image and the contrast-enhanced image to obtain the final clear image.

[0079] Solution 8. The method for obtaining a clear image according to Solution 7 is characterized in that the step of "determining the weights of the initial clear image and the contrast-enhanced image according to the grayscale of the pixels in the filtered image" specifically includes:

[0080] Obtaining the grayscale difference between the grayscale of each pixel in the filtered image and a preset grayscale upper limit value;

[0081] The grayscale difference corresponding to each pixel in the filtered image is used as the weight of each pixel in the initial clear image;

[0082] The grayscale of each pixel in the filtered image is used as the weight of each pixel in the contrast enhanced image.

[0083] Solution 9. The method for obtaining a clear image according to Solution 1 is characterized in that, after the step of “linearly blending the initial clear image with the contrast-enhanced image based on the filtered image to obtain a final clear image that improves the clarity of both non-edge areas and edge areas,” the method further comprises:

[0084] Random noise is added to the final clear image.

[0085] Solution 10. A computer device comprising a processor and a storage device, wherein the storage device is suitable for storing multiple program codes, and is characterized in that the program codes are suitable for being loaded and run by the processor to execute the method for obtaining a clear image according to any one of Solutions 1 to 9.

[0086] Solution 11. A computer-readable storage medium storing a plurality of program codes, wherein the program codes are suitable for being loaded and executed by a processor to execute the method for acquiring a clear image according to any one of Solutions 1 to 10.

[0087] Solution 12. A mobile terminal, characterized in that the mobile terminal includes the computer device described in Solution 11. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. Those skilled in the art will readily appreciate that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Among them:

[0089] Figure 1 1 is a flow chart showing the main steps of a method for obtaining a clear image according to an embodiment of the present invention;

[0090] Figure 2 is a comparison diagram of an original image and a contrast-enhanced image according to an embodiment of the present invention;

[0091] Figure 3 1 is a flow chart of main steps for obtaining a difference image between a filtered image and a contrast-enhanced image according to one embodiment of the present invention;

[0092] Figure 4 is a comparison diagram of an original image, a filtered image, and a difference image according to an embodiment of the present invention;

[0093] Figure 5 is a comparison diagram of an original image and an image after adding noise according to an embodiment of the present invention;

[0094] Figure 6 FIG. 1 is a schematic diagram of the main structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0095] Some embodiments of the present invention are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0096] In the description of the present invention, a "processor" may include hardware, software, or a combination of both. A processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. A processor has data and / or signal processing capabilities. A processor may be implemented in software, hardware, or a combination of both. Non-transitory computer-readable storage media include any suitable medium capable of storing program code, such as a magnetic disk, a hard disk, an optical disk, flash memory, read-only memory, random access memory, and the like.

[0097] The following describes an embodiment of a method for obtaining a clear image provided by the present invention.

[0098] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart showing the main steps of a method for obtaining a clear image according to an embodiment of the present invention. Figure 1 As shown, the method for obtaining a clear image in the embodiment of the present invention mainly includes the following steps S101 to S104.

[0099] Step S101: performing contrast enhancement on the original image to obtain a contrast-enhanced image.

[0100] Image contrast refers to the measurement of the different brightness levels between the brightest white and the darkest black in the light and dark areas of an image, that is, the size of the grayscale contrast of an image. Figure 2 As shown, a greater grayscale contrast in an image represents a greater contrast, while a smaller grayscale contrast in an image represents a smaller contrast. The purpose of contrast enhancement is to increase the grayscale range of an image, thereby making the image clearer. The method for contrast enhancement of an image can employ methods commonly used by those skilled in the art, such as an image enhancement algorithm based on histogram equalization, an image enhancement algorithm based on a Laplacian operator, or an image enhancement algorithm based on a gamma transform. The embodiments of the present invention are not limited to the method for contrast enhancement of the original image.

[0101] Step S102: performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image, wherein the grayscale of the difference image is greater than a preset grayscale threshold.

[0102] Low-frequency filtering is a filtering method that allows low-frequency signals to pass normally, while blocking and weakening high-frequency signals that exceed a set threshold. An edge region refers to edge information, such as the outline, of an object in the original image and / or the edge information, such as the outline, of local regions within the object. For example, if the original image contains a face, the edge region refers to the edge information of the face, including the facial features and hair.

[0103] The edge area of ​​the filtered image obtained by low-frequency filtering the original image will become blurred, while the non-edge area will change less. The method for obtaining the difference image between the filtered image and the contrast-enhanced image can adopt a method of traversing the pixels and subtracting the corresponding RGBA values ​​of the pixels. Of course, other methods commonly used by those skilled in the art can also be adopted, which will not be repeated here. The difference image between the filtered image and the contrast-enhanced image mainly contains the edge details of the original image. Therefore, the larger the grayscale value of the difference image, the more complete the edge details contained in the difference image, and the clearer the edge details contained in the difference image. When the grayscale of the difference image is greater than the preset grayscale threshold, it means that the difference image already contains the edge details of the original image, and the edge details of the original image contained in the difference image are clear.

[0104] Step S103: superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity.

[0105] Because the difference image contains edge details of the original image, superimposing the difference image with the contrast-enhanced image can obtain an initial clear image with improved edge clarity. The method of superimposing the difference image with the contrast-enhanced image is a common method used by those skilled in the art and will not be described in detail here.

[0106] Step S104: linearly blending the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image that improves the clarity of both the non-edge area and the edge area.

[0107] Linear blending of the initial clear image and the contrast-enhanced image involves linearly adding the RGBA values ​​of pixels at the same location in the initial clear image and the contrast-enhanced image with different weights to form the initial clear image. For example, the resulting value is assigned to the pixel at the same location in the target image, and the resulting target image is the initial clear image. Because the initial clear image improves the clarity of edge regions, while the contrast-enhanced image improves the clarity of non-edge regions, linear blending of the initial clear image and the contrast-enhanced image yields a final clear image that improves the clarity of both non-edge and edge regions.

[0108] Based on the method described in steps S101 to S104 above, by increasing the contrast of the original image, the light and dark contrast of the original image is enhanced, and the subjective visual effect of the image is improved. By performing low-frequency filtering on the original image, a filtered image with the edge area of ​​the image filtered can be obtained. Obtaining a difference image between a filtered image with a grayscale greater than a preset grayscale threshold and a contrast-enhanced image ensures that the edge area of ​​the original image is included in the difference image, avoiding the problem of being unable to obtain the edge area of ​​the original image due to various factors, and ultimately resulting in an inability to obtain a clear image. Then, the difference image containing the edge area of ​​the original image is superimposed with the contrast-enhanced image to obtain an initial clear image with improved clarity of the edge area. Then, the initial clear image and the contrast-enhanced image are linearly mixed, so that the final clear image can simultaneously improve the clarity of both the non-edge area and the edge area, ensuring the universality of the method for obtaining a clear image.

[0109] The above steps S102 to S104 are further explained below.

[0110] 1. Explain step S102.

[0111] See attached Figure 3 , Figure 3 FIG. 1 is a flow chart showing the main steps of obtaining a difference image between a filtered image and a contrast-enhanced image according to the present invention. Figure 3 As shown, in a possible implementation manner according to the present invention, the step of “performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image (the aforementioned step S102)” specifically includes the following steps S201 to S206:

[0112] Step S201: Acquire initial filtering parameters of low-frequency filtering.

[0113] When filtering an image, it is necessary to obtain the filtering parameters. Taking Gaussian filtering as an example, the filtering parameters include the size of the Gaussian kernel. When Gaussian filtering an image, it is first necessary to determine the size of the Gaussian kernel used for Gaussian filtering. When using other low-frequency filtering methods to filter the image, it is also necessary to first determine the filtering parameters.

[0114] Step S202: performing low-frequency filtering on the original image according to the initial filtering parameters to obtain a filtered image.

[0115] After obtaining the initial filtering parameters, the original image can be filtered using low-frequency filtering methods commonly used by those skilled in the art, such as Butterworth low-frequency filtering and Gaussian filtering. The embodiment of the present invention does not limit the specific method of low-frequency filtering of the original image.

[0116] In a preferred embodiment, a discretized window sliding convolution can be used to perform Gaussian filtering on the original image. After determining the initial filtering parameters, that is, determining the Gaussian kernel size, a convolution operation can be performed on the original image within the window until the window has traversed the entire original image. The methods for performing the convolution operation on the original image and traversing the original image with a window can adopt methods commonly used in the art and are not limited in the present embodiment.

[0117] Step S203: obtaining a difference image between the filtered image and the contrast-enhanced image.

[0118] The method for obtaining the difference image is the same as that in step S102, and will not be described in detail here. Figure 4 As shown in FIG, the original image is subjected to low-frequency filtering to obtain a filtered image, and a difference image can be obtained based on the filtered image and the contrast-enhanced image.

[0119] Step S204: Determine whether the grayscale of the difference image is greater than a preset grayscale threshold. If so, execute step S205; if not, execute step S206.

[0120] The grayscale of the difference image represents the detail of the edge region contained in the difference image. Therefore, if the grayscale of the difference image is less than a preset grayscale threshold, it indicates that the difference image contains less detail in the edge region and may not meet the requirements of subsequent processing. It should be noted that the value of the preset grayscale threshold can be set by those skilled in the art based on actual needs, and the embodiments of the present invention do not limit the specific value of the preset grayscale threshold.

[0121] Step S205: Stop low-frequency filtering of the original image and output a difference image.

[0122] Step S206: Adjust the filtering parameters and go to step S202 to perform low-frequency filtering on the original image again according to the adjusted filtering parameters to obtain a filtered image.

[0123] Since the grayscale of the difference image is less than the preset grayscale threshold, that is, the difference image contains fewer details in the edge area, which will affect the subsequent steps of obtaining a clear image. Therefore, it is necessary to adjust the filtering parameters and re-filter the original image to improve the details of the edge area contained in the difference image.

[0124] Based on the method described in steps S201 to S206 above, when the grayscale value of the difference image between the filtered image and the contrast-enhanced image is less than or equal to the preset grayscale threshold, by adjusting the filtering parameters and re-filtering the original image, the number of pixels in the edge area contained in the obtained filtered image can be reduced, thereby increasing the number of pixels in the edge area contained in the difference image, thereby making the details of the edge area in the difference image clearer.

[0125] When the grayscale of the difference image is less than or equal to the preset grayscale threshold, it is necessary to adjust the filtering parameters and perform low-frequency filtering on the original image again. If the grayscale of the difference image is still less than or equal to the preset grayscale threshold after adjusting the filtering parameters multiple times, it means that no matter how the filtering parameters are adjusted, the grayscale of the difference image may not be greater than the preset grayscale threshold. At this time, the adjustment of the filtering parameters should be stopped to avoid falling into a loop, failing to output the difference image, and then failing to continue with the subsequent steps.

[0126] In one possible implementation of the present invention, before the step of "determining whether the grayscale of the difference image is greater than a preset grayscale threshold (the aforementioned step S204)", the following steps 11 to 14 are further included to control whether to stop performing low-frequency filtering on the original image:

[0127] Step 11: Count the number of times low-frequency filtering is performed on the original image.

[0128] Step 12: Determine whether the number of times is greater than a preset number threshold, if so, execute step 13, if not, execute step 14.

[0129] The preset number threshold can be set by those skilled in the art according to actual needs. When the number is greater than the preset number threshold, it means that the difference image that meets the needs may not be obtained after low-frequency filtering of the original image.

[0130] Step 13: Stop low-frequency filtering of the original image and output the difference image.

[0131] Step 14: Continue to execute the step of “determining whether the grayscale of the difference image is greater than the preset grayscale threshold (the aforementioned step 12)”.

[0132] Based on the method described in steps 11 to 14 above, the number of times the original image is low-frequency filtered is counted. When the number of filtering times is greater than a preset threshold, the low-frequency filtering of the original image is stopped, thereby avoiding the process of obtaining the difference image from falling into a loop, being unable to output the difference image, and thus being unable to continue to execute subsequent steps.

[0133] In one possible implementation of the present invention, before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold (the aforementioned step S204)”, the grayscale of the difference image is obtained through the following steps 21 to 22:

[0134] Step 21: Obtain the grayscale of each pixel on the difference image.

[0135] Grayscale values ​​typically range from 0 to 255, indicating brightness from dark to light, corresponding to black to white in the image. By obtaining the numerical value corresponding to the grayscale attribute of each pixel in the difference image, the grayscale of each pixel in the difference image can be obtained.

[0136] Step 22: The grayscale values ​​of all pixels are summed up, and the result of the summation is used as the grayscale value of the difference image.

[0137] Based on the method described in steps 21 to 22 above, the grayscale of all pixels is summed up. Compared with calculating the grayscale average of each pixel or other methods of determining the grayscale of the difference image, the summation calculation can improve the speed of obtaining the grayscale of the difference image while accurately obtaining the grayscale of the difference image.

[0138] 2. Explain step S103.

[0139] In one possible implementation of the present invention, the step of “superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity (the aforementioned step S103)” specifically includes obtaining the initial clear image with improved edge area clarity through the following steps 31 to 32:

[0140] Step 31: Perform enhancement processing on the difference image to obtain a high-contrast image.

[0141] The high-contrast image is obtained by enhancing the difference image. Therefore, the high-contrast image includes higher definition at the edge of the original image. The difference image enhancement process can be performed using methods commonly used in the art. The embodiments of the present invention are not limited to the specific method for enhancing the difference image.

[0142] Step 32: Superimpose the high-contrast image and the contrast-enhanced image to obtain an initial clear image with enhanced edge area clarity.

[0143] Since the high-contrast image contains edge regions with higher clarity than the original image, superimposing the high-contrast image with the contrast-enhanced image can obtain an initial clear image with improved clarity of the edge regions.

[0144] Based on the method described in steps 31 and 32 above, by enhancing the difference image containing the edge region of the original image to obtain a high-contrast image, the clarity of the edge region of the original image contained in the difference image can be further improved. The high-contrast image with improved edge region clarity is superimposed with the contrast-enhanced image to obtain an initial clear image with improved edge region clarity.

[0145] In a possible implementation of the present invention, the step of “performing enhancement processing on the difference image to obtain a high-contrast image (the aforementioned step 31)” specifically includes the following steps 41 to 42:

[0146] Step 41: Obtain an enhancement coefficient, which is greater than or equal to 1.

[0147] The larger the enhancement coefficient, the more pronounced the effect of enhancing the difference image. The enhancement coefficient can be set by those skilled in the art based on actual needs, and the embodiment of the present invention does not limit the value of the enhancement coefficient. It should be noted that when the enhancement coefficient is 1, the difference image is the same as the high-contrast image.

[0148] Step 42: Enhance the difference image according to the enhancement coefficient and the following formula:

[0149] Idiff2=k*Idiff1

[0150] Where k is the enhancement coefficient, Idiff1 is the difference image, and Idiff2 is the high-contrast image. By traversing all pixels in the difference image and multiplying the RGBA value of each pixel by k, a high-contrast image can be obtained.

[0151] By enhancing the difference image using the method of steps 41 to 42, the difference between the pixel values ​​in the edge area and the pixel values ​​in the non-edge area in the difference image can be increased, thereby obtaining a clearer high-contrast image in the edge area.

[0152] 3. Explain step S104.

[0153] The initial clarity image improves the clarity of the edge area of ​​the original image and retains the clarity of the non-edge area of ​​the original image. Linearly blending the initial clarity image with the contrast-enhanced image can further improve the overall clarity of the original image.

[0154] In a possible embodiment of the present invention, the step of “linearly mixing the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image that improves the clarity of both the non-edge area and the edge area (the aforementioned step S104)” specifically includes the following steps 51 to 52:

[0155] Step 51: Determine the weights of the initial clear image and the contrast-enhanced image respectively according to the grayscale of the pixels in the filtered image.

[0156] Step 52: Perform a linear weighted sum calculation on the initial clear image and the contrast-enhanced image according to the weights to obtain a final clear image.

[0157] The linear weighted sum calculation of the initial clear image and the contrast enhanced image can be performed using conventional methods in the art, which will not be described in detail here.

[0158] Based on the method described in steps 51 to 52 above, the weights of the initial clear image and the contrast-enhanced image are first determined according to the grayscale of the pixels in the filtered image, and then the initial clear image that improves the clarity of the edge area and retains the clarity of the non-edge area and the contrast-enhanced image are linearly mixed according to the weights, thereby further improving the overall clarity of the original image.

[0159] In a possible implementation of the present invention, the step of “determining the weights of the initial clear image and the contrast-enhanced image according to the grayscale of each pixel in the filtered image (the aforementioned step 51)” specifically includes the following steps 61 to 63:

[0160] Step 61: Obtain the grayscale difference between the grayscale of each pixel in the filtered image and a preset grayscale upper limit value.

[0161] The preset grayscale upper limit can be set as needed. Typically, those skilled in the art set the preset grayscale upper limit to 255. For example, if the grayscale value of a pixel in the filtered image is 235 and the preset grayscale upper limit is 255, then the grayscale difference at that pixel is 255-235=20. The filtered image is obtained through low-pass filtering, so the grayscale of pixels in the edge areas of the filtered image is lowered, while the grayscale of pixels in non-edge areas remains unchanged.

[0162] Step 62: The grayscale difference corresponding to each pixel in the filtered image is used as the weight of each pixel in the initial clear image.

[0163] In the filtered image, the grayscale of pixels in non-edge areas remains unchanged, while the grayscale of pixels in edge areas becomes lower due to filtering, for example, to 0. At this point, the grayscale difference of pixels in the edge areas is relatively large. Using this grayscale difference as the weight of the pixels in the initial clear image can increase the RGBA values ​​of the pixels in the edge areas in the initial clear image, thereby increasing the grayscale of the pixels in the edge areas and improving the clarity of the edge areas.

[0164] Step 63: The grayscale of each pixel in the filtered image is used as the weight of each pixel in the contrast enhanced image.

[0165] As mentioned above, in the filtered image, the grayscale of the pixels in the non-edge area remains unchanged, while the grayscale of the pixels in the edge area becomes lower due to filtering. Therefore, using the grayscale of each pixel in the filtered image as the weight of each pixel in the contrast-enhanced image can increase the RGBA value of the pixels in the non-edge area of ​​the contrast-enhanced image, thereby improving the grayscale of the pixels in the non-edge area, thereby improving the clarity of the non-edge area in the final clear image.

[0166] By determining the weights of the initial clear image and the contrast-enhanced image using the method described in steps 61 to 63 above, the RGBA values ​​of the pixels in the non-edge area of ​​the contrast-enhanced image and the pixels in the edge area of ​​the clear image can be increased, thereby increasing the grayscale values ​​of the pixels in the non-edge area of ​​the contrast-enhanced image and the grayscale values ​​of the pixels in the edge area of ​​the clear image, so that the final clear image linearly mixed according to the above weights can simultaneously improve the clarity of the edge area and the non-edge area of ​​the original image.

[0167] Since the human eye is more sensitive to the texture of an image, it is possible to improve the human eye's perception of the image by adding virtual texture to the image.

[0168] In one possible embodiment of the present invention, after the step of “linearly blending the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image with improved clarity in both the non-edge area and the edge area (the aforementioned step S104)”, the following method is further included to improve the appearance of the final clear image:

[0169] Add random noise to the final clear image.

[0170] As an example, you can set random noise noise = fract(sin(dot(uv, vec2(12.9898, 78.233)))*437580.5453)

[0171] Among them, the fract() function is used to find the decimal part of a number, sin is the sine function, dot is the inner product function, UV value is the texture coordinate, U represents the distribution on the horizontal coordinate, V represents the distribution on the vertical coordinate, vec2 represents a two-dimensional vector, 12.9898, 78.233, and 437580.5453 are random numbers, which can be modified by those skilled in the art.

[0172] Then, the aforementioned random noise is superimposed on the final clear image using the following formula:

[0173] Ifin=Idst*(1-0.02*intensity)+vec3(noise*0.035*intensity)

[0174] The method for setting random noise can adopt the random noise acquisition method commonly used in the art, and the present invention does not limit the method for setting random noise. Ifin refers to the image after adding random noise, intensity is the noise intensity value, and Idst is the final clear image mentioned above. The image after adding random noise is as follows: Figure 5 shown.

[0175] By adding random noise to the final clear image, a final clear image containing virtual texture can be obtained, thereby improving the perception of the final clear image by human eyes.

[0176] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.

[0177] Those skilled in the art will appreciate that all or part of the processes in the method for implementing the above-mentioned embodiment of the present invention may also be accomplished by instructing the relevant hardware through a computer program. The computer program may be stored in a computer-readable storage medium. When the computer program is executed by a processor, it may implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal, and software distribution medium capable of carrying the computer program code. It should be noted that the content contained in the computer-readable storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0178] Furthermore, the present invention also provides a computer device.

[0179] See attached Figure 6 , Figure 6 FIG. 1 is a schematic diagram of the main structure of a computer device embodiment applied to a mobile terminal according to the present invention. Figure 6 As shown, the computer device in the embodiment of the present invention primarily includes a storage device 61 and a processor 62. The storage device 61 can be configured to store a program for executing the method for obtaining a clear image according to the method embodiment applied to a mobile terminal, and the processor 62 can be configured to execute the program in the storage device, including but not limited to a program for executing the method for obtaining a clear image according to the method embodiment. For ease of illustration, only the portions relevant to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method section of the embodiment of the present invention.

[0180] In some possible implementations, the computer device may include multiple storage devices and multiple processors. The program for executing the method for obtaining a clear image of the above-mentioned method embodiment may be divided into multiple subroutines, each of which may be loaded and run by a processor to execute different steps of the method for obtaining a clear image of the above-mentioned method embodiment. Specifically, each subroutine may be stored in a different storage device, and each processor may be configured to execute the program in one or more storage devices to jointly implement the method for obtaining a clear image of the above-mentioned method embodiment, that is, each processor executes different steps of the method for obtaining a clear image of the above-mentioned method embodiment to jointly implement the method for obtaining a clear image of the above-mentioned method embodiment.

[0181] The multiple processors may be processors deployed on the same device. For example, the controller may be a high-performance device composed of multiple processors, and the multiple processors may be processors configured on the high-performance device. In addition, the multiple processors may also be processors deployed on different devices.

[0182] Furthermore, the present invention also provides a computer-readable storage medium.

[0183] In an embodiment of a computer-readable storage medium according to the present invention, the computer-readable storage medium can be configured to store a program for executing the method for obtaining a clear image in the above-mentioned method embodiment. The program can be loaded and executed by a processor to implement the above-mentioned method for obtaining a clear image. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method section of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-transitory computer-readable storage medium.

[0184] Furthermore, the present invention also provides a mobile terminal.

[0185] In an embodiment of a mobile terminal according to the present invention, the mobile terminal may include the aforementioned computer device. Types of mobile terminals include but are not limited to smart phones, tablet computers, and other wearable devices.

[0186] Thus far, the technical solution of the present invention has been described in conjunction with an embodiment shown in the accompanying drawings. However, it is readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present invention.

Claims

1. A method for obtaining a clear image, characterized in that: The method comprises: performing contrast enhancement on the original image to obtain a contrast enhanced image; Performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image, wherein the grayscale of the difference image is greater than a preset grayscale threshold; Superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity; linearly blending the initial clear image with the contrast-enhanced image according to the filtered image to obtain a final clear image that improves the clarity of both non-edge areas and edge areas; The step of “linearly blending the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image that simultaneously improves the clarity of non-edge areas and edge areas” specifically includes: Determining weights of the initial clear image and the contrast-enhanced image respectively according to the grayscale of pixels in the filtered image; According to the weights, a linear weighted sum calculation is performed on the initial clear image and the contrast-enhanced image to obtain the final clear image.

2. The method for obtaining a clear image according to claim 1, wherein: The step of “performing low-frequency filtering on the original image to obtain a filtered image, and obtaining a difference image between the filtered image and the contrast-enhanced image” specifically includes: Step S1: obtaining initial filtering parameters of low-frequency filtering; Step S2: performing low-frequency filtering on the original image according to the initial filtering parameters to obtain a filtered image; Step S3: obtaining a difference image between the filtered image and the contrast-enhanced image; Step S4: determining whether the grayscale of the difference image is greater than a preset grayscale threshold; If yes, stop performing low-frequency filtering on the original image and output the difference image; If not, the filtering parameters are adjusted, and the process goes to step S2 to perform low-frequency filtering on the original image again according to the adjusted filtering parameters to obtain a filtered image.

3. The method for obtaining a clear image according to claim 2, wherein: Before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold”, the method further includes: Counting the number of times low-frequency filtering is performed on the original image; Determining whether the number of times is greater than a preset number threshold; If yes, stop performing low-frequency filtering on the original image and output the difference image; If not, continue to execute the step of "determining whether the grayscale of the difference image is greater than a preset grayscale threshold." 4. The method for obtaining a clear image according to claim 2, wherein: Before the step of “determining whether the grayscale of the difference image is greater than a preset grayscale threshold”, the method further includes: Obtaining the grayscale of each pixel on the difference image respectively; The grayscales of all pixels are summed up, and the summation result is used as the grayscale of the difference image.

5. The method for obtaining a clear image according to claim 1, wherein: The step of “superimposing the difference image and the contrast-enhanced image to obtain an initial clear image with improved edge area clarity” specifically includes: Performing enhancement processing on the difference image to obtain a high-contrast image; The high-contrast image and the contrast-enhanced image are superimposed to obtain an initial clear image with improved edge area clarity.

6. The method for obtaining a clear image according to claim 5, wherein: The step of “performing enhancement processing on the difference image to obtain a high-contrast image” specifically includes: Obtaining an enhancement coefficient, where the enhancement coefficient is greater than or equal to 1; The difference image is enhanced according to the enhancement coefficient and the following formula: Idiff2=k*Idiff1 Where k represents the enhancement coefficient, Idiff1 represents the difference image, and Idiff2 represents the high-contrast image.

7. The method for obtaining a clear image according to claim 1, wherein: The step of “determining the weights of the initial clear image and the contrast enhanced image respectively according to the grayscale of the pixels in the filtered image” specifically includes: Obtaining the grayscale difference between the grayscale of each pixel in the filtered image and a preset grayscale upper limit value; The grayscale difference corresponding to each pixel in the filtered image is used as the weight of each pixel in the initial clear image; The grayscale of each pixel in the filtered image is used as the weight of each pixel in the contrast enhanced image.

8. The method for obtaining a clear image according to claim 1, wherein: After the step of “linearly blending the initial clear image and the contrast-enhanced image according to the filtered image to obtain a final clear image that simultaneously improves the clarity of non-edge areas and edge areas”, the method further includes: Random noise is added to the final clear image.

9. A computer device comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, wherein: The program code is suitable for being loaded and executed by the processor to execute the method for acquiring a clear image according to any one of claims 1 to 8.

10. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the method for acquiring a clear image according to any one of claims 1 to 8.

11. A mobile terminal, characterized in that: The mobile terminal includes the computer device according to claim 9.

Citation Information

Patent Citations

  • Method and system for improving image definition, storage medium and electronic equipment

    CN113744145A

  • High-dynamic infrared image detail enhancement method and system and computer storage medium

    CN115587945A