AKAZE是KAZE的加速版,和SIFT特征检测一样,它也可以检测图像的特征点,和描述子但是它与SIFT的比较:

  • 更加稳定,更加迅速;
  • 非线性尺度空间,得到的关键点更准确
  • 比较新的算法。

AKAZE 特征对尺度、旋转、有限仿射具有不变性,并且由于非线性尺度空间,在不同尺度上具有更多的独特性。

API介绍

static Ptr<AKAZE> create(AKAZE::DescriptorType descriptor_type = AKAZE::DESCRIPTOR_MLDB,int descriptor_size = 0, int descriptor_channels = 3,float threshold = 0.001f, int nOctaves = 4,int nOctaveLayers = 4, KAZE::DiffusivityType diffusivity = KAZE::DIFF_PM_G2);
/*******************************************************************
*			descriptor_type: 				提取描述符的类型			
*			descriptor_size:	    		描述符的大小(以位为单位)0代表全尺寸
*			descriptor_channels:			描述符中的通道数(1、2、3)
*			threshold:  					响应阈值
*			nOctaves:						图像的最大倍频程演化
*			nOctaveLayers:					每个比例级别的默认子级别数
*			diffusivity:					扩散型
*							DIFF_PM_G1
*							DIFF_PM_G2
*							DIFF_WEICKERT 
*							DIFF_CHARBONNIER
*********************************************************************/
virtual void detect( InputArray image,std::vector<KeyPoint>& keypoints,InputArray mask=noArray());
/*******************************************************************
*			image: 				输入图				
*			keypoints:	        角点信息
*			mask:				计算亚像素角点区域大小			
*********************************************************************/
void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,const Scalar& color=Scalar::all(-1), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
/*******************************************************************
*			image: 				输入图				
*			keypoints:	        角点信息
*			outImage:			输出图
*			color:  			颜色
*			flags:				绘制匹配标记			
*********************************************************************/

综合代码

#include <iostream>
#include <map>
#include <new>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
class AKAZEFeature
{
public:
	AKAZEFeature() :img(imread("mm.jpg"))
	{
		result["img"] = img;
	}
	void TestAKAZE()
	{
		Ptr<AKAZE> akaze = AKAZE::create();
		akaze->detect(img, point);
		drawKeypoints(img, point, result["akaze"], Scalar(255, 0, 255));
	}
	void Show()
	{
		for (auto& v : result)
		{
			imshow(v.first, v.second);
		}
		waitKey(0);
	}
protected:
	Mat img;
	vector<KeyPoint> point;
	map<string, Mat> result;
};
int  main()
{
	unique_ptr<AKAZEFeature> p(new AKAZEFeature);
	p->TestAKAZE();
	p->Show();
	return 0;
}

OpenCV  AKAZE特征检测_#include