Image processing method and device, medium and product

By determining the cropping and mapping positions in image processing, and combining distance and grayscale gradient weights, the problem of poor visual effects in image upsampling is solved, resulting in a clearer zoom image effect.

CN121509827APending Publication Date: 2026-02-10SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511697707.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-18
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing image upsampling methods result in poor visual effects of the target image, especially during digital zoom, which can easily lead to mosaic effects, blurred edges, and loss of high-frequency components.

Method used

The original image is cropped based on the target zoom factor selected by the zoom operation. The mapping position of the gray-scale pixels in the cropped image is determined. By combining distance weight and gray-scale gradient weight, the gray value of the zoomed image is accurately determined. Gaussian filtering and guided filtering are used to improve image clarity.

Benefits of technology

It improves the sharpness of the image after zooming, reduces mosaic effect and edge blurring, and enhances the visual effect of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121509827A_ABST
    Figure CN121509827A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and particularly provides an image processing method and device, a medium and a product. The method comprises the following steps: clipping a collected original image based on a target zooming multiple selected by zooming operation to obtain a clipped image; determining mapping pixel points related to each gray-free pixel point in the blank target image in a plurality of pixel points of the clipped image based on the clipped image and the target zoom multiple; for each gray-free pixel point, determining a target gray value of the gray-free pixel point based on a distance weight from a target mapping position of the gray-free pixel point in the cut image to the first pixel point, a gray gradient weight of the second pixel point relative to the first pixel point, and a gray value of the second pixel point; assigning the target gray value of each gray-free pixel point to a blank target image to obtain a target image; according to the invention, the image up-sampling definition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of image processing, and in particular, to an image processing method, device, medium and product. BACKGROUND

[0002] In recent years, with the increasingly powerful shooting function of terminal devices such as mobile phones, tablets or wristbands, the zoom function of the camera on the terminal device has also attracted particular attention from consumers. The zoom on the terminal device mainly includes optical zoom and digital zoom. The digital zoom mainly optimizes the image effect of zoom shooting through an algorithm. Generally, the original image is cropped according to the zoom ratio, and the cropped part is image up-sampled to enlarge the low-resolution image into a high-resolution image.

[0003] In the related art, the image up-sampling method mainly includes an interpolation method or a model method. The interpolation method can optimize the visual effect of the image through nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, etc. The model method optimizes the visual effect of the image by training an image processing model.

[0004] However, the scheme for optimizing image up-sampling based on the interpolation method or the model method provided in the related art can result in poor visual effect of the obtained target image. SUMMARY

[0005] In view of the above problems, the present disclosure provides an image processing method, device, medium and product, which can improve the image definition of image up-sampling.

[0006] According to a first aspect of the present disclosure, an image processing method is provided, comprising: cropping an original image collected based on a target zoom ratio selected by a zoom operation, to obtain a cropped image; determining, based on the cropped image and the target zoom ratio, in a plurality of pixel points of the cropped image, a mapping pixel point related to each non-gray pixel point in a blank target image, wherein the blank target image is a non-gray value image obtained by enlarging the cropped image by the target zoom ratio, the mapping pixel point includes a first pixel point and a second pixel point adjacent to the first pixel point, and a position of the first pixel point in the cropped image satisfies a pixel mapping relationship with a target mapping position of the non-gray pixel point in the cropped image; For each non-gray pixel point, determining a target gray value of the non-gray pixel point based on a distance weight of the target mapping position of the non-gray pixel point in the cropped image to the first pixel point, a gray gradient weight of the second pixel point with respect to the first pixel point, and a gray value of the second pixel point; The target image is obtained by assigning the target gray value of each of the gray-scale-free pixels to the blank target image.

[0007] According to a second aspect of this disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method of the first aspect.

[0008] According to a third aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method described in the first aspect.

[0009] According to a fourth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0010] The image processing method, apparatus, medium, and product provided in this disclosure, by taking into account the reverse mapping of pixels in the zoomed image to the target mapping position in the cropped image, the distance from the first pixel, and the grayscale change of the second pixel adjacent to the first pixel with respect to the first pixel, can more accurately determine the grayscale value of the grayscale-free pixels in the blank target image after zooming, thereby improving the clarity of the target image obtained after zooming.

[0011] It should be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further illustration of the claimed technology. Attached Figure Description

[0012] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0013] Figure 1 This is a schematic flowchart of an image processing method according to an embodiment of the present disclosure.

[0014] Figure 2 This is a schematic diagram illustrating the target mapping position of a grayscale-free pixel in a blank target image after it is mapped to a cropped image, and the positional relationship of the mapped pixels related to the grayscale-free pixel in the cropped image, according to an embodiment of this disclosure.

[0015] Figure 3 This is a schematic flowchart of another image processing method according to an embodiment of the present disclosure.

