如何使用opencv查找手动定义的地标的描述符 [英] How to find descriptors for manualy defined landmarks with opencv

查看:120
本文介绍了如何使用opencv查找手动定义的地标的描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为一些手动定义的界标生成"SIFT"描述符(SIFT仅是示例). 当我尝试做时:

I am trying to generate "SIFT" descriptor (SIFT is only an example) for some manualy defined landmarks. When I try to do:

siftDetector(grayImage, Mat(), manualLandmarks, descriptors, true);

描述符的结果始终为0(零).我将manualLandmarks描述为std::vector<cv::KeyPoint>,并且更改了矢量中每个项目的x和y坐标(大小,八度和角度值不变).

the result is always 0 (zero) for the descriptors. I have described manualLandmarks as std::vector<cv::KeyPoint>, and I have changed the x and y coordinates for each item in the vector (the size, octave and angle values are not changed).

是否可以手动定义图像坐标并计算该位置的描述符?

Is there a way to define manualy the image coordinates and compute the descriptors for that location?

谢谢.

推荐答案

cv::Mat I = imread("image.jpg"); // load the image


std::vector<cv::Point2f> inputs;

inputs.push_back(cv::Point(74,114)); // manually defined landmark
inputs.push_back(cv::Point(130,114)); // manually defined landmark 

std::vector<cv::KeyPoint> kp;
for( size_t i = 0; i < inputs.size(); i++ ) {
kp.push_back(cv::KeyPoint(inputs[i], 1.f));
}

cv::Mat descriptors;
cv::SiftFeatureDetector detector;
detector.compute(I, kp, descriptors); // descriptors are the sift descriptors on manually defined landmarks

这篇关于如何使用opencv查找手动定义的地标的描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