CN113157688A - Nearest neighbor point searching method based on spatial index and neighbor point information - Google Patents
Nearest neighbor point searching method based on spatial index and neighbor point information Download PDFInfo
- Publication number
- CN113157688A CN113157688A CN202010012526.7A CN202010012526A CN113157688A CN 113157688 A CN113157688 A CN 113157688A CN 202010012526 A CN202010012526 A CN 202010012526A CN 113157688 A CN113157688 A CN 113157688A
- Authority
- CN
- China
- Prior art keywords
- point
- points
- information
- grid
- search
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 238000010586 diagram Methods 0.000 claims description 8
- 230000000694 effects Effects 0.000 description 4
- 238000003702 image correction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000012937 correction Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000012888 cubic function Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000007429 general method Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2462—Approximate or statistical queries
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Probability & Statistics with Applications (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Fuzzy Systems (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a nearest neighbor point searching method based on space index and neighbor point information, aiming at the problem that the nearest neighbor point searching is difficult to realize when the coordinates of the points are non-integers; the main inventive content includes creating spatial indexes of all scatter points; approximately searching nearest neighbor points around the current point; further accurately searching nearest neighbor points; the search process is simplified by the known nearest neighbors of previous points. The method provided by the invention can be used for effectively improving the image quality when being applied to image interpolation.
Description
Technical Field
The invention relates to nearest neighbor search, in particular to a nearest neighbor search method based on spatial index and neighbor point information.
Background
With the rapid development of the internet and multimedia technologies, the generation and sharing of mass data is already common in daily life. The nearest neighbor search is one of the basic problems in big data processing, and has wide application in the fields of machine learning, image processing and the like. The main process is to preprocess and index the data, so that the data object closest to the specified query can be found efficiently.
The nearest neighbor search is to find the item which is most similar to the target data from the database according to the similarity of the data. This similarity will typically be quantified as the distance between the data in space, i.e., the closer the data is in space, the higher the similarity between the data.
The nearest neighbor search can be classified into an exact query and an approximate query according to the accuracy of the query: the most simple method is linear scanning, namely, commonly called exhaustive search, the distances between the samples and the inquired data are sequentially calculated in a database, and the sample with the minimum calculated distance is extracted as the nearest neighbor to be searched; approximate queries are similar to approximate solutions, and the specific algorithms are basically based on hash algorithms, i.e., an input of an arbitrary length is converted into an output of a fixed length through a hash algorithm, and the output is a hash value. It is simply a function of compressing a message of arbitrary length to a message digest of some fixed length.
In the image interpolation, the closer the point to be interpolated is selected as the interpolation point, the better the image interpolation effect is, and therefore the nearest neighbor search is applied thereto. However, when the coordinates of points on the image are non-integer numbers, the general method is difficult to implement the nearest neighbor search. How to implement nearest neighbor search in this case is still one direction that needs to be continued.
Disclosure of Invention
The invention provides a nearest neighbor searching method based on spatial index and neighbor point information, aiming at the problem that the nearest neighbor searching is difficult to realize when the coordinates of the points are non-integers.
The invention provides a nearest neighbor point searching method based on spatial index and neighbor point information. The method provided by the invention further reduces the time consumption of the whole process while ensuring the accuracy of the searched nearest neighbor.
The specific process of the invention comprises the following steps:
to find k nearest neighbors of a current point G, the whole scattergram (i.e., the coordinates of the points in the graph are mostly non-integers) is divided into a plurality of small square regions by using a coordinate axis grid with the center of the whole scattergram as the origin, and all information (including x, y coordinate information and other information) of each scattergram in the grid region is retrieved by using the coordinates of a grid point located at the upper left corner of each grid (the point whose horizontal and vertical coordinates are integers in a rectangular coordinate system is called a "grid point") as an index, that is, all information of each scattergram is stored in the grid point at the upper left corner of the grid.
(1) If the current point G is the starting point of each row, a coordinate space based search is employed: the search range is a square with G as the center, the radius of the square is continuously increased from 1 until k grid points with information are found, and the coordinates of the k grid points are recorded in a grid point table;
extracting scattered point position information (x) stored in k grid points1,y1)、(x2,y2)……(xk,yk) Calculating Euclidean distance between each (x, y) and the point G and obtaining the maximum value dmax1To d is pairedmax1Calculating the radius R of the next accurate search square by rounding up according to formula (1)1:
Then the exact search is started: at a radius of R with G as the center1The square area is thoroughly searched, and in order to improve the speed, only the grid points which are not searched in the range are checked to determine whether scattered point information exists;
calculating the Euclidean distance between the positions (x, y) of the scatter points with the information and the point G, and comparing the Euclidean distance with the Euclidean distance from k scatter points to the point G found before accurate search to select k nearest neighbor points;
(2) if the current point G is the non-initial point of each row, the grid points G on the left side of the same row are adoptedleftThe nearest neighbor information of (2) is searched: calculating the known GleftK nearest neighbors of the current point G, and the maximum distance d of the k nearest neighbors and the current point Gmax2Calculating the radius R of the next accurate search square by formula (1)2;
To increase the search speed, the radius at the current point G is R2Under the search square region of (2), already at GleftSquare search area of (2) searched grid pointsAnd the check is only carried out to check whether the lattice points which are not searched in the range have scatter point information or not without searching again. Calculating Euclidean distance between the position (x, y) of the information-storing scatter point and the point G, and comparing the Euclidean distance with the point GleftComparing Euclidean distances from all adjacent points in the accurate search area to the current point G, and selecting k nearest adjacent points;
the nearest neighbor point searching method based on the spatial index and the neighbor point information, which is provided by the invention, is used for combining the approximate query and the accurate query aiming at the problem that the realization of the nearest neighbor point searching is difficult when the coordinates of the points are non-integers. Firstly, approximate query is adopted to find possible k nearest neighbor point sets; then, an accurate search area is obtained on the basis, accurate search is carried out, and k nearest neighbor points in all points of the area are selected. The approximate search reduces the amount of data that needs to be calculated; the accurate search compares all points in the accurate search area, and the accuracy of the final k nearest neighbors is guaranteed.
Drawings
Fig. 1 is a system diagram of a nearest neighbor search method based on spatial index and neighbor information.
Fig. 2 is a diagram of the effect of the bicubic interpolation method, the interpolation method based on multiple neighbors and the method applied to the image interpolation.
Detailed Description
The present invention is further described in detail with reference to the following embodiments, it should be noted that the following embodiments are only used for the image interpolation, and should not be construed as limiting the scope of the present invention, and those skilled in the art should be able to make some insubstantial modifications and adaptations to the present invention based on the above disclosure, and shall still fall within the scope of the present invention.
(1) The center of the whole scatter diagram (namely the coordinates of points in the diagram are mostly non-integers) is taken as an origin, the whole scatter diagram is divided into a plurality of small square areas by using a coordinate axis grid, all information (including x and y coordinate information and pixel value information) of each scatter point in the grid area is searched by using the coordinates of grid points positioned at the upper left corner of each grid as indexes, namely all information of each scatter point is stored in the grid points at the upper left corner of the grid. This embodiment takes 4-neighborhood interpolation as an example.
(2) If the current point G is the starting point of each row, a coordinate space based search is employed: the search range is a square with G as the center, the radius of the square is continuously increased from 1 until 4 grid points with information are found, and the coordinates of the grid points are recorded in a grid point table; extracting scattered point position information (x) stored in 4 grid points1,y1)、(x2,y2)、(x3,y3) And (x)4,y4) Calculating Euclidean distance between each (x, y) and the point G and obtaining the maximum value dmax1To d is pairedmax1Calculating the radius R of the next accurate search square by rounding up according to formula (1)1:
Then, the precise search is started: at a radius of R with G as the center1The square area is thoroughly searched, and in order to improve the speed, only the grid points which are not searched in the range are checked to determine whether scattered point information exists;
calculating Euclidean distances between the positions (x, y) of the scattered points and the point G, and comparing the Euclidean distances with the Euclidean distances from 4 scattered points to the point G found before accurate search to select 4 nearest neighbor points;
(3) if the current point G is the non-initial point of each row, the grid points G on the left side of the same row are adoptedleftThe nearest neighbor information of (2) is searched: calculating the known GleftThe Euclidean distance between the 4 nearest neighbor points and the current point G is obtained, and the maximum distance d is obtainedmax2Calculating the radius R of the next accurate search square by formula (1)2;
The search speed is increased, and the radius of the current point G is R2Under the search square region of (2), already at GleftThe searched grid points in the square search area do not need to be searched again, and only the grid points which are not searched in the range are checked to determine whether scatter point information exists. Calculate the position (x, y) and point G of these scatter pointsAnd is in Euclidean distance with GleftComparing the Euclidean distances from all adjacent points in the accurate search area to the current point G, and selecting 4 nearest adjacent points;
(4) searching to obtain accurate 4 nearest neighbor points, calculating the interpolation coefficient and the gray value of the current point G by using a formula (2) and a formula (3), and generating a final corrected image:
wherein k is 0,1,2,3, d is the euclidean distance between the nearest neighbor and G;
wherein IkIs the gray value of the nearest neighbor;
(5) the dual cubic interpolation effect is the best in the traditional interpolation method. In the bi-cubic interpolation method, the gray value of a point on the corrected image is obtained by a weighted average of the gray values of its nearest sixteen interpolation points around the corresponding point on the distorted image, where two polynomial interpolation cubic functions are used, one for each direction. In 2018, a multi-nearest neighbor-based interpolation method (multi-nearest neighbor-based interpolation) based on a corrected image is proposed abroad, and a corresponding point of a current point on the corrected image is found on a distorted image; then selecting the nearest 16 points around the corresponding point, and transforming the 16 points to the correction image; and finally, calculating Euclidean distances between the current point and the 16 points obtained by conversion on the corrected image, selecting the nearest 4 points as interpolation points, and calculating the gray value of the current point. But the 4 interpolation points found in the multi-neighbor based interpolation method are not always the 4 points closest to the current point. The method provided by the invention also searches the nearest neighbor point based on scattered points on the corrected image, but the peak signal-to-noise ratio (PSNR) and the Structural Similarity (SSIM) indexes are better, namely the image quality is better. The experimental original image adopts 24 pictures in the Kodak lossless true color image set, distortion processing is firstly carried out on the 24 pictures in the experimental process, and then correction images are respectively generated by three methods. Table 1 shows a comparison of nearest neighbor accuracy, average peak signal-to-noise ratio, and structural similarity for the corrected images generated for 24 distorted pictures under three methods.
Table 124 comparison of corrected image quality of distorted pictures generated under three methods
Compared with the prior art, the invention has the advantages and beneficial technical effects that:
(1) when the nearest neighbor point searching method based on the spatial index and the neighbor point information is applied to image correction interpolation, compared with the traditional interpolation method, the generated corrected image is less influenced by distortion, and the corrected image quality is higher;
(2) the nearest neighbor point searching method based on the spatial index and the neighbor point information, which is provided by the invention, finds the nearest interpolation point through the spatial index, and simultaneously accelerates the searching process by using the neighbor point of the previous point, thereby reducing the calculation complexity;
(3) when the nearest neighbor point searching method based on the spatial index and the neighbor point information is applied to image correction interpolation, the problem that image blurring is easily generated in image correction is solved, clear corrected images can be generated, and good human visual experience is provided.
Claims (5)
1. A nearest neighbor searching method based on spatial index and neighbor information is characterized in that:
in order to find k nearest neighbors of a current point G, a whole scatter diagram (namely, the coordinates of the points in the diagram are mostly non-integers) is divided into a plurality of small square areas by using a coordinate axis grid with the center of the whole scatter diagram as an origin, all information (including x and y coordinate information and other information) of each scatter point in the grid area is searched by using the coordinates of grid points positioned at the upper left corner of each grid (points with horizontal and vertical coordinates being integers in a rectangular coordinate system are called as grid points) as indexes, namely all information of each scatter point is stored in the grid points at the upper left corner of the grid;
(1) if the current point G is the starting point of each row, a coordinate space based search is employed: the search range is a square with G as the center, the radius of the square is continuously increased from 1 until k grid points with information are found, and the coordinates of the k grid points are recorded in a grid point table;
extracting scattered point position information (x) stored in k grid points1,y1)、(x2,y2)……(xk,yk) Calculating Euclidean distance between each (x, y) and the point G and obtaining the maximum value dmax1To d is pairedmax1Calculating the radius R of the next accurate search square by rounding up according to formula (1)1:
Then the exact search is started: at a radius of R with G as the center1The square area is thoroughly searched, and in order to improve the speed, only the grid points which are not searched in the range are checked to determine whether scattered point information exists;
calculating the Euclidean distances between the positions (x, y) of the scattered points and the point G, and comparing the Euclidean distances between k scattered points found before accurate search and the point G to select k nearest neighbor points;
(2) if the current point G is the non-initial point of each row, the grid points G on the left side of the same row are adoptedleftThe nearest neighbor information of (2) is searched: calculating the known GleftK nearest neighbors of the current point G, and the maximum distance d of the k nearest neighbors and the current point Gmax2Calculating the radius R of the next accurate search square by formula (1)2;
To increase the search speed, the radius at the current point G is R2Under the search square region of (2), already at GleftThe searched grid points in the square search area do not need to be searched again, and only whether scattered point information exists in the grid points which are not searched in the range is checked; calculating the bits of these scatter pointsSet Euclidean distance of (x, y) from point G and from GleftAll the neighbor points in the accurate search area to the current point G are compared, thereby selecting k nearest neighbor points.
2. The nearest neighbor searching method based on spatial index and neighbor information as claimed in claim 1, wherein the spatial index created for searching nearest neighbors.
3. The nearest neighbor searching method based on spatial index and neighbor information as claimed in claim 1, wherein the searching is performed based on spatial coordinates of non-integer coordinate points.
4. The method of claim 1, wherein the searching is performed based on spatial information of previous points.
5. A method for performing the nearest neighbor search based on spatial index and neighbor information as claimed in claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010012526.7A CN113157688A (en) | 2020-01-07 | 2020-01-07 | Nearest neighbor point searching method based on spatial index and neighbor point information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010012526.7A CN113157688A (en) | 2020-01-07 | 2020-01-07 | Nearest neighbor point searching method based on spatial index and neighbor point information |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113157688A true CN113157688A (en) | 2021-07-23 |
Family
ID=76881393
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010012526.7A Pending CN113157688A (en) | 2020-01-07 | 2020-01-07 | Nearest neighbor point searching method based on spatial index and neighbor point information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113157688A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101821732A (en) * | 2007-09-10 | 2010-09-01 | 神达电脑股份有限公司 | Nearest-neighbor geographic search |
CN102073689A (en) * | 2010-12-27 | 2011-05-25 | 东北大学 | Dynamic nearest neighbour inquiry method on basis of regional coverage |
JPWO2013129580A1 (en) * | 2012-02-28 | 2015-07-30 | 公立大学法人大阪府立大学 | Approximate nearest neighbor search device, approximate nearest neighbor search method and program thereof |
CN106126571A (en) * | 2016-06-20 | 2016-11-16 | 山东理工大学 | The increment type k nearest Neighbor of n dimension point set |
CN108550114A (en) * | 2018-04-19 | 2018-09-18 | 福建师范大学 | A kind of human face super-resolution processing method and system of multiscale space constraint |
CN108710626A (en) * | 2018-03-20 | 2018-10-26 | 浙江大学 | A kind of the approximate KNN search method and searching system of the high dimensional data based on satellite system figure |
CN109272458A (en) * | 2018-08-10 | 2019-01-25 | 河海大学 | A kind of point cloud filtering method based on prior information |
CN110009029A (en) * | 2019-03-28 | 2019-07-12 | 北京智行者科技有限公司 | Feature matching method based on point cloud segmentation |
-
2020
- 2020-01-07 CN CN202010012526.7A patent/CN113157688A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101821732A (en) * | 2007-09-10 | 2010-09-01 | 神达电脑股份有限公司 | Nearest-neighbor geographic search |
CN102073689A (en) * | 2010-12-27 | 2011-05-25 | 东北大学 | Dynamic nearest neighbour inquiry method on basis of regional coverage |
JPWO2013129580A1 (en) * | 2012-02-28 | 2015-07-30 | 公立大学法人大阪府立大学 | Approximate nearest neighbor search device, approximate nearest neighbor search method and program thereof |
CN106126571A (en) * | 2016-06-20 | 2016-11-16 | 山东理工大学 | The increment type k nearest Neighbor of n dimension point set |
CN108710626A (en) * | 2018-03-20 | 2018-10-26 | 浙江大学 | A kind of the approximate KNN search method and searching system of the high dimensional data based on satellite system figure |
CN108550114A (en) * | 2018-04-19 | 2018-09-18 | 福建师范大学 | A kind of human face super-resolution processing method and system of multiscale space constraint |
CN109272458A (en) * | 2018-08-10 | 2019-01-25 | 河海大学 | A kind of point cloud filtering method based on prior information |
CN110009029A (en) * | 2019-03-28 | 2019-07-12 | 北京智行者科技有限公司 | Feature matching method based on point cloud segmentation |
Non-Patent Citations (2)
Title |
---|
苗建辉等: "比特串划分多索引的近邻搜索算法", 《计算机辅助设计与图形学学报》 * |
马长胜等: "《一种改进的散乱数据点的k近邻快速搜索算法》", 《苏州大学学报(工科版)》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110322453B (en) | 3D point cloud semantic segmentation method based on position attention and auxiliary network | |
US6246790B1 (en) | Image indexing using color correlograms | |
KR101183391B1 (en) | Image comparison by metric embeddings | |
CN108491786B (en) | Face detection method based on hierarchical network and cluster merging | |
CN108230340B (en) | Method for determining SLIC superpixel extraction weight based on MMTD and superpixel extraction method | |
Bhoyar et al. | Color image segmentation based on JND color histogram | |
CN111583279A (en) | Super-pixel image segmentation method based on PCBA | |
CN113052859A (en) | Super-pixel segmentation method based on self-adaptive seed point density clustering | |
CN109391818B (en) | DCT (discrete cosine transformation) -based fractal image compression method for rapid search | |
US20020067864A1 (en) | Image processing device and image processing method | |
CN112035701A (en) | Internet short video source tracing method and system | |
JP2004021430A (en) | Image searching device, image searching method, and image searching program | |
CN113157688A (en) | Nearest neighbor point searching method based on spatial index and neighbor point information | |
CN107682699A (en) | A kind of nearly Lossless Image Compression method | |
CN116777745A (en) | Image super-resolution reconstruction method based on sparse self-adaptive clustering | |
CN1692369A (en) | Automatic natural content detection in video information | |
CN108712655B (en) | group image coding method for similar image set merging | |
KR101178015B1 (en) | Generating method for disparity map | |
CN115937540A (en) | Image Matching Method Based on Transformer Encoder | |
CN115294424A (en) | Sample data enhancement method based on generation countermeasure network | |
CN114820987A (en) | Three-dimensional reconstruction method and system based on multi-view image sequence | |
Valle et al. | Indexing personal image collections: a flexible, scalable solution | |
CN108268533A (en) | A kind of Image Feature Matching method for image retrieval | |
KR101220003B1 (en) | Generating method for disparity map | |
CN113554036A (en) | Characteristic point extraction and matching method for improving ORB algorithm |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20210723 |