[0016] Figure 4 is a block diagram of an image processing device according to an embodiment of the present disclosure.

[0017] Figure 5 is a schematic diagram of a computer program product according to an embodiment of the present disclosure.

[0018] Figure 6 is a hardware block diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] In order to make the purposes, technical solutions and advantages of the present disclosure more obvious, the example embodiments according to the present disclosure will be described in detail below with reference to the drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the example embodiments described herein.

[0020] In the related art, when the cropped image needs to be up-sampled, the nearest neighbor interpolation method can map the pixel points in the enlarged image to the original image, and determine the gray value of the point closest to the mapping position as the value of the pixel point in the enlarged image, which is a simple and efficient up-sampling algorithm, but it is easy to cause the mosaic phenomenon after the image is up-sampled.

[0021] The bilinear interpolation method maps the pixel points in the enlarged image to the original image, and determines the four pixel points closest to the mapping position as the target pixel points, and obtains the gray value of the pixel points in the enlarged image by performing linear interpolation in two directions, i.e., first using linear interpolation in the horizontal direction, and then using linear interpolation in the vertical direction, but the bilinear interpolation method is easy to blur image details and cause edge diffusion, resulting in loss of edge feature information, and the higher the magnification, the more serious the image edge diffusion.

[0022] The bicubic interpolation method maps the pixel points in the enlarged image to the original image, and determines the four pixel points closest to the mapping position and the eight pixel points around the four pixel points closest to the mapping position, a total of sixteen pixel points, and similar to the bilinear interpolation method, performs linear interpolation in the horizontal direction and the vertical direction on the sixteen pixel points to obtain the gray value of the pixel points in the enlarged image, but the bicubic interpolation method has low-pass filtering property, which will lose the high-frequency part of the interpolated image and cause image edge blur.

[0023] The up-sampling effect of the model method is then closely related to the model architecture used and the sample quality, and the problem of unstable up-sampling effect is easy to occur.

[0024] In order to solve the above problems, the present disclosure provides an image processing method, which can be applied to a terminal device with a photography function, and the terminal device can be a mobile phone, a tablet, a wearable device, or a camera, etc.Figure 1 As shown, Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this disclosure is shown, including: Step S101: Based on the target zoom level selected by the zoom operation, the acquired original image is cropped to obtain a cropped image; Step S102: Based on the cropped image and the target zoom level, determine the mapped pixel points associated with each grayscale pixel point in the blank target image from among multiple pixels in the cropped image. Wherein, the blank target image is a grayscale-free image obtained by magnifying the cropped image by a target zoom factor. The mapped pixels include a first pixel and a second pixel adjacent to the first pixel. The position of the first pixel in the cropped image and the grayscale-free pixel are mapped in reverse to the target mapping position in the cropped image to satisfy the pixel mapping relationship. Step S103: For each gray-scale pixel, the target gray value of the gray-scale pixel is determined based on the distance weight from the target mapping position of the gray-scale pixel in the cropped image to the first pixel, the gray-scale gradient weight of the second pixel with respect to the first pixel, and the gray value of the second pixel. Step S104: Assign the target gray value of each gray-scale pixel to the blank target image to obtain the target image.

[0025] In summary, the image processing method provided in this disclosure, when zooming an image is required, can crop the acquired original image based on the target zoom factor selected by the zoom operation, and determine in the cropped image a first pixel that satisfies the pixel mapping relationship with the target mapping position of each grayscale pixel in the zoomed blank target image after inverse mapping to the cropped image, and a second pixel adjacent to the first pixel. Combining the grayscale value of the second pixel, the distance weight from the target mapping position to the first pixel, and the grayscale gradient weight of the second pixel with respect to the first pixel, the target grayscale value of the grayscale pixels in the zoomed blank target image is determined, and the target image is obtained. Since the distance of the pixels in the zoomed image to the target mapping position in the cropped image after inverse mapping to the first pixel, and the grayscale change of the second pixel adjacent to the first pixel with respect to the first pixel are considered, the grayscale value of the grayscale pixels in the zoomed blank target image can be determined more accurately, improving the clarity of the target image obtained after zooming.

[0026] The following are Figure 1 The specific implementation methods of each step in the illustrated embodiment are described in detail below: In step S101, the terminal device crops the acquired original image based on the target zoom level selected by the zoom operation to obtain a cropped image.

[0027] In this embodiment of the disclosure, the target zoom factor is a factor greater than 1, and the original image is an image captured by the camera of the terminal device after it is started at a zoom factor of less than or equal to 1.

[0028] In one optional implementation, when the camera of the terminal device is turned on, the terminal device crops the acquired original image based on the target zoom factor selected by the zoom operation to obtain a cropped image. The process includes: in response to detecting the zoom operation, the terminal device determines the target zoom factor selected by the zoom operation, then determines the target position area after the original image is magnified by the target zoom factor, and crops the target position area in the original image to obtain a cropped image.

[0029] It should be noted that, in the embodiments of this disclosure, the image format of the original image can be YUV format or RGB format, etc., and the image processing method provided in the embodiments of this disclosure is a scheme for processing single-channel data.

[0030] For example, for RGB format images, the terminal device upsamples one or more data from the R, G, and B channels using the image processing method provided in this disclosure embodiment; similarly, for YUV format images, the terminal device can upsample one or more data from the Y, U, and V channels using the image processing method provided in this disclosure embodiment as needed.

[0031] It is understood that, in the embodiments of this disclosure, after the terminal device performs upsampling processing on each channel of the multi-channel image using the image processing method provided in the embodiments of this disclosure, the clarity of the obtained upsampled image can be further improved.

[0032] In one optional implementation, after obtaining the cropped image, the terminal device may further: perform Gaussian filtering on the cropped image to obtain a target filtered image; then, use the target filtered image as a guide image to perform guided filtering on the cropped image to obtain a filtered cropped image. Grain noise removal can be performed on the cropped image obtained directly from the original image to improve the accuracy of pixel grayscale values ​​in the final target image and enhance the visual effect of the target image.

[0033] In step S102, the terminal device, based on the cropped image and the target zoom level, determines the mapped pixel points associated with each grayscale pixel point in the blank target image from among multiple pixels in the cropped image.

[0034] In this embodiment of the disclosure, the blank target image is a grayscale-free image obtained by magnifying the cropped image to the target zoom level. For example, taking a mobile phone as the terminal device, if the cropped image is a 1000x750 image with a target zoom level of 4, then the blank target image is a 4000x3000 image. The mapped pixel includes a first pixel and a second pixel adjacent to the first pixel. The position of the first pixel in the cropped image satisfies the pixel mapping relationship with the target mapping position in the cropped image that is mapped in reverse from the grayscale-free pixel.

[0035] It should be noted that, in this embodiment, the pixel mapping relationship is used to characterize the pixel mapping relationship between pixels in the zoomed image and pixels in the unzoomed image. Specifically, the pixel mapping relationship is the conversion relationship between mapping pixels in the zoomed image to their mapped positions in the unzoomed image based on the zoom ratio, and mapping pixels in the zoomed image to their mapped positions in the unzoomed image. The mapped position is the ratio of the pixel position in the zoomed image to the zoom ratio. This mapped position is a floating-point number, and the conversion relationship can be determined based on actual needs; this embodiment does not limit this.

[0036] For example, the mapping relationship is as follows: the pixel corresponding to the integer part of the mapping position is determined as the center pixel, and the center pixel and the three pixels adjacent to the center pixel are determined as the first pixel. At the same time, the second pixel adjacent to the first pixel is determined as the second pixel, resulting in 16 mapped pixels. Among them, the three pixels adjacent to the center pixel can be the three pixels adjacent to the upper left corner of the center pixel, or the three pixels adjacent to the lower left corner of the center pixel, or the three pixels adjacent to the upper right corner of the center pixel, or the three pixels adjacent to the lower right corner of the center pixel. Specifically, this embodiment does not limit this.

[0037] In the case where the three adjacent pixels are the three pixels adjacent to the bottom right corner, assuming the center pixel is (i, j), the first pixel determined by the terminal device includes (i, j), (i, j+1), (i+1, j), and (i+1, j+1). The second pixel adjacent to the first pixel (i, j) includes (i-1, j), (i-1, j-1), and (i, j-1). The second pixel adjacent to the first pixel (i, j+1) includes (i-1, j+1), (i-1, j+2), and (i, j+2). The second pixel adjacent to the first pixel (i+1, j) includes (i+1, j-1), (i+2, j-1), and (i+2, j). The second pixel adjacent to the first pixel (i+1, j+1) includes (i+1, j+2), (i+2, j+2), and (i+2, j+1).

[0038] It is understood that when the three adjacent pixels are the three pixels adjacent to the lower left, upper left, or upper right corner, the process by which the terminal device determines the first pixel and the second pixel is similar to the process by which the three adjacent pixels are the three pixels adjacent to the lower right corner. This embodiment of the present disclosure will not elaborate on this.

