资源简介
Feature::Feature(const string& detectType, const string& extractType, const string& matchType)
{
assert(!detectType.empty());
assert(!extractType.empty());
assert(!matchType.empty());
m_detectType = detectType;
m_extractType = extractType;
m_matchType = matchType;
initModule_nonfree();
}

代码片段和文件信息
// 局部图像特征提取与匹配
// Author: www.icvpr.com
// Blog : http://blog.csdn.net/icvpr
#include “LocalFeature.h“
Feature::Feature()
{
m_detectType = “SIFT“;
m_extractType = “SIFT“;
m_matchType = “FruteForce“;
initModule_nonfree();
}
Feature::~Feature()
{
}
Feature::Feature(const string& detectType const string& extractType const string& matchType)
{
assert(!detectType.empty());
assert(!extractType.empty());
assert(!matchType.empty());
m_detectType = detectType;
m_extractType = extractType;
m_matchType = matchType;
initModule_nonfree();
}
void Feature::detectKeypoints(const Mat& image std::vector& keypoints)
{
assert(image.type() == CV_8UC1);
assert(!m_detectType.empty());
keypoints.clear();
m_detector = FeatureDetector::create(m_detectType);
m_detector->detect(image keypoints);
}
void Feature::extractDescriptors(const Mat& image std::vector& keypoints Mat& descriptor)
{
assert(image.type() == CV_8UC1);
assert(!m_extractType.empty());
m_extractor = DescriptorExtractor::create(m_extractType);
m_extractor->compute(image keypoints descriptor);
}
void Feature::bestMatch(const Mat& queryDescriptor Mat& trainDescriptor std::vector& matches)
{
assert(!queryDescriptor.empty());
assert(!trainDescriptor.empty());
assert(!m_matchType.empty());
matches.clear();
m_matcher = DescriptorMatcher::create(m_matchType);
m_matcher->add(std::vector(1 trainDescriptor));
m_matcher->train();
m_matcher->match(queryDescriptor matches);
}
void Feature::knnMatch(const Mat& queryDescriptor Mat& trainDescriptor std::vector>& matches int k)
{
assert(k > 0);
assert(!queryDescriptor.empty());
assert(!trainDescriptor.empty());
assert(!m_matchType.empty());
matches.clear();
m_matcher = DescriptorMatcher::create(m_matchType);
m_matcher->add(std::vector(1 trainDescriptor));
m_matcher->train();
m_matcher->knnMatch(queryDescriptor matches k);
}
void Feature::saveKeypoints(const Mat& image const vector& keypoints const string& saveFileName)
{
assert(!saveFileName.empty());
Mat outImage;
cv::drawKeypoints(image keypoints outImage Scalar(2552550) DrawMatchesFlags::DRAW_RICH_KEYPOINTS );
//
string saveKeypointsImgName = saveFileName + “_“ + m_detectType + “.jpg“;
imwrite(saveKeypointsImgName outImage);
}
void Feature::saveMatches(const Mat& queryImage
const vector& queryKeypoints
const Mat& trainImage
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3667 2017-11-23 16:38 LocalFeature.cpp
文件 1669 2017-11-23 16:37 LocalFeature.h
文件 0 2017-11-23 16:38 main.txt
----------- --------- ---------- ----- ----
5336 3
相关资源
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- opencv环境配置
- win10 64位下编译的opencv4.5.5库,opencv
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- opencv_contrib-3.4.0.zip
- opencv2.4.9源码分析——SIFT
- 用两个摄像头实现,双目标定,双目
- opencv_traincascade训练分类器,手势识别
- opencv3.0交叉编译用parallel.cpp
- 基于opencv的图像识别识别图像中的色
- 基于openCV的识别特定颜色区域
- 基于OpenCV的分水岭算法实现
- QT+opencv+OCR 身份证号码,银行卡号识别
- opencv视频特定颜色区域识别
- 把RGB转换为HSV和HSI然后根据黄色和蓝
- opencv视觉测距
- 基于Qt和opencv的身份证号码识别系统
- opencv_ffmpeg249.dll
- SfM稀疏三维点云重建--完整工程文件
- 基于opencv的数人头程序源代码
- 利用OpenCV中的Stitcher类实现全景图像拼
- opencv实现的sift算法源码,包含了图像
- openCV 上的小波变换
- 基于OPENCV的车牌识别系统设计
- 617张国内车牌60-17bmp图片用于OpenCV正样
- hog特征提取,c版本代码
- 基于Qt5.8+OpenCV3.2的Basler多相机触发开
- 基于Opencv实现的图像纠偏
- ImageWatch2019.vsix
评论
共有 条评论