Image interpolation method and device, electronic equipment and computer readable medium

By using the direction values ​​and direction reliability of pixel points in image interpolation, the problems of insufficient image edge detail recovery and complexity of deep learning algorithms in the prior art are solved, and high-quality image interpolation and simplified model deployment are achieved. .

CN118898565AActive Publication Date: 2024-11-05SANECHIPS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310477890.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2024-11-05
Estimated Expiration
2043-04-27

AI Technical Summary

Technical Problem

The existing image interpolation methods in the field of digital image processing cannot effectively generate image edge texture details, resulting in jagged edges at the interpolated image edges, low subjective quality, and complex deep learning algorithm models, high hardware resource requirements, and training in generalization effects. Data and image content have a great impact.

Method used

By converting the coordinates of the pixel points to be interpolated in the target image coordinate system into the original image coordinate system, the direction values ​​and direction reliability of the corresponding pixel points in the original image are determined, and interpolated based on these values ​​are performed to achieve image interpolation.

Benefits of technology

Improve image edge detail recovery, reduce edge jagging after interpolation, improve subjective quality, simplify mathematical model, reduce terminal deployment complexity, and improve generalization effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118898565A_ABST
    Figure CN118898565A_ABST
Patent Text Reader

Abstract

The invention provides an image interpolation method and device, electronic equipment and a computer readable medium. The image interpolation method comprises the following steps: converting a first coordinate of a pixel point to be interpolated in a target image coordinate system into a second coordinate in an original image coordinate system; determining a direction value and direction reliability of a first pixel point corresponding to the second coordinate in the original image; and determining a final pixel value of the pixel point to be interpolated according to the direction value and the direction reliability of the first pixel point.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to an image interpolation method and device, an electronic device, and a computer-readable medium. Background Art

[0002] At present, there are two main image interpolation methods in the field of digital image processing: traditional interpolation methods and deep learning algorithm interpolation methods. Traditional interpolation methods such as bilinear interpolation method, bicubic interpolation method, Lanczos interpolation method, etc. have simple implementation principles and are easy to implement in hardware, but these methods cannot generate image edge texture details well. There are many jagged edges on the interpolated image, so the subjective quality is not high; deep learning algorithm interpolation method can well preserve image texture details, and the subjective quality is significantly better than traditional interpolation methods, but the deep learning algorithm model is complex and has many parameters. The deployment of the algorithm has high requirements on hardware resources, and its effect is greatly affected by the training data set and the content of the image itself. Summary of the invention

[0003] Embodiments of the present application provide an image interpolation method and device, an electronic device, and a computer-readable medium.

[0004] In a first aspect, an embodiment of the present application provides an image interpolation method, comprising: converting a first coordinate of a pixel point to be interpolated in a target image coordinate system into a second coordinate in an original image coordinate system; determining a direction value and a direction reliability of a first pixel point corresponding to the second coordinate in the original image; and determining a final pixel value of the pixel point to be interpolated based on the direction value and the direction reliability of the first pixel point.

[0005] In a second aspect, an embodiment of the present application provides an image interpolation device, comprising: a coordinate conversion module, used to convert the first coordinate of the pixel point to be interpolated in the target image coordinate system into a second coordinate in the original image coordinate system; a direction calculation module, used to determine the direction value and direction reliability of the first pixel point corresponding to the second coordinate in the original image; and an interpolation module, used to determine the final pixel value of the pixel point to be interpolated based on the direction value and direction reliability of the first pixel point.

[0006] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor; a memory, wherein at least one program is stored in the memory, and when the at least one program is executed by the at least one processor, any one of the above-mentioned image interpolation methods is implemented.