[0039] In one optional implementation, the process by which the terminal device determines the mapped pixel associated with each grayscale-free pixel in the blank target image among multiple pixels in the cropped image, based on the cropped image and the target zoom factor, includes: determining the product of the specifications of the cropped image and the target zoom factor, determining the specifications of the blank target image, and constructing a grayscale-free image based on the specifications of the blank target image to obtain the blank target image; then, determining the ratio of the position parameter of each grayscale-free pixel in the blank target image to the target zoom factor to obtain the target mapped position of each grayscale-free pixel in the cropped image; further, based on the target mapped position of each grayscale-free pixel in the cropped image, and the conversion relationship between the mapped position and the mapped pixel in the pixel mapping relationship, determining the mapped pixel associated with each grayscale-free pixel in the cropped image. First, a blank target image without grayscale values ​​can be constructed. Then, based on the target mapping position of each grayscale pixel in the blank target image in the cropped image, and according to the target mapping position and the transformation relationship between the mapping position and the mapping pixel, the mapping pixel related to each grayscale pixel can be accurately determined to improve the efficiency of image optimization.

[0040] The process by which the terminal device determines the target mapping position of each gray-scale-free pixel in the cropped image by the ratio of its position parameter in the blank target image to the target zoom factor can be based on a first formula: ;(Formula 1) In Formula 1, x is the horizontal position parameter value of the grayscale-free pixel in the blank target image, y is the vertical position parameter value of the grayscale-free pixel in the blank target image, x' is the horizontal position parameter value of the grayscale-free pixel in the target mapping position in the cropped image, y' is the vertical position parameter value of the grayscale-free pixel in the target mapping position in the cropped image, and scale is the target zoom factor.

[0041] For example, for a gray-scale pixel with position parameters (10, 12) in a blank target image, if the target zoom factor is 3, the target mapping position of the gray-scale pixel in the cropped image is (3.3, 4).

[0042] Furthermore, assuming the mapping relationship is as follows: the pixel corresponding to the integer part of the mapped position is determined as the center pixel, and the center pixel, along with the three pixels adjacent to the center pixel to its lower right, are determined as the first pixel. Simultaneously, the second pixel adjacent to the first pixel is determined as the second pixel. Then, the center pixel associated with the grayscale-free pixel at position (10, 12) in the blank target image is pixel (3, 4). Therefore, the first pixel associated with the grayscale-free pixel at position (10, 12) includes pixel (3, 4). ), (3,5), (4,4), (4,5), wherein the second pixel adjacent to the first pixel (3,4) includes pixels (2,4), (2,3), (3,3); the second pixel adjacent to the first pixel (3,5) includes pixels (2,5), (2,6), (3,6); the second pixel adjacent to the first pixel (4,4) includes pixels (4,3), (5,3), (5,4); the second pixel adjacent to the first pixel (4,5) includes pixels (4,6), (5,6), (5,5).

[0043] For example, such as Figure 2 As shown, Figure 2This illustration shows the target mapping position of a grayscale-free pixel in a blank target image after it is mapped to a cropped image, according to an embodiment of this disclosure. It also shows the positional relationship of the mapped pixels associated with the grayscale-free pixel. Here, p' is the target mapping position of the grayscale-free pixel p in the blank target image in the cropped image; pixels a, b, c, and d are first pixels associated with the grayscale-free pixel p; pixels 1, 2, and 3 are second pixels adjacent to pixel a; pixels 4, 5, and 6 are second pixels adjacent to pixel b; pixels 7, 8, and 9 are second pixels adjacent to pixel c; and pixels 10, 11, and 12 are second pixels adjacent to pixel d.

[0044] In step S103, the terminal device determines the target grayscale value of each grayscale-free pixel based on the distance weight from the target mapping position of the grayscale-free pixel in the cropped image to the first pixel, the grayscale gradient weight of the second pixel with respect to the first pixel, and the grayscale value of the second pixel.

[0045] In this embodiment of the disclosure, the distance weight is used to characterize the distance between the first pixel and the target mapping position of the pixel without grayscale in the cropped image; the grayscale gradient weight is used to characterize the degree of difference in grayscale value of the second pixel with respect to the first pixel.

[0046] In an optional implementation, the terminal device may further determine, for each grayscale-free pixel, the distance value from the target mapping position of the grayscale-free pixel in the cropped image to the first pixel; then, the distance value is normalized based on a Gaussian curve to obtain the distance weight from the target mapping position to the first pixel; wherein, the distance value from the target mapping position to the first pixel is an Euclidean distance value; the distance between the target mapping position of the grayscale-free pixel and the first pixel in the cropped image can be normalized using a Gaussian curve, thereby quickly determining the distance weight from the target mapping position to the first pixel.

[0047] For example, the positional relationship between the target mapping position of a grayscale pixel and the first pixel in the cropped image is as follows: Figure 2 In the case shown, the terminal device can determine the distance weight da from the target mapping position p' to the first pixel a, the distance weight db from the target mapping position p' to the first pixel b, the distance weight dc from the target mapping position p' to the first pixel c, and the distance weight dd from the target mapping position p' to the first pixel d.

