资源简介
这里是基于Opencv的SIFT和SURF特征进行目标跟踪的源代码,但是代码还有错误,找不到错误的来由
代码片段和文件信息
#include “FeatureTraker.h“
#include
#include
#include “opencv2/calib3d/calib3d.hpp“
#include “opencv2/contrib/contrib.hpp“
#include “opencv2/features2d/features2d.hpp“
#include “opencv2/objdetect/objdetect.hpp“
#include “opencv2/imgproc/imgproc.hpp“
#include “opencv2/imgproc/imgproc_c.h“
#include “opencv2/core/internal.hpp“
#include “opencv2/nonfree/nonfree.hpp“
using namespace cv;
FeatureTraker::FeatureTraker(CvFeatureTrackerParams _params) :
params(_params)
{
initModule_nonfree();
switch (params.feature_type)
{
case CvFeatureTrackerParams::SIFT:
dd = Algorithm::create(“Feature2D.SIFT“);
if( dd.empty() )
CV_Error(CV_StsNotImplemented “OpenCV has been compiled without SIFT support“);
dd->set(“nOctavelayers“ 5);
dd->set(“contrastThreshold“ 0.04);
dd->set(“edgeThreshold“ 10.7);
break;
case CvFeatureTrackerParams::SURF:
dd = Algorithm::create(“Feature2D.SURF“);
if( dd.empty() )
CV_Error(CV_StsNotImplemented “OpenCV has been compiled without SURF support“);
dd->set(“hessianThreshold“ 400);
dd->set(“nOctaves“ 3);
dd->set(“nOctavelayers“ 4);
break;
default:
CV_Error(CV_StsBadArg “Unknown feature type“);
break;
}
matcher = new BFMatcher(NORM_L2);
}
FeatureTraker::FeatureTraker()
{
}
FeatureTraker::~FeatureTraker()
{
}
void FeatureTraker::newTrackingWindow(Mat image Rect selection)
{
image.copyTo(prev_image);
cvtColor(prev_image prev_image_bw CV_BGR2GRAY);
prev_trackwindow = selection;
prev_center.x = selection.x;
prev_center.y = selection.y;
ittr = 0;
}
Rect FeatureTraker::updateTrackingWindow(Mat image)
{
if(params.feature_type == CvFeatureTrackerParams::OPTICAL_FLOW)
return updateTrackingWindowWithFlow(image);
else
return updateTrackingWindowWithSIFT(image);
}
Rect FeatureTraker::updateTrackingWindowWithSIFT(Mat image)
{
ittr++;
vector prev_keypoints curr_keypoints;
vector prev_keys curr_keys;
Mat prev_desc curr_desc;
Rect window = prev_trackwindow;
Mat mask = Mat::zeros(image.size() CV_8UC1);
rectangle(mask Point(window.x window.y) Point(window.x + window.width
window.y + window.height) Scalar(255) CV_FILLED);
dd->operator()(prev_image mask prev_keypoints prev_desc);
window.x -= params.window_size;
window.y -= params.window_size;
window.width += params.window_size;
window.height += params.window_size;
rectangle(mask Point(window.x window.y) Point(window.x + window.width
window.y + window.height) Scalar(255) CV_FILLED);
dd->operator()(image mask curr_keypoints curr_desc);
if (prev_keypoints.size() > 4 && curr_keypoints.size() > 4)
{
//descriptor->compute(prev_image prev_keypoints prev_desc);
//descriptor->compute(image curr_keypoints curr_desc);
matcher->match(prev_desc curr_desc matches);
for (int i = 0; i < (int)matches.size(); i++)
{
prev_keys.push_back(prev_keypoints[matches[i].queryIdx].pt);
curr_keys.push_back(curr_keypoints[matches[i].train
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 133632 2013-06-27 17:11 FeatureTracking\Debug\FeatureTracking.exe
文件 723172 2013-06-27 17:11 FeatureTracking\Debug\FeatureTracking.ilk
文件 1666048 2013-06-27 17:11 FeatureTracking\Debug\FeatureTracking.pdb
文件 7650 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\BuildLog.htm
文件 621 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\FeatureTracking.exe.intermediate.manifest
文件 474692 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\FeatureTraker.obj
文件 139138 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\main.obj
文件 67 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\mt.dep
文件 543744 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\vc90.idb
文件 1044480 2013-06-27 17:11 FeatureTracking\FeatureTracking\Debug\vc90.pdb
文件 4697 2013-06-27 16:19 FeatureTracking\FeatureTracking\FeatureTracking.vcproj
文件 1427 2013-06-27 17:15 FeatureTracking\FeatureTracking\FeatureTracking.vcproj.DY5A4OBOCPYFOX7.Administrator.user
文件 5379 2013-06-27 17:08 FeatureTracking\FeatureTracking\FeatureTraker.cpp
文件 1324 2013-06-27 16:23 FeatureTracking\FeatureTracking\FeatureTraker.h
文件 2943 2013-06-27 17:15 FeatureTracking\FeatureTracking\main.cpp
文件 7420 2013-06-27 16:23 FeatureTracking\FeatureTracking\Release\BuildLog.htm
文件 1221941 2013-06-27 16:06 FeatureTracking\FeatureTracking\Release\featuretracker.obj
文件 616 2013-06-27 16:23 FeatureTracking\FeatureTracking\Release\FeatureTracking.exe.intermediate.manifest
文件 1222612 2013-06-27 16:18 FeatureTracking\FeatureTracking\Release\FeatureTraker.obj
文件 1009858 2013-06-27 15:24 FeatureTracking\FeatureTracking\Release\hybridtracker.obj
文件 1102698 2013-06-27 16:23 FeatureTracking\FeatureTracking\Release\main.obj
文件 67 2013-06-27 16:23 FeatureTracking\FeatureTracking\Release\mt.dep
文件 1068986 2013-06-27 16:02 FeatureTracking\FeatureTracking\Release\precomp.obj
文件 265216 2013-06-27 16:23 FeatureTracking\FeatureTracking\Release\vc90.idb
文件 839680 2013-06-27 16:23 FeatureTracking\FeatureTracking\Release\vc90.pdb
文件 3419136 2013-06-27 17:15 FeatureTracking\FeatureTracking.ncb
文件 911 2013-06-27 14:18 FeatureTracking\FeatureTracking.sln
..A..H. 46592 2013-06-27 17:15 FeatureTracking\FeatureTracking.suo
文件 32256 2013-06-27 16:23 FeatureTracking\Release\FeatureTracking.exe
文件 1092608 2013-06-27 16:23 FeatureTracking\Release\FeatureTracking.pdb
............此处省略9个文件信息
- 上一篇:RTC时钟实验
- 下一篇:北京大学高等代数word版
相关资源
- 基于SIFT算法的图像特征提取系统的研
- SIFT算法详解及应用(讲的很详细)
- surf算法详解
- sift.rar
- sift DemoV4
- SIFT提出者David Lowe1999-2004发表的4篇文
- Distinctive Image Features from Scale-Invarian
- SIFT\\PCA-SIFT\\SURF论文源代码
- SIFT、SURF、ORB的区别与联系
- Blind Copy-Paste Detection Using SIFT Ring Des
- protobuf-cpp-3.1.0.tar.gz 配置文件
- maxsurf中文手册
- PaintSurfaceView源码
- surfer11中文版教程
- SurfaceView放大和缩小
- 图像局部不变性特征与描述.pdf 王永明
- Curves and Surfaces for CAGD A Practical Guide
- SurfaceView碰撞检测小程序
- sift 几篇英文文献
- 计算机视觉SIFT算子OPENCV3.0详细实现未
- surface电脑win10系统修复工具
- SIFT算法实现及代码详解239444
- GlSurfaceView_Camera
- LBP/HOG/SIFT/SURF特征SVM的trainAuto范例
- SURF特征检测、描述、匹配
- 基于SIFT算法的特征提取(VS2015+OpenC
- VS2013+opencv2.4.10提取SURF_BOW特征使用s
- surfer8安装包.rar
- SURF算法+单应矩阵+RANSAC算法实现拼接
- jdsoft surfmill 8.0 —64 精雕8.0 专业版
评论
共有 条评论