MPIG Seminar0045
Feature Extraction
陈伟杰
Machine Perception and Interaction Group (MPIG)
cwj@
Feature Extraction
Refined based on the book:
Mastering OpenCV with Practical Computer Vision
Projects_full.pdf
and
Bay H, Tuytelaars T, Van Gool L. Surf: Speeded up robust features [M]. Computer vision–ECCV 2006. Springer. 2006: 404-417.
or F for [R|t]Drawing path
The main steps of Visual Odometry
images parameters
Feature Extraction
Feature
matching
Compute E
First
Feature Extraction What feature is?
Characteristics can be easily identified in images
Edges Corners Blobs
lines points
Harris SIFT SURF Commonly used algorithm:
•Corner extractor
•Fast operation •Poor resolution •Not applicable when scale
changes •Blobs extractor
•Slow operation
•Good resolution
•Scale invariance
•Upgrade from
SIFT
•Speed up
•More robust
SURF(Speed Up Robust Feature) opencv2/nonfree/features2d.hpp
SurfFeatureDetectordetector()
SurfDescriptorExtractor
SURF(Speed Up Robust Feature)
Integral image
ii x,y = i=0i≤x j=0
j≤y
I(i,j)
(x,y)
A
C
B D
123
4
ii 1= A ii 2= A + B
D =ii 1+ii 4−ii 2−ii 3
SURF(Speed Up Robust Feature)
Hessian matrix
H x,σ=L xx(x,σ)L xy(x,σ) L xy(x,σ)L yy(x,σ)
L x,σ=Gσ∗I(x,y)Gσ=ð2g(σ)
ðx2g(σ) is Gaussian function andσis variance
It’s the image conversion like frequency domain transform
Approximation of Hessian matrix
Det
H
approx
=D xx D yy−0.9D xy2
L yy L xy
D yy D
xy
We can use integral image to compute easily now
H x,σ=
L xx(x,σ)L xy(x,σ)
L xy(x,σ)L yy(x,σ) Filter template
SURF(Speed Up Robust Feature)
scale space (image pyramid)
SIFT SURF Change size of filter only Easier and faster
Positioning feature points
3×3 window
“x”is extreme point when it’s the
max or the min of 26 points around
Setting a threshold value t
if x>t, x is feature point
The larger t is, the less points will be
SURF feature descriptor
Main direction
Statistics harr wavelet feature around the feature point with the range of 60°in a circle of radius6s(s is the scale of the feature point)
The max value is main direction
SURF feature descriptor
main direction
feature point 20s Every descriptor has
4*4*4=64 dimensional vector
Mat img1 = imread( "chapel00.png");
Mat img2 = imread("chapel01.png");
int minHessian = 400;
SurfFeatureDetector detector( minHessian );std::vector<KeyPoint> keypoints1, keypoints2;detector.detect(img1, keypoints1);
detector.detect(img2, keypoints2);
// computing descriptors
SurfDescriptorExtractor extractor;
Mat descriptors1, descriptors2;
pute(img1, keypoints1, descriptors1);
pute(img2, keypoints2, descriptors2);CODE
//--Draw keypoints Mat img_keypoints_1; Mat img_keypoints_2;drawKeypoints( img1, keypoints1, img_keypoints_1, Scalar::all(-1), DrawMatchesFlags::DEFAULT );drawKeypoints( img2, keypoints2, img_keypoints_2, Scalar::all(-1), DrawMatchesFlags::DEFAULT );//--Show detected (drawn) keypoints imshow("Keypoints 1", img_keypoints_1 );imshow("Keypoints 2", img_keypoints_2 );waitKey(0);return 0;
800 400
200 minHessian。