Image interpolation method and apparatus, and electronic device and computer-readable storage medium

By using the direction value and direction reliability calculation method in image interpolation, the problems of insufficient restoration of image edge details and complexity of deep learning algorithms in the existing technology are solved, achieving high-quality image interpolation, simplifying hardware deployment and improving Generalization ability.

WO2024221914A1PCT designated stage expired Publication Date: 2024-10-31SANECHIPS TECH CO LTD

Patent Information

Application Number
PCT/CN2023/135103
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-27
Filing Date
2023-11-29
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

Existing image interpolation methods in digital image processing cannot effectively generate image edge texture details, resulting in jagged edges in the interpolated image and low subjective quality. Moreover, the deep learning algorithm model is complex, requires high hardware resources, and the effect is limited by the training data set. and image content have a great impact.

Method used

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

Benefits of technology

Improved image edge detail recovery, reduced aliasing, improved subjective quality, simple mathematical model, easy deployment, and better generalization effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023135103_31102024_PF_FP_ABST
    Figure CN2023135103_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are an image interpolation method and apparatus, and an electronic device and a computer-readable medium. The image interpolation method comprises: converting, into second coordinates in a coordinate system of an original image, first coordinates of a pixel point to be subjected to interpolation that are in a coordinate system of a target image; determining a direction value and direction reliability of a first pixel point corresponding to the second coordinates in the original image; and according to the direction value and direction reliability of the first pixel point, determining a final pixel value of the pixel point to be subjected to interpolation.
Need to check novelty before this filing date? Find Prior Art

Description

Image interpolation method and device, electronic device, and computer-readable storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application No. 202310477890.4 filed on April 27, 2023, the contents of which are incorporated herein by reference in their entirety. Technical Field

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

[0004] Currently, 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 for hardware resources, and its effect is greatly affected by the training data set and the content of the image itself.

[0005] Summary of the Invention

[0006] 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.

[0007] In a second aspect, an embodiment of the present application provides an image interpolation device, comprising: a coordinate conversion module, configured to convert 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, configured to determine a direction value and a direction reliability of a first pixel point corresponding to the second coordinate in the original image; and an interpolation module, configured to determine 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.

[0008] 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 computer program is stored in the memory, and the at least one computer program is executed by the at least one processor, so that the at least one processor implements any one of the above-mentioned image interpolation methods.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program is executed by a processor so that the processor implements any one of the above-mentioned image interpolation methods. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] FIG1 is a flowchart of an image interpolation method provided by one embodiment of the present application;

[0011] FIG2 is a schematic diagram of 16 sub-directions when the slope is positive in an embodiment of the present application;

[0012] FIG3 is a schematic diagram showing 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 an embodiment of the present application;

[0013] FIG4 is a block diagram of an image interpolation device provided by another embodiment of the present application; and

[0014] FIG5 is a block diagram of the composition of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0015] 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 storage medium provided in the present application are described in detail below with reference to the accompanying drawings.

[0016] Hereinafter, example embodiments will be described more fully 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. These examples are provided to make this application more thorough and complete and to enable those skilled in the art to fully understand the scope of this application.

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

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

[0019] The terms used herein are used only to describe specific embodiments and are not intended to limit this 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 group thereof is not excluded.

[0020] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one 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 expressly defined as such herein.

[0021] FIG1 is a flowchart of an image interpolation method provided by one embodiment of the present application.

[0022] In a first aspect, referring to FIG. 1 , an embodiment of the present application provides an image interpolation method, comprising the following steps 100 to 102 .

[0023] In step 100 , the first coordinates of the pixel to be interpolated in the target image coordinate system are converted into second coordinates in the original image coordinate system.

[0024] 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.

[0025] 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

[0026] In step 101, the direction value and direction reliability of a first pixel point corresponding to a second coordinate in an original image are determined.

[0027] 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.

[0028] 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 pixel points in the first pixel matrix centered on the second pixel point in the original image.

