如何解决来自实时摄像机的 PItag 姿态估计
我想估计 Pitag 标记的位置(源代码在这里:https://github.com/mpetroff/pi-tag-detector)
按照自述文件,“可以使用 ./pitag-test 模型文件图像文件调用包含的测试程序,它将打印检测到的标签列表及其点的图像像素位置。”,我打印了一个标记并将其放入一个图片文件JPG/PNG,检测正常。
现在我想做同样的事情,但使用实时摄像机,这意味着如果我移动标记,输出会显示标记已移动等。 但它不起作用,我不知道如何。
这是我的代码:
cv::VideoCapture inputVideo;
inputVideo.open(0);
while (inputVideo.grab())
{
cv::Mat image;
cv::Mat im;
inputVideo.retrieve(im);
im.copyTo(image);
unsigned long ret_val = RET_OK;
std::vector<t_points> vec_points;
if (tag_detector->GetPoints(image,vec_points) & RET_FAILED)
{
puts("No tags detected");
//return -1;
}
for (unsigned int i=0; i<vec_points.size(); i++)
{
std::cout << "Detected Tag " << vec_points[i].id << ": " << vec_points[i].image_points << std::endl;
}
cv::imshow("out",image);
char key = (char) cv::waitKey(10);
if(key == 27)
break;
}
使用实时摄像头时,我总是“未检测到标签”,我不知道为什么,也不知道如何更改代码。 也许它不适合实时相机,但如果在照片上检测到标签,我不知道为什么在实时相机上检测不到。
/// Locates the fiducial within the image
/// @param image scene image
/// @param vec_points Vector of points from all detected tags
/// @return <code>RET_FAILED</code> if no tag could be detected
/// <code>RET_OK</code> on success
virtual unsigned long GetPoints(cv::Mat& image,std::vector<t_points>& vec_points) = 0;
函数 GetPoints 返回 RET_FAILED,但我不知道为什么
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。