Akaze is an accelerated version of Kaze.
Feature point find and draw: change the surf in surf to Kaze or AKAZE
1#include <opencv2/opencv.hpp>2#include <opencv2/xfeatures2d.hpp>3#include <iostream>4 5 using namespaceCV;6 using namespacecv::xfeatures2d;7 using namespacestd;8 9 intMainintargcChar**argv) {TenMat src = imread ("test.jpg", Imread_grayscale); One if(Src.empty ()) { Aprintf"could not load image...\n"); - return-1; - } theNamedwindow ("Input Image", cv_window_autosize); -Imshow ("Input Image", SRC); - - //akaze feature Point detection +ptr<akaze> detector = akaze::create ();//creates a Akaze class object and initializes -Vector<keypoint>keypoints; +Detector->detect (SRC, keypoints, Mat ());//find the key. A at //Draw key points - Mat keypoint_img; -Drawkeypoints (SRC, keypoints, keypoint_img, Scalar::all (-1), Drawmatchesflags::D efault); -Imshow ("keypoints Image", keypoint_img); - -Waitkey (0); in return 0; -}
The:
1#include <opencv2/opencv.hpp>2#include <iostream>3#include <math.h>4 5 using namespaceCV;6 using namespacestd;7 8 intMainintargcChar**argv) {9Mat IMG1 = Imread ("fire_5.jpg", Imread_grayscale);TenMat Img2 = Imread ("number. jpg", Imread_grayscale); One if(Img1.empty () | |Img2.empty ()) { Aprintf"could not load images...\n"); - return-1; - } theImshow ("Box Image", IMG1); -Imshow ("Scene Image", IMG2); - - + //Extract Akaze features -ptr<akaze> detector =akaze::create (); +Vector<keypoint>keypoints_obj; AVector<keypoint>Keypoints_scene; at Mat descriptor_obj, Descriptor_scene; -Detector->Detectandcompute (IMG1, Mat (), Keypoints_obj, descriptor_obj); -Detector->Detectandcompute (Img2, Mat (), Keypoints_scene, descriptor_scene); - - - //Matching inFlannbasedmatcher Matcher (NewFlann::lshindexparams ( -,Ten,2)); - //flannbasedmatcher Matcher; toVector<dmatch>matches; + Matcher.match (Descriptor_obj, descriptor_scene, matches); - the //draw matches (key points) * Mat akazematchesimg; $ /*Panax Notoginseng drawmatches (IMG1, Keypoints_obj, Img2, Keypoints_scene, matches, akazematchesimg); - imshow ("Akaze match result", akazematchesimg);*/ the +Vector<dmatch>goodmatches; A DoubleMindist =100000, maxDist =0; the for(inti =0; i < descriptor_obj.rows; i++) { + DoubleDist =matches[i].distance; - if(Dist <mindist) { $Mindist =Dist; $ } - if(Dist >maxDist) { -MaxDist =Dist; the } - }Wuyiprintf"min Distance:%f", mindist); the - for(inti =0; i < descriptor_obj.rows; i++) { Wu DoubleDist =matches[i].distance; - if(Dist < Max (1.5*mindist,0.02)) { About Goodmatches.push_back (Matches[i]); $ } - } - -Drawmatches (IMG1, Keypoints_obj, Img2, Keypoints_scene, Goodmatches, Akazematchesimg, Scalar::all (-1), AScalar::all (-1), vector<Char>(), drawmatchesflags::not_draw_single_points); +Imshow ("Good match result", akazematchesimg); the -Waitkey (0); $ return 0; the}
Opencv--kaze, Akaze feature detection, matching and object finding