[0048] In an optional implementation, the terminal device can further determine, for each grayscale-free pixel, the grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels associated with the grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel among the mapped pixels associated with the grayscale-free pixel, and a grayscale gradient weight model. The grayscale gradient weight of the second pixel with respect to the first pixel can be quickly determined based on the grayscale values ​​of the first and second pixels associated with each grayscale-free pixel, and the grayscale gradient weight model.

[0049] The gray-level gradient weight model can be: ;(Formula 2) In Formula 2, Let m be the grayscale gradient weight of the second pixel point m with respect to the first pixel point n. Let m be the grayscale value of the second pixel. Let n be the grayscale value of the first pixel. The target parameter is used to adjust the edge convergence degree and grain suppression degree of the grayscale-free pixels. The larger the target parameter, the weaker the edge convergence degree of the grayscale-free pixels; the smaller the target parameter, the smaller the edge diffusion degree of the grayscale-free pixels. The value range of the target parameter can be determined based on actual needs, and this embodiment does not limit it.

[0050] For example, the positional relationship between the target mapping position and the second pixel in the cropped image of a pixel without grayscale is as follows: Figure 2 In the scenario shown, the terminal device can determine the grayscale gradient weight g1 of the second pixel point 1 with respect to the first pixel point a, the grayscale gradient weight g2 of the second pixel point 2 with respect to the first pixel point a, the grayscale gradient weight g3 of the second pixel point 3 with respect to the first pixel point a; the grayscale gradient weight g4 of the second pixel point 4 with respect to the first pixel point b, the grayscale gradient weight g5 of the second pixel point 5 with respect to the first pixel point b, the grayscale gradient weight g6 of the second pixel point 6 with respect to the first pixel point b; the grayscale gradient weight g7 of the second pixel point 7 with respect to the first pixel point c, the grayscale gradient weight g8 of the second pixel point 8 with respect to the first pixel point c, the grayscale gradient weight g9 of the second pixel point 9 with respect to the first pixel point c; and the grayscale gradient weight g10 of the second pixel point 10 with respect to the first pixel point d, the grayscale gradient weight g11 of the second pixel point 11 with respect to the first pixel point d, and the grayscale gradient weight g12 of the second pixel point 12 with respect to the first pixel point d.

[0051] It should be noted that, in the embodiments of this disclosure, when the gray value of a pixel without gray value is determined by the gray gradient weight obtained by the gray gradient weight model with a small target parameter, the pixel edge in the final generated target image may contain irregular granular points. Alternatively, when the gray value of a pixel without gray value is determined by the gray gradient weight obtained by the gray gradient weight model with a large target parameter, the pixel edge convergence in the final generated target image is weak.

[0052] In an optional implementation, to maximize the suppression of pixel particles in the final generated target image while further converging edges, the terminal device can use the aforementioned grayscale gradient weight model as a first grayscale gradient weight model, where the grayscale gradient weight is the first grayscale gradient weight, and combine the first grayscale gradient weight of the second pixel with respect to the first pixel in the mapped pixels associated with each grayscale-free pixel to form a first grayscale gradient weight image; then, for each grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel in the mapped pixels associated with the grayscale-free pixel, and the second grayscale gradient weight model, determine the grayscale gradient weight of the second pixel with respect to the first pixel in the mapped pixels associated with the grayscale-free pixel. The second grayscale gradient weight of the second pixel with respect to the first pixel is described, wherein the target parameter in the second grayscale gradient weight model is greater than the target parameter in the first grayscale gradient weight model, and the target parameter is used to adjust the edge convergence degree of the grayscale-free pixel; further, the second grayscale gradient weight of the second pixel with respect to the first pixel in the mapped pixels associated with each grayscale-free pixel is combined into a second grayscale gradient weight image; then, the second grayscale gradient weight image is determined as a guide image, and the first grayscale weight image is subjected to guide filtering to obtain the updated grayscale gradient weight of the second pixel with respect to the first pixel in the mapped pixels associated with the grayscale-free pixel. Two gray-level gradient weights for the second pixel with respect to the first pixel can be determined using gray-level gradient weight models with two target parameters. A gray-level gradient weight image is constructed using the gray-level gradient weight determined by the gray-level gradient weight model with smaller target parameters. A guided filter is then applied to the gray-level gradient weight image constructed using the gray-level gradient weight determined by the gray-level gradient weight model with larger target parameters. This process maximizes the suppression of pixel particles in the final target image based on the updated gray-level gradient weights, further converges edges, and improves the visual effect of the final target image.