[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, any one of the above-mentioned image interpolation methods is implemented.

[0008] The image interpolation method provided in the embodiment of the present application performs interpolation based on the direction value and direction reliability of the first pixel point corresponding to the pixel point to be interpolated in the original image. Compared with the traditional interpolation method, the image interpolation method in the embodiment of the present application better restores the edge detail information of the image, and the edge of the interpolated image has less jagged edges and higher subjective quality. Compared with the deep learning algorithm, the mathematical model of the image interpolation method in the embodiment of the present application is simple, easier to deploy on terminals, and has better generalization effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 A flowchart of an image interpolation method provided by one embodiment of the present application;

[0010] Figure 2 This is a schematic diagram of 16 sub-directions when the slope is positive in an embodiment of the present application;

[0011] Figure 3 Schematic diagram of the positional relationship among the first straight line L2, the second straight line L1, the third straight line L3 and the vertical line L4 in the target coordinate system in the embodiment of the present application;

[0012] Figure 4 A block diagram of an image interpolation device provided in another embodiment of the present application;

[0013] Figure 5 A block diagram of the composition of an electronic device provided for another embodiment of the present application. DETAILED DESCRIPTION

[0014] In order to enable those skilled in the art to better understand the technical solution of the present application, the image interpolation method and device, electronic device, and computer-readable medium provided by the present application are described in detail below in conjunction with the accompanying drawings.

[0015] Example embodiments will be described more fully below with reference to the accompanying drawings, but the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. On the contrary, the purpose of providing these embodiments is to make this application thorough and complete and to enable those skilled in the art to fully understand the scope of this application.

[0016] In the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.

[0017] As used herein, the term "and / or" includes any and all combinations of at least one of the associated listed items.

[0018] The terms used herein are only used to describe specific embodiments and are not intended to limit the present application. As used herein, the singular forms "a", "an" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of at least one other feature, whole, step, operation, element, component and / or its group is not excluded.

[0019] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined herein.

[0020] Figure 1 A flowchart of an image interpolation method provided by one embodiment of the present application.

[0021] First, refer to Figure 1 An embodiment of the present application provides an image interpolation method, comprising:

[0022] Step 100: convert the first coordinates of the pixel to be interpolated in the target image coordinate system into the second coordinates in the original image coordinate system.

[0023] In some exemplary embodiments, the original image refers to an image that needs to be interpolated, and the target image refers to an image obtained by interpolating the original image.

[0024] In some exemplary embodiments, if the resolution of the original image is src_width×src_height, the resolution of the target image is dst_width×dst_height, the first coordinate of the pixel to be interpolated in the target image coordinate system is (x, y), and the second coordinate of the pixel to be interpolated in the original image coordinate system is (x0, y0), then x0 and x satisfy y0 and y satisfy

[0025] Step 101, determining the direction value and direction reliability of a first pixel point corresponding to a second coordinate in an original image.

[0026] In some exemplary embodiments, determining the direction value and direction reliability of the first pixel point corresponding to the second coordinate in the original image includes: respectively calculating the direction value and direction reliability of each second pixel point in the original image; and determining the direction value and direction reliability of the first pixel point based on the direction value and direction reliability of each second pixel point in the original image.

[0027] In some exemplary embodiments, respectively calculating the direction value and direction reliability of each second pixel point in the original image includes: respectively calculating the gradient in the x direction and the gradient in the y direction of each third pixel point in the original image; for each second pixel point in the original image, calculating the direction value and direction reliability of the second pixel point based on the gradient in the x direction and the gradient in the y direction of all third pixels in a first pixel matrix centered on the second pixel point in the original image.

[0028] In some exemplary embodiments, determining the direction value and direction reliability of a first pixel point corresponding to a second coordinate in an original image includes: respectively calculating the gradient in the x direction and the gradient in the y direction of each third pixel point in a second pixel matrix centered on the first pixel point; and calculating the direction value and direction reliability of the first pixel point based on the gradient in the x direction and the gradient in the y direction of all third pixel points in the second pixel matrix.

[0029] In some exemplary embodiments, determining the direction value and direction reliability of the first pixel point corresponding to the second coordinate in the original image includes: when the second coordinate is an integer, respectively calculating the gradient in the x direction and the gradient in the y direction of each third pixel point in the second pixel matrix centered on the first pixel point; calculating the direction value and direction reliability of the first pixel point according to the gradient in the x direction and the gradient in the y direction of all the third pixel points in the second pixel matrix. When the second coordinate is a non-integer, converting the second coordinate to an integer coordinate; respectively calculating the gradient in the x direction and the gradient in the y direction of each third pixel point in the second pixel matrix centered on the pixel point corresponding to the integer coordinate; calculating the direction value and direction reliability of the pixel point corresponding to the integer coordinate according to the gradient in the x direction and the gradient in the y direction of all the third pixel points in the second pixel matrix, and taking the direction value and direction reliability of the pixel point corresponding to the integer coordinate as the direction value and direction reliability of the first pixel point.

[0030] In some exemplary embodiments, calculating the gradient of the third pixel point in the x direction and the gradient in the y direction includes: multiplying the pixel values ​​of all eighth pixels in the third pixel matrix centered on the third pixel point in the original image by the gradient operator in the x direction and then summing them to obtain the gradient of the third pixel point in the x direction, that is, is the gradient of the third pixel in the x direction, M ijis the pixel value of the jth eighth pixel in the third pixel matrix centered at the i-th third pixel, oper_x j is the jth element value of the gradient operator in the x direction; the pixel values ​​of all the eighth pixels in the third pixel matrix centered on the third pixel in the original image are multiplied by the gradient operator in the y direction and then summed to obtain the gradient of the third pixel in the y direction, that is, is the gradient of the third pixel in the y direction, M ij is the pixel value of the jth eighth pixel in the third pixel matrix centered at the i-th third pixel, oper_y j is the j-th element value of the gradient operator in the y direction.

[0031] In some exemplary embodiments, the size of any one of the first pixel matrix, the second pixel matrix, and the third pixel matrix is ​​B×B, where B is 2b+1, and b is an integer greater than or equal to 1, for example, B is 3, 5, 7, 9, etc.

[0032] The sizes of the first pixel matrix, the second pixel matrix, and the third pixel matrix may be the same or different.

[0033] In some exemplary embodiments, the gradient operator may be a Sobel operator, a Prewiit operator, a Scharr operator, etc. For example, when B is 3, the Sobel operator in the x direction is The sobel operator in the y direction is

[0034] In some exemplary embodiments, when calculating the gradient of the third pixel point in the x direction and the gradient in the y direction, if the third pixel point is an edge pixel point in the original image, the original image needs to be filled with edge pixel values.

[0035] In some exemplary embodiments, calculating the direction value and direction reliability of the second pixel point according to the gradients in the x direction and the gradients in the y direction of all third pixel points in the first pixel matrix centered on the second pixel point in the original image includes: according to the formula Calculate the angle corresponding to the direction value of the second pixel.

[0036] According to the formula Calculate the directional reliability of the second pixel.

[0037] The direction value of the second pixel can be obtained by performing discretization calculation on θ. Specifically, the direction value of the pixel can be set to 4, 8, 16, 32, etc. The calculation of the direction value is explained below by taking setting 32 direction values ​​as an example.

[0038] make Then, a, b, and c satisfy different conditions and correspond to different direction values, as shown in Table 1.

[0039] In some exemplary embodiments, if the directional reliability of the second pixel point is less than 0, or greater than 1, the directional reliability of the second pixel point is truncated to between 0 and 1. That is, if the directional reliability of the second pixel point is less than 0, the directional reliability of the second pixel point is modified to 0; if the directional reliability of the second pixel point is greater than 1, the directional reliability of the second pixel point is modified to 1.

[0040] In some exemplary embodiments, calculating the direction value and direction reliability of the pixel point corresponding to the integer coordinate according to the gradient of all third pixel points in the second pixel matrix in the x direction and the gradient in the y direction includes: according to the formula Calculate the angle corresponding to the direction value of the pixel point corresponding to the integer coordinate.

[0041] According to the formula Calculate the directional reliability of the pixel point corresponding to the integer coordinate.

[0042] By performing discretization calculation on θ, the direction value of the pixel point corresponding to the integer coordinate can be obtained. Specifically, the direction value of the pixel point can be set to 4, 8, 16, 32, etc. The following takes setting 32 direction values ​​as an example to illustrate the calculation of the direction value.

[0043] make Then, a, b, and c satisfy different conditions and correspond to different direction values, as shown in Table 1.

[0044] In some exemplary embodiments, if the directional reliability of the pixel point corresponding to the integer coordinate is less than 0, or greater than 1, the directional reliability of the pixel point corresponding to the integer coordinate is truncated to between 0 and 1. That is, if the directional reliability of the pixel point corresponding to the integer coordinate is less than 0, the directional reliability of the pixel point corresponding to the integer coordinate is modified to 0; if the directional reliability of the pixel point corresponding to the integer coordinate is greater than 1, the directional reliability of the pixel point corresponding to the integer coordinate is modified to 1.

[0045] Table 1

[0046]

[0047] Figure 2 Schematic diagram of 16 sub-directions when the slope is positive in the embodiment of the present application. Figure 2 As shown in the figure, each gradient direction can be discretely mapped to a pixel point in the neighborhood of the 5×5 interval. For the straight line corresponding to each direction, the direction of the third and fourth quadrants is the same as that of the first and second quadrants. Therefore, it is only necessary to calculate the pixel points in the direction of the first and second quadrants.

[0048] In some exemplary embodiments, determining the direction value and direction reliability of a first pixel point based on the direction value and direction reliability of each second pixel point in the original image includes: using the direction value of the second pixel point whose coordinates are the second coordinates in the original image as the direction value of the first pixel point, and using the direction reliability of the second pixel point whose coordinates are the second coordinates in the original image as the direction reliability of the first pixel point.

[0049] In some exemplary embodiments, determining the direction value and direction reliability of the first pixel point according to the direction value and direction reliability of each second pixel point in the original image includes: when the second coordinate is an integer, taking the direction value of the second pixel point whose coordinate is the second coordinate in the original image as the direction value of the first pixel point, and taking the direction reliability of the second pixel point whose coordinate is the second coordinate in the original image as the direction reliability of the first pixel point. When the second coordinate is a non-integer, converting the second coordinate into an integer coordinate, taking the direction value of the second pixel point whose coordinate is the integer coordinate in the original image as the direction value of the first pixel point, and taking the direction reliability of the second pixel point whose coordinate is the integer coordinate in the original image as the direction reliability of the first pixel point.

[0050] In some exemplary embodiments, the second coordinate being an integer means that both the x coordinate and the y coordinate in the second coordinate are integers.

[0051] In some exemplary embodiments, the second coordinate being a non-integer means that the x coordinate in the second coordinate is a non-integer, or the y coordinate is a non-integer, or both the x coordinate and the y coordinate are non-integers.

[0052] In some exemplary embodiments, converting the second coordinate to an integer coordinate includes: rounding down the second coordinate to obtain an integer coordinate; or rounding up the second coordinate to obtain an integer coordinate; or rounding the second coordinate to obtain an integer coordinate.

[0053] In some exemplary embodiments, when the x coordinate in the second coordinate is a non-integer, converting the second coordinate into an integer coordinate includes converting the x coordinate in the second coordinate into an integer; when the y coordinate in the second coordinate is a non-integer, converting the second coordinate into an integer coordinate includes converting the y coordinate in the second coordinate into an integer; when both the x coordinate and the y coordinate in the second coordinate are non-integers, converting the second coordinate into an integer coordinate includes converting the x coordinate and the y coordinate in the second coordinate into an integer.

[0054] Step 102: determining a final pixel value of the pixel to be interpolated according to the direction value and direction reliability of the first pixel.

[0055] In some exemplary embodiments, determining the final pixel value of the pixel to be interpolated based on the direction value and direction reliability of the first pixel includes: determining the original pixel value of the pixel to be interpolated based on the direction value of the first pixel; correcting the original pixel value of the pixel to be interpolated to obtain an intermediate pixel value of the pixel to be interpolated in the target image; and determining the final pixel value of the pixel to be interpolated based on the direction reliability of the first pixel, the intermediate pixel value of the pixel to be interpolated, and the pixel value of the pixel to be interpolated calculated using a traditional interpolation method.

[0056] In some exemplary embodiments, Figure 3 As shown, determining the original pixel value of the pixel to be interpolated according to the direction value of the first pixel point includes: determining the slope and the first intercept Theta of the first straight line L2 passing through the first pixel point (x1, y1) according to the direction value of the first pixel point; determining the second intercept Theta[0] of the second straight line L1 and the third intercept Theta[1] of the third straight line L3 having the same slope as the slope of the first straight line L2 according to the slope and the first intercept Theta of the first straight line L2, and the slope and the fourth intercept theta' of the vertical line L4 passing through the first pixel point (x1, y1) and perpendicular to the first straight line L2; wherein the second straight line L1 and the third straight line L3 are located at the first straight line L2. The invention relates to a method for determining the pixel value of the first intersection point (x[0], y[0]) of the second straight line L1 and the vertical line L4 according to the slope and the second intercept Theta[0] of the second straight line L1, and the slope and the fourth intercept theta' of the vertical line L4; the invention relates to a method for determining the pixel value of the second intersection point (x[1], y[1]) of the third straight line L3 and the vertical line L4 according to the slope and the third intercept Theta[1] of the third straight line L3, and the slope and the fourth intercept theta' of the vertical line L4; the invention relates to a method for determining the pixel value of the second intersection point (x[0], y[0]) of the third straight line L3 and the vertical line L4 according to the slope and the third intercept Theta[1] of the third straight line L3, and the slope and the fourth intercept theta' of the vertical line L4; the invention relates to a method for determining the pixel value of the second intersection point (x[1], y[1]) of the third straight line L3 and the vertical line L4 according to the slope and the third intercept Theta[0] of the third straight line L3, and the slope and the fourth intercept theta' of the third straight line L4; the invention relates to a method for determining the pixel value of the second intersection point (x[1], y[1]) of the third straight line L3 and the vertical line L4 according to the slope and the third intercept Theta[1] of the third straight line L3.

[0057] In some exemplary embodiments, the slope and the first intercept Theta of the first straight line L2, the slope and the second intercept Theta[0] of the second straight line L1, the slope and the third intercept Theta[1] of the third straight line L3, and the slope and the fourth intercept theta' of the vertical line L4 may be the slope and intercept in the target coordinate system, and the target coordinate system may be the original image coordinate system, or it may be a coordinate system in which the origin of the original image coordinate system is translated to a coordinate system with the integer part of the second coordinate (x0_int, y0_int) as the origin.

[0058] In some exemplary embodiments, determining the slope and the first intercept Theta of the first straight line L2 passing through the first pixel point (x1, y1) based on the direction value of the first pixel point includes: searching for the slope corresponding to the direction value of the first pixel point (x1, y1) as the slope of the first straight line L2 in a correspondence between pre-set direction values ​​and slopes; and determining the first intercept Theta based on the coordinates (x1, y1) of the first pixel point (x1, y1) in the target coordinate system and the slope of the first straight line.

[0059] In some exemplary embodiments, the correspondence between the direction value and the slope can be pre-set. For example, the corresponding slopes when the direction value is 1-32 can be set to [0, 1], [1, 5], [1, 4], [1, 3], [2, 5], [1, 2], [2, 3], [3, 4], [1, 1], [4, 3], [3, 2], [2, 1], [5, 2], [3, 1], [4, 1], [5, 1], [1, 0], [5, -1], [4, -1], [3, -1], [5, -2], [2, -1], [3, -2], [4, -3], [1, -1], [3, -4], [2, -3], [1, -2], [2, -5], [1, -3], [1, -4], [1, -5]. The slope is represented by two values, the first value is m, and the second value is n. Then, according to m and n, the slope can be obtained as The values ​​of m and n can be adjusted according to the actual effect, and the values ​​of m and n should satisfy the angles corresponding to the corresponding direction values ​​as much as possible.

[0060] In some exemplary embodiments, determining the first intercept Theta according to the coordinates (x1, y1) of the first pixel point (x1, y1) in the target coordinate system and the slope of the first straight line includes: according to the formula Determine the first intercept; where (x1, y1) is the coordinate of the first pixel in the target coordinate system, and Theta is the first intercept.

[0061] In some exemplary embodiments, the second intercept may be obtained by rounding up the first intercept, that is, The third intercept can be obtained by rounding down the first intercept, that is, Among them, Theta[0] is the second intercept and Theta[1] is the third intercept.

[0062] In some exemplary embodiments, the second intercept can be obtained by rounding up the first intercept and adding the first constant, that is, The third intercept can be obtained by rounding down the first intercept minus the second constant, that is, Among them, Theta[0] is the second intercept, d1 is the first constant, Theta[1] is the third intercept, and d2 is the second constant.

[0063] In some exemplary embodiments, the slope of the vertical line is The fourth intercept is

[0064] In some exemplary embodiments, determining the pixel value of the first intersection (x[0], y[0]) of the second straight line L1 and the vertical line L4 according to the slope and the second intercept Theta[0] of the second straight line L1, and the slope and the fourth intercept theta' of the vertical line L4 includes: determining the coordinates of the fourth pixel point and the fifth pixel point located on the second straight line L1 in the original image in the target coordinate system according to the slope and the second intercept Theta[0] of the second straight line L1; wherein the fourth pixel point and the fifth pixel point are located at the first intersection (x[0] , y[0]); determine the coordinates of the first intersection in the target coordinate system (x[0], y[0]) according to the slope of the second straight line L1 and the second intercept Theta[0], and the slope of the vertical line L4 and the fourth intercept theta'; determine the pixel values ​​of the fourth pixel point and the fifth pixel point according to the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system; determine the pixel value of the first intersection according to the pixel values ​​of the fourth pixel point and the fifth pixel point, and the coordinates of the first intersection in the target coordinate system (x[0], y[0]).

[0065] In some exemplary embodiments, when the target coordinate system is the original image coordinate system, the pixel value of the fourth pixel is the pixel value of the pixel in the original image whose coordinates are the same as the fourth pixel, and the pixel value of the fifth pixel is the pixel value of the pixel in the original image whose coordinates are the same as the fifth pixel; when the target coordinate system is a coordinate system in which the origin of the original image coordinate system is translated to a coordinate system with the integer part of the second coordinate (x0_int, y0_int) as the origin, the pixel value of the fourth pixel is the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the fourth pixel in the target coordinate system converted into the coordinates in the original image coordinate system; the pixel value of the fifth pixel is the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the fifth pixel in the target coordinate system converted into the original image coordinate system.

[0066] In some exemplary embodiments, determining the coordinates of the fourth pixel point and the fifth pixel point located on the second straight line L1 in the original image in the target coordinate system according to the slope and the second intercept Theta[0] of the second straight line L1 includes: converting the coordinates of each pixel point in the original image in the original image coordinate system into the coordinates in the target coordinate system, and substituting the coordinates of each pixel point in the target coordinate system into the expression of the second straight line L1 in turn to verify whether the expression of the second straight line L1 is satisfied; wherein the expression of the second straight line L1 is determined according to the slope and the second intercept Theta[0] of the second straight line L1, that is, the expression of the second straight line L1 is

[0067] The pixel points corresponding to the coordinates that satisfy the expression of the second straight line L1 can be used as candidate pixel points for the fourth pixel point and the fifth pixel point; after determining the coordinates (x[0], y[0]) of the first intersection point in the target coordinate system according to the slope and the second intercept Theta[0] of the second straight line L1, and the slope and the fourth intercept theta' of the vertical line L4, two pixel points on both sides of the first intersection point on the second straight line L1 are selected from the candidate pixel points of the fourth pixel point and the fifth pixel point as the fourth pixel point and the fifth pixel point.

[0068] In some exemplary embodiments, when the coordinates (x[0], y[0]) of the first intersection point in the target coordinate system are determined according to the slope and the second intercept Theta[0] of the second straight line L1, and the slope and the fourth intercept theta' of the vertical line L4, the expression of the second straight line L1 is determined according to the slope and the second intercept Theta[0] of the second straight line L1, that is, the expression of the second straight line L1d is: The expression of the vertical line L4 is determined according to the slope of the vertical line L4 and the fourth intercept theta', that is, the expression of the vertical line L4 is: The expression of the second straight line L1 and the expression of the perpendicular line L4 are solved as a system of equations to obtain the coordinates of the first intersection point in the target coordinate system.

[0069] In some exemplary embodiments, determining the coordinates of the fourth pixel point and the fifth pixel point on the second straight line L1 in the original image in the target coordinate system according to the slope of the second straight line L1 and the second intercept Theta[0] includes: determining the coordinates of the candidate pixel point in the target coordinate system according to the slope of the second straight line L1 and the second intercept Theta[0]; determining the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system according to the coordinates of the candidate pixel point in the target coordinate system.

[0070] In some exemplary embodiments, determining the coordinates of the candidate pixel points in the target coordinate system according to the slope of the second straight line L1 and the second intercept Theta[0] includes: determining the coordinates of the first candidate pixel point in the target coordinate system according to the slope of the second straight line L1 and the second intercept Theta[0], and determining the coordinates of the second candidate pixel point in the target coordinate system and the coordinates of the third candidate pixel point in the target coordinate system according to the coordinates of the first candidate pixel point in the target coordinate system.

[0071] In some exemplary embodiments, determining the coordinates of the first candidate pixel point in the target coordinate system according to the slope of the second straight line L1 and the second intercept Theta[0] includes at least one of the following:

[0072] When at least one of m and n in the slope of the second straight line L1 is 1 and the absolute value of m is greater than the absolute value of n, the coordinates of the first candidate pixel in the target coordinate system are determined to be (0, c1); wherein c1 = abs(n)×y1+sign(n)×m×x1;

[0073] When at least one of m and n in the slope of the second straight line L1 is 1 and the absolute value of m is less than or equal to the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (c1×sign(n), 0);

[0074] When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the second straight line L1 is 1, and the absolute value of m is greater than the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (c1×sign(n), -c1);

[0075] When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the second straight line L1 is 1, and the absolute value of m is less than or equal to the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (-c1×sign(n), c1);

[0076] When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the second straight line L1 is 3, the coordinates of the first candidate pixel point in the target coordinate system are determined according to the preconfigured coordinate table.

[0077] In some exemplary embodiments, determining the coordinates of the first candidate pixel in the target coordinate system according to the preconfigured coordinate table includes:

[0078] When the absolute value of m in the slope of the second straight line L1 is greater than the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (LUT[ln1+7]×sign bit of ln1, LUT[ln1+22]×sign bit of ln1×sign bit of n).

[0079] When the absolute value of m in the slope of the second straight line L1 is less than the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (LUT[ln1+22]×sign bit of ln1, LUT[ln1+7]×sign bit of ln1×sign bit of n).

[0080] In some exemplary embodiments, the preconfigured coordinate table is: LUT = [1, 2, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, -1, -2, 0, -3, -1, -4, -2, 0, -2, -4, -1, -3, 0, 3, 1].

[0081] In some exemplary embodiments, LUT[ln1+7] refers to the ln1+7th element in the coordinate table, and LUT[ln1+22] refers to the ln1+22th element in the coordinate table.

[0082] In some exemplary embodiments, when ln1 is a positive number, the sign bit of ln1 is 1; when ln1 is a negative number, the sign bit of ln1 is -1; when ln1 is 0, the sign bit of ln1 is 1.

[0083] In some exemplary embodiments, ln1 is obtained by shifting ln0 right by A bits, ln0=abs(n)×vertical phase+m×n sign bit×horizontal phase; wherein A is an integer greater than or equal to 1.

[0084] In some exemplary embodiments, the vertical phase and the horizontal phase have a value range of 2 A .

[0085] In some exemplary embodiments, when n is a positive number, the sign bit of n is 1; when n is a negative number, the sign bit of n is -1; when n is 0, the sign bit of n is 1.

[0086] In some exemplary embodiments, determining the coordinates of the second candidate pixel point in the target coordinate system and the coordinates of the third candidate pixel point in the target coordinate system based on the coordinates of the first candidate pixel point in the target coordinate system includes: translating the coordinates of the first candidate pixel point in the target coordinate system by (n, -m) units to obtain the coordinates of the second candidate pixel point in the target coordinate system, and translating the coordinates of the first candidate pixel point in the target coordinate system by (-n, m) units to obtain the coordinates of the third candidate pixel point in the target coordinate system.

[0087] Assuming that the coordinates of the first candidate pixel in the target coordinate system are (x, y), then the coordinates of the second candidate pixel in the target coordinate system are (x+n, ym), and the coordinates of the third pixel in the target coordinate system are (xn, y+m).

[0088] In some exemplary embodiments, determining the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system based on the coordinates of the candidate pixel points in the target coordinate system includes: determining the coordinates of the fourth pixel point in the target coordinate system based on the coordinates of the first candidate pixel point, the second candidate pixel point, and the third candidate pixel point in the target coordinate system; determining the coordinates of the fifth pixel point in the target coordinate system based on the coordinates of the fourth pixel point in the target coordinate system.

[0089] In some exemplary embodiments, when determining the coordinates of the fourth pixel and the fifth pixel in the target coordinate system according to the coordinates of the candidate pixel in the target coordinate system, the pixel closest to the coordinate origin of the target coordinate system may be selected from the candidate pixel as the fourth pixel. That is, the pixel closest to the coordinate origin of the target coordinate system may be selected from the first candidate pixel, the second candidate pixel, and the third candidate pixel as the fourth pixel.

[0090] In some exemplary embodiments, determining the coordinates of the fourth pixel point in the target coordinate system according to the coordinates of the first candidate pixel point, the second candidate pixel point, and the third candidate pixel point in the target coordinate system includes at least one of the following:

[0091] In the case where the absolute value of the second coordinate is smaller than the absolute value of the first coordinate and the absolute value of the third coordinate, the coordinate of the fourth pixel point in the target coordinate system is determined to be the coordinate of the second candidate pixel point in the target coordinate system; wherein the absolute value of the first coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinate of the first candidate pixel point in the target coordinate system, the absolute value of the second coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinate of the second candidate pixel point in the target coordinate system, and the absolute value of the third coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinate of the third candidate pixel point in the target coordinate system;

[0092] When the absolute value of the third coordinate is smaller than the absolute value of the first coordinate and the absolute value of the second coordinate, the coordinate of the fourth pixel point in the target coordinate system is determined to be the coordinate of the third candidate pixel point in the target coordinate system;

[0093] When the absolute value of the first coordinate is greater than the absolute value of the second coordinate, or the absolute value of the first coordinate is greater than the absolute value of the third coordinate, the coordinates of the fourth pixel point in the target coordinate system are determined to be the coordinates of the first candidate pixel point in the target coordinate system.

[0094] In some exemplary embodiments, determining the coordinates of the fifth pixel point in the target coordinate system based on the coordinates of the fourth pixel point in the target coordinate system includes: translating the coordinates of the fourth pixel point in the target coordinate system by (n, -m) units to obtain the coordinates of the fourth candidate pixel point in the target coordinate system, translating the coordinates of the fourth pixel point in the target coordinate system by (-n, m) units to obtain the coordinates of the fifth candidate pixel point in the target coordinate system; determining the coordinates of the fifth pixel point in the target coordinate system based on the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system.

[0095] In some exemplary embodiments, when determining the coordinates of the fifth pixel point in the target coordinate system based on the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system, a pixel point that is closer to the coordinate origin of the target coordinate system can be selected from the fourth candidate pixel point and the fifth candidate pixel point as the fifth pixel point.

[0096] In some exemplary embodiments, determining the coordinates of the fifth pixel point in the target coordinate system according to the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system includes at least one of the following:

[0097] When the absolute value of the fourth coordinate is greater than the absolute value of the fifth coordinate, determine the coordinates of the fifth pixel point in the target coordinate system as the coordinates of the fifth candidate pixel point in the target coordinate system; wherein the absolute value of the fourth coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinates of the fourth candidate pixel point in the target coordinate system, and the absolute value of the fifth coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinates of the fifth candidate pixel point in the target coordinate system;

[0098] When the absolute value of the fourth coordinate is less than the absolute value of the fifth coordinate, determining the coordinates of the fifth pixel point in the target coordinate system as the coordinates of the fourth candidate pixel point in the target coordinate system;

[0099] When the absolute value of the fourth coordinate is equal to the absolute value of the fifth coordinate, and the maximum value of the first coordinate is greater than the maximum value of the second coordinate, the coordinates of the fifth pixel point in the target coordinate system are determined to be the coordinates of the fifth candidate pixel point in the target coordinate system; wherein the maximum value of the first coordinate is the maximum value of the x coordinate and the y coordinate of the coordinates of the fourth candidate pixel point in the target coordinate system, and the maximum value of the second coordinate is the maximum value of the x coordinate and the y coordinate of the coordinates of the fifth candidate pixel point in the target coordinate system;

[0100] When the absolute value of the fourth coordinate is equal to the absolute value of the fifth coordinate and the maximum value of the first coordinate is less than the maximum value of the second coordinate, the coordinates of the fifth pixel point in the target coordinate system are determined to be the coordinates of the fourth candidate pixel point in the target coordinate system.

[0101] In some exemplary embodiments, determining the pixel values ​​of the fourth pixel and the fifth pixel based on the coordinates of the fourth pixel and the fifth pixel in the target coordinate system includes: converting the coordinates of the fourth pixel in the target coordinate system into coordinates in the original image coordinate system, converting the coordinates of the fifth pixel in the target coordinate system into coordinates in the original image coordinate system, taking the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the fourth pixel in the original image coordinate system as the pixel value of the fourth pixel, and taking the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the fifth pixel in the original image coordinate system as the pixel value of the fifth pixel.

[0102] In some exemplary embodiments, determining the pixel value of the first intersection based on the pixel values ​​of the fourth pixel and the fifth pixel, and the coordinates of the first intersection in the target coordinate system (x[0], y[0]) includes: converting the coordinates of the first intersection in the target coordinate system into coordinates in the original image coordinate system; interpolating the pixel value of the fourth pixel and the pixel value of the fifth pixel to obtain the pixel value of the first intersection based on the coordinates of the fourth pixel in the original image coordinate system, the coordinates of the fifth pixel in the original image coordinate system, and the coordinates of the first intersection in the original image coordinate system.

[0103] In some exemplary embodiments, the pixel value of the first intersection can be obtained by interpolating the pixel value of the fourth pixel point and the pixel value of the fifth pixel point using bilinear interpolation according to the coordinates of the fourth pixel point in the original image coordinate system, the coordinates of the fifth pixel point in the original image coordinate system, and the coordinates of the first intersection point in the original image coordinate system.

[0104] In some exemplary embodiments, determining the pixel value of the second intersection point (x[1], y[1]) of the third straight line L3 and the vertical line L4 according to the slope of the third straight line L3 and the third intercept Theta[1], and the slope of the vertical line L4 and the fourth intercept theta' comprises: determining the coordinates of the sixth pixel point and the seventh pixel point located on the third straight line L3 in the original image in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1]; wherein the sixth pixel point and the seventh pixel point are located at the second intersection point (x[1] , y[1]); determine the coordinates of the second intersection in the target coordinate system (x[1], y[1]) according to the slope of the third straight line L3 and the third intercept Theta[1], and the slope of the vertical line L4 and the fourth intercept theta'; determine the pixel values ​​of the sixth pixel and the seventh pixel according to the coordinates of the sixth pixel and the seventh pixel in the target coordinate system; determine the pixel value of the second intersection according to the pixel values ​​of the sixth pixel and the seventh pixel and the coordinates of the second intersection in the target coordinate system (x[1], y[1]).

[0105] In some exemplary embodiments, when the target coordinate system is the original image coordinate system, the pixel value of the sixth pixel is the pixel value of the pixel in the original image whose coordinates are the same as the sixth pixel, and the pixel value of the seventh pixel is the pixel value of the pixel in the original image whose coordinates are the same as the seventh pixel; when the target coordinate system is a coordinate system in which the origin of the original image coordinate system is translated to a coordinate system with the integer part of the second coordinate (x0_int, y0_int) as the origin, the pixel value of the sixth pixel is the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the sixth pixel in the target coordinate system converted into the coordinates in the original image coordinate system; the pixel value of the seventh pixel is the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the seventh pixel in the target coordinate system converted into the original image coordinate system.

[0106] In some exemplary embodiments, determining the coordinates of the sixth pixel point and the seventh pixel point on the third straight line L3 in the original image in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1] includes: converting the coordinates of each pixel point in the original image in the original image coordinate system into the coordinates in the target coordinate system, and substituting the coordinates of each pixel point in the target coordinate system into the expression of the third straight line L3 in turn to verify whether the expression of the third straight line L3 is satisfied; wherein the expression of the third straight line L3 is determined according to the slope of the third straight line L3 and the third intercept Theta[1], that is, the expression of the third straight line L3 is

