CN110349089B - Image processing method and device for improving linear interpolation effect - Google Patents

Image processing method and device for improving linear interpolation effect Download PDF

Info

Publication number
CN110349089B
CN110349089B CN201910638377.2A CN201910638377A CN110349089B CN 110349089 B CN110349089 B CN 110349089B CN 201910638377 A CN201910638377 A CN 201910638377A CN 110349089 B CN110349089 B CN 110349089B
Authority
CN
China
Prior art keywords
point
interpolation
pixel
adjacent pixel
interpolation point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910638377.2A
Other languages
Chinese (zh)
Other versions
CN110349089A (en
Inventor
成富平
杜碧
刘阳胜
王俊荷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anjian Science And Technology Guangdong Co ltd
Original Assignee
Anjian Science And Technology Guangdong Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anjian Science And Technology Guangdong Co ltd filed Critical Anjian Science And Technology Guangdong Co ltd
Priority to CN201910638377.2A priority Critical patent/CN110349089B/en
Publication of CN110349089A publication Critical patent/CN110349089A/en
Application granted granted Critical
Publication of CN110349089B publication Critical patent/CN110349089B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4007Scaling of whole images or parts thereof, e.g. expanding or contracting based on interpolation, e.g. bilinear interpolation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4023Scaling of whole images or parts thereof, e.g. expanding or contracting based on decimating pixels or lines of pixels; based on inserting pixels or lines of pixels

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the invention discloses an image processing method for improving a linear interpolation effect, which is applied to the technical field of images and comprises the following steps: confirming whether an interpolation point newly added into an image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point, if not, calculating a pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm, if so, judging whether the interpolation point falls on a graph in an oblique line direction, if so, performing linear interpolation calculation according to the oblique line direction interpolation algorithm to obtain the pixel value of the interpolation point, and inserting the interpolation point into the image to be processed according to the pixel value of the interpolation point. The embodiment of the invention also discloses an image processing device for improving the linear interpolation effect, which can improve the definition of the interpolated image.

Description

Image processing method and device for improving linear interpolation effect
Technical Field
The invention belongs to the technical field of images, and particularly relates to an image processing method and device for improving a linear interpolation effect.
Background
In the information age, images are an important means for human beings to acquire information, express information, and transmit information as a visual basis for human beings to perceive the world. Digital image processing, i.e., processing images with a computer, is also increasingly developed. When the image is enlarged, a bilinear interpolation mode is usually used, that is, the bilinear interpolation is performed in the horizontal direction and the longitudinal direction, respectively, so as to achieve the purpose of enlarging the size of the image.
However, the above prior art only considers the linearity in the horizontal and vertical directions, which causes poor interpolation effect of the graph in the oblique line direction in the image, and when the pixel values of the adjacent original pixel points are greatly different, the pixel value of the newly added interpolation point is between the two original pixel values, so that the graph boundary in the interpolated image is blurred, and the original boundary becomes clear and blurred.
Disclosure of Invention
The invention provides an image processing method for improving a linear interpolation effect, and aims to solve the problem of poor image definition during image expansion processing.
The embodiment of the invention provides an image processing method for improving a linear interpolation effect, which comprises the following steps:
confirming whether an interpolation point newly added to an image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
if the pixel value does not fall on the oblique line formed by a plurality of adjacent pixel points of the interpolation point, calculating the pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm;
if the interpolation point falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point, judging whether the interpolation point falls on a graph in the oblique line direction;
if the image falls on the graph in the oblique line direction, linear interpolation calculation is carried out according to an interpolation algorithm in the oblique line direction to obtain a pixel value of the interpolation point;
and inserting the interpolation point into the image to be processed according to the pixel value of the interpolation point.
An embodiment of the present invention further provides an image processing apparatus for improving a linear interpolation effect, including:
the confirming module is used for confirming whether an interpolation point newly added into the image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the calculation module is used for calculating the pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm if the pixel value does not fall on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the judging module is used for judging whether the interpolation point falls on a graph in the oblique line direction or not if the interpolation point falls on the oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the calculation module is further configured to perform linear interpolation calculation according to an interpolation algorithm in the oblique line direction if the image falls on the graph in the oblique line direction, so as to obtain a pixel value of the interpolation point;
and the processing module is used for inserting the interpolation point into the image to be processed according to the pixel value of the interpolation point.
It can be known from the foregoing embodiments of the present invention that, by determining whether an interpolation point newly added to an image to be processed falls on a diagonal line formed by a plurality of adjacent pixel points of the interpolation point, if not, calculating a pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm, if so, determining whether the interpolation point falls on a graph in a diagonal direction, and if so, performing a linear interpolation calculation according to the diagonal direction interpolation algorithm to obtain the pixel value of the interpolation point, the interpolation effect of the graph in the diagonal direction in the image can be improved, and the boundary definition of the image after interpolation processing can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention.
FIG. 1 is a flow chart of an image processing method for improving linear interpolation effect according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating that an interpolation point does not fall on any oblique line formed by adjacent pixel points in the image processing method for improving a linear interpolation effect according to the embodiment of the present invention;
fig. 3 is a schematic diagram illustrating a position relationship between an interpolation point and its neighboring pixel points and derived interpolation points when the interpolation point does not fall on any of the diagonals in the image processing method for improving a linear interpolation effect according to the embodiment of the present invention;
fig. 4 is a schematic diagram illustrating a position relationship between an interpolation point and an adjacent pixel point and a derived interpolation point when the interpolation point falls on a graph in a diagonal direction in the image processing method for improving a linear interpolation effect according to the embodiment of the present invention;
fig. 5 is another schematic diagram illustrating a position relationship between an interpolation point and an adjacent pixel point and a derived interpolation point when the interpolation point falls on a graph in a diagonal direction in the image processing method for improving a linear interpolation effect according to the embodiment of the present invention;
fig. 6 is a schematic diagram illustrating a position relationship between an interpolation point and its neighboring pixel points and a derivative interpolation point when the interpolation point falls in two diagonal directions in the image processing method for improving a linear interpolation effect according to the embodiment of the present invention;
fig. 7 is a schematic structural diagram of an image processing apparatus for improving a linear interpolation effect according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a diagram of an image processing method for improving a linear interpolation effect according to an embodiment of the present invention, where the method may be applied to a scene of an image processed through interpolation, for convenience of description, 4 adjacent pixel points are taken as an example in this embodiment, and more scenes of adjacent pixel points are also applicable to the image processing method for improving a linear interpolation effect in this embodiment.
The method mainly comprises the following steps:
s101, determining whether an interpolation point newly added to an image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
an interpolation point is a new pixel point inserted into an image for processing the image, for example, a new pixel point inserted into an image for enlarging the image.
As shown in fig. 2, the interpolation point has 4 adjacent pixel points, the interpolation point is four pixel points in four quadrants of the origin, that is, four pixel points located in the upper left, upper right, lower left and lower right directions of the interpolation point, and the abscissa of the first adjacent pixel point is the same as that of the second adjacent pixel point, the abscissa of the third adjacent pixel point is the same as that of the fourth adjacent pixel point, the ordinate of the first adjacent pixel point is the same as that of the third adjacent pixel point, and the ordinate of the second adjacent pixel point is the same as that of the fourth adjacent pixel point.
The 4 adjacent pixel points can form two oblique lines as shown in fig. 2.
S102, if the pixel value does not fall on an oblique line formed by a plurality of adjacent pixel points of the interpolation point, calculating the pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm;
whether the interpolation point falls on the oblique line formed by the plurality of pixel points or not can be judged through the coordinates of the interpolation point and the plurality of adjacent pixel points.
If the pixel value does not fall on any diagonal line, the pixel value of the interpolation point is calculated according to the interpolation in the horizontal direction and the vertical direction.
Specifically, as shown in fig. 3, the derived interpolation point is derived according to the position relationship between the interpolation point and the adjacent pixel point of the interpolation point, so as to calculate the pixel value of the interpolation point. The X coordinates of the first derivative interpolation point and the second derivative interpolation point are the same as the interpolation point, the first derivative interpolation point is located on a connecting line between the first adjacent pixel point and the second adjacent pixel point, and the second derivative interpolation point is located on a connecting line between the third adjacent pixel point and the fourth adjacent pixel point.
The pixel value of the interpolation point is P _ vy, and the pixel value of the first adjacent pixel point is P _ h 1 The pixel value of the second adjacent pixel point is P _ h 2 The pixel value of the third adjacent pixel point is P _ h 3 The pixel value of the fourth adjacent pixel point is P _ h 4 The pixel value of the first derivative interpolation point is P _ hx 1 The pixel value of the second derivative interpolation point is P _ hx 2 . The distance from the first derived interpolation point to the first adjacent pixel point is S _ h 1 The distance from the first derivative interpolation point to the second adjacent pixel point is S _ h 2 The distance from the second derived interpolation point to the third adjacent pixel point is S _ h 1 The distance from the second derived interpolation point to the fourth adjacent pixel point is S _ h 2 The distance from the first derived interpolation point to the interpolation point is S _ v 1 The distance from the interpolation point to the second derived interpolation point is S _ v 2 The distance from the interpolation point to the first adjacent pixel point is S _ L 1 The distance from the interpolation point to the second adjacent pixel point is S _ L 2 The distance from the interpolation point to the third adjacent pixel point is S _ L 3 The distance from the interpolation point to the fourth adjacent pixel point is S _ L 4 . The first predetermined threshold is Pth _ h, the second predetermined threshold is Pth _ v, and the third predetermined threshold is Pth _ L.
Firstly, calculating the absolute value of the difference between the pixel values of a plurality of adjacent pixels of the interpolation point according to the horizontal direction interpolation, and judging whether the absolute value is greater than a first preset threshold value or not, if so, taking the pixel value of the adjacent pixel closest to the interpolation point as the pixel value of a derivative interpolation point of the interpolation point, wherein the derivative interpolation pixel is positioned on a connecting line of the plurality of adjacent pixels in the horizontal direction; if not, calculating the weighted average value of the pixel values of the adjacent pixel points, and taking the weighted average value as the pixel value of the derivative interpolation of the interpolation point.
Further, calculating the absolute value of the difference between the pixel values of the derived interpolation points according to the interpolation in the vertical direction, and if the absolute value is greater than a second preset threshold, taking the pixel value of the derived interpolation point closest to the interpolation point as the pixel value of the interpolation point if the absolute value is greater than the second preset threshold; if not, calculating the weighted average value of the pixel values of all the derived interpolation points as the pixel value of the interpolation point.
Specifically, whether the absolute value of the difference between the pixel values of the first adjacent pixel and the second adjacent pixel is greater than the first preset threshold is calculated according to the horizontal direction interpolation, and if the absolute value is greater than the first preset threshold, the pixel value of the adjacent pixel closest to the interpolation point in the first adjacent pixel and the second adjacent pixel is taken as the pixel value of the first derivative interpolation point:
calculating absolute value | P _ h of difference between pixel values of the first adjacent pixel and the second adjacent pixel 1 –P_h 2 |;
If the absolute value is greater than the first predetermined threshold, i.e., | P _ h 1 –P_h 2 |>Pth_h;
Further comparing the distance S _ h from the interpolation point to the first adjacent pixel point 1 The distance S _ h from the interpolation point to the second adjacent pixel point 2 And taking the pixel value of the adjacent pixel point closest to the interpolation point as the pixel value of the interpolation point:
if S _ h 1 >S_h 2 Then P _ hx 1 =P_h 2 (ii) a If S _ h 2 >S_h 1 Then P _ hx 1 =P_h 1
If the pixel value of the first adjacent pixel point of the interpolation point is not larger than the first preset threshold, calculating the product of the pixel value of the first adjacent pixel point of the interpolation point and the first weighting coefficient, and the product of the pixel value of the second adjacent pixel point of the interpolation point and the second weighting coefficient, and taking the sum of the two products as the pixel value of the interpolation point, wherein the first weighting coefficient is the ratio of the distance between the second adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the second adjacent pixel point, and the second weighting coefficient is the ratio of the distance between the first adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the second adjacent pixel point:
i.e., if | P _ h 1 –P_h 2 If | is less than or equal to Pth _ h, then:
Figure GDA0003999041540000061
similarly, whether the absolute value of the difference between the pixel values of the third adjacent pixel and the fourth adjacent pixel is greater than the first preset threshold or not is calculated according to the horizontal direction interpolation, and if the absolute value is greater than the first preset threshold, the pixel value of the adjacent pixel closest to the interpolation point in the third adjacent pixel and the fourth adjacent pixel is taken as the pixel value of the second derivative interpolation point:
calculating the absolute value | P _ h of the difference between the pixel values of the third adjacent pixel and the fourth adjacent pixel 3 –P_h 4 |;
If the absolute value is greater than the first predetermined threshold, i.e., | P _ h 3 –P_h 4 |>Pth_h;
Then it is furtherComparing the distance S _ h from the interpolation point to the third adjacent pixel point 3 The distance S _ h from the interpolation point to the fourth adjacent pixel point 4 And taking the pixel value of the adjacent pixel point closest to the interpolation point as the pixel value of the interpolation point:
if S _ h 3 >S_h 4 Then P _ hx 2 =P_h 4 (ii) a If S _ h 4 >S_h 3 Then P _ hx 2 =P_h 3
If the pixel value of the third adjacent pixel point of the interpolation point is not more than the first preset threshold, calculating the product of the pixel value of the third adjacent pixel point of the interpolation point and the third weighting coefficient, and the product of the pixel value of the fourth adjacent pixel point of the interpolation point and the fourth weighting coefficient, and taking the sum of the two products as the pixel value of the interpolation point, wherein the third weighting coefficient is the ratio of the distance between the third adjacent pixel point and the interpolation point to the distance between the third adjacent pixel point and the fourth adjacent pixel point, and the fourth weighting coefficient is the ratio of the distance between the fourth adjacent pixel point and the interpolation point to the distance between the third adjacent pixel point and the fourth adjacent pixel point:
i.e., if | P _ h 3 –P_h 4 If | is less than or equal to Pth _ h, then:
Figure GDA0003999041540000071
further, an absolute value | P _ hx of a difference between pixel values of the first derived interpolation point and the second derived interpolation point is calculated 1 –P_hx 2 |。
If the absolute value is greater than the second predetermined threshold, i.e., | P _ hx 1 –P_hx 2 |>Pth_v;
The distance S _ v from the first derived interpolation point to the interpolation point is further compared 1 Distance S _ v from the second derived interpolation point to the interpolation point 2 And the pixel value of the derived interpolation point closest to the interpolation point is taken as the pixel value of the interpolation point:
if S _ v 1 >S_v 2 Then P _ vy = P _ hx 2 (ii) a If S _ v 2 >S_v 1 Then P _ vy =P_hx 1
If the absolute value is not greater than the predetermined threshold for the vertical interpolation, i.e., | P _ hx 1 –P_hx 2 |≤Pth_v;
Then, the product of the pixel value of the first derived interpolation point and the fifth weighting coefficient is calculated, the product of the pixel value of the second derived interpolation point and the sixth weighting coefficient is calculated, and the sum of the two products is used as the pixel value of the interpolation point, the fifth weighting coefficient is the ratio of the distance between the interpolation point and the second derived interpolation point to the distance between the first derived interpolation point and the second derived interpolation point, and the sixth weighting coefficient is the ratio of the distance between the first derived interpolation point and the first derived interpolation point to the distance between the first derived interpolation point and the second derived interpolation point. Namely:
Figure GDA0003999041540000072
s103, if the interpolation point falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point, judging whether the interpolation point falls on a graph in the oblique line direction;
if the absolute value is smaller than the third preset threshold, the interpolation point is confirmed to fall on the graph in the oblique line direction.
If the interpolation point falls on two of the oblique lines, respectively calculating the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the two oblique lines, and if the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the two oblique lines is smaller than the third preset threshold, determining that the interpolation point falls on the graph in the direction of the two oblique lines; if the absolute value of the difference between the pixel values of two adjacent pixels corresponding to one of the two oblique lines is smaller than the preset threshold value, and the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the other oblique line is not smaller than the preset threshold value, confirming that the interpolation point falls on the graph in the oblique line direction but does not fall on the graph in the other oblique line direction; and if the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the two oblique lines is not less than the preset threshold, determining that the interpolation point does not fall on the graphs in the directions of the two oblique lines.
See in particular fig. 4-6. In fig. 4, if the interpolation point falls on the oblique line between the first adjacent pixel and the fourth adjacent pixel, the absolute value of the difference between the pixel values of the first adjacent pixel and the fourth adjacent pixel is calculated:
|P_h 1 –P_h 4 |;
if the absolute value is less than the third predetermined threshold, i.e., | P _ h 1 –P_h 4 If | is less than Pth _ L, the interpolation point is confirmed to fall on the graph in the diagonal direction.
In fig. 5, if the interpolation point falls on the oblique line between the second adjacent pixel and the third adjacent pixel, the absolute value of the difference between the pixel values of the second adjacent pixel and the third adjacent pixel is calculated:
|P_h 2 –P_h 3 |;
if the absolute value is less than the third predetermined threshold, i.e., | P _ h 2 –P_h 3 If | is less than Pth _ L, the interpolation point is confirmed to fall on the graph in the diagonal direction.
In fig. 6, if the interpolation point falls on both the oblique line between the first adjacent pixel and the fourth adjacent pixel and the oblique line between the second adjacent pixel and the third adjacent pixel, the absolute value | P _ h of the difference between the pixel values of the first adjacent pixel and the fourth adjacent pixel is calculated 1 –P_h 4 And calculating an absolute value | P _ h of a difference between pixel values of the second adjacent pixel and the third adjacent pixel 2 –P_h 3 |;
If both of the two absolute values are smaller than the third preset threshold, the following steps are performed:
|P_h 1 –P_h 4 < Pth _ L, and, | P _ h 2 –P_h 3 |<Pth_L;
Confirming that the interpolation point falls on the graphs in the two oblique line directions;
if | P _ h 1 –P_h 4 < Pth _ L, and, | P _ h 2 –P_h 3 |≥Pth_L;
Confirming that the interpolation point falls on a graph in the oblique line direction between the first adjacent pixel point and the fourth adjacent pixel point;
if | P _ h 1 –P_h 4 L is not less than Pth _ L, and L P _ h 2 –P_h 3 |<Pth_L;
Then confirming that the interpolation point falls on the graph in the oblique line direction between the second adjacent pixel point and the third adjacent pixel point.
The interpolation point in fig. 4 is on the graph in the diagonal direction between the first adjacent pixel point and the fourth adjacent pixel point; the interpolation point in fig. 5 is on the graph in the diagonal direction between the second adjacent pixel point and the third adjacent pixel point; the interpolation point in fig. 6 is on the graph in the diagonal direction between the first adjacent pixel point and the fourth adjacent pixel point, and on the graph in the diagonal direction between the second adjacent pixel point and the third adjacent pixel point at the same time.
S104, if the graph falls on the graph in the oblique line direction, performing linear interpolation calculation according to an oblique line direction interpolation algorithm to obtain a pixel value of the interpolation point;
specifically, if the interpolation point falls on a graph in the direction of one oblique line of the oblique lines, calculating the product of two different weighting coefficients and the pixel values of two adjacent pixel points corresponding to the falling oblique line, and taking the sum of the two products as the pixel value of the interpolation point, where the two weighting coefficients are the ratio of the distance between the two adjacent pixel points and the interpolation point to the distance between the two adjacent pixel points, and the two different weighting coefficients are inversely proportional to the distance between the two adjacent pixel points and the interpolation point.
Furthermore, the graph falling in the direction of one oblique line is divided into two situations, namely a graph 4 and a graph 5, wherein the oblique line is formed by the first adjacent pixel point and the fourth adjacent pixel point, and the oblique line is formed by the second adjacent pixel point and the third adjacent pixel point.
In fig. 4, the interpolation point falls on the graph in the diagonal direction between the first adjacent pixel point and the fourth adjacent pixel point, the product of the pixel value of the first adjacent pixel point of the interpolation point and the first weighting coefficient and the product of the pixel value of the fourth adjacent pixel point of the interpolation point and the second weighting coefficient are calculated, and the sum of the two products is used as the pixel value of the interpolation point, the first weighting coefficient is the ratio of the distance between the fourth adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the fourth adjacent pixel point (the distance between the first adjacent pixel point and the fourth adjacent pixel point is equal to the sum of the interpolation point and the first adjacent pixel point and the interpolation point to the fourth adjacent pixel point), and the second weighting coefficient is the ratio of the distance between the first adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the fourth adjacent pixel point. Namely:
Figure GDA0003999041540000101
if the absolute value is not less than the preset threshold, i.e., | P _ h 1 –P_h 4 |≥Pth_L;
Then, the interpolated pixel is calculated according to the bilinear interpolation algorithm, that is: firstly, according to a horizontal interpolation algorithm, calculating a pixel of a first derivative interpolation point and a pixel of a second derivative interpolation point according to the pixel of a first adjacent pixel point, the pixel of a second adjacent pixel point, the distance between a third adjacent pixel point, the pixel of a fourth adjacent pixel point, the distance between the first derivative interpolation point and the first adjacent pixel point, and the distance between the first derivative interpolation point and the second adjacent pixel point, and then according to a vertical interpolation algorithm, calculating the pixel of the interpolation point according to the pixel of the first derivative interpolation point, the pixel of the second derivative interpolation point, the distance between the first derivative interpolation point and the interpolation point, and the distance between the second derivative interpolation point and the interpolation point;
the pixels of the first derivative interpolation point are:
Figure GDA0003999041540000102
the pixels of the second derivative interpolation point are:
Figure GDA0003999041540000103
the pixel points of the interpolation points are:
Figure GDA0003999041540000104
in fig. 5, the interpolation point falls on the graph in the diagonal direction between the second adjacent pixel point and the third adjacent pixel point, a product of the pixel value of the second adjacent pixel point of the interpolation point and the third weighting coefficient and a product of the pixel value of the third adjacent pixel point of the interpolation point and the fourth weighting coefficient are calculated, and the sum of the two products is used as the pixel value of the interpolation point, the third weighting coefficient is a ratio of a distance between the third adjacent pixel point and the interpolation point to a distance between the second adjacent pixel point and the third adjacent pixel point (the distance between the second adjacent pixel point and the third adjacent pixel point is equal to the sum of the interpolation point and the second adjacent pixel point and the third adjacent pixel point), and the second weighting coefficient is a ratio of a distance between the second adjacent pixel point and the interpolation point to a distance between the second adjacent pixel point and the third adjacent pixel point. Namely:
Figure GDA0003999041540000111
if the absolute value is not less than the preset threshold, i.e., | P _ h 2 –P_h 3 |≥Pth_L;
Then, the pixel point of the interpolation is calculated according to the bilinear interpolation algorithm, that is: firstly, according to a horizontal interpolation algorithm, calculating a pixel of a first derivative interpolation point and a pixel of a second derivative interpolation point according to the pixel of a first adjacent pixel point, the pixel of a second adjacent pixel point, the distance between a third adjacent pixel point, the pixel of a fourth adjacent pixel point, the distance between the first derivative interpolation point and the first adjacent pixel point, and the distance between the first derivative interpolation point and the second adjacent pixel point, and then according to a vertical interpolation algorithm, calculating the pixel of the interpolation point according to the pixel of the first derivative interpolation point, the pixel of the second derivative interpolation point, the distance between the first derivative interpolation point and the interpolation point, and the distance between the second derivative interpolation point and the interpolation point;
the pixels of the first derivative interpolation point are:
Figure GDA0003999041540000112
the pixels of the second derivative interpolation point are:
Figure GDA0003999041540000113
the pixel points of the interpolation points are:
Figure GDA0003999041540000114
in fig. 6, the interpolation point is simultaneously located on the graph in the diagonal direction between the first adjacent pixel point and the fourth adjacent pixel point, and the graph in the diagonal direction between the second adjacent pixel point and the third adjacent pixel point, and a first pixel value of the interpolation point and a second pixel value of the interpolation point are calculated, and an arithmetic average of the first pixel value and the second pixel value is a pixel value of the interpolation point.
Specifically, the first pixel value of the interpolation point is calculated: the method comprises the steps of calculating a first weighted coefficient of an interpolation point, calculating a second weighted coefficient of an interpolation point, calculating a product of a pixel value of a first adjacent pixel point of the interpolation point and the first weighted coefficient, calculating a product of a pixel value of a fourth adjacent pixel point of the interpolation point and the second weighted coefficient, and taking the sum of the two products as the first pixel value of the interpolation point, wherein the first weighted coefficient is the ratio of the distance between the fourth adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the fourth adjacent pixel point, and the second weighted coefficient is the ratio of the distance between the first adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the fourth adjacent pixel point. Namely:
Figure GDA0003999041540000121
calculating a second pixel value of the interpolation point: and calculating the product of the pixel value of the second adjacent pixel point of the interpolation point and a third weighting coefficient, calculating the product of the pixel value of the third adjacent pixel point of the interpolation point and a fourth weighting coefficient, and taking the sum of the two products as the pixel value of the interpolation point, wherein the third weighting coefficient is the ratio of the distance between the third adjacent pixel point and the interpolation point to the distance between the second adjacent pixel point and the third adjacent pixel point, and the second weighting coefficient is the ratio of the distance between the second adjacent pixel point and the interpolation point to the distance between the second adjacent pixel point and the third adjacent pixel point. Namely:
Figure GDA0003999041540000122
the pixel value of the interpolation point is equal to the arithmetic mean of the first pixel value and the second pixel value. Namely:
Figure GDA0003999041540000123
if the absolute value of the difference between the pixel values of the first adjacent pixel and the fourth adjacent pixel is less than the preset threshold, and the absolute value of the difference between the pixel values of the second adjacent pixel and the third adjacent pixel is not less than the preset threshold. I.e., | P _ h 1 –P_h 4 < Pth _ L, and, | P _ h 2 –P_h 3 |≥Pth_L;
Then, the product of the pixel value of the first adjacent pixel of the interpolation point and the first weighting coefficient is calculated, and the product of the pixel value of the fourth adjacent pixel of the interpolation point and the second weighting coefficient is calculated, and the sum of the two products is used as the pixel value of the interpolation point, the first weighting coefficient is the ratio of the distance between the fourth adjacent pixel and the interpolation point to the distance between the first adjacent pixel and the fourth adjacent pixel (the distance between the first adjacent pixel and the fourth adjacent pixel is equal to the sum of the interpolation point and the first adjacent pixel and the interpolation point and the fourth adjacent pixel), and the second weighting coefficient is the ratio of the distance between the first adjacent pixel and the interpolation point to the distance between the first adjacent pixel and the fourth adjacent pixel. Namely:
Figure GDA0003999041540000131
if the absolute value of the difference between the pixel values of the first adjacent pixel and the fourth adjacent pixel is not less than the preset threshold, the absolute value of the difference between the pixel values of the second adjacent pixel and the third adjacent pixel is less than the preset threshold. I.e., | P _ h 1 –P_h 4 L is not less than Pth _ L, and L P _ h 2 –P_h 3 |<Pth_L;
Then, calculating the product of the pixel value of the second adjacent pixel point of the interpolation point and the third weighting coefficient, and the product of the pixel value of the third adjacent pixel point of the interpolation point and the fourth weighting coefficient, and taking the sum of the two products as the pixel value of the interpolation point, wherein the third weighting coefficient is the ratio of the distance between the third adjacent pixel point and the interpolation point to the distance between the second adjacent pixel point and the third adjacent pixel point (the distance between the second adjacent pixel point and the third adjacent pixel point is equal to the sum of the interpolation point and the second adjacent pixel point and the third adjacent pixel point), and the second weighting coefficient is the ratio of the distance between the second adjacent pixel point and the interpolation point to the distance between the second adjacent pixel point and the third adjacent pixel point. Namely:
Figure GDA0003999041540000132
if the absolute value of the difference between the pixel values of the first adjacent pixel and the fourth adjacent pixel is not less than the preset threshold, the absolute value of the difference between the pixel values of the second adjacent pixel and the third adjacent pixel is not less than the preset threshold. I.e., | P _ h 1 –P_h 4 The value of Pth _ L is more than or equal to, and the value of P _ h2-P _ h3 is more than or equal to Pth _ L;
then, the pixel point of the interpolation is calculated according to the bilinear interpolation algorithm, that is: firstly, according to a horizontal interpolation algorithm, calculating a pixel of a first derivative interpolation point and a pixel of a second derivative interpolation point according to the pixel of a first adjacent pixel point, the pixel of a second adjacent pixel point, the distance between a third adjacent pixel point, the pixel of a fourth adjacent pixel point, the distance between the first derivative interpolation point and the first adjacent pixel point, and the distance between the first derivative interpolation point and the second adjacent pixel point, and then according to a vertical interpolation algorithm, calculating the pixel of the interpolation point according to the pixel of the first derivative interpolation point, the pixel of the second derivative interpolation point, the distance between the first derivative interpolation point and the interpolation point, and the distance between the second derivative interpolation point and the interpolation point;
the pixels of the first derivative interpolation point are:
Figure GDA0003999041540000141
the pixels of the second derivative interpolation point are:
Figure GDA0003999041540000142
the pixel points of the interpolation points are:
Figure GDA0003999041540000143
and S105, inserting the interpolation point into the image to be processed according to the pixel value of the interpolation point.
And after the pixel value of the interpolation point is calculated, the interpolation point is inserted into the image to be processed according to the pixel value, and the processing of the image to be processed is finished.
In the embodiment of the invention, by confirming whether the interpolation point newly added to the image to be processed falls on the oblique line formed by a plurality of adjacent pixel points of the interpolation point, if not, the pixel value of the interpolation point is calculated according to the horizontal direction interpolation algorithm and the vertical direction interpolation algorithm, if so, the pixel value of the interpolation point is judged whether the interpolation point falls on the graph in the oblique line direction, and if so, the linear interpolation calculation is carried out according to the oblique line direction interpolation algorithm to obtain the pixel value of the interpolation point, thereby improving the interpolation effect of the graph in the oblique line direction in the image and improving the boundary definition of the image after interpolation processing.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an image processing apparatus for improving a linear interpolation effect according to an embodiment of the present invention, and for convenience of description, only a portion related to the embodiment of the present invention is shown. The image processing apparatus for improving the linear interpolation effect illustrated in fig. 7 may be an execution subject of the image processing method for improving the linear interpolation effect provided by the foregoing embodiment illustrated in fig. 1, and the image processing apparatus for improving the linear interpolation effect may be built in a terminal, and the terminal includes a PC computer, a mobile phone, and other electronic devices. The image processing apparatus for improving the effect of linear interpolation includes:
the confirming module 401 is configured to confirm whether an interpolation point newly added to an image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
a calculating module 402, configured to calculate a pixel value of the interpolation point according to a horizontal interpolation algorithm and a vertical interpolation algorithm if the determining module 401 determines that the pixel value does not fall on a diagonal line formed by a plurality of adjacent pixel points of the interpolation point;
a determining module 403, configured to determine whether the interpolation point falls on a graph in the oblique line direction if the determining module 401 determines that the interpolation point falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the calculating module 402 is further configured to perform linear interpolation calculation according to an interpolation algorithm in the oblique line direction if the image falls on the graph in the oblique line direction, so as to obtain a pixel value of the interpolation point;
a processing module 404, configured to insert the interpolation point into the image to be processed according to the pixel value of the interpolation point.
Further, the calculating module 402 is further configured to calculate, according to the interpolation in the horizontal direction, whether an absolute value of a difference between pixel values of a plurality of adjacent pixels of the interpolation point is greater than a first preset threshold, if yes, taking a pixel value of an adjacent pixel closest to the interpolation point as a pixel value of a derivative interpolation point of the interpolation point, where the derivative interpolation pixel is located on a connection line of the plurality of adjacent pixels in the horizontal direction;
and calculating the absolute value of the difference between the pixel values of the derived interpolation points according to the vertical direction interpolation, and if the absolute value is larger than a second preset threshold, taking the pixel value of the derived interpolation point closest to the interpolation point as the pixel value of the interpolation point.
Further, the adjacent pixel points of the interpolation point include: the interpolation point is used as an original point of the four adjacent pixel points, the abscissa of a first adjacent pixel point of the four adjacent pixel points is the same as that of a second adjacent pixel point of the four adjacent pixel points, the abscissa of a third adjacent pixel point of the four adjacent pixel points is the same as that of a fourth adjacent pixel point of the four adjacent pixel points, the ordinate of the first adjacent pixel point of the four adjacent pixel points is the same as that of the third adjacent pixel point of the four adjacent pixel points, and the ordinate of the second adjacent pixel point of the four adjacent pixel points is the same as that of the fourth adjacent pixel point of the four adjacent pixel points.
The calculating module 402 is further configured to calculate, according to a horizontal direction interpolation, whether an absolute value of a difference between pixel values of the first adjacent pixel and the second adjacent pixel is greater than a first preset threshold, and if the absolute value is greater than the first preset threshold, take a pixel value of an adjacent pixel closest to the interpolation point among the first adjacent pixel and the second adjacent pixel as a pixel value of a first derivative interpolation pixel, where the first derivative interpolation pixel is located on a connection line between the first adjacent pixel and the second adjacent pixel, and an X coordinate of the first derivative interpolation pixel is the same as an X coordinate of the interpolation point;
calculating whether the absolute value of the difference between the pixel values of the third adjacent pixel point and the fourth adjacent pixel point is greater than a first preset threshold value or not according to the horizontal direction interpolation, if so, taking the pixel value of the adjacent pixel point which is closest to the interpolation point in the third adjacent pixel point and the fourth adjacent pixel point as the pixel value of a second derivative interpolation point, wherein the first derivative interpolation pixel point is located on the connecting line of the third adjacent pixel point and the fourth adjacent pixel point, and the X coordinate of the second derivative interpolation pixel point is the same as the X coordinate of the interpolation point;
the calculating module 402 is further configured to calculate, according to the vertical direction interpolation, whether an absolute value of a difference between pixel values of the interpolation point and a third neighboring pixel point and a fourth neighboring pixel point is greater than the first preset threshold, and if the absolute value is greater than the first preset threshold, take a pixel value of a neighboring pixel point closest to the interpolation point among the third neighboring pixel point and the fourth neighboring pixel point as a pixel value of a second derivative interpolation point.
Further, the determining module 403 is further configured to, if the interpolation point falls on one of the oblique lines, calculate an absolute value of a difference between pixel values of two adjacent pixels corresponding to the oblique line, and if the absolute value is smaller than a third preset threshold, determine that the interpolation point falls on the graph in the oblique line direction;
if the absolute value of the difference of the pixel values of two adjacent pixels corresponding to the two oblique lines falls on two oblique lines of the oblique lines;
and if the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the two oblique lines is smaller than a third preset threshold, confirming that the interpolation point falls on the graphs in the directions of the two oblique lines.
The calculating module 402 is further configured to calculate, if the interpolation point falls on a graph in a diagonal direction of the plurality of diagonals, a product of a first weighting coefficient and a pixel value of a first adjacent pixel corresponding to the falling diagonal, and a product of a second weighting coefficient and a pixel value of a second adjacent pixel corresponding to the falling diagonal, and use a sum of the two products as a pixel value of the interpolation point, where the first weighting coefficient is a ratio of a distance between the second adjacent pixel and the interpolation point to a distance between the first adjacent pixel and the second adjacent pixel.
The calculating module 402 is further configured to calculate, if the interpolation point falls on the graph in two oblique line directions in the multiple oblique lines at the same time, a product of a first weighting coefficient and a pixel value of a first adjacent pixel point corresponding to the falling first oblique line, and a product of a second weighting coefficient and a pixel value of a fourth adjacent pixel point corresponding to the falling first oblique line, and use a sum of the two products as the first pixel value of the interpolation point, where the first weighting coefficient is a ratio of a distance between the fourth adjacent pixel point and the interpolation point to a distance between the first adjacent pixel point and the fourth adjacent pixel point;
calculating the product of a third weighting coefficient and the pixel value of a second adjacent pixel point corresponding to the second falling oblique line, calculating the product of a fourth weighting coefficient and the pixel value of a third adjacent pixel point corresponding to the second falling oblique line, and taking the sum of the two products as the second pixel value of the interpolation point, wherein the third weighting coefficient is the ratio of the distance between the third adjacent pixel point and the interpolation point to the distance between the second adjacent pixel point and the third adjacent pixel point;
and calculating the arithmetic mean value of the first pixel value and the second pixel value of the interpolation point to obtain the pixel value of the interpolation point.
For further details of this embodiment, reference is made to the description of the embodiment shown in fig. 1 above.
In this embodiment, by determining whether an interpolation point newly added to an image to be processed falls on a diagonal line formed by a plurality of adjacent pixel points of the interpolation point, if not, calculating a pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm, if so, determining whether the interpolation point falls on a graph in a diagonal direction, and if so, performing linear interpolation calculation according to the diagonal direction interpolation algorithm to obtain the pixel value of the interpolation point, the interpolation effect of the graph in the diagonal direction in the image can be improved, and the boundary definition of the image after interpolation processing is improved.
An embodiment of the present invention further provides a terminal, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the image processing method for improving linear interpolation effect as described in the foregoing fig. 1 when executing the computer program.
Further, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be disposed in the terminal, and the computer-readable storage medium may be a memory of the terminal. The computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the image processing method for improving the linear interpolation effect described in the foregoing embodiment shown in fig. 1. Further, the computer-readable storage medium may be various media that can store program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a RAM, a magnetic disk, or an optical disk.
It should be noted that for simplicity and convenience of description, the above-described method embodiments are shown as a series of combinations of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The above description is provided for the image processing method and the image processing apparatus for improving linear interpolation effect, and those skilled in the art will be able to change the concepts of the embodiments of the present invention in the following detailed description and application scope.

Claims (7)

1. An image processing method for improving linear interpolation effect, comprising:
confirming whether an interpolation point newly added into an image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
if the pixel value does not fall on the oblique line formed by a plurality of adjacent pixel points of the interpolation point, calculating the pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm;
if the interpolation point falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point, judging whether the interpolation point falls on a graph in the oblique line direction;
if the image falls on the graph in the oblique line direction, linear interpolation calculation is carried out according to an interpolation algorithm in the oblique line direction to obtain a pixel value of the interpolation point;
inserting the interpolation point into the image to be processed according to the pixel value of the interpolation point;
the adjacent pixel points of the interpolation point include: four adjacent pixel points which are respectively positioned in four quadrants with the interpolation point as an original point, wherein the abscissa of a first adjacent pixel point is the same as that of a second adjacent pixel point, the abscissa of a third adjacent pixel point is the same as that of a fourth adjacent pixel point, the ordinate of the first adjacent pixel point is the same as that of the third adjacent pixel point, and the ordinate of the second adjacent pixel point is the same as that of the fourth adjacent pixel point; the calculating the pixel value of the interpolation point according to the horizontal direction interpolation algorithm and the vertical direction interpolation algorithm comprises:
calculating whether the absolute value of the difference between the pixel values of the first adjacent pixel and the second adjacent pixel is greater than a first preset threshold or not according to the horizontal direction interpolation, if so, taking the pixel value of the adjacent pixel closest to the interpolation point in the first adjacent pixel and the second adjacent pixel as the pixel value of a first derivative interpolation pixel, wherein the first derivative interpolation pixel is located on the connecting line of the first adjacent pixel and the second adjacent pixel, and the X coordinate of the first derivative interpolation pixel is the same as the X coordinate of the interpolation point;
calculating whether the absolute value of the difference between the pixel values of the third adjacent pixel point and the fourth adjacent pixel point is greater than a first preset threshold value or not according to the horizontal direction interpolation, if so, taking the pixel value of the adjacent pixel point which is closest to the interpolation point in the third adjacent pixel point and the fourth adjacent pixel point as the pixel value of a second derivative interpolation point, wherein the first derivative interpolation pixel point is located on the connecting line of the third adjacent pixel point and the fourth adjacent pixel point, and the X coordinate of the second derivative interpolation pixel point is the same as the X coordinate of the interpolation point;
and calculating whether the absolute value of the difference between the pixel values of the interpolation point and the third adjacent pixel point and the fourth adjacent pixel point is greater than the first preset threshold value or not according to the interpolation in the vertical direction, and if so, taking the pixel value of the adjacent pixel point which is closest to the interpolation point in the third adjacent pixel point and the fourth adjacent pixel point as the pixel value of a second derivative interpolation point.
2. The method according to claim 1, wherein the determining whether the interpolation point falls on the graph in the oblique line direction if the interpolation point falls on the oblique line formed by a plurality of adjacent pixels of the interpolation point comprises:
and if the interpolation point falls on one of the oblique lines, calculating the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the oblique line, and if the absolute value is smaller than a third preset threshold, confirming that the interpolation point falls on the graph in the oblique line direction.
3. The method according to claim 1, wherein the determining whether the interpolation point falls on the graph in the oblique line direction if the interpolation point falls on the oblique line formed by a plurality of adjacent pixels of the interpolation point comprises:
if the absolute value of the difference of the pixel values of two adjacent pixels corresponding to the two oblique lines falls on two oblique lines of the oblique lines;
and if the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the two oblique lines is smaller than a third preset threshold, confirming that the interpolation point falls on the graphs in the directions of the two oblique lines.
4. The method according to claim 2, wherein the performing linear interpolation calculation according to a diagonal interpolation algorithm to obtain the pixel value of the interpolation point comprises:
if the interpolation point falls on a graph in the direction of one oblique line of the oblique lines, calculating the product of a first weighting coefficient and the pixel value of a first adjacent pixel point corresponding to the falling oblique line, calculating the product of a second weighting coefficient and the pixel value of a second adjacent pixel point corresponding to the falling oblique line, and taking the sum of the two products as the pixel value of the interpolation point, wherein the first weighting coefficient is the ratio of the distance between the second adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the second adjacent pixel point.
5. The method of claim 3, wherein the performing linear interpolation calculation according to a diagonal interpolation algorithm to obtain the pixel value of the interpolation point comprises:
if the interpolation point falls on the graphs in two oblique line directions in the plurality of oblique lines at the same time, calculating the product of a first weighting coefficient and the pixel value of a first adjacent pixel point corresponding to the falling first oblique line, calculating the product of a second weighting coefficient and the pixel value of a fourth adjacent pixel point corresponding to the falling first oblique line, and taking the sum of the two products as the first pixel value of the interpolation point, wherein the first weighting coefficient is the ratio of the distance between the fourth adjacent pixel point and the interpolation point to the distance between the first adjacent pixel point and the fourth adjacent pixel point;
calculating the product of a third weighting coefficient and the pixel value of a second adjacent pixel point corresponding to the second falling oblique line, calculating the product of a fourth weighting coefficient and the pixel value of a third adjacent pixel point corresponding to the second falling oblique line, and taking the sum of the two products as the second pixel value of the interpolation point, wherein the third weighting coefficient is the ratio of the distance between the third adjacent pixel point and the interpolation point to the distance between the second adjacent pixel point and the third adjacent pixel point;
and calculating the arithmetic mean value of the first pixel value and the second pixel value of the interpolation point to obtain the pixel value of the interpolation point.
6. An image processing apparatus that improves a linear interpolation effect, comprising:
the confirming module is used for confirming whether an interpolation point newly added into the image to be processed falls on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the calculation module is used for calculating the pixel value of the interpolation point according to a horizontal direction interpolation algorithm and a vertical direction interpolation algorithm if the pixel value does not fall on an oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the judging module is used for judging whether the interpolation point falls on a graph in the oblique line direction or not if the interpolation point falls on the oblique line formed by a plurality of adjacent pixel points of the interpolation point;
the calculation module is further configured to perform linear interpolation calculation according to an interpolation algorithm in the oblique line direction if the image falls on the graph in the oblique line direction, so as to obtain a pixel value of the interpolation point;
the processing module is used for inserting the interpolation point into the image to be processed according to the pixel value of the interpolation point;
calculating whether the absolute value of the difference between the pixel values of the interpolation point and a third adjacent pixel point and a fourth adjacent pixel point is larger than a first preset threshold value or not according to the interpolation in the vertical direction, and if so, taking the pixel value of the adjacent pixel point which is closest to the interpolation point in the third adjacent pixel point and the fourth adjacent pixel point as the pixel value of a second derivative interpolation point; the calculation module is further configured to calculate, according to a horizontal direction interpolation, whether an absolute value of a difference between pixel values of the first adjacent pixel and the second adjacent pixel is greater than a first preset threshold, and if the absolute value is greater than the first preset threshold, take a pixel value of an adjacent pixel closest to the interpolation point among the first adjacent pixel and the second adjacent pixel as a pixel value of a first derivative interpolation point, where the first derivative interpolation pixel is located on a connection line between the first adjacent pixel and the second adjacent pixel, and an X coordinate of the first derivative interpolation pixel is the same as an X coordinate of the interpolation point; calculating whether the absolute value of the difference between the pixel values of the third adjacent pixel point and the fourth adjacent pixel point is greater than a first preset threshold value or not according to the horizontal direction interpolation, if so, taking the pixel value of the adjacent pixel point which is closest to the interpolation point in the third adjacent pixel point and the fourth adjacent pixel point as the pixel value of a second derivative interpolation point, wherein the first derivative interpolation pixel point is located on the connecting line of the third adjacent pixel point and the fourth adjacent pixel point, and the X coordinate of the second derivative interpolation pixel point is the same as the X coordinate of the interpolation point; and the interpolation processing unit is further configured to calculate, according to the interpolation in the vertical direction, whether an absolute value of a difference between pixel values of the interpolation point and a third neighboring pixel point and a fourth neighboring pixel point is greater than the first preset threshold, and if the absolute value is greater than the first preset threshold, use a pixel value of a neighboring pixel point, which is closest to the interpolation point, of the third neighboring pixel point and the fourth neighboring pixel point as a pixel value of a second derivative interpolation point.
7. The apparatus according to claim 6, wherein the determining module is further configured to calculate an absolute value of a difference between pixel values of two adjacent pixels corresponding to each oblique line if the interpolation point falls on one of the oblique lines, and confirm that the interpolation point falls on the graph in the oblique line direction if the absolute value is smaller than a third preset threshold;
if the absolute value of the difference of the pixel values of two adjacent pixels corresponding to the two oblique lines falls on two oblique lines of the oblique lines;
and if the absolute value of the difference between the pixel values of two adjacent pixels corresponding to the two oblique lines is smaller than a third preset threshold, confirming that the interpolation point falls on the graphs in the directions of the two oblique lines.
CN201910638377.2A 2019-07-16 2019-07-16 Image processing method and device for improving linear interpolation effect Active CN110349089B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910638377.2A CN110349089B (en) 2019-07-16 2019-07-16 Image processing method and device for improving linear interpolation effect

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910638377.2A CN110349089B (en) 2019-07-16 2019-07-16 Image processing method and device for improving linear interpolation effect

Publications (2)

Publication Number Publication Date
CN110349089A CN110349089A (en) 2019-10-18
CN110349089B true CN110349089B (en) 2023-03-10

Family

ID=68176394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910638377.2A Active CN110349089B (en) 2019-07-16 2019-07-16 Image processing method and device for improving linear interpolation effect

Country Status (1)

Country Link
CN (1) CN110349089B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103366342A (en) * 2013-07-02 2013-10-23 天津大学 Piecewise linear interpolation method applied to video image amplification
CN107734281A (en) * 2017-09-22 2018-02-23 维沃移动通信有限公司 A kind of image magnification method and mobile terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7842926B2 (en) * 2003-11-12 2010-11-30 Micronic Laser Systems Ab Method and device for correcting SLM stamp image imperfections

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103366342A (en) * 2013-07-02 2013-10-23 天津大学 Piecewise linear interpolation method applied to video image amplification
CN107734281A (en) * 2017-09-22 2018-02-23 维沃移动通信有限公司 A kind of image magnification method and mobile terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于局部特征的图像插值算法在B/S视频监控中的应用;孟利民等;《浙江工业大学学报》;20150425(第02期);全文 *

Also Published As

Publication number Publication date
CN110349089A (en) 2019-10-18

Similar Documents

Publication Publication Date Title
CN110324664B (en) Video frame supplementing method based on neural network and training method of model thereof
CN111275626B (en) Video deblurring method, device and equipment based on ambiguity
US9361725B2 (en) Image generation apparatus, image display apparatus, image generation method and non-transitory computer readable medium
WO2018082185A1 (en) Image processing method and device
CN111311482B (en) Background blurring method and device, terminal equipment and storage medium
US10255665B2 (en) Image processing device and method, image capturing device, program, and record medium
CN112017222A (en) Video panorama stitching and three-dimensional fusion method and device
CN106204441B (en) Image local amplification method and device
CN110874827B (en) Turbulent image restoration method and device, terminal equipment and computer readable medium
CN109214996B (en) Image processing method and device
CN111724304A (en) Image scaling method and device, terminal equipment and storage medium
CN111383178A (en) Image enhancement method and device and terminal equipment
CN111311481A (en) Background blurring method and device, terminal equipment and storage medium
CN111563517A (en) Image processing method, image processing device, electronic equipment and storage medium
CN112073718B (en) Television screen splash detection method and device, computer equipment and storage medium
CN110363723B (en) Image processing method and device for improving image boundary effect
CN110349089B (en) Image processing method and device for improving linear interpolation effect
JP4868249B2 (en) Video signal processing device
KR20130036430A (en) Method for generating high resolution depth image from low resolution depth image, and medium recording the same
CN110363708B (en) Image processing method and device for improving interpolation effect in oblique line direction
CN111462015A (en) Map track processing method and device, electronic equipment and storage medium
KR100882085B1 (en) Method for enhancing contrast of image
CN111429383B (en) Image noise reduction method and device and computer readable storage medium
CN111383183B (en) Image edge enhancement method and device and computer storage medium
CN112150532A (en) Image processing method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant