Image Processing Method, Image Processing Apparatus, Electronic Device, and Readable Storage Medium
By performing area division and covariance adjustment on the blurred image, the problem of water ripple in the gradient area of the image is solved, and a better visual effect of the image is achieved.
Patent Information
- Application Number
- CN202210422995.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-04-21
AI Technical Summary
When the prior art blurs the image, water ripples are easily seen in the gradient area, affecting the visual effect of the image.
By performing area division processing on the blurred image, the covariance of each pixel point is determined, and the pixel value is adjusted according to the preset numerical range to remove water ripple phenomenon.
Effectively remove water ripple in the image, making the image smoother and more delicate, and improving the visual effect.
Smart Images

Figure CN114708142B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of image processing, and particularly relates to an image processing method, an image processing device, an electronic device, and a readable storage medium. Background Art
[0002] In the prior art, when blurring an image, due to the limitation of the processing precision of each channel of the image, moire phenomena often occur in the gradient regions of the blurred image, and the more gradient regions the image has, the more obvious the moire phenomena are, which affects the visual effect of the image. Summary of the Invention
[0003] The purpose of the embodiments of this application is to provide an image processing method, an image processing device, an electronic device, and a readable storage medium, which can solve the problem that moire phenomena occur when blurring an image, thus affecting the visual effect of the image.
[0004] In a first aspect, the embodiments of this application provide an image processing method, which includes: performing region division processing on a first image after blurring; determining N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point positions; determining the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point; and adjusting the pixels of the first image according to the comparison result between the covariance and a preset numerical range to obtain a target image.
[0005] In a second aspect, the embodiments of this application provide an image processing device, which includes: a processing unit configured to perform region division processing on a first image after blurring; determine N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point positions; determine the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point; and adjust the pixels of the first image according to the comparison result between the covariance and a preset numerical range to obtain a target image.
[0006] In a third aspect, the embodiments of this application provide an electronic device, which includes a processor and a memory, and the memory stores a program or instructions that can run on the processor. When the program or instructions are executed by the processor, the steps of the image processing method as in the first aspect are implemented.
[0007] In a fourth aspect, the embodiments of this application provide a readable storage medium, on which a program or instructions are stored. When the program or instructions are executed by the processor, the steps of the image processing method as in the first aspect are implemented.
[0008] Fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run programs or instructions to implement the steps of the image processing method as in the first aspect.
[0009] Sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the image processing method as in the first aspect.
[0010] In the embodiment of the present application, the first image after blurring processing is subjected to region division processing; according to a preset pixel position offset and pixel point positions, N second pixel points corresponding to N first pixel points in each region after region division in the first image are determined; the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point is determined; and the pixels of the first image are adjusted according to the comparison result between the covariance and a preset numerical range to obtain a target image. Through the above image processing method, the first image after blurring processing is subjected to region division processing, and then, according to the preset pixel position offset and the regional positions of each pixel point in the first image, the second pixel points corresponding to each first pixel point in each region in the first image are determined. Then, the covariance between the first pixel value of the first pixel point and the second pixel value of the second pixel point is determined, and the covariance is compared with the preset numerical range. Then, according to the comparison result of the two, the pixels of the first image are adjusted, so as to obtain a target image. In this way, by combining the pixel remapping algorithm to perform targeted adjustment on the pixel values of each region in the first image after blurring processing, the moire phenomenon generated in the gradient region of the first image after blurring processing can be effectively removed, so that the obtained target image is smoother and more delicate, and the visual effect of the target image is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a schematic flowchart of the image processing method provided by the embodiment of the present application;
[0012] Figure 2 is a schematic operation flowchart of the image processing method provided by the embodiment of the present application;
[0013] Figure 3 is a schematic diagram of a random graph provided by the embodiment of the present application;
[0014] Figure 4 is a schematic diagram of the pixel remapping principle provided by the embodiment of the present application;
[0015] Figure 5 is a flowchart of the pixel remapping provided by the embodiment of the present application;
[0016] Figure 6Structural block diagram of the image processing apparatus provided by an embodiment of the present application;
[0017] Figure 7 One of the hardware schematic diagrams of the electronic device provided by an embodiment of the present application;
[0018] Figure 8 Two of the hardware schematic diagrams of the electronic device provided by an embodiment of the present application. Detailed implementation manners
[0019] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0020] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data may be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order different from those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object may be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally represents an "or" relationship between the associated objects before and after.
[0021] An embodiment of the first aspect of the present application provides an image processing method. The execution subject of the technical solution of the image processing method provided by the embodiment of the present application may be an image processing apparatus, which can be specifically determined according to actual usage requirements, and the embodiments of the present application do not make limitations. To describe more clearly the image processing method provided by the embodiments of the present application, the following method embodiments will exemplarily illustrate with the execution subject of the image processing method being an image processing apparatus.
[0022] Next, in conjunction with the accompanying drawings, the image processing method provided by the embodiments of the present application will be described in detail through specific embodiments and their application scenarios.
[0023] As Figure 1 shown, the embodiments of the present application provide an image processing method, and the method may include the following steps S102 to S108:
[0024] Step S102: Perform region division processing on the first image after blurring processing.
[0025] Among them, the first image is the image obtained after blurring the original image. The blurring process is to perform weighted averaging on the pixel value of each pixel point in the original image with the pixel values of the surrounding pixel points, and use the obtained result as the pixel value of the pixel point, so as to obtain the first image with a smoothing effect, that is, the first image.
[0026] It can be understood that when blurring the original image to obtain the first image, due to the limitation of the processing accuracy of each channel of the image, in the gradient region of the first image, a moiré phenomenon will occur, reducing the smooth and delicate visual effect of the first image.
[0027] Therefore, in the embodiment of the present application, the blurred image, that is, the first image, is subjected to region division processing to divide the gradient region and the non-gradient region in the first image. That is, through the region division processing, the image region with the moiré phenomenon in the first image is segmented from the image region without the moiré phenomenon, so as to perform targeted processing on the image region with the moiré phenomenon and the image region without the moiré phenomenon respectively, thereby effectively removing the moiré phenomenon in the first image and achieving the smooth and delicate visual effect of the first image.
[0028] Step S104: Determine N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point positions.
[0029] Among them, the value of N is the same as the total number of pixel points in the first image. For example, if the pixel (or resolution) of the first image is 20×30, then the number of pixel points in the first image is 600, that is, the value of N is 600.
[0030] Furthermore, the preset pixel position offset is a coordinate offset.
[0031] It can be understood that an image is composed of multiple pixel points, and different pixel points are located at different pixel positions. If the first image is regarded as a two-dimensional coordinate system, then each pixel point in the image corresponds to a unique and determined coordinate point, and this coordinate point is the pixel point coordinate of the corresponding pixel point.
[0032] Specifically, the first image contains N first pixel points. For each first pixel point in the first image, its corresponding first pixel point coordinate is obtained. Then, according to this first pixel point coordinate, a preset pixel position offset, and the specific regional position of the first pixel point in the first image, a second pixel point coordinate is determined, and this second pixel point coordinate is the coordinate of the second pixel point corresponding to the first pixel point. Thus, N second pixel points corresponding to the N first pixel points in the first image can be determined, where the N first pixel points and the N second pixel points are in one-to-one correspondence.
[0033] Among them, according to the different specific regional positions (gradient region or non-gradient region) of the first pixel point in the first image, different pixel position offsets are used when determining the corresponding second pixel point. In this way, for each pixel point in the gradient region and non-gradient region of the first image, pixel offset is performed specifically on it, and then the pixels of the first image are adjusted, ensuring the accuracy of eliminating the water ripple phenomenon, and further ensuring the smooth and delicate visual effect of the image.
[0034] In addition, it can be determined that there is a mapping relationship between the second pixel point and the first pixel point, and the first pixel point and the second pixel point are in one-to-one correspondence. For each first pixel point in the first image, a unique and determined second pixel point can be determined through the above mapping relationship, that is, the above preset pixel position offset.
[0035] Step S106: Determine the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point.
[0036] It can be understood that an image is composed of multiple pixel points, and the pixel values of different pixel points may be the same or different. Different pixel values correspond to different colors. The greater the difference between the pixel values of two pixel points, the more obvious the color difference between these two pixel points. Therefore, various images can be formed through the permutation and combination of each pixel point in the image and its corresponding pixel value.
[0037] In this embodiment, specifically, after determining the second pixel point corresponding to each first pixel point in the first image according to the above mapping relationship between the second pixel point and the first pixel point, the first pixel value corresponding to the first pixel point and the second pixel value corresponding to the second pixel point are obtained, and then the covariance between the first pixel value and the second pixel value is calculated to judge the degree of difference between the first pixel value and the second pixel value through the value of this covariance.
[0038] Step S108: Adjust the pixels of the first image according to the comparison result between the covariance and the preset numerical range to obtain the target image.
[0039] It can be understood that the moiré phenomenon is caused by pixel offset. In the area where the moiré phenomenon occurs in the image, the change of the image color is repetitive and regular, that is, the change directions of the image pixel values are the same and the degree of change coordination is small. And the degree of coordination between the pixel values of two pixel points can just be represented by the covariance between the two pixel values.
[0040] Specifically, when the covariance between two pixel values is greater than zero, it indicates that the change directions of the pixel values of the two pixel points are the same. At this time, the larger the value of the covariance, the higher the degree of change coordination of the pixel values of the two pixel points; and the smaller the covariance, the lower the degree of change coordination of the pixel values of the two pixel points. When the covariance between two pixel values is less than zero, it indicates that the pixel values between the two pixel points show opposite change trends, that is, the change directions of the pixel values are opposite.
[0041] Therefore, in this embodiment, after determining the covariance between the first pixel value and the second pixel value, the value of the covariance is compared with a preset value range, and then the pixels of the first image are adjusted according to the comparison result of the two, that is, pixel remapping processing is performed on the first image. Among them, the definition of pixel remapping is: for each pixel point in the image, its pixel value is taken from its own or the pixel values of surrounding pixel points.
[0042] Specifically, in the embodiment of the present application, when the above covariance is within the preset value range, it indicates that the pixel values between the first pixel point and the second pixel point conform to the pixel change law at the moiré phenomenon. At this time, the pixel value of the first pixel point is filled and adjusted by the pixel value of the second pixel point, that is, the pixel value of the first pixel point is adjusted to the second pixel value to eliminate the moiré phenomenon. When the above covariance is outside the preset value range, it indicates that the changes of the first pixel value and the second pixel value do not conform to the pixel change law at the moiré phenomenon. At this time, the pixel value of the first pixel point is not adjusted.
[0043] Exemplarily, such as Figure 4As shown in the figure, for the first pixel point P1 in the first image, the coordinates of the first pixel point are obtained as (X, Y). Then, according to the preset pixel position offset (Ox, Oy), the coordinates of the second pixel point corresponding to the coordinates of the first pixel point are determined as (X + Ox, Y + Oy), so as to determine the second pixel point P2 corresponding to the first pixel point P1. At this time, if the calculated covariance value of the first pixel value of the first pixel point P1 and the second pixel value of the second pixel point P2 is within the preset value range, the second pixel value of the second pixel point P2 is determined as the pixel value of the first pixel point P1, that is, the color of the first pixel point is filled with the color of the second pixel point; if the above covariance is outside the preset value range, the pixel value of the first pixel point is not adjusted, that is, the color of the first pixel point is not changed.
[0044] Through the above image processing method provided by the embodiments of the present application, the blurred image, that is, the first image, is subjected to region division processing. Then, according to the preset pixel position offset and the region position of each pixel point in the first image, the second pixel point corresponding to each first pixel point in each region after the region division in the first image is determined. On this basis, the first pixel value of the first pixel point and the second pixel value of the second pixel point are obtained and the covariance between the two is calculated. Then, the specific value of the covariance between the first pixel value and the second pixel value is compared with the preset value range, and then the pixels of the first image are adjusted according to the comparison result between the two, so as to obtain the target image. In this way, by combining the pixel remapping algorithm to specifically adjust the pixel values of each region in the first image, the moire phenomenon generated in the gradient region of the first image can be effectively removed, so that the obtained target image is smoother and more delicate, and the visual effect of the target image is improved.
[0045] In the embodiments of the present application, the above step S102 may specifically include the following step S102a:
[0046] Step S102a: Perform edge detection on the first image, and divide the first image into a first region and a second region according to the edge detection result.
[0047] Among them, the first region corresponds to the background region in the first image, and the second region corresponds to the main body region in the first image.
[0048] It can be understood that after the original image is blurred to obtain the first image, the first image can be divided into a gradient region and a non-gradient region according to the image content. Among them, the gradient region corresponds to the background region in the first image, and the non-gradient region corresponds to the main body region in the first image, that is, the first region is the gradient region in the first image, and the second region is the non-gradient region in the first image. Further, due to the limitation of the processing accuracy of each channel of the image, moire phenomena will occur in the gradient region of the first image.
[0049] Therefore, in this embodiment, as Figure 2 shown in step III of [reference], edge detection is performed on the blurred image, i.e., the first image, and then the main region part and the background region part in the first image are divided according to the result of the edge detection, that is, the first image is divided into a first region and a second region. Among them, as Figure 2 shown in (d) of [reference], the three regions A1, A2, and A3 are the divided first regions, and the remaining part is the second region. That is, by performing edge detection on the blurred image, the region with moiré phenomenon in the first image is divided out, so as to perform moiré elimination processing on this region specifically later, ensuring the accuracy of moiré elimination processing and improving the efficiency of image processing.
[0050] Among them, when performing edge detection on the first image, specifically, the Robert operator edge detection algorithm, Sobel operator edge detection algorithm, Prewitt operator edge detection algorithm, LOG (Laplacian of Gassian) operator edge detection algorithm, Canny operator edge detection algorithm, Kirsch operator edge detection algorithm, etc. can be used, and no specific limitation is made here.
[0051] In the above embodiment provided by this application, edge detection is performed on the first image, and then the first image is divided into a region with moiré phenomenon (i.e., the first region) and a region without moiré phenomenon (i.e., the second region) according to the edge detection result. In this way, the region with moiré phenomenon in the first image is divided out through edge detection, so as to perform moiré elimination processing on this region specifically later, ensuring the accuracy of moiré elimination processing and improving the efficiency of image processing.
[0052] In the embodiment of this application, the above step S102a may specifically include the following steps S102a1 to S102a4:
[0053] Step S102a1: Determine the contour line of the image content in the first image according to the edge detection result.
[0054] Among them, the above contour line is the overall contour line of the image content in the first image, and this overall contour line can be divided into the outer contour line and the inner contour line of the image content in the first image.
[0055] It can be understood that the result of edge detection is to display the image content in the first image (specifically referring to the main body of the image in the first image) in the form of lines, that is, contour lines. Among them, the above-mentioned outer contour line refers to the edge contour line of the image main body, and the image main body is located within this edge contour line (i.e., the outer contour line), while the inner contour line refers to the other contour lines of the entire contour line of the image main body except the above-mentioned edge contour line. For example, if the image main body is a disc with patterns, the outer contour line of this image main body is a circle, and the inner contour line is the contour line of the patterns therein.
[0056] Specifically, edge detection is performed on the blurred image through one of multiple edge detection algorithms such as the Robert operator edge detection algorithm, the Sobel operator edge detection algorithm, and the Prewitt operator edge detection algorithm to identify the image content in the first image and display the image content in the first image in the form of lines. That is, the overall contour line of the image content in the first image is determined according to the edge detection result, and this overall contour line may include the outer contour line and the inner contour line of the image content in the first image.
[0057] Step S102a2: Identify the outer contour line of the image content in the first image from the contour lines.
[0058] Specifically, the above-mentioned contour line is the overall contour line of the image content in the first image, and this overall contour line can be divided into the outer contour line and the inner contour line of the image content in the first image. After determining the overall contour line of the image content in the first image according to the edge detection result, further identify the outer contour line of the image content in the first image from this overall contour line, so as to accurately determine the area where the main body of the image in the first image is located according to this outer contour line in the subsequent process.
[0059] Step S102a3: Set the pixel values of the image content within the outer contour line in the first image to the first preset pixel value.
[0060] Specifically, after identifying the outer contour line of the image content in the first image from the above-mentioned overall contour line, set the pixel values of the image content within the above-mentioned outer contour line in the first image to the first preset pixel value, that is, set the pixel values of the image main body area of the first image to the first preset pixel value.
[0061] Among them, the first preset pixel value should be different from the pixel values at other positions in the first image, so that the area where the main body of the image in the first image is located can be clearly determined according to the image pixel values in the subsequent processing.
[0062] It can be understood that the image pixel values correspond to the image colors, and different pixel values correspond to different colors. To facilitate the subsequent determination of the area where the main body of the image is located, the color of the image content within the above-mentioned outer contour line, that is, the main body area of the first image, can be set to a special color.
[0063] Specifically, the pixel values of the image content within the above-mentioned outer contour line can be set to the pixel value (0, 0, 0, 0), and the corresponding color is the fully transparent color, which is equivalent to removing the main body area in the first image, thereby obtaining the image background area in the first image.
[0064] In the actual application process, the color of the image content within the outer contour line in the first image, that is, the specific value of the above-mentioned first preset pixel value, can be determined according to the actual situation, and no specific limitation is made here.
[0065] Step S102a4: Determine the image content with pixel values other than the first preset pixel value in the first image as the first area, and determine the image content with pixel values equal to the first preset pixel value in the first image as the second area.
[0066] Specifically, after the pixel values of the image content in the first image are reset according to the pixel positions of the above-mentioned outer contour line, the first image is divided into a first area and a second area according to the pixel values of each area in the first image.
[0067] Among them, the area part with pixel values equal to the first preset pixel value in the first image is divided into the second area, and the area part with pixel values other than the first preset pixel value in the first image is divided into the first area. That is, the above-mentioned second area corresponds to the main body area in the original image, and the first area corresponds to the background area in the original image. That is, the above-mentioned second area is the non-gradient area in the first image, and the first area is the gradient area in the first image. That is, the above-mentioned first area is the area with the water ripple phenomenon, and the second area is the area without the water ripple phenomenon.
[0068] In the above-mentioned embodiment provided by the present application, when the first image is divided into a first area and a second area according to the edge detection result, the contour line of the image content in the first image is determined according to the edge detection result, and then the outer contour line of the image content in the first image is identified from the determined above-mentioned contour line, and the pixel values of the image content within the outer contour line in the first image are set to the first preset pixel value. On this basis, the first image is divided into a first area and a second area according to whether the pixel values of each area in the first image are the first preset pixel value. In this way, the accuracy of the division of the first area and the second area is ensured, and further the accuracy of the subsequent water ripple elimination process is ensured, improving the visual effect of the first image.
[0069] In the embodiment of the present application, the above step S102a2 may specifically include the following steps S102a21 and S102a22:
[0070] Step S102a21: Adjust the line color of the contour line.
[0071] Among them, the above contour line is the overall contour line of the image content in the first image, and this overall contour line can be divided into the outer contour line and the inner contour line of the image content in the first image.
[0072] Specifically, after determining the overall contour line of the image content in the first image according to the edge detection result, the line color of this overall contour line is adjusted so that the color of the above overall contour line is different from the color at other positions in the first image, so as to subsequently identify the outer contour line of the image content in the first image from the above overall contour line by means of color recognition.
[0073] Specifically, the image pixel value corresponds to the image color. When adjusting the line color of the above overall contour line, the line color can be adjusted by setting the pixel value of this overall contour line to a second preset pixel value.
[0074] Among them, the above second preset pixel value should be different from the pixel values at other positions in the first image, so that the color of the overall contour line is different from the color at other positions in the first image, so as to accurately identify the outer contour line of the image content from the overall contour line of the image content in the first image through subsequent processing, and then determine the area where the image content, that is, the image main body, is located according to this outer contour line.
[0075] It can be understood that the image pixel value corresponds to the image color, and different pixel values correspond to different colors. To facilitate subsequent determination of the position of the outer contour line, the color of the overall contour line of the image content in the first image can be set to a special color, that is, the pixel value of this overall contour line is set to the pixel value corresponding to the above special color, such as the pixel value (255, 255, 255, 0). In the actual application process, the color of the above overall contour line, that is, the specific value of the above second preset pixel value, can be determined according to the actual situation, and no specific limitation is made here.
[0076] Step S102a22: Perform color recognition on the first image after adjusting the contour line color, and identify the outer contour line from the contour line according to the color recognition result.
[0077] Specifically, the image pixel values correspond to the image colors, and different pixel values correspond to different colors. After setting the pixel values of the overall contour line of the image content in the first image to the second preset pixel values, that is, setting the line color of the overall contour line to a specific color (this specific color is different from the colors at other positions in the first image), color recognition can be performed on the first image after edge detection, and then the outer contour line of the image content of the first image can be recognized from the above-mentioned overall contour line according to the color recognition result.
[0078] Specifically, when performing color recognition on the first image after edge detection, color recognition is performed on the first image simultaneously from both sides of the first image in the recognition order from left to right and from right to left. In each recognition direction, for multiple pixel points in each horizontal row of the first image, the first pixel point of the specific color recognized is determined as the pixel point of the outer contour line of the image content in the first image in this recognition direction, so as to determine the pixel positions of the left and right outer contour lines of the image content in the first image, and then achieve the purpose of recognizing the outer contour line of the image content of the first image from the above-mentioned overall contour line. In this way, the accuracy of color recognition of the first image is ensured, that is, the accuracy of recognizing the outer contour line of the image content in the first image is ensured, and the efficiency of color recognition is improved, thereby improving the accuracy and efficiency of image processing.
[0079] It should be noted that in the actual application process, color recognition can also be performed on the first image after edge detection in recognition directions such as the up-down direction and the oblique direction. The specific recognition direction for color recognition is not specifically limited here.
[0080] In the above embodiments provided by the present application, when recognizing the outer contour line of the image content of the first image from the above-mentioned overall contour line, the line color of the overall contour line is adjusted, and then color recognition is performed on the first image after adjusting the contour line color, and the outer contour line of the image content of the first image is recognized from the above-mentioned overall contour line according to the color recognition result. In this way, the accuracy of recognizing the outer contour line of the image content in the first image is ensured, thereby ensuring the accuracy of the division of the first region and the second region, ensuring the accuracy of the subsequent water ripple elimination process, and improving the visual effect of the first image.
[0081] In the embodiments of the present application, the above step S104 may specifically include the following step S104a and step S104b:
[0082] Step S104a: When the first pixel point is located in the first region, determine the corresponding second pixel point according to the first pixel position offset.
[0083] Among them, the first region corresponds to the background region of the first image, that is, the first region is the gradient region of the first image, that is, the first region is the region where the water ripple phenomenon exists.
[0084] Specifically, the preset pixel position offset includes a first pixel position offset. When determining the second pixel corresponding to each first pixel in each region of the first image according to the preset pixel position offset and the pixel point position, first determine the region where the first pixel is located. When the first pixel is in the first region of the first image, determine the second pixel corresponding to the first pixel according to the first pixel offset.
[0085] Step S104b: When the first pixel is in the second region, determine the corresponding second pixel according to the second pixel position offset.
[0086] Among them, the second region corresponds to the main region of the first image, that is, the second region is the non-gradual change region of the first image, that is, the second region is the region in the first image where there is no water ripple phenomenon.
[0087] Specifically, the preset pixel position offset further includes a second pixel position offset. When determining the second pixel corresponding to each first pixel in each region of the first image according to the preset pixel position offset and the pixel point position, first determine the region where the first pixel is located. When the first pixel is in the second region of the first image, determine the second pixel corresponding to the first pixel according to the second pixel offset.
[0088] In addition, it should be noted that in order to achieve targeted, efficient, and accurate processing of the water ripple phenomenon in the first image, the above second pixel position offset should be different from the above first pixel position offset.
[0089] Specifically, when performing pixel remapping on the first image, the above first pixel position offset and second pixel position offset can be determined according to a preset random map. Among them, the preset random map is a random map pre-stored in the storage area, and the size of the preset random map is the same as the size of the original image before the first image is blurred.
[0090] In the actual application process, as Figure 3 shown (the left figure is a schematic diagram of the random radius range, and the right figure is the generated preset random map), the user can randomly generate a random map according to a certain radius. Among them, it should be noted that when generating the above preset random map, the size of the preset random map is the same as the size of the original image to be processed, and the third digit of the pixel value coordinates of each pixel point in the preset random map is set to zero for subsequent retrieval and use.
[0091] Specifically, the above first pixel position offset is the product of the first offset and the second offset, and the second pixel position offset is the above first offset. Among them, the second offset is a preset offset, and the first offset is the pixel value at the position corresponding to the first pixel point of the first image in the preset random map. The size of the preset random map is the same as that of the original image, that is, the first offset is the pixel value at the coordinates of the first pixel point in the preset random map. Specifically, the first pixel position offset and the second pixel position offset can be expressed by the following formula:
[0092]
[0093] (Ox, Oy)' = (Ux, Vy),
[0094] where (Ox, Oy) is the first pixel position offset, (Ox, Oy)' is the second pixel position offset, (Ux, Vy) is the first offset, that is, the pixel value at the coordinates of the first pixel point in the preset random map, is the second offset,
[0095] Exemplarily, as Figure 5 shown, when performing pixel remapping on each first pixel point in the first image, first determine that the coordinates of the first pixel point are (X, Y), and then obtain the pixel value (Ux, Vy) at the pixel point coordinates (X, Y) in the preset random map, that is, determine that the first offset is (Ux, Vy). On this basis, if the first pixel point is located in the first region of the first image, then determine the first pixel position offset (Ox, Oy) according to the product of the first offset (Ux, Vy) and the second offset ; if the first pixel point is located in the second region of the first image, then directly determine the first offset (Ux, Vy) as the first pixel position offset (Ox, Oy). After determining the first pixel position offset (Ox, Oy), then determine the coordinates of the second pixel point as (X + Ox, Y + Oy) according to the coordinates (X, Y) of the first pixel point and the first pixel position offset (Ox, Oy), so as to determine the second pixel point. On this basis, extract the first pixel value of the first pixel point in the first image and the second coordinate value of the second pixel point, and calculate the covariance between the two. When the value of the covariance between the first pixel value and the second pixel value is within the preset numerical range, fill the pixel value at the second pixel point coordinates (X + Ox, Y + Oy) to the first pixel point coordinates (X, Y), that is, adjust the pixel value of the first pixel point to the above second pixel value.
[0096] In the above embodiments provided by the present application, when determining the second pixel points corresponding to each first pixel point in each region of the first image according to the preset pixel position offset and the pixel point positions, first, the region where the first pixel point is located is determined. When the first pixel point is located in the first region of the first image, the second pixel point corresponding to the first pixel point is determined according to the first pixel offset. When the first pixel point is located in the second region of the first image, the second pixel point corresponding to the first pixel point is determined according to the second pixel offset. Among them, the above first pixel position offset and second pixel position offset are determined according to a preset random graph. In this way, in combination with the preset random graph, different pixel position offsets are used for pixel remapping processing of the region with moiré phenomenon (i.e., the first region) and the region without moiré phenomenon (i.e., the second region) in the first image, ensuring the accuracy and randomness of moiré phenomenon elimination, effectively removing the moiré phenomenon generated in the gradient region of the first image, making the first image smoother and more delicate, and improving the visual effect of the first image.
[0097] In the embodiment of the present application, step S108 specifically may include the following step S108a and step S108b:
[0098] Step S108a: When the covariance is less than or equal to the preset threshold and greater than or equal to zero, adjust the pixel value of the first pixel point to the second pixel value.
[0099] It can be understood that the moiré phenomenon is caused by pixel offset. In the region where the moiré phenomenon occurs in the image, the change of the image color is repetitive and regular, that is, the change direction of the image pixel values is the same and the change coordination degree is small. And the coordination degree between the pixel values of two pixel points can just be represented by the covariance between the two pixel values.
[0100] Specifically, when the covariance between two pixel values is greater than zero, it indicates that the change directions of the pixel values of the two pixel points are the same. At this time, the larger the value of the covariance, the higher the change coordination degree of the pixel values of the two pixel points; and the smaller the covariance, the lower the change coordination degree of the pixel values of the two pixel points. When the covariance between two pixel values is less than zero, it indicates that the pixel values of the two pixel points show opposite change trends, that is, the change directions of the pixel values are opposite.
[0101] Therefore, in this embodiment, the pixels of the first image are adjusted according to the comparison result between the covariance between the first pixel value of the first pixel point and the second pixel value of the second pixel point and a preset numerical range. Specifically, when the covariance is greater than or equal to zero and less than or equal to a preset threshold, it indicates that the change directions of the first pixel value and the second pixel value are the same and the degree of cooperation is low, that is, the pixel values between the first pixel point and the second pixel point conform to the pixel change rule at the water ripple phenomenon. At this time, the pixel value of the first pixel point is filled with the pixel value of the second pixel point, that is, the pixel value of the first pixel point is adjusted to the above-mentioned second pixel value.
[0102] Among them, the above-mentioned preset threshold is a relatively small value. In the actual application process, it can take values such as 0.018, 0.019, 0.02, 0.021, 0.022, etc., and no specific limitation is made here.
[0103] Step S108b: When the covariance is greater than the preset threshold or the covariance is less than zero, keep the pixel value of the first pixel point unchanged.
[0104] Specifically, after determining the covariance between the first pixel value and the second pixel value, the covariance is compared with a preset numerical range. When the covariance is greater than the preset threshold, it indicates that the degree of cooperation in the change of the first pixel value and the second pixel value is high. When the covariance is less than zero, it indicates that the change directions of the first pixel value and the second pixel value are opposite. The above two situations do not conform to the pixel change rule at the water ripple phenomenon. Therefore, in the above two situations, the pixel value of the first pixel point is not adjusted.
[0105] Exemplarily, as Figure 4 shown, for the first pixel point P1 in the first image, the coordinates of the first pixel point are obtained as (X, Y), and then the coordinates of the second pixel point corresponding to the coordinates of the first pixel point are determined as (X + Ox, Y + Oy) according to the preset pixel position offset (Ox, Oy), so as to determine the second pixel point P2 corresponding to the first pixel point P1. At this time, if the covariance calculated from the first pixel value of the first pixel point P1 and the second pixel value of the second pixel point P2 is greater than or equal to zero and less than or equal to the preset threshold, the second pixel value of the second pixel point P2 is determined as the pixel value of the first pixel point P1, that is, the color of the first pixel point is filled with the color of the second pixel point; if the above covariance is greater than the preset threshold or the covariance is less than zero, the pixel value of the first pixel point is not adjusted, that is, the color of the first pixel point is not changed.
[0106] In the above embodiments provided by the present application, when the covariance between the first pixel value of the first pixel and the second pixel value of the second pixel is greater than or equal to zero and less than or equal to a preset threshold, the pixel value of the first pixel is filled and adjusted by the pixel value of the second pixel, and when the covariance is greater than the preset threshold or the covariance is less than zero, the pixel value of the first pixel is not adjusted. In this way, the accuracy of the first image pixel remapping is ensured, the moire phenomenon in the first image can be effectively removed, so that the first image is smoother and more delicate, and the visual effect of the first image is improved.
[0107] In the embodiments of the present application, before the above step S102, the graphic processing method may further include the following steps S100 and S101:
[0108] Step S100: Reduce the original image by a target multiple.
[0109] Among them, the above original image may be an image obtained by shooting, or an image obtained from a local storage area such as a local photo album, or an image imported through an external data connection (such as an external disk, a USB flash drive, etc.).
[0110] That is to say, in the embodiments of the present application, the image captured during shooting can be subjected to online blur processing, or the image to be processed can be selected after shooting or imported from an external storage space after shooting, and then the image to be processed is subjected to blur processing to obtain the first blurred image.
[0111] Specifically, as shown in step I of Figure 2 , after obtaining the original image, first reduce the original image by a target multiple, and then perform subsequent image processing on the reduced original image. By reducing the original image by a target multiple and then processing it, the computing power required for subsequent image processing can be effectively reduced, thereby effectively saving computing resources.
[0112] Specifically, in the actual application process, the original image can be reduced according to image processing algorithms such as bilinear interpolation algorithm, nearest neighbor interpolation algorithm, bicubic interpolation algorithm, etc. to obtain the reduced original image. For the specific method of reducing the original image, the user can select according to the actual situation, and no specific limitation is made here.
[0113] In addition, in the actual processing process, the above target multiple can specifically take values such as 0.2, 0.3, 0.4, 0.5, etc., and no specific limitation is made here either.
[0114] Step S101: Perform Gaussian blur processing on the reduced original image according to the first blur radius.
[0115] Specifically, asFigure 2 As shown in Step II in [reference], after the original image is downsized to obtain the original image with the target reduction multiple, Gaussian blur (or Gaussian smoothing) processing is performed on the downsized original image according to the first blur radius based on the Gaussian distribution algorithm to obtain the blurred image.
[0116] Among them, the blur radius of Gaussian blur processing is related to the degree of blur. The larger the blur radius, the greater the degree of Gaussian blur, and the smaller the blur radius, the smaller the degree of Gaussian blur. In the actual application process, the specific value of the above-mentioned first blur radius can be set according to the actual situation to perform Gaussian blur processing on the downsized original image with different degrees of blur. For example, the above-mentioned first blur radius can specifically take values such as 2, 3, 4, 5, etc., and no specific limitation is made here.
[0117] Furthermore, in the actual image processing process, in addition to the Gaussian blur processing algorithm applied above, the downsized original image can also be blurred by other blur algorithms, such as the mean blur algorithm, the radial blur algorithm, etc., and no specific limitation is made here.
[0118] In addition, it should be noted that before performing Gaussian blur processing on the original image, the original image is downsized by the target multiple. To ensure the accuracy of the water ripple elimination processing, as Figure 2 shown in Steps IV and V in [reference], after the first image divided into the first region and the second region is restored to the original size, pixel remapping processing is performed on the first image. At this time, as Figure 2 shown in (e) in [reference], the above-mentioned three regions A1, A2, and A3 become three regions A4, A5, and A6 after magnification.
[0119] In the above embodiments provided by this application, after the original image is downsized by the target multiple, Gaussian blur processing is performed on the downsized original image according to the first blur radius, effectively reducing the computing power required for image processing and saving computing resources.
[0120] In the embodiments of this application, the above-mentioned image processing method may further include the following Steps S110 to S114:
[0121] Step S110: Perform first denoising processing on the first image after pixel adjustment to obtain the first intermediate image.
[0122] Step S112: Perform second denoising processing on the second image after pixel adjustment to obtain the second intermediate image.
[0123] Specifically, after pixel remapping of the first image, denoising processing can be performed on the image after pixel adjustment to remove the noise phenomenon in the image and further improve the visual effect of the image.
[0124] Specifically, the image after replicated pixel remapping is copied to obtain two identical first images. One of the two first images is denoised through a first denoising process, and the other of the two first images is denoised through a second denoising process to obtain two first images after different denoising processes, namely a first intermediate image and a second intermediate image.
[0125] Among them, the first denoising process and the second denoising process are different denoising algorithms. Specifically, both the first denoising process and the second denoising process can be one of denoising algorithms such as AI algorithm denoising, Gaussian blur denoising, median filtering algorithm denoising, wavelet transform algorithm denoising, etc., and no specific limitation is made here.
[0126] Among them, to distinguish from the above Gaussian blur processing, when performing denoising processing through Gaussian blur, the second blur radius used for Gaussian blur denoising should be different from the above first blur radius to ensure the smooth and delicate effect of the image while ensuring the effect of the denoising process.
[0127] In addition, it should be noted that there is no clear execution order between the above step S110 and step S112. Step S112 can be executed after step S110, or step S110 can be executed after step S112, or step S110 and step S112 can be executed simultaneously. No specific limitation is made here for the execution order of step S110 and step S112.
[0128] Step S114: Perform weighted averaging on the first intermediate image and the second intermediate image to obtain a target image.
[0129] Specifically, after obtaining the first intermediate image and the second intermediate image by performing different denoising processes on the first image, the first intermediate image and the second intermediate image obtained after the denoising process are fused through a weighted averaging algorithm to obtain a target image.
[0130] That is, for the pixel value of each pixel point in the target image, it is determined by multiplying half of the pixel value of the corresponding pixel point in the first intermediate image by half of the pixel value of the corresponding pixel point in the second intermediate image. The specific algorithm can be expressed by the following formula:
[0131] T = T1×50% + T2×50%,
[0132] Among them, T is the pixel value of the target image, T1 is the pixel value of the first intermediate image, and T2 is the pixel value of the second intermediate image.
[0133] In the above embodiments provided by the present application, after pixel remapping of the first image, noise reduction is performed on the image after pixel adjustment through first noise reduction processing and second noise reduction processing respectively to obtain a first intermediate image and a second intermediate image after noise reduction processing, and then the first intermediate image and the second intermediate image are subjected to weighted average fusion processing to obtain a target image. In this way, noise reduction processing is performed on the first image after pixel remapping to remove the noise phenomenon in the image, making the first image smoother and more delicate, and further improving the visual effect of the first image.
[0134] The image processing method proposed in the first aspect of the embodiments of the present application combines a pixel remapping algorithm to perform blurring processing on an image, which can effectively remove the moire phenomenon generated in the gradient area of the first image, thereby making the first image smoother and more delicate and improving the visual effect of the first image. The following is based on Figure 2 to elaborate on the image processing method proposed in the first aspect of the embodiments of the present application. As Figure 2 shown, the image processing method proposed in the first aspect of the embodiments of the present application mainly includes the following five steps:
[0135] Step I: As Figure 2 shown in (a) of Figure 2 , obtain an original image to be processed, and then reduce the obtained original image by a target multiple. As
[0136] shown in (b) of Figure 2 , obtain the reduced original image.
[0137] Step II: Perform Gaussian blurring processing on the reduced original image according to the first blurring radius. As Figure 2 shown in (c) of
[0138] , obtain the blurred image, that is, the first image. Figure 2 shown in (d) of
[0139] Step III: Perform edge detection on the first image, and then divide the first image into a first region and a second region according to the edge detection result. As Figure 2 shown in (d) of
[0140] Among them, after step V, operations such as first noise reduction processing, second noise reduction processing, and weighted average fusion processing can also be performed to reduce the noise of the blur after pixel remapping, and finally obtain a smooth, delicate, and noise-free target image.
[0141] For the image processing method provided in the embodiment of the first aspect of the present application, the execution subject can be an image processing device. In the embodiments of the present application, taking the image processing device executing the above image processing method as an example, the image processing device provided in the embodiment of the second aspect of the present application is described.
[0142] As Figure 6 shown, the embodiment of the present application provides an image processing device 600, and the device includes the following processing unit 602.
[0143] The processing unit 602 is used to perform region division processing on the first image after blur processing;
[0144] The processing unit 602 is further used to determine N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point position;
[0145] The processing unit 602 is further used to determine the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point;
[0146] The processing unit 602 is further used to adjust the pixels of the first image according to the comparison result between the covariance and a preset numerical range to obtain a target image.
[0147] In the embodiment of the present application, the image processing device 600 performs region division processing on the blurred image, that is, the first image, through the processing unit 602, and then determines the second pixel corresponding to each first pixel point in each region after region division in the first image according to the preset pixel position offset and the region position of each pixel point in the first image. On this basis, the first pixel value of the first pixel point and the second pixel value of the second pixel point are obtained and the covariance between the two is calculated. Furthermore, the specific value of the covariance between the first pixel value and the second pixel value is compared with a preset numerical range, and the pixels of the first image are adjusted according to the comparison result between the two, so as to obtain a target image. In this way, by combining the pixel remapping algorithm to specifically adjust the pixel values of each region in the first image, the moire phenomenon generated in the gradient region of the first image can be effectively removed, so that the first image is smoother and more delicate, and the visual effect of the first image is improved.
[0148] In the embodiment of the present application, the processing unit 602 can also be used to: reduce the original image by a target multiple; perform Gaussian blur processing on the reduced original image according to a first blur radius.
[0149] In the above embodiments provided by the present application, the original image can also be blurred by the processing unit 602. Specifically, the original image is reduced by a target multiple, and then Gaussian blur processing is performed on the reduced original image according to the first blur radius, effectively reducing the computing power required for image processing and saving computing resources.
[0150] In the embodiments of the present application, the processing unit 602 is specifically further configured to: perform edge detection on the first image; divide the first image into a first region and a second region according to the edge detection result; wherein, the first region corresponds to the background region in the original image, and the second region corresponds to the main body region in the original image.
[0151] In the above embodiments provided by the present application, when the processing unit 602 performs region division processing on the blurred first image, first, edge detection is performed on the first image, and then the first image is divided into a region with moire phenomenon (i.e., the first region) and a region without moire phenomenon (i.e., the second region) according to the edge detection result. In this way, the region with moire phenomenon in the first image is divided out through edge detection, so as to perform moire elimination processing on this region specifically later, ensuring the accuracy of moire elimination processing and improving the efficiency of image processing.
[0152] In the embodiments of the present application, the processing unit 602 can specifically be configured to: determine the contour line of the image content in the first image according to the edge detection result; identify the outer contour line of the image content in the first image from the contour line; set the pixel value of the image content located inside the outer contour line in the first image to a first preset pixel value; determine the image content with a pixel value other than the first preset pixel value in the first image as the first region, and determine the image content with a pixel value of the first preset pixel value in the first image as the second region.
[0153] In the above embodiments provided by the present application, when the processing unit 602 divides the first image into a first region and a second region according to the edge detection result, the contour line of the image content in the first image is determined according to the edge detection result, and then the outer contour line of the image content in the first image is identified from the determined contour line, and the pixel value of the image content located inside the outer contour line in the first image is set to the first preset pixel value. On this basis, the first image is divided into a first region and a second region according to whether the pixel value of each region in the first image is the first preset pixel value. In this way, the accuracy of the division of the first region and the second region is ensured, and further the accuracy of the subsequent moire elimination processing is ensured, improving the visual effect of the first image.
[0154] In the embodiment of the present application, the processing unit 602 is specifically configured to: adjust the line color of the contour line; perform color recognition on the first image after adjusting the contour line color, and identify the outer contour line from the contour line according to the color recognition result.
[0155] In the above embodiment provided by the present application, when the processing unit 602 identifies the outer contour line of the image content of the first image from the above overall contour line, the line color of the overall contour line is adjusted, and then color recognition is performed on the first image after adjusting the contour line color, and the outer contour line of the image content of the first image is identified from the above overall contour line according to the color recognition result. In this way, the accuracy of identifying the outer contour line of the image content in the first image is ensured, thereby ensuring the accuracy of the division of the first region and the second region, ensuring the accuracy of the subsequent water ripple elimination processing, and improving the visual effect of the first image.
[0156] In the embodiment of the present application, the processing unit 602 is specifically configured to: when the first pixel point is located in the first region, determine the corresponding second pixel point according to the first pixel position offset; when the first pixel point is located in the second region, determine the corresponding second pixel point according to the second pixel position offset; wherein, the first pixel position offset and the second pixel position offset are determined according to a preset random map, and the preset random map has the same size as the original image of the first image.
[0157] In the above embodiment provided by the present application, when the processing unit 602 determines the second pixel point corresponding to each first pixel point in each region of the first image according to the preset pixel position offset and the pixel point position, it first determines the region where the first pixel point is located. When the first pixel point is located in the first region of the first image, the second pixel point corresponding to the first pixel point is determined according to the first pixel offset, and when the first pixel point is located in the second region of the first image, the second pixel point corresponding to the first pixel point is determined according to the second pixel offset, wherein the above first pixel position offset and the second pixel position offset are determined according to a preset random map. In this way, in combination with the preset random map, different pixel position offsets are used for pixel remapping processing in the region with water ripple phenomenon (i.e., the first region) and the region without water ripple phenomenon (i.e., the second region) in the first image, ensuring the accuracy and randomness of water ripple phenomenon elimination, effectively removing the water ripple phenomenon generated in the gradient region of the first image, thereby making the first image smoother and more delicate, and improving the visual effect of the first image.
[0158] In an embodiment of the present application, the processing unit 602 is specifically configured to: when the covariance is less than or equal to a preset threshold and greater than or equal to zero, adjust the pixel value of the first pixel point to a second pixel value; when the covariance is greater than the preset threshold or less than zero, keep the pixel value of the first pixel point unchanged.
[0159] In the above embodiment provided by the present application, when performing pixel remapping on each first pixel point in the first image, when the covariance between the first pixel value of the first pixel point and the second pixel value of the second pixel point is greater than or equal to zero and less than or equal to the preset threshold, the pixel value of the first pixel point is filled and adjusted by the pixel value of the second pixel point, and when the above covariance is greater than the preset threshold or less than zero, the pixel value of the first pixel point is not adjusted. In this way, the accuracy of pixel remapping of the first image is ensured, the moire phenomenon in the first image can be effectively removed, the accuracy of moire removal is ensured, so that the first image is smoother and more delicate, and the visual effect of the first image is improved.
[0160] In an embodiment of the present application, the processing unit 602 is further specifically configured to: perform first denoising processing on the first image after pixel adjustment to obtain a first intermediate image; perform second denoising processing on the first image after pixel adjustment to obtain a second intermediate image; perform weighted averaging on the first intermediate image and the second intermediate image to obtain a target image.
[0161] In the above embodiment provided by the present application, after the processing unit 602 performs pixel remapping on the first image, it can also perform denoising on the image after pixel adjustment through first denoising processing and second denoising processing respectively to obtain a first intermediate image and a second intermediate image after denoising processing, and then perform weighted average fusion processing on the first intermediate image and the second intermediate image to obtain a target image. In this way, the first image after pixel remapping is denoised to remove the noise phenomenon in the image, making the first image smoother and more delicate, and further improving the visual effect of the first image.
[0162] The image processing device 600 in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than terminals. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0163] The image processing device 600 in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.
[0164] The image processing device 600 provided in the second aspect embodiments of the present application can implement Figure 1 each process implemented by the method embodiments. To avoid repetition, details are not described herein again.
[0165] Optionally, as Figure 7 shown, the embodiments of the present application further provide an electronic device 700, including a processor 702 and a memory 704. A program or instruction that can run on the processor 702 is stored on the memory 704. When the program or instruction is executed by the processor 702, it implements each step of the image processing method embodiments in the first aspect above and can achieve the same technical effects. To avoid repetition, details are not described herein again.
[0166] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0167] Figure 8 Schematic diagram of the hardware structure of an electronic device for implementing the embodiments of the present application.
[0168] The electronic device 800 includes, but is not limited to, components such as a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 810.
[0169] Those skilled in the art can understand that the electronic device 800 may further include a power supply (such as a battery) for powering each component. The power supply can be logically connected to the processor 810 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 8 The structure of the electronic device shown does not limit the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0170] The electronic device 800 according to the embodiment of the present application can be used to implement each step of the image processing method embodiment in the above first aspect.
[0171] Among them, the processor 810 is used to perform region division processing on the first image after blurring processing;
[0172] The processor 810 is further used to determine N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point position;
[0173] The processor 810 is further used to determine the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point;
[0174] The processor 810 is further used to adjust the pixels of the first image according to the comparison result between the covariance and a preset numerical range to obtain a target image.
[0175] The electronic device 800 proposed in the embodiment of the present application performs region division processing on the blurred image, that is, the first image, through the processor 810, and then determines the second pixel points corresponding to each first pixel point in each region after region division in the first image according to the preset pixel position offset and the region position of each pixel point in the first image. On this basis, the first pixel value of the first pixel point and the second pixel value of the second pixel point are obtained and the covariance between the two is calculated. Furthermore, the specific value of the covariance between the first pixel value and the second pixel value is compared with a preset numerical range, and the pixels of the first image are adjusted according to the comparison result between the two, so as to obtain a target image. In this way, by combining the pixel remapping algorithm to specifically adjust the pixel values of each region in the first image, the moire phenomenon generated in the gradient region of the first image can be effectively removed, so that the first image is smoother and more delicate, and the visual effect of the first image is improved.
[0176] Optionally, the processor 810 can also be used to: reduce the original image by a target multiple; perform Gaussian blur processing on the reduced original image according to the first blur radius.
[0177] In the above embodiments provided by the present application, the original image can also be blurred by the processor 810. Specifically, the original image is reduced by a target multiple, and then Gaussian blur processing is performed on the reduced original image according to the first blur radius, effectively reducing the computing power required for image processing and saving computing resources.
[0178] Optionally, the processor 810 is specifically further used to: perform edge detection on the first image; divide the first image into a first region and a second region according to the edge detection result; determine a second pixel point according to whether the first pixel point is in the first region or the second region and a preset pixel position offset; where the first region corresponds to the background region in the original image, and the second region corresponds to the main body region in the original image.
[0179] In the above embodiments provided by the present application, when performing region division processing on the first blurred image by the processor 810, first, edge detection is performed on the first image, and then the first image is divided into a region with moire phenomenon (i.e., the first region) and a region without moire phenomenon (i.e., the second region) according to the edge detection result. In this way, the region with moire phenomenon in the first image is divided out through edge detection, so as to perform moire elimination processing on this region specifically later, ensuring the accuracy of moire elimination processing and improving the efficiency of image processing.
[0180] Optionally, the processor 810 can be specifically used to: determine the contour line of the image content in the first image according to the edge detection result; identify the outer contour line of the image content in the first image from the contour line; set the pixel values of the image content within the outer contour line in the first image to a first preset pixel value; determine the image content with pixel values other than the first preset pixel value in the first image as the first region, and determine the image content with pixel values of the first preset pixel value in the first image as the second region.
[0181] In the above embodiments provided by the present application, when the processor 810 divides the first image into a first region and a second region according to the edge detection result, the contour line of the image content in the first image is determined according to the edge detection result, and then the outer contour line of the image content in the first image is identified from the determined contour line, and the pixel values of the image content within the outer contour line in the first image are set to a first preset pixel value. On this basis, the first image is divided into a first region and a second region according to whether the pixel values of each region in the first image are the first preset pixel value. In this way, the accuracy of the division of the first region and the second region is ensured, and further the accuracy of the subsequent water ripple elimination process is ensured, improving the visual effect of the first image.
[0182] Optionally, the processor 810 is specifically configured to: adjust the line color of the contour line; perform color recognition on the first image after adjusting the contour line color, and identify the outer contour line from the contour line according to the color recognition result.
[0183] In the above embodiments provided by the present application, when the processor 810 identifies the outer contour line of the image content of the first image from the overall contour line, the line color of the overall contour line is adjusted, and then color recognition is performed on the first image after adjusting the contour line color, and the outer contour line of the image content of the first image is identified from the overall contour line according to the color recognition result. In this way, the accuracy of the identification of the outer contour line of the image content in the first image is ensured, thus ensuring the accuracy of the division of the first region and the second region, ensuring the accuracy of the subsequent water ripple elimination process, and improving the visual effect of the first image.
[0184] Optionally, the processor 810 is specifically configured to: determine a corresponding second pixel point according to the first pixel position offset when the first pixel point is located in the first region; determine a corresponding second pixel point according to the second pixel position offset when the first pixel point is located in the second region; wherein, the first pixel position offset and the second pixel position offset are determined according to a preset random graph, and the preset random graph has the same size as the original image of the first image.
[0185] In the above embodiments provided by the present application, when the processor 810 determines the second pixel points corresponding to each first pixel point in each region of the first image according to the preset pixel position offset and the pixel point position, it first determines the region where the first pixel point is located. When the first pixel point is in the first region of the first image, the second pixel point corresponding to the first pixel point is determined according to the first pixel offset. When the first pixel point is in the second region of the first image, the second pixel point corresponding to the first pixel point is determined according to the second pixel offset. Among them, the above first pixel position offset and second pixel position offset are determined according to a preset random map. In this way, in combination with the preset random map, different pixel position offsets are used for pixel remapping processing in the region with moire phenomenon (i.e., the first region) and the region without moire phenomenon (i.e., the second region) in the first image, ensuring the accuracy and randomness of moire phenomenon elimination, effectively removing the moire phenomenon generated in the gradient region of the first image, making the first image smoother and more delicate, and improving the visual effect of the first image.
[0186] Optionally, the processor 810 is specifically configured to: when the covariance is less than or equal to a preset threshold and greater than or equal to zero, adjust the pixel value of the first pixel point to the second pixel value; when the covariance is greater than the preset threshold or less than zero, keep the pixel value of the first pixel point unchanged.
[0187] In the above embodiments provided by the present application, when performing pixel remapping on each first pixel point in the first image, when the covariance between the first pixel value of the first pixel point and the second pixel value of the second pixel point is greater than or equal to zero and less than or equal to the preset threshold, the pixel value of the first pixel point is filled and adjusted by the pixel value of the second pixel point. When the covariance is greater than the preset threshold or less than zero, the pixel value of the first pixel point is not adjusted. In this way, the accuracy of pixel remapping of the first image is ensured, the moire phenomenon in the first image can be effectively removed, the accuracy of moire removal is ensured, and the first image is made smoother and more delicate, improving the visual effect of the first image.
[0188] Optionally, the processor 810 is further specifically configured to: perform first denoising processing on the first image after pixel adjustment to obtain a first intermediate image; perform second denoising processing on the first image after pixel adjustment to obtain a second intermediate image; and perform weighted averaging on the first intermediate image and the second intermediate image to obtain a target image.
[0189] In the above embodiments provided by the present application, after the processor 810 performs pixel remapping on the first image, the pixel-adjusted image can be denoised through first denoising processing and second denoising processing respectively to obtain a first intermediate image and a second intermediate image after denoising processing, and then the first intermediate image and the second intermediate image are subjected to weighted average fusion processing to obtain a target image. In this way, the first image after pixel remapping is denoised to remove the noise phenomenon in the image, making the first image smoother and more delicate, and further improving the visual effect of the first image.
[0190] It should be understood that in the embodiments of the present application, the input unit 804 may include a Graphics Processing Unit (GPU) 8041 and a microphone 8042. The graphics processor 8041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 806 may include a display panel 8061, and the display panel 8061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 807 includes at least one of a touch panel 8071 and other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include two parts: a touch detection device and a touch controller. The other input devices 8072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0191] The memory 809 can be used to store software programs and various data. The memory 809 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.).
[0192] In addition, the memory 809 may include volatile memory or non-volatile memory, or the memory 809 may include both volatile and non-volatile memory. Among them, the non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synch link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The memory 809 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.
[0193] The processor 810 may include one or more processing units; optionally, the processor 810 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 810 either.
[0194] The embodiments of the present application also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above-mentioned embodiment of the image processing method in the first aspect and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0195] Among them, the processor is the processor in the electronic device in the above-mentioned embodiment. The readable storage medium includes computer-readable storage media, such as computer read-only memory ROM, random access memory RAM, magnetic disk, or optical disc, etc.
[0196] Another embodiment of the present application further provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is configured to run programs or instructions to implement each process of the embodiment of the image processing method in the first aspect above, and can achieve the same technical effects. To avoid repetition, details are not described herein again.
[0197] It should be understood that the chip mentioned in the embodiment of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip.
[0198] The embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement each process of the embodiment of the image processing method in the first aspect above, and can achieve the same technical effects. To avoid repetition, details are not described herein again.
[0199] It should be noted that in this document, the terms "include", "comprise" or any other variation thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device including a series of elements includes not only those elements but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the methods and devices in the embodiments of the present application are not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.
[0200] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present application.
[0201] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative rather than restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them fall within the protection scope of the present application.
Claims
1. An image processing method, characterized in that, The described image processing method includes: Performing region division processing on the first image after blurring; Determining N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point positions; Wherein, according to the different specific region positions where the first pixel points are located in the first image, the pixel position offsets used when determining the second pixel points corresponding to the first pixel points are different; Determining the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point; Adjusting the pixels of the first image according to the comparison result between the covariance and a preset numerical range to obtain a target image.
2. The image processing method according to claim 1, wherein The performing region division processing on the first image after blurring specifically includes: Performing edge detection on the first image; Dividing the first image into a first region and a second region according to the edge detection result; Wherein, the first region corresponds to the background region in the first image, and the second region corresponds to the main body region in the first image.
3. The image processing method according to claim 2, wherein The dividing the first image into a first region and a second region according to the edge detection result specifically includes: Determining the contour line of the image content in the first image according to the edge detection result; Identifying the outer contour line of the image content in the first image from the contour line; Setting the pixel values of the image content located inside the outer contour line in the first image to a first preset pixel value; Determining the image content with pixel values other than the first preset pixel value in the first image as the first region, and determining the image content with pixel values being the first preset pixel value in the first image as the second region.
4. The image processing method according to claim 2, wherein The determining N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point positions specifically includes: When the first pixel point is located in the first region, determining the corresponding second pixel point according to a first pixel position offset; When the first pixel point is located in the second region, determining the corresponding second pixel point according to a second pixel position offset; Wherein, the first pixel position offset and the second pixel position offset are determined according to a preset random graph, and the preset random graph has the same size as the original image of the first image.
5. The image processing method according to claim 1, characterized in that The adjusting the pixels of the first image according to the comparison result between the covariance and a preset numerical range specifically includes: When the covariance is less than or equal to a preset threshold and the covariance is greater than or equal to zero, adjusting the pixel value of the first pixel point to the second pixel value; When the covariance is greater than the preset threshold or the covariance is less than zero, keeping the pixel value of the first pixel point unchanged.
6. The image processing method according to any one of claims 1 to 5, characterized in that, Before the performing region division processing on the first image after blurring, the image processing method further includes: Reducing the original image by a target multiple; Performing Gaussian blurring on the reduced original image according to a first blurring radius to obtain the first image after blurring.
7. The image processing method according to any one of claims 1 to 5, characterized in that The described image processing method further includes: Performing first denoising processing on the first image after pixel adjustment to obtain a first intermediate image; Performing second denoising processing on the first image after pixel adjustment to obtain a second intermediate image; Performing weighted averaging on the first intermediate image and the second intermediate image to obtain the target image.
8. An image processing apparatus, characterized in that, The described image processing apparatus includes: A processing unit configured to perform region division processing on the first image after blurring processing; The processing unit is further configured to determine N second pixel points corresponding to N first pixel points in each region after region division in the first image according to a preset pixel position offset and pixel point positions; Wherein, according to the different specific region positions of the first pixel point in the first image, the pixel position offset used when determining the second pixel point corresponding to the first pixel point is different; The processing unit is further configured to determine the covariance between the first pixel value of each first pixel point and the second pixel value of the corresponding second pixel point; The processing unit is further configured to adjust the pixels of the first image according to the comparison result between the covariance and a preset numerical range to obtain the target image.
9. The image processing apparatus according to claim 8, wherein Specifically, the processing unit is further configured to: Perform edge detection on the first image; Divide the first image into a first region and a second region according to the edge detection result; Wherein, the first region corresponds to the background region in the first image, and the second region corresponds to the main body region in the first image.
10. The image processing apparatus according to claim 9, wherein Specifically, the processing unit is configured to: Determine the contour line of the image content in the first image according to the edge detection result; Identify the outer contour line of the image content in the first image from the contour line; Set the pixel values of the image content within the outer contour line in the first image to a first preset pixel value; Determine the image content with pixel values other than the first preset pixel value in the first image as the first region, and determine the image content with pixel values of the first preset pixel value in the first image as the second region.
11. The image processing apparatus according to claim 9, wherein Specifically, the processing unit is configured to: When the first pixel point is located in the first region, determine the corresponding second pixel point according to the first pixel position offset; When the first pixel point is located in the second region, determine the corresponding second pixel point according to the second pixel position offset; Wherein, the first pixel position offset and the second pixel position offset are determined according to a preset random graph, and the preset random graph has the same size as the first image.
12. The image processing apparatus according to claim 8, wherein Specifically, the processing unit is configured to: When the covariance is less than or equal to a preset threshold and greater than or equal to zero, adjust the pixel value of the first pixel point to the second pixel value; When the covariance is greater than the preset threshold or less than zero, keep the pixel value of the first pixel point unchanged.
13. The image processing apparatus according to any one of claims 8 to 12, characterized in that, Specifically, the processing unit is configured to: Reduce the original image by a target multiple; Perform Gaussian blurring processing on the reduced original image according to a first blurring radius.
14. The image processing apparatus according to any one of claims 8 to 12, characterized in that Specifically, the processing unit is further configured to: Perform a first denoising process on the first image after pixel adjustment to obtain a first intermediate image; Perform a second denoising process on the first image after pixel adjustment to obtain a second intermediate image; Perform a weighted average on the first intermediate image and the second intermediate image to obtain the target image.
15. An electronic device, characterized in that, It includes a processor and a memory. The memory stores programs or instructions that can run on the processor. When the programs or instructions are executed by the processor, the steps of the image processing method described in any one of claims 1 to 7 are implemented.
16. A readable storage medium, characterized in that, Programs or instructions are stored on the readable storage medium. When the programs or instructions are executed by a processor, the steps of the image processing method described in any one of claims 1 to 7 are implemented.