C++ implementation of the robust keypoint elimination algorithm described in the paper
Malashin R.O. Core algorithm for structural verification of keypoint matches. Intelligent Systems Reference Library. Computer Vision in Control Systems-3. 2018. P. 251-286
I did minor changes to the code to make it compatible with new opencv4.x.
apt-get install libboost-all-dev
Download, compile and install opencv with opencv_contrib. Follow opencv documentation.
Make sure to enable DOPENCV_ENABLE_NONFREE
flag when configure. The flag is needed for SURF detector, which is used by default (you can substitute it later). I used the following commands:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DOPENCV_ENABLE_NONFREE:BOOL=ON -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.x/modules ../opencv-4.x
make -j8
make install
Compile CSVA project.
git clone https://github.com/malashinroman/CSVA
cd CSVA
mkdir build && cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
make -j8
You should get following files in CSVA/bin directory
libcommon_lib.a, libcsva_lib.so, match3D, match_aero.
If you see them, then everything is OK, and you can proceed to tests.
See Dockerfile to see all commands for clean installation in Ubuntu
CSVA (“core” structural verification algorithm) is a robust and fast algorithm for outlier elimination of keypoint matches (e.g. SURF, SIFT or BRISK features) that heavily exploits gemetrical constraints. It can be used by developers and researches in different practical tasks with minor adaptation. CSVA an improved version of SIFT clustering proposed by David Lowe in SIFT.
for more demonstration results visit project page
opencv
CSVA uses openCV structures like cv::DMatch and cv::KeyPoint internally, opencv3.1 and opencv4.0 were tested
opencv-contrib
You will need xfeatures2d from opencv-contrib to compile and test with SURF and SIFT
Boost
CSVA uses boost library in it's core
Windows 7 and Ubuntu 14.04 were tested
Cmake is a recommended tool for creating CSVA project
CSVA has two regimes for 3D scene matching and aerospace matching.
After compilation you can run
match3D image1.jpg image2.jpg
The result showing keypoint matches selected by CSVA will be drawn in result.jpg
After compilation you can run
match_aero im1.jpg im2.jpg 0.5 0.5 1
where im1.jpg is first aero or space image, im2.jpg is second aero or space image, 0.5 is a resize factor, 1 - is fast mode (use 2 to get robust results).
Folder
To use CSVA in your C++ project
#include "csva_lib/csva.h"
csva::filter_matches(points1, points2, matches, image1, image2, csva::geometry_mode::THREEDIM_SCENE, LocalMatchtype, goodmatches, confidence, 0.001);
where points1 and points2 are vector
Current repository suggests using OpenCVfeatures wrapper to compute features defined in features2d and xfeatures2d modules:
std::vector
This project is licensed under the MIT License - see the LICENSE file for details
1. Malashin R.O. Core algorithm for structural verification of keypoint matches. Intelligent Systems Reference Library. Computer Vision in Control Systems-3. 2018. P. 251-286
2. Malashin R. Matching of Aerospace Photographs with the use of Local Features // Journal of Physics: Conference Series - 2014, Vol. 536, No. 1, pp. 012018.