[0053] In one optional implementation, the number of first pixels includes multiple pixels, and the number of second pixels includes multiple pixels. The process by which the terminal device determines the target grayscale value of the grayless pixel based on the distance weight from the target mapping position of the grayless pixel in the cropped image to the first pixel, the grayscale gradient weight of the second pixel with respect to the first pixel, and the grayscale value of the second pixel includes: for each second pixel, determining the grayscale gradient weight of the second pixel with respect to the target first pixel, and the product of the distance weights associated with the target first pixel, to obtain the total weight of the second pixel with respect to the target mapping position, wherein the target first pixel is the first pixel adjacent to the second pixel among multiple first pixels; then, based on the total weight of the multiple second pixels and the grayscale values ​​of the multiple second pixels, determining the weighted average grayscale value of the multiple second pixels to obtain the target grayscale value of the grayless pixel. On the one hand, by reverse mapping the grayscale pixels to the target mapping position in the cropped image, multiple first pixels that satisfy the pixel mapping relationship are used to determine the target grayscale value of the grayscale pixels. Since more relevant information about the grayscale pixels in the cropped image can be obtained, the accuracy of the obtained grayscale pixel values ​​can be improved. On the other hand, the target grayscale value of the grayscale pixels can be obtained based on the total weight of each second pixel with respect to the target mapping position and the grayscale value of each second pixel. Since the total weight of each second pixel with respect to the target mapping position takes into account the positional relationship of the second pixel with respect to the target mapping position and the grayscale change of the second pixel with respect to the target mapping position, the accuracy of the obtained grayscale pixel values ​​can be further improved.

[0054] In the case where both the first and second pixels have multiple values, the process by which the terminal device determines the target grayscale value of the grayscale-free pixel can be based on a third formula, which is: ;(Formula 3) In formula 3, Let M be the total weight of the second pixel m with respect to the target mapping position, where M is the total number of second pixels. ,in, The distance weight from the first pixel point adjacent to the second pixel point m to the target mapping position.

[0055] In step S104, the terminal device assigns the target grayscale value of each of the grayscale-free pixels to the blank target image to obtain the target image.

[0056] In this embodiment of the disclosure, the target image is the image obtained by zooming the cropped image to a target zoom level.

[0057] In one optional implementation, after obtaining the target grayscale value of each of the grayscale-free pixels in the blank target image, the terminal device assigns the target grayscale value of each of the grayscale-free pixels to the blank target image to obtain the target image.

[0058] For example, such as Figure 3 As shown, Figure 3 A flowchart of another image processing method provided by an embodiment of this disclosure is shown, including: Step S301: Based on the target zoom level selected by the zoom operation, the acquired original image is cropped to obtain a cropped image; Step S302: Perform Gaussian filtering on the cropped image to obtain the target filtered image; Step S303: Using the target filtered image as a guide image, guide filtering is applied to the cropped image to obtain the filtered cropped image; Step S304: Based on the cropped image and the target zoom level, determine the mapped pixel points associated with each grayscale pixel point in the blank target image from among multiple pixels in the cropped image. Step S305: For each grayscale pixel, determine the distance value from the target mapping position of the grayscale pixel to the first pixel in the cropped image, and normalize the distance value based on the Gaussian curve to obtain the distance weight from the target mapping position to the first pixel. Step S306: For each grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel in the mapped pixels associated with the grayscale-free pixel, and the grayscale gradient weight model, determine the grayscale gradient weight of the second pixel with respect to the first pixel in the mapped pixels associated with the grayscale-free pixel. Step S307: For each gray-scale pixel, the target gray value of the gray-scale pixel is determined based on the distance weight from the target mapping position of the gray-scale pixel in the cropped image to the first pixel, the gray-scale gradient weight of the second pixel with respect to the first pixel, and the gray value of the second pixel. Step S308: Assign the target grayscale value of each grayscale-free pixel to the blank target image to obtain the target image.

[0059] An exemplary embodiment of this disclosure provides an image processing apparatus, which may be a terminal device or a chip applied to a terminal device. Figure 4 A schematic block diagram of the functional modules of an image processing apparatus according to an exemplary embodiment of the present disclosure is shown. Figure 4 As shown, the image processing apparatus 400 includes: The cropping module 401 is configured to crop the acquired original image based on the target zoom magnification selected by the zoom operation to obtain a cropped image; The first determining module 402 is configured to, based on the cropped image and the target zoom factor, determine, among a plurality of pixels in the cropped image, a mapping pixel related to each grayscale-free pixel in the blank target image, wherein the blank target image is a grayscale-free image obtained by magnifying the cropped image by the target zoom factor, the mapping pixel includes a first pixel and a second pixel adjacent to the first pixel, the position of the first pixel in the cropped image satisfies a pixel mapping relationship with the target mapping position in the cropped image in reverse mapping from the grayscale-free pixel; The second determining module 403 is configured to, for each grayscale pixel, determine the target grayscale value of the grayscale pixel based on the distance weight from the target mapping position of the grayscale pixel in the cropped image to the first pixel, the grayscale gradient weight of the second pixel with respect to the first pixel, and the grayscale value of the second pixel. The assignment module 404 is configured to assign the target grayscale value of each of the grayscale-free pixels to the blank target image to obtain the target image.