[0107] The pixel points corresponding to the coordinates that satisfy the expression of the third straight line L3 can be used as candidate pixel points for the sixth pixel point and the seventh pixel point; after determining the coordinates (x[1], y[1]) of the second intersection point in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1], and the slope of the vertical line L4 and the fourth intercept theta', two pixel points on the third straight line L3 located on both sides of the second intersection point are selected from the candidate pixel points of the sixth pixel point and the seventh pixel point as the sixth pixel point and the seventh pixel point.

[0108] In some exemplary embodiments, when the coordinates (x[1], y[1]) of the second intersection point in the target coordinate system are determined according to the slope of the third straight line L3 and the third intercept Theta[1], and the slope of the perpendicular line L4 and the fourth intercept theta', the expression of the third straight line L3 is determined according to the slope of the third straight line L3 and the second intercept Theta[1], that is, the expression of the third straight line L3 is The expression of the vertical line L4 is determined according to the slope of the vertical line L4 and the fourth intercept theta', that is, the expression of the vertical line L4 is: The solution obtained by solving the expression of the third straight line L3 and the expression of the perpendicular line L4 as a system of equations is the coordinate of the second intersection point in the target coordinate system.

[0109] In some exemplary embodiments, determining the coordinates of the sixth pixel and the seventh pixel located on the third straight line L3 in the original image in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1] includes: determining the coordinates of the candidate pixel in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1]; determining the coordinates of the sixth pixel and the seventh pixel in the target coordinate system according to the coordinates of the candidate pixel in the target coordinate system.

