基本信息
源码名称:图像处理FAST算法.cpp
源码大小:1.38KB
文件格式:.cpp
开发语言:C/C++
更新时间:2020-12-20
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
#include "opencv2/opencv.hpp"
#include<opencv2/xfeatures2d.hpp>
using namespace cv;
using namespace cv::xfeatures2d;
int thre1 = 49, thre2 = 49;
Mat src1, src2;
void trackBar1(int, void*) , trackBar2(int, void*);
int main(int argc, char** argv)
{
src1 = imread("A.jpg");
src2 = imread("D.jpg");
if (src1.empty())
{
printf("can not load image \n");
return -1;
}
namedWindow("input1", WINDOW_AUTOSIZE);
imshow("input1", src1);
namedWindow("output1", WINDOW_AUTOSIZE);
createTrackbar("threshould1", "output1", &thre1, 255, trackBar1);
namedWindow("input2", WINDOW_AUTOSIZE);
imshow("input2", src2);
namedWindow("output2", WINDOW_AUTOSIZE);
createTrackbar("threshould", "output2", &thre2, 255, trackBar2);
cvWaitKey(0);
return 0;
}
void trackBar1(int, void*)
{
std::vector<KeyPoint> keypoints1;
Mat dst1 = src1.clone();
Ptr<FastFeatureDetector> detector1 = FastFeatureDetector::create(thre1);
detector1->detect(src1, keypoints1);
drawKeypoints(dst1, keypoints1, dst1, Scalar::all(-1), DrawMatchesFlags::DRAW_OVER_OUTIMG);
imshow("output1", dst1);
}
void trackBar2(int, void*)
{
std::vector<KeyPoint> keypoints2;
Mat dst2 = src2.clone();
Ptr<FastFeatureDetector> detector2 = FastFeatureDetector::create(thre2);
detector2->detect(src2, keypoints2);
drawKeypoints(dst2, keypoints2, dst2, Scalar::all(-1), DrawMatchesFlags::DRAW_OVER_OUTIMG);
imshow("output2", dst2);
}
在局部特征点检测快速发展的时候,人们对于特征的认识也越来越深入,近几年来许多学者提出了许许多多的特征检测算法及其改进算法,在众多的特征提取算法中,不乏涌现出佼佼者。
从最早期的Moravec,到Harris,再到SIFT、SUSAN、GLOH、SURF算法,可以说特征提取算法层出不穷。各种改进算法PCA-SIFT、ICA-SIFT、P-ASURF、R-ASURF、Radon-SIFT等也是搞得如火如荼,不亦乐乎。上面的算法如SIFT、SURF提取到的特征也是非常优秀(有较强的不变性),但是时间消耗依然很大,而在一个系统中,特征提取仅仅是一部分,还要进行诸如配准、提纯、融合等后续算法。这使得实时性不好,降系了统性能。
#include "opencv2/opencv.hpp"
#include<opencv2/xfeatures2d.hpp>
using namespace cv;
using namespace cv::xfeatures2d;
int thre1 = 49, thre2 = 49;
Mat src1, src2;
void trackBar1(int, void*) , trackBar2(int, void*);
int main(int argc, char** argv)
{
src1 = imread("A.jpg");
src2 = imread("D.jpg");
if (src1.empty())
{
printf("can not load image \n");
return -1;
}
namedWindow("input1", WINDOW_AUTOSIZE);
imshow("input1", src1);
namedWindow("output1", WINDOW_AUTOSIZE);
createTrackbar("threshould1", "output1", &thre1, 255, trackBar1);
namedWindow("input2", WINDOW_AUTOSIZE);
imshow("input2", src2);
namedWindow("output2", WINDOW_AUTOSIZE);
createTrackbar("threshould", "output2", &thre2, 255, trackBar2);
cvWaitKey(0);
return 0;
}
void trackBar1(int, void*)
{
std::vector<KeyPoint> keypoints1;
Mat dst1 = src1.clone();
Ptr<FastFeatureDetector> detector1 = FastFeatureDetector::create(thre1);
detector1->detect(src1, keypoints1);
drawKeypoints(dst1, keypoints1, dst1, Scalar::all(-1), DrawMatchesFlags::DRAW_OVER_OUTIMG);
imshow("output1", dst1);
}
void trackBar2(int, void*)
{
std::vector<KeyPoint> keypoints2;
Mat dst2 = src2.clone();
Ptr<FastFeatureDetector> detector2 = FastFeatureDetector::create(thre2);
detector2->detect(src2, keypoints2);
drawKeypoints(dst2, keypoints2, dst2, Scalar::all(-1), DrawMatchesFlags::DRAW_OVER_OUTIMG);
imshow("output2", dst2);
}