[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: 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; 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.

[0030] In some exemplary embodiments, determining the direction value and direction reliability of a first pixel corresponding to a second coordinate in an original image includes: when the second coordinate is an integer, calculating the gradient in the x direction and the gradient in the y direction for each third pixel in a second pixel matrix centered on the first pixel; and calculating the direction value and direction reliability of the first pixel based on the gradients in the x direction and the gradients in the y direction for all third pixels in the second pixel matrix. When the second coordinate is a non-integer, converting the second coordinate to an integer coordinate; calculating the gradient in the x direction and the gradient in the y direction for each third pixel in the second pixel matrix centered on the pixel corresponding to the integer coordinate; and calculating the direction value and direction reliability of the pixel corresponding to the integer coordinate based on the gradients in the x direction and the gradients in the y direction for all third pixels in the second pixel matrix, and using the direction value and direction reliability of the pixel corresponding to the integer coordinate as the direction value and direction reliability of the first pixel.

[0031] 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 point in the x 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_x j is the jth element value of the gradient operator in the x direction; the pixel values ​​of all 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 point 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.

[0032] 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.

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

[0034] 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

[0035] 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.

[0036] In some exemplary embodiments, calculating the direction value and direction reliability of the second pixel point based on the gradients in the x direction and 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.

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

[0038] 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 using the example of setting 32 direction values.

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

[0040] 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.

[0041] 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 Calculates the angle corresponding to the direction value of the pixel point corresponding to the integer coordinate.

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

[0043] By discretizing θ, we can obtain the direction value of the pixel corresponding to the integer coordinate. Specifically, the direction value of the pixel can be set to 4, 8, 16, 32, etc. The following example uses 32 direction values ​​to illustrate the calculation of the direction value.

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

[0045] 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.

[0046] Table 1

[0047] Figure 2 is a schematic diagram of the 16 sub-directions in the case of a positive slope in an embodiment of the present application. As shown in Figure 2, each gradient direction can be discretely mapped to a pixel point in a 5×5 neighborhood. For the line corresponding to each direction, the directions of quadrants 3 and 4 are the same as those of quadrants 1 and 2. Therefore, only the pixels in the directions of quadrants 1 and 2 need to be calculated.

[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 with coordinates of the second coordinate in the original image as the direction value of the first pixel point, and using the direction reliability of the second pixel point with coordinates of the second coordinate 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 a first pixel point based on the direction value and direction reliability of each second pixel point in the original image includes: when the second coordinate is an integer, using the direction value of the second pixel point with the second coordinate in the original image as the direction value of the first pixel point, and using the direction reliability of the second pixel point with 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, using the direction value of the second pixel point with the integer coordinate in the original image as the direction value of the first pixel point, and using the direction reliability of the second pixel point with 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 into 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 integers.

[0054] In step 102, a final pixel value of a pixel to be interpolated is determined 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, as shown in FIG3 , 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, and the slope and the fourth intercept Theta' of the perpendicular line L4 passing through the first pixel point (x1, y1) and perpendicular to the first straight line L2 according to the slope and the first intercept Theta of the first straight line L2; wherein the second straight line L1 and the third straight line L3 have the same slope as the first straight line L2. Line L3 is located on both sides of the first straight line L2; the pixel value of the first intersection (x[0], y[0]) of the second straight line L1 and the perpendicular line L4 is determined based on the slope and the second intercept Theta[0] of the second straight line L1, and the slope and the fourth intercept theta' of the perpendicular line L4; the pixel value of the second intersection (x[1], y[1]) of the third straight line L3 and the perpendicular line L4 is determined based on the slope and the third intercept Theta[1] of the third straight line L3, and the slope and the fourth intercept theta' of the perpendicular line L4; the original pixel value of the pixel to be interpolated is determined 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]).

[0057] In some exemplary embodiments, the slope and first intercept Theta of the first straight line L2, the slope and second intercept Theta[0] of the second straight line L1, the slope and third intercept Theta[1] of the third straight line L3, and the slope and fourth intercept theta' of the perpendicular line L4 can be the slope and intercept in the target coordinate system. The target coordinate system can be the original image coordinate system, or it can be a coordinate system in which the coordinate 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 coordinate 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 preset correspondence between the direction value and the slope; 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, based on m and n, the slope can be obtained as The values ​​of m and n can be adjusted according to the actual effect. 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 vertical line L4 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 perpendicular 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 perpendicular 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 on both sides of the first intersection (x[0], y[0]); determining the pixel value of the first intersection (x[0], y[0]) of the second straight line L1 ... wherein the fourth pixel point and the fifth pixel point are located on both sides of the first intersection (x[0], y[0]); wherein the fourth pixel point and the fifth pixel point are located on both sides of the first intersection (x[0], y[0]); wherein the fourth pixel point and the fifth pixel point are located on both sides of the first intersection (x[0], y[0]); wherein the fourth pixel point and the fifth pixel point are located on both sides of the first intersection (x The slope and second intercept Theta[0] of the vertical line L4, and the slope and fourth intercept theta' of the vertical line L4 determine the coordinates of the first intersection point in the target coordinate system (x[0], y[0]); the pixel values ​​of the fourth pixel point and the fifth pixel point in the target coordinate system are determined; 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 (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 point is the pixel value of the pixel point in the original image whose coordinates are the same as the coordinates of the fourth pixel point, and the pixel value of the fifth pixel point is the pixel value of the pixel point in the original image whose coordinates are the same as the coordinates of the fifth pixel point; 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 of the coordinates, the pixel value of the fourth pixel point is 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 target coordinate system converted into the coordinates in the original image coordinate system; the pixel value of the fifth pixel point is 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 target coordinate system converted into the coordinates in 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, and verifying 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 second intercept Theta[0] of the second straight line L1, and the slope and 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 based on the slope and the second intercept Theta[0] of the second straight line L1, and the slope and the fourth intercept theta' of the perpendicular line L4, the expression of the second straight line L1 is determined based on 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 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 based on the slope and the second intercept Theta[0] of the second straight line L1 includes: determining the coordinates of the candidate pixel point in the target coordinate system based on the slope and the second intercept Theta[0] of the second straight line L1; and 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 point in the target coordinate system.

[0070] In some exemplary embodiments, determining the coordinates of the candidate pixel points in the target coordinate system based on 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 based on 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 based on 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); where 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 a 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 In1 is a positive number, the sign bit of In1 is 1; when In1 is a negative number, the sign bit of In1 is -1; and when In1 is 0, the sign bit of In1 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; where 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; and 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 point in the target coordinate system are (x, y), then the coordinates of the second candidate pixel point in the target coordinate system are (x+n, ym), and the coordinates of the third pixel point 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; and 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 and fifth pixels in the target coordinate system based on the coordinates of the candidate pixels in the target coordinate system, the pixel closest to the origin of the target coordinate system may be selected from the candidate pixels as the fourth pixel. In other words, the pixel closest to the origin of the target coordinate system may be selected from the first, second, and third candidate pixels 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] When the absolute value of the second coordinate is less 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 coordinates of the fourth pixel point in the target coordinate system are determined to be the coordinates 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, and 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 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 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, 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 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, 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;

[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 point and the fifth pixel point based on the coordinates of the fourth pixel point and the fifth pixel point in the target coordinate system includes: converting the coordinates of the fourth pixel point in the target coordinate system into coordinates in the original image coordinate system, converting the coordinates of the fifth pixel point in the target coordinate system into coordinates in the original image coordinate system, using 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 as the pixel value of the fourth pixel point, and using 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 as the pixel value of the fifth pixel point.

[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 values ​​of the fourth pixel and the fifth pixel 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 to obtain the pixel value of the first intersection.

[0103] In some exemplary embodiments, the pixel value of the fourth pixel point and the pixel value of the fifth pixel point can be interpolated 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 to obtain the pixel value of the first intersection point.

[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 perpendicular 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 perpendicular line L4 includes: 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 L3 and the third intercept Theta[1] of the third straight line; 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 point 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 perpendicular line L4 and the fourth intercept theta'; determine 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; determine the pixel value of the second intersection point 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 (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 coordinates of 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 coordinates of 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 coordinates in the original image coordinate system.

[0106] In some exemplary embodiments, 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] 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 based on 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, two pixel points on both sides of the second intersection point on the third straight line L3 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 based on the slope and the third intercept Theta[1] of the third straight line L3, and the slope and the fourth intercept theta' of the perpendicular line L4, the expression of the third straight line L3 is determined based on the slope and the second intercept Theta[1] of the third straight line L3, 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 expression of the third straight line L3 and the expression of the perpendicular line L4 are solved as a system of equations to obtain the coordinates of the second intersection point in the target coordinate system.

[0109] In some exemplary embodiments, 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 based on the slope of the third straight line L3 and the third intercept Theta[1] includes: determining the coordinates of the candidate pixel point in the target coordinate system based on the slope of the third straight line L3 and the third intercept Theta[1]; determining the coordinates of the sixth pixel point and the seventh pixel point in the target coordinate system based on the coordinates of the candidate pixel point in the target coordinate system.

[0110] In some exemplary embodiments, determining the coordinates of the candidate pixel points in the target coordinate system based on 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 based on 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 based on 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); where 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 point 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 point 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 a 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 In2 is a positive number, the sign bit of In2 is 1; when In2 is a negative number, the sign bit of In2 is −1; and when In2 is 0, the sign bit of In2 is 1.

[0123] In some exemplary embodiments, ln2=ln1+1, where ln1 is obtained by shifting ln0 right by A bits, and ln0=abs(n)×vertical phase+m×n sign bit×horizontal phase; where 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; and 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 point in the target coordinate system are (x, y), then the coordinates of the second candidate pixel point in the target coordinate system are (x+n, ym), and the coordinates of the third pixel point in the target coordinate system are (xn, y+m).

[0128] In some exemplary embodiments, determining the coordinates of the sixth pixel point and the seventh 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 sixth 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; and 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.

[0129] In some exemplary embodiments, when determining the coordinates of the sixth and seventh pixels in the target coordinate system based on the coordinates of the candidate pixels in the target coordinate system, the pixel closest to the origin of the target coordinate system may be selected from the candidate pixels as the sixth pixel. In other words, the pixel closest to the origin of the target coordinate system may be selected from the first, second, and third candidate pixels as the sixth 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 includes at least one of the following:

[0131] When the absolute value of the second coordinate is less than the absolute value of the first coordinate and the absolute value of the third coordinate, determine the coordinates of the sixth pixel point in the target coordinate system as the coordinates 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 of the coordinates 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 of the coordinates 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 of the coordinates 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 coordinates of the sixth pixel point in the target coordinate system as the coordinates 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, and 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 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 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, determining 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 of 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 of 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, determining 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 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;

[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 point and the seventh pixel point based on the coordinates of the sixth pixel point and the seventh pixel point in the target coordinate system includes: converting the coordinates of the sixth pixel point in the target coordinate system into coordinates in the original image coordinate system, converting the coordinates of the seventh pixel point in the target coordinate system into coordinates in the original image coordinate system, using the pixel value of the pixel point in the original image whose coordinates are the same as the coordinates of the sixth pixel point in the original image coordinate system as the pixel value of the sixth pixel point, and using the pixel value of the pixel point in the original image whose coordinates are the same as the coordinates of the seventh pixel point in the original image coordinate system as the pixel value of the seventh pixel point.

[0142] In some exemplary embodiments, determining the pixel value of the second intersection point based on 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 (x[1], y[1]) includes: converting the coordinates of the second intersection point in the target coordinate system into coordinates in the original image coordinate system; interpolating the pixel value of the sixth pixel point and the pixel value of the seventh pixel point based on 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.

[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 pixel value of the second intersection 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 to be interpolated in the original image coordinate system to obtain the original pixel value of the pixel 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 using 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 using the traditional interpolation method is greater than a preset threshold, 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 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 using the traditional interpolation method is less than or equal to a preset threshold, determining the intermediate pixel value of the pixel to be interpolated based on 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 using 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 using 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 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 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 final 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, conventional interpolation methods include bilinear interpolation method, bicubic interpolation method, 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 of 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 of the embodiment of the present application is simple, easier to deploy on the terminal, and has better generalization effect.

[0154] FIG4 is a block diagram of an image interpolation device according to another embodiment of the present application.

[0155] In the second aspect, referring to Figure 4, another embodiment of the present application provides an image interpolation device, including: a coordinate conversion module 401, configured 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, configured 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 403, configured 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.

[0156] In some exemplary embodiments, the direction calculation module 402 is specifically configured to: calculate the direction value and direction reliability of each second pixel point in the original image respectively; 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 configured 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 pixel points 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 configured to determine the final pixel value of the pixel to be interpolated based on the direction value and direction reliability of the first pixel point in the following manner: determine the original pixel value of the pixel to be interpolated based on the direction value of the first pixel point; 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 point, 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.

[0159] In some exemplary embodiments, the interpolation module 403 is specifically configured to determine the original pixel value of the pixel to be interpolated based on 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 a second straight line having the same slope as the slope of the first straight line and the third intercept of a third straight line according to the slope and the first intercept of the first straight line, as well as the slope and the fourth intercept of a perpendicular 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 a first intersection of the second straight line and the perpendicular line according to the slope and the second intercept of the second straight line, and the slope and the fourth intercept of the perpendicular line; determine the pixel value of a second intersection of the third straight line and the perpendicular line according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the perpendicular line; determine the pixel value of a second intersection of the third straight line and the perpendicular line according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the perpendicular line; and determine the original pixel value of the pixel to be interpolated based on 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 configured to implement the following method to determine the pixel value of the first intersection of the second straight line and the perpendicular line according to the slope and the second intercept of the second straight line, and the slope and the fourth intercept of the perpendicular 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 perpendicular 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 configured to implement the determination of the pixel value of the second intersection of the third straight line and the perpendicular line according to the slope and the third intercept of the third straight line, and the slope and the fourth intercept of the perpendicular 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 perpendicular 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 configured 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: comparing 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 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 less 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.

[0163] In some exemplary embodiments, the interpolation module 403 is specifically configured 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 using 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 using 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, and will not be repeated here.

[0165] In the third aspect, referring 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 computer program is stored in the memory 502, and the at least one computer program is executed by the at least one processor 501, so that the at least one processor implements any one of the above-mentioned image interpolation methods.

[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), and 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 storage medium, on which a computer program is stored. The computer program is executed by a processor so that the processor implements any one of the above-mentioned image interpolation methods.

[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 is 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 includes, but is 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 tape, 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, as is well known to those skilled in the art, communication media typically embodies 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 purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly indicated, 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, it will be understood by those skilled in the art 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; as well as 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: respectively calculating the direction value and direction reliability of each second pixel point in the original image; and 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: respectively calculating the gradient in the x direction and the gradient in the y direction of each third pixel point in the original image; and 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 pixel points 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; and 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; Determine, 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 first straight line, a third intercept of a third straight line having the same slope as the first straight line, and 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; Determining 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; and 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; Determining 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; and 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: Converting the coordinates of the fourth pixel point in the target coordinate system into the coordinates of the original image coordinate system, and converting the coordinates of the fifth pixel point in the target coordinate system into the coordinates of the original image coordinate system; and 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: 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 includes: converting the coordinates of the first intersection point in the target coordinate system into the coordinates in the original image coordinate system; and 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: The coordinates of each pixel point in the original image in the original image coordinate system are converted into the coordinates of the target coordinate system, and the coordinates of each pixel point in the target coordinate system are sequentially substituted into the expression of the second straight line to verify whether the second straight line satisfies the Expression; wherein the expression of the second straight line is determined according to the slope of the second straight line and the second intercept; taking pixel points corresponding to coordinates satisfying the expression of the second straight line as candidate pixel points for the fourth pixel point and the fifth pixel point; and 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: determining 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; and 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; and 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, the first candidate is determined. The coordinates of the selected pixel point in the target coordinate system are (-c1×sign(n), c1); and 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: 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, and 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; and 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; and 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: 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 are determined 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 point; 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 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 less 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, configured to convert 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, configured to determine a direction value and a direction reliability of a first pixel point corresponding to the second coordinate in the original image; as well as The interpolation module is configured 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 computer program is stored in the memory, and the at least one computer program is executed by the at least one processor, so that the at least one processor implements the image interpolation method according to any one of claims 1 to 17.

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

Citation Information

Patent Citations

  • Interpolation method, terminal and computer readable storage medium

    CN108198137A

  • An image enlargement method and an image enlargement apparatus

    CN109325909A

  • System and process for image rescaling with edge adaptive phase control in interpolation process

    US20090262247A1

  • Method and system for image interpolation based on edge detection

    WO2016154970A1

Cited By

  • Construction operation monitoring method, system and equipment based on Internet of Things platform

    CN120451914A