[0110] In some exemplary embodiments, determining the coordinates of the candidate pixel points in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1] includes: determining the coordinates of the first candidate pixel point in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1], and determining the coordinates of the second candidate pixel point in the target coordinate system and the coordinates of the third candidate pixel point in the target coordinate system according to the coordinates of the first candidate pixel point in the target coordinate system.

[0111] In some exemplary embodiments, determining the coordinates of the first candidate pixel point in the target coordinate system according to the slope of the third straight line L3 and the third intercept Theta[1] includes at least one of the following:

[0112] When at least one of m and n in the slope of the third straight line L3 is 1 and the absolute value of m is greater than the absolute value of n, the coordinates of the first candidate pixel in the target coordinate system are determined to be (0, c1); wherein c1 = abs(n)×y1+sign(n)×m×x1;

[0113] When at least one of m and n in the slope of the third straight line L3 is 1 and the absolute value of m is less than or equal to the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (c1×sign(n), 0);

[0114] When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the third straight line L3 is 1, and the absolute value of m is greater than the absolute value of n, the coordinates of the first candidate pixel in the target coordinate system are determined to be (c1×sign(n), -c1);

[0115] When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the third straight line L3 is 1, and the absolute value of m is less than or equal to the absolute value of n, the coordinates of the first candidate pixel in the target coordinate system are determined to be (-c1×sign(n), c1);

[0116] When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the third straight line L3 is 3, the coordinates of the first candidate pixel point in the target coordinate system are determined according to the preconfigured coordinate table.

[0117] In some exemplary embodiments, determining the coordinates of the first candidate pixel in the target coordinate system according to the preconfigured coordinate table includes:

[0118] When the absolute value of m in the slope of the third straight line L3 is greater than the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (LUT[ln2+7]×sign bit of ln2, LUT[ln2+22]×sign bit of ln2×sign bit of n).

[0119] When the absolute value of m in the slope of the third straight line L3 is less than the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (LUT[ln2+22]×sign bit of ln2, LUT[ln2+7]×sign bit of ln2×sign bit of n).

[0120] In some exemplary embodiments, the preconfigured coordinate table is: LUT = [1, 2, 1, 2, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, -1, -2, 0, -3, -1, -4, -2, 0, -2, -4, -1, -3, 0, 3, 1].

[0121] In some exemplary embodiments, LUT[ln2+7] refers to the ln2+7th element in the coordinate table, and LUT[ln2+22] refers to the ln2+22th element in the coordinate table.

[0122] In some exemplary embodiments, when ln2 is a positive number, the sign bit of ln2 is 1; when ln2 is a negative number, the sign bit of ln2 is -1; when ln2 is 0, the sign bit of ln2 is 1.

[0123] In some exemplary embodiments, ln2=ln1+1, ln1 is obtained by shifting ln0 right by A bits, and ln0=abs(n)×vertical phase+m×n sign bit×horizontal phase; wherein A is an integer greater than or equal to 1.

[0124] In some exemplary embodiments, the vertical phase and the horizontal phase have a value range of 2 A .

[0125] In some exemplary embodiments, when n is a positive number, the sign bit of n is 1; when n is a negative number, the sign bit of n is -1; when n is 0, the sign bit of n is 1.

[0126] In some exemplary embodiments, determining the coordinates of the second candidate pixel point in the target coordinate system and the coordinates of the third candidate pixel point in the target coordinate system based on the coordinates of the first candidate pixel point in the target coordinate system includes: translating the coordinates of the first candidate pixel point in the target coordinate system by (n, -m) units to obtain the coordinates of the second candidate pixel point in the target coordinate system, and translating the coordinates of the first candidate pixel point in the target coordinate system by (-n, m) units to obtain the coordinates of the third candidate pixel point in the target coordinate system.

[0127] Assuming that the coordinates of the first candidate pixel in the target coordinate system are (x, y), then the coordinates of the second candidate pixel in the target coordinate system are (x+n, ym), and the coordinates of the third pixel in the target coordinate system are (xn, y+m).

[0128] In some exemplary embodiments, determining the coordinates of the sixth pixel and the seventh pixel in the target coordinate system based on the coordinates of the candidate pixel in the target coordinate system includes: determining the coordinates of the sixth pixel in the target coordinate system based on the coordinates of the first candidate pixel, the second candidate pixel, and the third candidate pixel in the target coordinate system; determining the coordinates of the seventh pixel in the target coordinate system based on the coordinates of the sixth pixel in the target coordinate system.

[0129] In some exemplary embodiments, when determining the coordinates of the fourth pixel and the fifth pixel in the target coordinate system according to the coordinates of the candidate pixel in the target coordinate system, the pixel closest to the coordinate origin of the target coordinate system may be selected from the candidate pixel as the fourth pixel. That is, the pixel closest to the coordinate origin of the target coordinate system may be selected from the first candidate pixel, the second candidate pixel, and the third candidate pixel as the fourth pixel.

[0130] In some exemplary embodiments, determining the coordinates of the sixth pixel point in the target coordinate system according to the coordinates of the first candidate pixel point, the second candidate pixel point, and the third candidate pixel point in the target coordinate system comprises at least one of the following:

[0131] In the case where the absolute value of the second coordinate is smaller than the absolute value of the first coordinate and the absolute value of the third coordinate, the coordinate of the sixth pixel point in the target coordinate system is determined to be the coordinate of the second candidate pixel point in the target coordinate system; wherein the absolute value of the first coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinate of the first candidate pixel point in the target coordinate system, the absolute value of the second coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinate of the second candidate pixel point in the target coordinate system, and the absolute value of the third coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinate of the third candidate pixel point in the target coordinate system;

[0132] When the absolute value of the third coordinate is smaller than the absolute value of the first coordinate and the absolute value of the second coordinate, determining the coordinate of the sixth pixel point in the target coordinate system as the coordinate of the third candidate pixel point in the target coordinate system;

[0133] When the absolute value of the first coordinate is greater than the absolute value of the second coordinate, or the absolute value of the first coordinate is greater than the absolute value of the third coordinate, the coordinates of the sixth pixel point in the target coordinate system are determined to be the coordinates of the first candidate pixel point in the target coordinate system.

[0134] In some exemplary embodiments, determining the coordinates of the seventh pixel point in the target coordinate system based on the coordinates of the sixth pixel point in the target coordinate system includes: translating the coordinates of the sixth pixel point in the target coordinate system by (n, -m) units to obtain the coordinates of the fourth candidate pixel point in the target coordinate system, translating the coordinates of the sixth pixel point in the target coordinate system by (-n, m) units to obtain the coordinates of the fifth candidate pixel point in the target coordinate system; determining the coordinates of the seventh pixel point in the target coordinate system based on the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system.

[0135] In some exemplary embodiments, when determining the coordinates of the fifth pixel point in the target coordinate system based on the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system, a pixel point that is closer to the coordinate origin of the target coordinate system can be selected from the fourth candidate pixel point and the fifth candidate pixel point as the fifth pixel point.

[0136] In some exemplary embodiments, determining the coordinates of the seventh pixel point in the target coordinate system according to the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system includes at least one of the following:

[0137] When the absolute value of the fourth coordinate is greater than the absolute value of the fifth coordinate, determine the coordinates of the seventh pixel point in the target coordinate system as the coordinates of the fifth candidate pixel point in the target coordinate system; wherein the absolute value of the fourth coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinates of the fourth candidate pixel point in the target coordinate system, and the absolute value of the fifth coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinates of the fifth candidate pixel point in the target coordinate system;

[0138] When the absolute value of the fourth coordinate is less than the absolute value of the fifth coordinate, determining the coordinates of the seventh pixel point in the target coordinate system as the coordinates of the fourth candidate pixel point in the target coordinate system;

[0139] When the absolute value of the fourth coordinate is equal to the absolute value of the fifth coordinate, and the maximum value of the first coordinate is greater than the maximum value of the second coordinate, the coordinate of the seventh pixel point in the target coordinate system is determined to be the coordinate of the fifth candidate pixel point in the target coordinate system; wherein the maximum value of the first coordinate is the maximum value of the x coordinate and the y coordinate of the coordinate of the fourth candidate pixel point in the target coordinate system, and the maximum value of the second coordinate is the maximum value of the x coordinate and the y coordinate of the coordinate of the fifth candidate pixel point in the target coordinate system;

[0140] When the absolute value of the fourth coordinate is equal to the absolute value of the fifth coordinate and the maximum value of the first coordinate is less than the maximum value of the second coordinate, the coordinates of the seventh pixel point in the target coordinate system are determined to be the coordinates of the fourth candidate pixel point in the target coordinate system.

[0141] In some exemplary embodiments, determining the pixel values ​​of the sixth pixel and the seventh pixel based on the coordinates of the sixth pixel and the seventh pixel in the target coordinate system includes: converting the coordinates of the sixth pixel in the target coordinate system into coordinates in the original image coordinate system, converting the coordinates of the seventh pixel in the target coordinate system into coordinates in the original image coordinate system, taking the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the sixth pixel in the original image coordinate system as the pixel value of the sixth pixel, and taking the pixel value of the pixel in the original image whose coordinates are the same as the coordinates of the seventh pixel in the original image coordinate system as the pixel value of the seventh pixel.

[0142] In some exemplary embodiments, determining the pixel value of the second intersection based on the pixel values ​​of the sixth pixel and the seventh pixel, and the coordinates of the second intersection in the target coordinate system (x[1], y[1]) includes: converting the coordinates of the second intersection in the target coordinate system into coordinates in the original image coordinate system; interpolating the pixel value of the sixth pixel and the pixel value of the seventh pixel to obtain the pixel value of the second intersection based on the coordinates of the sixth pixel in the original image coordinate system, the coordinates of the seventh pixel in the original image coordinate system, and the coordinates of the second intersection in the original image coordinate system.

[0143] In some exemplary embodiments, the pixel value of the sixth pixel point and the pixel value of the seventh pixel point can be interpolated using bilinear interpolation according to the coordinates of the sixth pixel point in the original image coordinate system, the coordinates of the seventh pixel point in the original image coordinate system, and the coordinates of the second intersection point in the original image coordinate system to obtain the pixel value of the second intersection point.

[0144] In some exemplary embodiments, determining the original pixel value of the pixel to be interpolated based on the pixel value of the first intersection (x[0], y[0]) and the pixel value of the second intersection (x[1], y[1]) includes: interpolating the pixel value of the first intersection and the second pixel value of the pixel to be interpolated based on the coordinates of the first intersection in the original image coordinate system, the coordinates of the second intersection in the original image coordinate system, and the second coordinates of the pixel to be interpolated in the original image coordinate system to obtain the original pixel value of the pixel to be interpolated.

[0145] In some exemplary embodiments, bilinear interpolation can be used to interpolate the pixel value of the first intersection and the pixel value of the second intersection according to the coordinates of the first intersection in the original image coordinate system, the coordinates of the second intersection in the original image coordinate system, and the second coordinates of the pixel point to be interpolated in the original image coordinate system to obtain the original pixel value of the pixel point to be interpolated.

[0146] In some exemplary embodiments, correcting the original pixel value of the pixel to be interpolated to obtain the intermediate pixel value of the pixel to be interpolated in the target image includes: comparing the original pixel value of the pixel to be interpolated with the pixel value of the pixel to be interpolated calculated by a traditional interpolation method; when the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by a traditional interpolation method is greater than or equal to a preset threshold, determining the intermediate pixel value of the pixel to be interpolated according to the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method; when the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method is greater than or equal to a preset threshold, determining the intermediate pixel value of the pixel to be interpolated according to the original pixel value of the pixel to be interpolated.

[0147] In some exemplary embodiments, determining the intermediate pixel value of the pixel to be interpolated based on the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method includes: determining the intermediate pixel value of the pixel to be interpolated according to the formula result1=weight1×dir+(1-weight1)×tradition; wherein result1 is the intermediate pixel value of the pixel to be interpolated, weight1 is the first weight, dir is the original pixel value of the pixel to be interpolated, and tradition is the pixel value of the pixel to be interpolated calculated by the traditional interpolation method.

[0148] In some exemplary embodiments, weight1 is proportional to the absolute value of the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated using a traditional interpolation method.

[0149] In some exemplary embodiments, determining the intermediate pixel value of the pixel to be interpolated according to the original pixel value of the pixel to be interpolated includes: using the original pixel value of the pixel to be interpolated as the intermediate pixel value of the pixel to be interpolated.

[0150] In some exemplary embodiments, determining the final pixel value of the pixel to be interpolated based on the directional reliability of the first pixel, the intermediate pixel value of the pixel to be interpolated, and the pixel value of the pixel to be interpolated calculated using a traditional interpolation method includes: using the directional reliability of the first pixel as a weight, and calculating a weighted average of the intermediate pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated using a traditional interpolation method as the final pixel value of the pixel to be interpolated.

[0151] In some exemplary embodiments, the directional reliability of the first pixel point is used as a weight, and the weighted average of the intermediate pixel value of the pixel point to be interpolated and the pixel value of the pixel point to be interpolated obtained by using the traditional interpolation method is calculated as the final pixel value of the pixel point to be interpolated, including: determining the final pixel value of the pixel point to be interpolated according to the formula result2=weight2×result1+(1-weight2)×tradition; wherein result2 is the intermediate pixel value of the pixel point to be interpolated, weight2 is the second weight, result1 is the intermediate pixel value of the pixel point to be interpolated, and tradition is the pixel value of the pixel point to be interpolated obtained by using the traditional interpolation method.

[0152] In some exemplary embodiments, the conventional interpolation method is a bilinear interpolation method, a bicubic interpolation method, a Lanczos interpolation method, and the like.

[0153] The image interpolation method provided in the embodiment of the present application performs interpolation based on the direction value and direction reliability of the first pixel point corresponding to the pixel point to be interpolated in the original image. Compared with the traditional interpolation method, the image interpolation method in the embodiment of the present application better restores the edge detail information of the image, and the edge of the interpolated image has less jagged edges and higher subjective quality. Compared with the deep learning algorithm, the mathematical model of the image interpolation method in the embodiment of the present application is simple, easier to deploy on terminals, and has better generalization effect.

[0154] Figure 4 A block diagram of the composition of an image interpolation device provided in another embodiment of the present application.

[0155] Second, refer to Figure 4Another embodiment of the present application provides an image interpolation device, including: a coordinate conversion module 401, used to convert the first coordinate of the pixel point to be interpolated in the target image coordinate system into the second coordinate in the original image coordinate system; a direction calculation module 402, used to determine the direction value and direction reliability of the first pixel point corresponding to the second coordinate in the original image; an interpolation module 403, used to determine the final pixel value of the pixel point to be interpolated according to the direction value and direction reliability of the first pixel point.

[0156] In some exemplary embodiments, the direction calculation module 402 is specifically used to: respectively calculate the direction value and direction reliability of each second pixel point in the original image; determine the direction value and direction reliability of the first pixel point based on the direction value and direction reliability of each second pixel point in the original image.

[0157] In some exemplary embodiments, the direction calculation module 402 is specifically used to respectively calculate the direction value and direction reliability of each second pixel point in the original image in the following manner: respectively calculate the gradient in the x direction and the gradient in the y direction of each third pixel point in the original image; for each second pixel point in the original image, calculate the direction value and direction reliability of the second pixel point based on the gradient in the x direction and the gradient in the y direction of all third pixels in the first pixel matrix centered on the second pixel point in the original image.

[0158] In some exemplary embodiments, the interpolation module 403 is specifically used to determine the final pixel value of the pixel to be interpolated based on the direction value and direction reliability of the first pixel in the following manner: determine the original pixel value of the pixel to be interpolated based on the direction value of the first pixel; correct the original pixel value of the pixel to be interpolated to obtain the intermediate pixel value of the pixel to be interpolated in the target image; determine the final pixel value of the pixel to be interpolated based on the direction reliability of the first pixel, the intermediate pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method.

