opencv
opencv copied to clipboard
Learn OpenCV, ORB/SIFT descriptors match by ratio test to find similarity.
Learning OpenCV !!
1. Feature Detecting Methods Compare
=> feature_methods_compare.cxx : Compare the speed of feature detecting method(just detecting, it is easy to include the descriptors computing into it.)
- FAST ,Machine Learning for High-speed Corner Detection, 2006
- SIFT,Distinctive Image Features from Scale-Invariant Keypoints,2004, invariant to image translation, scaling, and rotation, partially invariant to illumination changes and robust to local geometric distortion
- SURF,Speeded Up Robust Features,2006,受SIFT启发,比SIFT快,健壮
- ORB,ORB: an efficient alternative to SIFT or SURF,2011,基于FAST,比SIFT快两个数量级,可作为SIFT的替代
- BRISK,BRISK: Binary Robust Invariant Scalable Keypoints
- STAR,Censure: Center surround extremas for realtime feature detection and matching,引用次数不高
- MSER,Robust Wide Baseline Stereo from Maximally Stable Extremal Regions,2002,斑点检测
- GFTT,Good Features to Track,1994,Determines strong corners on an image
- HARRIS,Harris and M. Stephens (1988). "A combined corner and edge detector",也是一种角点检测方法
2.To See How Ratio impact the ORB Descriptors Matching.
=> ORB_match0.cpp : detect features, compute descriptors, then broute force match them ,but the result is bad, even not similar images also mathces too many!
=> ORB_match.cpp : After the ratio test and symmetric test, the result is good, but with ORB the Jaccard similarity is low.(Q)
ratio | image1 keypoints size | image2 keypoints size | Good matches1 | Good matches2 | Better matches |
---|---|---|---|---|---|
0.9 | 500 | 487 | 287 | 263 | 176 |
0.85 | 500 | 487 | 237 | 218 | 157 |
0.8 | 500 | 487 | 209 | 192 | 144 |
0.75 | 500 | 487 | 170 | 160 | 120 |
0.65 | 500 | 487 | 113 | 106 | 76 |
So, You can see the trend!
3.Combine Them Together to Implement Image Retrieval by similarity.
=> image-search
=> Test Results
-
500 features with ratio 0.9
-
1000 features with ratio 0.8
4. How the Query Image size impact the retrieval score.
test result
5. Dump the Descriptors to file for using next time, make it faster to process large dataset. There are two mehtods:1)You can define your own serialization format, such as my demo, 2) Using OpenCV built in component FileStorage. Here I Choose the second method for its easy use.
==> write ORB descriptors to file batchly ==> write SIFT descriptors to file batchly
6.1 This time I get train images' ORB descriptors from file to do the image retrieval!
test result
查询图片也从orb特征向量文件中获取 2015.8.23
**问题:**从图片得到的descriptos.cols可能为0,所以在匹配的时候就会出现类型不匹配的错误!
6.2 As above, get train images' SIFT descriptors from files, and then do image retrieval.
Source Code
使用SIFT特征向量进行相似图片查找 Source
7. Match descriptors of SIFT,ORB,FAST,etc ,and show how two images matched...
==>match
8.Image resize by scale factor and dump them to specified folders.
==>resize
8.Other easy demo on the road.
==>demo