[0060] Optionally, the number of the first pixel may include multiple pixels, the number of the second pixel may include multiple pixels, and the second determining module 403 is configured to: For each second pixel, the grayscale gradient weight of the second pixel with respect to the target first pixel and the distance weight associated with the target first pixel are determined to obtain the total weight of the second pixel with respect to the target mapping position, wherein the target first pixel is the first pixel adjacent to the second pixel among a plurality of first pixels; Based on the total weight of the multiple second pixels and the gray values ​​of the multiple second pixels, a weighted average gray value of the multiple second pixels is determined to obtain the target gray value of the gray-free pixel.

[0061] Optionally, the second determining module 403 is further configured to: For each grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel among the mapped pixels associated with the grayscale-free pixel, and the grayscale gradient weight model, the grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels associated with the grayscale-free pixel is determined.

[0062] Optionally, the second determining module 403 is further configured to: The first gray-level gradient weight of the second pixel with respect to the first pixel is combined into a first gray-level gradient weight image among the mapped pixels associated with each of the gray-level non-gray-level pixels. For each grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel among the mapped pixels associated with the grayscale-free pixel, and a second grayscale gradient weight model, a second grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels associated with the grayscale-free pixel is determined. The target parameter in the second grayscale gradient weight model is greater than the target parameter in the first grayscale gradient weight model. The target parameter is used to adjust the edge convergence degree and particle suppression degree of the grayscale-free pixel. The second gray-level gradient weight of the second pixel with respect to the first pixel is combined into a second gray-level gradient weight image among the mapped pixels associated with each of the gray-level non-gray-level pixels. The second grayscale gradient weight image is determined as the guide image, and the first grayscale weight image is subjected to guide filtering to obtain the updated grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels related to the grayscale-free pixels.

[0063] Optionally, the second determining module 403 is further configured to: For each grayscale-free pixel, determine the distance value from the target mapping position of the grayscale-free pixel in the cropped image to the first pixel. The distance value is normalized based on a Gaussian curve to obtain the distance weight from the target mapping position to the first pixel.

[0064] Optional, such as Figure 4 As shown, the device further includes a filter module 405, configured as follows: The cropped image is subjected to Gaussian filtering to obtain the target filtered image; Using the target filtered image as a guide image, guide filtering is applied to the cropped image to obtain the filtered cropped image.

[0065] Optionally, the first determining module 402 is configured to: The specifications of the cropped image and the product of the target zoom factor are determined to determine the specifications of the blank target image, and a grayscale-free image is constructed based on the specifications of the blank target image to obtain the blank target image; Determine the target mapping position of each gray-scale-free pixel in the blank target image by the ratio of its position parameter in the blank target image to the target zoom factor. Based on the target mapping position of each grayscale-free pixel in the cropped image, and the transformation relationship between the mapping position and the mapping pixel in the pixel mapping relationship, the mapping pixel associated with each grayscale-free pixel is determined in the cropped image.

[0066] Exemplary embodiments of this disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to cause the electronic device to perform a method according to an embodiment of this disclosure.

[0067] Exemplary embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to embodiments of this disclosure.

[0068] like Figure 5 As shown, an exemplary embodiment of this disclosure also provides a computer program product 500, including a computer program 501, wherein the computer program, when executed by a computer's processor, is used to cause the computer to perform a method according to an embodiment of this disclosure.

[0069] refer to Figure 6 The present invention describes a structural block diagram of an electronic device 600 that can serve as a terminal device or terminal device of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0070] like Figure 6 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0071] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, output unit 607, storage unit 608, and communication unit 609. Input unit 606 can be any type of device capable of inputting information to electronic device 600. Input unit 606 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device. Output unit 607 can be any type of device capable of presenting information and may include, but is not limited to, a display, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 608 may include, but is not limited to, disks and optical discs. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.

[0072] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above. For example, in some embodiments, the methods of the exemplary embodiments of this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. In some embodiments, the computing unit 601 can be configured to perform the methods of the exemplary embodiments of this disclosure by any other suitable means (e.g., by means of firmware).

[0073] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0074] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0075] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0076] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0077] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0078] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this disclosure are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a terminal, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc (DVD); or it can be a semiconductor medium, such as a solid-state drive (SSD).

[0079] Although this disclosure has been described in conjunction with specific features and embodiments, it will be apparent that various modifications and combinations can be made therein without departing from the spirit and scope of this disclosure. Accordingly, this specification and drawings are merely exemplary illustrations of the disclosure as defined by the appended claims and are to be considered as covering any and all modifications, variations, combinations, or equivalents within the scope of this disclosure. It is obvious that those skilled in the art can make various alterations and modifications to this disclosure without departing from its spirit and scope. Thus, this disclosure is also intended to include any such modifications and modifications that fall within the scope of the claims of this disclosure and their equivalents.