[0159] In some exemplary embodiments, the interpolation module 403 is specifically used to determine the original pixel value of the pixel to be interpolated according to the direction value of the first pixel in the following manner: determine the slope and the first intercept of the first straight line passing through the first pixel according to the direction value of the first pixel; determine the second intercept of the second straight line having the same slope as the slope of the first straight line and the third intercept of the third straight line according to the slope of the first straight line and the first intercept, as well as the slope and the fourth intercept of the vertical line passing through the first pixel and perpendicular to the first straight line; wherein the second straight line and the third straight line are located on both sides of the first straight line; determine the pixel value of the first intersection of the second straight line and the vertical line according to the slope and the second intercept of the second straight line, and the slope and the fourth intercept of the vertical line; determine the pixel value of the second intersection of the third straight line and the vertical line according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the vertical line; determine the pixel value of the second intersection of the third straight line and the vertical line according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the vertical line; and determine the original pixel value of the pixel to be interpolated according to the pixel value of the first intersection and the pixel value of the second intersection.

[0160] In some exemplary embodiments, the interpolation module 403 is specifically used to implement the following method to determine the pixel value of the first intersection of the second straight line and the vertical line according to the slope and the second intercept of the second straight line, and the slope and the fourth intercept of the vertical line: determine the coordinates of the fourth pixel point and the fifth pixel point on the second straight line in the original image in the target coordinate system according to the slope and the second intercept of the second straight line; wherein the fourth pixel point and the fifth pixel point are located on both sides of the first intersection; determine the coordinates of the first intersection in the target coordinate system according to the slope and the second intercept of the second straight line, and the slope and the fourth intercept of the vertical line; determine the pixel values ​​of the fourth pixel point and the fifth pixel point according to the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system; determine the pixel value of the first intersection according to the pixel values ​​of the fourth pixel point and the fifth pixel point, and the coordinates of the first intersection in the target coordinate system.

[0161] In some exemplary embodiments, the interpolation module 403 is specifically used to implement the determination of the pixel value of the second intersection of the third straight line and the vertical line according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the vertical line in the following manner: determining the coordinates of the sixth pixel point and the seventh pixel point on the third straight line in the original image in the target coordinate system according to the slope and the third intercept of the third straight line; wherein the sixth pixel point and the seventh pixel point are located on both sides of the second intersection; determining the coordinates of the second intersection in the target coordinate system according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the vertical line; determining the pixel values ​​of the sixth pixel point and the seventh pixel point according to the coordinates of the sixth pixel point and the seventh pixel point in the target coordinate system; determining the pixel value of the second intersection according to the pixel values ​​of the sixth pixel point and the seventh pixel point, and the coordinates of the second intersection in the target coordinate system.

[0162] In some exemplary embodiments, the interpolation module 403 is specifically used to correct the original pixel value of the pixel to be interpolated to obtain the intermediate pixel value of the pixel to be interpolated in the target image in the following manner: compare the original pixel value of the pixel to be interpolated with the pixel value of the pixel to be interpolated calculated by the traditional interpolation method; when the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method is greater than or equal to a preset threshold, determine the intermediate pixel value of the pixel to be interpolated according to the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method; when the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method is greater than or equal to a preset threshold, determine the intermediate pixel value of the pixel to be interpolated according to the original pixel value of the pixel to be interpolated.

[0163] In some exemplary embodiments, the interpolation module 403 is specifically used to determine the final pixel value of the pixel to be interpolated based on the directional reliability of the first pixel, the intermediate pixel value of the pixel to be interpolated, and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method in the following manner: using the directional reliability of the first pixel as a weight, calculating the weighted average of the intermediate pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method as the final pixel value of the pixel to be interpolated.

[0164] The specific implementation process of the above-mentioned image interpolation device is the same as the specific implementation process of the image interpolation method of the above-mentioned embodiment, which will not be repeated here.

[0165] Thirdly, refer to Figure 5 Another embodiment of the present application provides an electronic device, including: at least one processor 501; a memory 502, wherein at least one program is stored in the memory 502, and when the at least one program is executed by the at least one processor 501, any one of the above-mentioned image interpolation methods is implemented.

[0166] In some exemplary embodiments, the electronic device further includes: one or more I / O interfaces 503 connected between the processor 501 and the memory 502 , and configured to implement information interaction between the processor 501 and the memory 502 .

[0167] Among them, the processor 501 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 502 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 503 is connected between the processor 501 and the memory 502, and can realize information interaction between the processor 501 and the memory 502, including but not limited to a data bus (Bus), etc.

[0168] In some embodiments, the processor 501 , the memory 502 , and the I / O interface 503 are connected to each other via a bus 504 , and further connected to other components of the computing device.

[0169] In a fourth aspect, another embodiment of the present application provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, any one of the above-mentioned image interpolation methods is implemented.

[0170] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0171] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present application as set forth in the appended claims.

Claims

1. An image interpolation method, comprising: Convert the first coordinate of the pixel to be interpolated in the target image coordinate system to the second coordinate in the original image coordinate system; Determine a direction value and a direction reliability of a first pixel point corresponding to the second coordinate in the original image; A final pixel value of the pixel to be interpolated is determined according to the direction value and direction reliability of the first pixel.

2. The image interpolation method according to claim 1, wherein: The determining of the direction value and direction reliability of the first pixel point corresponding to the second coordinate in the original image comprises: Calculating the direction value and direction reliability of each second pixel point in the original image respectively; The direction value and the direction reliability of each of the second pixel points in the original image are determined.

3. The image interpolation method according to claim 2, wherein: The respectively calculating the direction value and direction reliability of each second pixel point in the original image comprises: Calculating the gradient of each third pixel point in the original image in the x direction and the gradient in the y direction respectively; For each second pixel in the original image, the direction value and direction reliability of the second pixel are calculated based on the gradients in the x direction and the gradients in the y direction of all third pixels in the first pixel matrix centered on the second pixel in the original image.

4. The image interpolation method according to claim 1, wherein: The determining the final pixel value of the pixel to be interpolated according to the direction value and direction reliability of the first pixel includes: Determine the original pixel value of the pixel to be interpolated according to the direction value of the first pixel; Correcting the original pixel value of the pixel to be interpolated to obtain an intermediate pixel value of the pixel to be interpolated in the target image; The final pixel value of the pixel to be interpolated is determined according to the directional reliability of the first pixel, the intermediate pixel value of the pixel to be interpolated, and the pixel value of the pixel to be interpolated calculated by using a traditional interpolation method.

5. The image interpolation method according to claim 4, wherein: The determining the original pixel value of the pixel to be interpolated according to the direction value of the first pixel includes: Determine a slope and a first intercept of a first straight line passing through the first pixel point according to the direction value of the first pixel point; Determining, according to the slope of the first straight line and the first intercept, a second intercept of a second straight line having the same slope as the slope of the first straight line and a third intercept of a third straight line, as well as a slope and a fourth intercept of a vertical line passing through the first pixel point and perpendicular to the first straight line; wherein the second straight line and the third straight line are located on both sides of the first straight line; Determine a pixel value of a first intersection point of the second straight line and the vertical line according to the slope and the second intercept of the second straight line, and the slope and the fourth intercept of the vertical line; Determine a pixel value of a second intersection point of the third straight line and the vertical line according to the slope and the third intercept of the third straight line and the slope and the fourth intercept of the vertical line; The original pixel value of the pixel point to be interpolated is determined according to the pixel value of the first intersection point and the pixel value of the second intersection point.

6. The image interpolation method according to claim 5, wherein: Determining the pixel value of the first intersection point of the second straight line and the vertical line according to the slope and the second intercept of the second straight line and the slope and the fourth intercept of the vertical line comprises: determining coordinates of a fourth pixel point and a fifth pixel point located on the second straight line in the original image in the target coordinate system according to the slope and the second intercept of the second straight line; wherein the fourth pixel point and the fifth pixel point are located on both sides of the first intersection; Determine the coordinates of the first intersection point in the target coordinate system according to the slope and the second intercept of the second straight line and the slope and the fourth intercept of the vertical line; Determine pixel values ​​of the fourth pixel point and the fifth pixel point according to coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system; The pixel value of the first intersection point is determined according to the pixel values ​​of the fourth pixel point and the fifth pixel point and the coordinates of the first intersection point in the target coordinate system.

7. The image interpolation method according to claim 6, wherein: Determining the pixel values ​​of the fourth pixel point and the fifth pixel point according to the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system comprises: Convert the coordinates of the fourth pixel point in the target coordinate system into the coordinates of the original image coordinate system, and convert the coordinates of the fifth pixel point in the target coordinate system into the coordinates of the original image coordinate system; The pixel value of the pixel point in the original image whose coordinates are the same as the coordinates of the fourth pixel point in the original image coordinate system is used as the pixel value of the fourth pixel point, and the pixel value of the pixel point in the original image whose coordinates are the same as the coordinates of the fifth pixel point in the original image coordinate system is used as the pixel value of the fifth pixel point.

8. The image interpolation method according to claim 6, wherein: The determining the pixel value of the first intersection point according to the pixel values ​​of the fourth pixel point and the fifth pixel point and the coordinates of the first intersection point in the target coordinate system comprises: Converting the coordinates of the first intersection point in the target coordinate system into the coordinates of the original image coordinate system; The pixel value of the fourth pixel point and the pixel value of the fifth pixel point are interpolated according to the coordinates of the fourth pixel point in the original image coordinate system, the coordinates of the fifth pixel point in the original image coordinate system and the coordinates of the first intersection point in the original image coordinate system to obtain the pixel value of the first intersection point.

