A two-dimensional image-based adaptive interpolation and filtering method
Through adaptive interpolation and filtering methods, the problems of uneven interpolation and noise in the prior art are solved, and the uniform arrangement and simplification of image data are achieved, and the processing efficiency and recognition effect are improved.
Patent Information
- Application Number
- CN202210169582.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-23
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-02-23
AI Technical Summary
The existing two-dimensional image interpolation method is poor in processing uneven image density and noise, it is difficult to reflect changes in attribute values in blank areas, and it is prone to sawtooth effects and deviations.
An adaptive interpolation and filtering method based on two-dimensional images is proposed. By setting a gap threshold and an adaptive interpolation decision factor, the image data is adaptively interpolated and filtered, so that the points are evenly arranged, and the amount of image data is reduced by filtering, and the processing efficiency is improved.
The uniform arrangement and simplification of image data is achieved, the processing efficiency of image feature recognition is significantly improved, the calculation amount is reduced, and it can be applied to various types of two-dimensional images.
Smart Images

Figure CN114565527B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image data processing, and particularly relates to an adaptive interpolation and filtering method based on a two-dimensional image. Background Art
[0002] An unprocessed image usually presents characteristics such as irregular distribution and uneven density. The uneven density of the image may cause the established model to not accurately reflect the morphological changes of the entity, seriously affecting subsequent feature extraction. Rearranging the messy and irregularly distributed laser images regularly is a necessary means for image processing in certain detection and recognition work.
[0003] The interpolation algorithm can effectively solve the non-uniformity of the image. The core of the interpolation algorithm is to accurately predict the information of unknown points based on the information of known points. Currently, the following two common two-dimensional image interpolation methods are available:
[0004] The nearest neighbor interpolation algorithm is simple in operation and high in efficiency, but it has a high dependence on image data. If there is a lot of noise, there may be many noise points in the interpolation result. And the nearest neighbor interpolation algorithm ignores the geometric information of the image data. When the data distribution is uneven, it cannot reflect the change of the attribute value in the blank area; the boundary is prone to the sawtooth effect.
[0005] The inverse distance weighted interpolation algorithm has the principle that: the elevation value of the point set in a neighborhood is weighted and averaged to estimate the estimated value of the point to be interpolated. The weighted weight with the points in the neighborhood is determined according to the distance from this point to the point to be interpolated. The weight is the reciprocal of the k-th power of the distance, so the closer the distance, the greater the weight. The inverse distance weighted interpolation algorithm has a higher accuracy than the nearest neighbor interpolation algorithm because it effectively uses the position information of the point set in the neighborhood. However, its interpolation effect in the missing value area is poor, it cannot estimate the error, and it is easy to generate deviations. Summary of the Invention
[0006] The purpose of the present invention is to propose an adaptive interpolation and filtering method based on a two-dimensional image to perform adaptive interpolation and filtering on the messy two-dimensional image, so that the points are evenly arranged, thereby laying a foundation for subsequent image feature recognition and other work and achieving a reasonable detection effect. After adaptive interpolation, the image data is filtered again, so that on the premise that the image data can be evenly distributed in density and distance, the image data is streamlined, greatly reducing the amount of calculation for subsequent image feature recognition work and improving the processing efficiency.
[0007] To achieve the purpose of the present invention, the present invention provides an adaptive interpolation and filtering method based on a two-dimensional image, which is characterized by including the following steps:
[0008] Step 1: Set a notch threshold α, find the breakpoints in the two-dimensional image, and mark them;
[0009] Step 2: Obtain the adaptive interpolation decision factor β according to the statistical characteristics of the two-dimensional image data;
[0010] Step 3: Perform adaptive interpolation on the points in the two-dimensional image according to the judgment of the decision factor;
[0011] Step 4: Perform adaptive filtering on the image after adaptive interpolation.
[0012] Furthermore, in Step 1, according to the different image objects to be processed, preset the notch threshold; read a point P in sequence in the two-dimensional image a , calculate the Euclidean distance d a between P b and the next adjacent point P ab , and determine whether the distance d ab is greater than the notch threshold α. If it is greater, it is determined that there is a notch between the two points, and the two points are marked as breakpoints for breakpoint protection in the subsequent adaptive filtering work; if it is less, it is determined that the two points are continuous, and the adaptive interpolation judgment is started.
[0013] Furthermore, in Step 2, the decision factor is used to judge whether interpolation is required between two points in the two-dimensional image; if the distance d ab between the two points is greater than the adaptive interpolation decision factor β, it means that the two points are too sparse and adaptive interpolation is required; if it is less, it means that the distance between the two points meets the requirements and no interpolation processing is required.
[0014] Furthermore, in Step 3, according to the decision factor β and the Euclidean distance d ab between two points in the two-dimensional image, calculate the number of points PC to be inserted; according to the coordinates P a (x a ,y a ),P b (x b ,y b ) of the two points in the two-dimensional image and the number of points PC to be inserted, calculate the coordinates IP 1 ,IP 2 …IP n (1≤n≤PC) of the newly inserted points, and insert them into the image.
[0015] Furthermore, in Step 4, set the filtering threshold γ, traverse all the points in the image, and calculate the distances d n between the current point P to be processed and the previous point P n-1 and the next point P n+1 respectively n-1 and d n+1, Compare the mean value between two distances with the filtering threshold γ; if the mean value between the two distances is greater than γ, then remove the point P n , if it is less than γ, keep it; at the same time, protect the points that have been marked as breakpoints and keep them, and finally generate image data that is equidense, equidistant, and sparse.
[0016] Furthermore, step 1 specifically includes:
[0017] Step 1-1: In the image coordinate system, assume a point P a has coordinates (x a , y a ), and the coordinates of P b are (x b , y b ). Substitute the two points P b and P b into the Euclidean distance formula, and the Euclidean distance d ab between the two points can be obtained as
[0018]
[0019] Step 1-2: Compare the Euclidean distance d ab between the two points with the notch threshold α. If d ab > α, then it is determined that there is a notch between P a and P b , and mark P a and P b as breakpoints; if d ab ≤ α, then it is determined that P a and P b are continuous, and start the adaptive interpolation judgment.
[0020] Furthermore, step 2 specifically includes:
[0021] Step 2-1: First, calculate the variance σ 2 of the Euclidean distances between all points and their neighboring points in the two-dimensional image:
[0022] Assume that for a point P 0 (x 0 , y 0 ) in the image, the Euclidean distances d i between it and N neighboring points P i (x i , y i ) around it. Among them, assume N = 6, 1 ≤ i ≤ N, then the Euclidean distance d i between the current point and its neighboring points can be expressed as:
[0023]
[0024] Then P 0 to P i The average distance is
[0025]
[0026] Let P 0 The Euclidean distance d from P to the surrounding N adjacent points i and The difference is Δd i Then
[0027]
[0028] Let P 0 The average distance difference between P and the surrounding N adjacent points P i is denoted as Then is
[0029]
[0030] Calculate the variance σ of Δd i Then σ 2 is 2 is
[0031]
[0032] Step 2-2: Obtain the adaptive interpolation decision factor β;
[0033] In a two-dimensional image, assume there are a total of M points. Successively calculate the distances between adjacent points. The number of points where the distance from a certain point to the next adjacent point is less than or equal to the variance σ 2 is denoted as N 0 The ratio of N 0 to the total number of points M is denoted as ω 0 The average distance of all distances less than or equal to the variance σ 2 is denoted as μ 0 ; The number of points where the distance from a certain point to the next adjacent point is greater than the variance σ 2 is denoted as N 1 The ratio of N 1 to the total number of points M is denoted as ω 1 The average distance of all distances greater than the variance σ 2 is denoted as μ 1 Then there is the following formula:
[0034]
[0035]
[0036] N 0 +N 1= M
[0037] ω 0 + ω 1 = 1
[0038]
[0039] From the above formula, assuming that the average value of the distances between all adjacent points is μ, then μ is:
[0040] μ = ω 0 μ 0 + ω 1 μ 1
[0041] Finally, the calculation formula for the adaptive interpolation decision factor β is:
[0042] β = ω 0 (μ - μ 0 ) 2 + ω 1 (μ - μ 1 ) 2
[0043] Furthermore, step 3 specifically includes:
[0044] Step 3-1: Calculate the Euclidean distance d a and P b : ab :
[0045]
[0046] To improve performance, use the square of the distance for judgment without taking the square root, then d ab is:
[0047] d ab = (x a - x b ) 2 + (y a - y b ) 2
[0048] Step 3-2: If d ab is less than the adaptive interpolation decision factor β, then no interpolation is performed; if it is greater, then interpolation is performed, and calculate the number of points PC to be inserted:
[0049]
[0050] Step 3-3: Given the coordinates of two adjacent points P a (x a , y a ), P b (xb , y b ), and the number of points PC to be inserted can be used to calculate the step sizes S in the x and y directions x and S y :
[0051]
[0052] The nth inserted point IP can be obtained n (x n , y n ) has the coordinates:
[0053]
[0054] Step 3-4: Perform equalization rounding on the coordinates of the newly inserted points; after rounding the coordinates, the position of the newly inserted points will shift. To achieve high-precision point insertion, it is necessary to determine whether to round up or down, and the judgment basis depends on the equalization index τ;
[0055] τ in the x direction x and τ in the y direction y are determined by the newly inserted point IP n (x n , y n ) and the coordinates of the original two points P a (x a , y a ), P b (x b , y b ). The evaluation formulas for τ y and τ x are:
[0056]
[0057] Based on the magnitudes of τ y and τ x , determine the values of y n and x n :
[0058]
[0059]
[0060] Furthermore, the specific filtering method in Step 4 is:
[0061] Set the filtering threshold γ. The larger this threshold is set, the stronger the filtering effect and the sparser the filtered image. Assume that there are M points in the two-dimensional image after adaptive interpolation processing. Traverse all the points P in order n(1 ≤ n ≤ M), determine P n whether it is marked as a break point. If it is marked as a break point, retain it;
[0062] If P n is not a break point, then separately calculate the distances d n (x n , y n ) between the current point P to be processed and the previous point P n-1 (x n-1 , y n-1 ) and the next point P n+1 (x n+1 , y n+1 ): n-1 and d n+1 :
[0063]
[0064]
[0065] Divisibility factor θ:
[0066]
[0067]
[0068] If θ is greater than 0, retain it; otherwise, filter it out.
[0069] Compared with the prior art, the remarkable progress of the present invention lies in: 1) strong pertinence, having a good adaptive interpolation effect on two-dimensional images; 2) high efficiency and excellent performance. The method for adaptive interpolation based on two-dimensional images provided by the present invention does not require complex formula iteration calculations, taking into account both processing efficiency and effect, with an obvious equal-density effect and good interpolation quality; the interpolation algorithm is simple and efficient, greatly improving the operation performance; 3) threshold adaptability. The method for adaptive interpolation and filtering based on two-dimensional images provided by the present invention determines whether interpolation is required by obtaining an adaptive threshold parameter, and the threshold is dynamically generated, capable of being applied to various types of two-dimensional images.
[0070] To more clearly illustrate the functional characteristics and structural parameters of the present invention, the following further explains in conjunction with the accompanying drawings and specific embodiments. Brief Description of the Drawings
[0071] The accompanying drawings described herein are used to provide a further understanding of the present invention, and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0072] Figure 1 is a schematic diagram of the overall process of the present invention;
[0073] Figure 2 is a global schematic diagram of the original two-dimensional laser image data;
[0074] Figure 3 is a global schematic diagram of the original two-dimensional line laser image data after adaptive interpolation processing;
[0075] Figure 4 is a global schematic diagram of the original two-dimensional line laser image data after adaptive interpolation processing and then filtering and thinning;
[0076] Figure 5 is a partial schematic diagram of the original two-dimensional line laser image data;
[0077] Figure 6 is a partial schematic diagram of the original two-dimensional line laser image data after adaptive interpolation processing;
[0078] Figure 7 is a partial schematic diagram of the original two-dimensional line laser image data after adaptive interpolation processing and then filtering and simplifying;
[0079] Figure 8 is a partial schematic diagram of a smaller range of the original two-dimensional line laser image data;
[0080] Figure 9 Partial schematic diagram of a smaller range of the original two-dimensional line laser image data after adaptive interpolation processing;
[0081] Figure 10 Partial schematic diagram of a smaller range of the original two-dimensional line laser image data after adaptive interpolation processing and then filtering and simplifying. Detailed implementation manner
[0082] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments; based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0083] As Figure 1 shown, in this embodiment, a flowchart of an adaptive interpolation and filtering method based on a two-dimensional image is disclosed, including the following steps:
[0084] First, read the image data, set the notch threshold α, and find the breakpoints in the two-dimensional image. According to the different image objects to be processed, the notch threshold needs to be set manually. Read a point P in sequence in the two-dimensional image a , and find P aand the next adjacent point P b The Euclidean distance d between ab , and determine the distance d ab Whether it is greater than the gap threshold α, if it is greater, it is determined that there is a gap between the two points, and the two points are marked as breakpoints for breakpoint protection in subsequent adaptive filtering work; if it is less than, it is determined that the two points are continuous and adaptive interpolation judgment is started.
[0085] Next, the adaptive interpolation threshold is calculated and interpolation judgment is performed based on the threshold. The decision factor is used to determine whether interpolation is required between two points in a two-dimensional image. If the distance between the two points is greater than the adaptive interpolation decision factor β, it means that the two points are too sparse and adaptive interpolation is required. If it is less than, it means that the distance between the two points meets the requirements and no interpolation processing is required.
[0086] Then, adaptive interpolation is performed between two points that meet the requirements. According to the decision factor β and the Euclidean distance d between the two points ab , calculate the number of points PC that should be inserted; according to the coordinates P of the two points in the two-dimensional image a (x a ,y a ),P b (x b ,y b ) and the number of points to be inserted PC to calculate the coordinates IP of the new insertion point 1 ,IP 2 …IP n (1≤n≤PC). Insert it into the image.
[0087] Finally, filter the image after adaptive interpolation. Set the filter threshold γ, traverse all points in the image, and find the current point P to be processed. n and the point before it, P n-1 and the next point P n+1 The distance between n-1 and d n+1 ,Compare the mean value between the two distances with the filter threshold γ. If it is greater than γ, the point is removed, and if it is less than γ, it is retained. At the same time, the points that have been marked as breakpoints are protected and retained, and finally equal-density, equal-distance and sparse image data are generated.
[0088] Example
[0089] like Figure 2 , Figure 5 and Figure 8 As shown, Figure 2 , Figure 5 and Figure 8 They are the global, local and smaller-scale local images of the original image respectively.
[0090] As Figure 3 、 Figure 6 and Figure 9 shown, Figure 3 、 Figure 6 and Figure 9 are the global, local, and smaller-scale local images after the original image data has been processed by adaptive interpolation, respectively. The hollow circles in the figure represent the original data, and the asterisks represent the adaptively inserted data. By comparison, it can be found that after adaptive interpolation, the amount of image data has increased from the original 1524 to 2860, the image density has increased, and the distance between points has become more uniform.
[0091] As Figure 4 、 Figure 7 and Figure 10 shown, Figure 4 、 Figure 7 and Figure 10 are the global, local, and smaller-scale local schematic diagrams of the image after adaptive interpolation and then filtering and reduction, respectively. The crosses in the figure represent the data points after filtering. After filtering, the number of the image has decreased from the original 2860 to 1496, and the amount of data has been reduced. At the same time, compared with the original image, it can be found that the number of the image is not much different from the original 1524, and the image features of the image have not been lost, but the arrangement between points is more uniform. It can be seen that the image data after filtering by this method retains the characteristics of the adaptive interpolation algorithm, and at the same time does not lose the image features of the original image. Since the number of images has not changed much compared with the original image, it does not add a performance burden to the later recognition algorithm.
[0092] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device.
[0093] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An adaptive interpolation and filtering method based on a two-dimensional image, characterized in that , it includes the following steps: Step 1: Set a notch threshold α, find the breakpoints in the two-dimensional image, and mark them; Step 2: Obtain an adaptive interpolation decision factor β according to the statistical characteristics of the two-dimensional image data; Step 3: Perform adaptive interpolation on the points in the two-dimensional image according to the judgment of the decision factor; Step 4: Perform adaptive filtering on the image after adaptive interpolation; In step 2, the decision factor is used to determine whether interpolation is required between two points in the two-dimensional image; if the distance d ab between two points is greater than the adaptive interpolation decision factor β, it indicates that the two points are too sparse and adaptive interpolation is required; if it is less, it indicates that the distance between the two points meets the requirements and no interpolation processing is required; In step 3, according to the decision factor β and the Euclidean distance d between two points in the two-dimensional image ab , the number of points PC to be inserted is calculated; according to the coordinates P a (x a , y a ) of two points in the two-dimensional image, P b (x b , y b ) and the number of points PC to be inserted, the coordinates IP 1 , IP 2 … IP n are calculated, where 1 ≤ n ≤ PC, and then they are inserted into the image.
2. The adaptive interpolation and filtering method based on a two-dimensional image according to claim 1, characterized in that, In step 1, a notch threshold is preset according to different image objects to be processed; a point P is sequentially read in the two-dimensional image a , and the Euclidean distance d a between P b and the next adjacent point P ab is calculated, and it is determined whether the distance d ab is greater than the notch threshold α. If it is greater, it is determined that there is a notch between the two points, and the two points are marked as breakpoints for breakpoint protection in subsequent adaptive filtering operations; if it is less, it is determined that the two points are continuous, and adaptive interpolation judgment is started.
3. The adaptive interpolation and filtering method based on a two-dimensional image according to claim 1, characterized in that, In step 4, set the filtering threshold γ, traverse all points in the image, and respectively calculate the point P to be processed currently n and the previous point P of this point n-1 and the next point P n+1 The distance d between them n-1 and d n+1 , compare the mean value between the two distances with the filtering threshold γ; if the mean value between the two distances is greater than γ, then remove this point P n If it is less, keep it; at the same time, protect the points that have been marked as breakpoints and keep them, and finally generate image data that is equidense, equidistant, and sparse.
4. The adaptive interpolation and filtering method based on a two-dimensional image according to claim 2, characterized in that, Step 1 specifically includes: Step 1-1: In the image coordinate system, assume a point P a with coordinates (x a , y a ), and the coordinates of P b are (x b , y b ). Substitute the two points P a and P b into the Euclidean distance formula, and the Euclidean distance d ab between the two points is obtained as follows: Step 1-2: According to the Euclidean distance d between two points ab compare it with the notch threshold α. If d ab >α, it is determined that there is a notch between P a and P b , and P a and P b are marked as breakpoints; if d ab ≤α, it is determined that P a and P b are continuous, and start the adaptive interpolation judgment.
5. The adaptive interpolation and filtering method based on a two-dimensional image according to claim 1, characterized in that, Step 2 specifically includes: Step 2-1: First, calculate the variance σ of the Euclidean distances between all points and their neighboring points in the two-dimensional image 2 : Let a point P in the image 0 (x 0 , y 0 ), and the Euclidean distance between the current point P and N neighboring points P i (x i , y i ) around it is d i . Among them, let N = 6 and 1 ≤ i ≤ N. Then the Euclidean distance d i between the current point and its neighboring points is expressed as: Then P 0 to P i the average distance is Let P 0 be the Euclidean distance d to the surrounding N neighboring points i and the difference is Δd i , then Let P 0 and the average distance difference between P and the surrounding N adjacent points P i be denoted as Then is Calculate Δd i of the variance σ 2 , then σ 2 is Step 2-2: Obtain the adaptive interpolation decision factor β; In a two-dimensional image, suppose there are a total of M points, and the distance between two adjacent points is calculated in sequence, where the distance between a point and the next adjacent point is less than or equal to the variance σ 2 The number of points is recorded as N 0 , N 0 The ratio to the total number of points M is denoted as ω 0 , all distances are less than or equal to the variance σ 2 The average distance is denoted as μ 0 ; The distance between a point and the next adjacent point is greater than the variance σ 2 The number of points is recorded as N 1 , N 1 The ratio to the total number of points M is denoted as ω 1 , all distances greater than the variance σ 2 The average distance is denoted as μ 1 ; then we have the following formula: N 0 +N 1 = M ω 0 + ω 1 = 1 From the above formula, let the average value of the distances between all neighboring points be μ, then μ is: μ = ω 0 μ 0 + ω 1 μ 1 Finally, the calculation formula for the adaptive interpolation decision factor β is: β = ω 0 (μ - μ 0 ) 2 + ω 1 (μ - μ 1 ) 2 。 6. The adaptive interpolation and filtering method based on a two-dimensional image according to claim 1, characterized in that, Step 3 specifically includes: Step 3-1: Calculate P a and P b to obtain the Euclidean distance d ab : To improve performance, the square of the distance is used for judgment without taking the square root, so d ab is: d ab = (x a - x b ) 2 + (y a - y n ) 2 Step 3-2: If d ab is less than the adaptive interpolation decision factor β, no interpolation is performed; if it is greater, interpolation is performed to calculate the number of points PC to be inserted: Step 3-3: Given the coordinates P of two adjacent points a (x a , y a ), P b (x b , y b ), and the number of points PC to be inserted, calculate the step sizes S x and S y : Find the coordinates of the nth inserted point IP n (x n , y n ) are as follows: Step 3-4: Perform equalization rounding processing on the coordinates of the newly inserted points obtained; perform rounding on the obtained coordinates. After rounding the coordinates, the position of the newly inserted points will shift. In order to achieve high-precision interpolation points, it is necessary to judge whether to round up or down, and the judgment basis depends on the equalization index τ; τ in the x direction x and τ in the y direction y are determined by the newly inserted point IP n (x n , y n ) and the coordinates of the original two points P a (x a , y a ), P b (x b , y b ). The evaluation formulas for τ y and τ x are as follows: According to τ y and τ x to determine the values of y n and x n as follows:
7. The adaptive interpolation and filtering method based on a two-dimensional image according to claim 3, characterized in that, The specific filtering method in Step 4 is: Set the filtering threshold γ. The larger this threshold is set, the stronger the filtering effect and the sparser the filtered image. Assume that there are a total of M points in the two-dimensional image after adaptive interpolation processing. Traverse all the points P n (1 ≤ n ≤ M) in sequence, and judge whether P n is marked as a break point. If it is marked as a break point, keep it; If P n is not a break point, then calculate the distances d n (x n , y n ) between the current point P to be processed and the previous point P n-1 (x n-1 , y n-1 ) and the next point P n+1 (x n+1 , y n+1 ) respectively, and d n-1 and d n+1 : Divisor θ: If θ is greater than 0, keep it, otherwise filter it out.
Citation Information
Patent Citations
Interpolation filter coefficient adaptive generation method and device
CN113709483A
Method and device for isodensification processing of two-dimensional laser point cloud
CN114049407A