Claims

1. An image processing method, characterized in that, include: The original image is cropped based on the zoom magnification of the target selected by the zoom operation to obtain a cropped image; Based on the cropped image and the target zoom factor, among multiple pixels in the cropped image, a mapping pixel is determined that is associated with each grayscale-free pixel in the blank target image. The blank target image is a grayscale-free image obtained by magnifying the cropped image by the target zoom factor. The mapping pixel includes a first pixel and a second pixel adjacent to the first pixel. The position of the first pixel in the cropped image satisfies a pixel mapping relationship with the target mapping position in the cropped image that is mapped in reverse from the grayscale-free pixel. For each grayscale-free pixel, the target grayscale value of the grayscale-free pixel is determined based on the distance weight from the target mapping position of the grayscale-free pixel in the cropped image to the first pixel, the grayscale gradient weight of the second pixel with respect to the first pixel, and the grayscale value of the second pixel. The target image is obtained by assigning the target gray value of each of the gray-scale-free pixels to the blank target image.

2. The image processing method as described in claim 1, characterized in that, The number of first pixels includes multiple pixels, the number of second pixels includes multiple pixels, and the step of determining the target grayscale value of the grayscale-free pixel based on the distance weight from the target mapping position of the grayscale-free pixel in the cropped image to the first pixel, the grayscale gradient weight of the second pixel with respect to the first pixel, and the grayscale value of the second pixel includes: For each second pixel, the grayscale gradient weight of the second pixel with respect to the target first pixel and the distance weight associated with the target first pixel are determined to obtain the total weight of the second pixel with respect to the target mapping position, wherein the target first pixel is the first pixel adjacent to the second pixel among a plurality of first pixels; Based on the total weight of the multiple second pixels and the gray values ​​of the multiple second pixels, a weighted average gray value of the multiple second pixels is determined to obtain the target gray value of the gray-free pixel.

3. The image processing method as described in claim 1, characterized in that, The method further includes: For each grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel among the mapped pixels associated with the grayscale-free pixel, and the grayscale gradient weight model, the grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels associated with the grayscale-free pixel is determined.

4. The image processing method as described in claim 3, characterized in that, The gray-level gradient weight model is a first gray-level gradient weight model, and the gray-level gradient weight is a first gray-level gradient weight. The method further includes: The first gray-level gradient weight of the second pixel with respect to the first pixel is combined into a first gray-level gradient weight image among the mapped pixels associated with each of the gray-level non-gray-level pixels. For each grayscale-free pixel, based on the grayscale values ​​of the second pixel and the first pixel among the mapped pixels associated with the grayscale-free pixel, and a second grayscale gradient weight model, a second grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels associated with the grayscale-free pixel is determined. The target parameter in the second grayscale gradient weight model is greater than the target parameter in the first grayscale gradient weight model. The target parameter is used to adjust the edge convergence degree and particle suppression degree of the grayscale-free pixel. The second gray-level gradient weight of the second pixel with respect to the first pixel is combined into a second gray-level gradient weight image among the mapped pixels associated with each of the gray-level non-gray-level pixels. The second grayscale gradient weight image is determined as the guide image, and the first grayscale weight image is subjected to guide filtering to obtain the updated grayscale gradient weight of the second pixel with respect to the first pixel among the mapped pixels related to the grayscale-free pixels.

5. The image processing method as described in claim 1, characterized in that, The method further includes: For each grayscale-free pixel, determine the distance value from the target mapping position of the grayscale-free pixel in the cropped image to the first pixel. The distance value is normalized based on a Gaussian curve to obtain the distance weight from the target mapping position to the first pixel.

6. The image processing method as described in claim 1, characterized in that, Before determining the mapped pixels in the cropped image associated with each grayscale pixel within the blank target image based on the cropped image and the target zoom level, the method further includes: The cropped image is subjected to Gaussian filtering to obtain the target filtered image; Using the target filtered image as a guide image, guide filtering is applied to the cropped image to obtain the filtered cropped image.

7. The image processing method as described in claim 1, characterized in that, The step of determining, based on the cropped image and the target zoom level, the mapping pixel associated with each grayscale pixel in the blank target image from among multiple pixels in the cropped image includes: The specifications of the cropped image and the product of the target zoom factor are determined to determine the specifications of the blank target image, and a grayscale-free image is constructed based on the specifications of the blank target image to obtain the blank target image; Determine the target mapping position of each gray-scale-free pixel in the blank target image by the ratio of its position parameter in the blank target image to the target zoom factor. Based on the target mapping position of each grayscale-free pixel in the cropped image, and the transformation relationship between the mapping position and the mapping pixel in the pixel mapping relationship, the mapping pixel associated with each grayscale-free pixel is determined in the cropped image.

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

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.