9. The image interpolation method according to claim 5, wherein: The step of determining the coordinates of a fourth pixel point and a fifth pixel point located on the second straight line in the original image in the target coordinate system according to the slope and the second intercept of the second straight line comprises: Convert the coordinates of each pixel point in the original image in the original image coordinate system into the coordinates in the target coordinate system, and substitute the coordinates of each pixel point in the target coordinate system into the expression of the second straight line in turn to verify whether the expression of the second straight line is satisfied; wherein the expression of the second straight line is determined according to the slope of the second straight line and the second intercept; Taking the pixel points corresponding to the coordinates satisfying the expression of the second straight line as the candidate pixel points of the fourth pixel point and the fifth pixel point; Two pixel points on the second straight line located on both sides of the first intersection are selected from candidate pixel points of the fourth pixel point and the fifth pixel point as the fourth pixel point and the fifth pixel point.

10. The image interpolation method according to claim 5, wherein: The step of determining the coordinates of a fourth pixel point and a fifth pixel point located on the second straight line in the original image in the target coordinate system according to the slope and the second intercept of the second straight line comprises: Determine the coordinates of the candidate pixel point in the target coordinate system according to the slope of the second straight line and the second intercept; The coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system are determined according to the coordinates of the candidate pixel point in the target coordinate system.

11. The image interpolation method according to claim 10, wherein: Determining the coordinates of the candidate pixel points in the target coordinate system according to the slope of the second straight line and the second intercept includes: determining the coordinates of the first candidate pixel point in the target coordinate system according to the slope of the second straight line and the second intercept, and determining the coordinates of the second candidate pixel point in the target coordinate system and the coordinates of the third candidate pixel point in the target coordinate system according to the coordinates of the first candidate pixel point in the target coordinate system; The method of determining the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system according to the coordinates of the candidate pixel point in the target coordinate system includes: determining the coordinates of the fourth pixel point in the target coordinate system according to the coordinates of the first candidate pixel point, the second candidate pixel point and the third candidate pixel point in the target coordinate system; and determining the coordinates of the fifth pixel point in the target coordinate system according to the coordinates of the fourth pixel point in the target coordinate system.

12. The image interpolation method according to claim 11, wherein: Determining the coordinates of the first candidate pixel point in the target coordinate system according to the slope of the second straight line and the second intercept includes at least one of the following: When at least one of m and n in the slope of the second straight line is 1 and the absolute value of m is greater than the absolute value of n, the coordinates of the first candidate pixel point in the target coordinate system are determined to be (0, c1); wherein c1=abs(n)×y1+sign(n)×m×x1; (x1, y1) are the coordinates of the first pixel point in the target coordinate system; When at least one of m and n in the slope of the second straight line is 1 and the absolute value of m is less than or equal to the absolute value of n, determine the coordinates of the first candidate pixel point in the target coordinate system to be (c1×sign(n), 0); When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the second straight line is 1, and the absolute value of m is greater than the absolute value of n, determining the coordinates of the first candidate pixel point in the target coordinate system to be (c1×sign(n), -c1); When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the second straight line is 1, and the absolute value of m is less than or equal to the absolute value of n, determining the coordinates of the first candidate pixel point in the target coordinate system to be (-c1×sign(n), c1); When the absolute value of the difference between the absolute value of m and the absolute value of n in the slope of the second straight line is 3, the coordinates of the first candidate pixel point in the target coordinate system are determined according to a preconfigured coordinate table.

13. The image interpolation method according to claim 11, wherein: Determining the coordinates of the fifth pixel point in the target coordinate system according to the coordinates of the fourth pixel point in the target coordinate system comprises: The coordinates of the fourth pixel point in the target coordinate system are translated by (n, -m) units to obtain the coordinates of the fourth candidate pixel point in the target coordinate system, and the coordinates of the fourth pixel point in the target coordinate system are translated by (-n, m) units to obtain the coordinates of the fifth candidate pixel point in the target coordinate system; The coordinates of the fifth pixel point in the target coordinate system are determined according to the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system.

14. The image interpolation method according to claim 13, wherein: The determining the coordinates of the fifth pixel point in the target coordinate system according to the coordinates of the fourth candidate pixel point in the target coordinate system and the coordinates of the fifth candidate pixel point in the target coordinate system comprises at least one of the following: When the absolute value of the fourth coordinate is greater than the absolute value of the fifth coordinate, determine the coordinates of the fifth pixel point in the target coordinate system as the coordinates of the fifth candidate pixel point in the target coordinate system; wherein the absolute value of the fourth coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinates of the fourth candidate pixel point in the target coordinate system, and the absolute value of the fifth coordinate is the sum of the absolute value of the x coordinate and the absolute value of the y coordinate in the coordinates of the fifth candidate pixel point in the target coordinate system; When the absolute value of the fourth coordinate is smaller than the absolute value of the fifth coordinate, determining the coordinates of the fifth pixel point in the target coordinate system as the coordinates of the fourth candidate pixel point in the target coordinate system; In a case where the absolute value of the fourth coordinate is equal to the absolute value of the fifth coordinate, and the maximum value of the first coordinate is greater than the maximum value of the second coordinate, determining the coordinates of the fifth pixel point in the target coordinate system as the coordinates of the fifth candidate pixel point in the target coordinate system; wherein the maximum value of the first coordinate is the maximum value of the x coordinate and the y coordinate of the coordinates of the fourth candidate pixel point in the target coordinate system, and the maximum value of the second coordinate is the maximum value of the x coordinate and the y coordinate of the coordinates of the fifth candidate pixel point in the target coordinate system; When the absolute value of the fourth coordinate is equal to the absolute value of the fifth coordinate and the maximum value of the first coordinate is less than the maximum value of the second coordinate, the coordinates of the fifth pixel point in the target coordinate system are determined to be the coordinates of the fourth candidate pixel point in the target coordinate system.

15. The image interpolation method according to claim 5, wherein: Determining the pixel value of the second intersection point of the third straight line and the vertical line according to the slope and the third intercept of the third straight line and the slope and the fourth intercept of the vertical line comprises: determining the coordinates of a sixth pixel point and a seventh pixel point on the third straight line in the original image in the target coordinate system according to the slope and the third intercept of the third straight line; wherein the sixth pixel point and the seventh pixel point are located on both sides of the second intersection; Determine the coordinates of the second intersection point in the target coordinate system according to the slope and the third intercept of the third straight line and the slope and the fourth intercept of the vertical line; Determine pixel values ​​of the sixth pixel point and the seventh pixel point according to coordinates of the sixth pixel point and the seventh pixel point in the target coordinate system; The pixel value of the second intersection point is determined according to the pixel values ​​of the sixth pixel point and the seventh pixel point and the coordinates of the second intersection point in the target coordinate system.

16. The image interpolation method according to claim 4, wherein: The correcting the original pixel value of the pixel to be interpolated to obtain the intermediate pixel value of the pixel to be interpolated in the target image comprises: Comparing the original pixel value of the pixel to be interpolated with the pixel value of the pixel to be interpolated calculated by using the traditional interpolation method; When the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method is greater than or equal to a preset threshold, determining the intermediate pixel value of the pixel to be interpolated according to the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated by the traditional interpolation method; When the difference between the original pixel value of the pixel to be interpolated and the pixel value of the pixel to be interpolated calculated using the traditional interpolation method is greater than or equal to a preset threshold, the intermediate pixel value of the pixel to be interpolated is determined according to the original pixel value of the pixel to be interpolated.

17. The image interpolation method according to claim 4, wherein: Determining the final pixel value of the pixel to be interpolated according to the directional reliability of the first pixel, the intermediate pixel value of the pixel to be interpolated, and the pixel value of the pixel to be interpolated calculated by using a traditional interpolation method comprises: The directional reliability of the first pixel point is used as a weight, and a weighted average of an intermediate pixel value of the pixel point to be interpolated and a pixel value of the pixel point to be interpolated obtained by using a traditional interpolation method is calculated as a final pixel value of the pixel point to be interpolated.

18. An image interpolation device, comprising: A coordinate conversion module, used for converting a first coordinate of a pixel point to be interpolated in a target image coordinate system into a second coordinate in an original image coordinate system; a direction calculation module, used to determine a direction value and direction reliability of a first pixel point corresponding to the second coordinate in the original image; An interpolation module is used to determine a final pixel value of the pixel to be interpolated according to the direction value and direction reliability of the first pixel.

19. An electronic device comprising: at least one processor; A memory, wherein at least one program is stored in the memory, and when the at least one program is executed by the at least one processor, the image interpolation method according to any one of claims 1 to 17 is implemented.

20. A computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the image interpolation method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Adaptive color interpolation

    CN101151907A

  • An image enlargement method and an image enlargement apparatus

    CN109325909A

  • High-spatial-resolution remote sensing image processing method and system and storage medium

    CN115187545A