- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
所以我有一个点,左图为 x:1168px, y:1140px,右图为 x:1062px, y:1167px。我通过程序获得的实际坐标是:120.91、4.94059、-175.609(x、y 和 z,单位为毫米)。 X 和 Y 似乎正确但 Z 不正确,该点距离我的相机大约 1 米。
现在我有这段代码:
FileStorage fsI("intrinsics.yml", FileStorage::READ);
Mat matI1, matI2, matD1, matD2;
fsI["M1"] >> matI1;
fsI["M2"] >> matI2;
fsI["D1"] >> matD1;
fsI["D2"] >> matD2;
CvMat camInt1 = matI1, camInt2 = matI2, camDist1 = matD1, camDist2 = matD2;
FileStorage fs("extrinsics.yml", FileStorage::READ);
Mat mat1, mat2;
fs["P1"] >> mat1;
fs["P2"] >> mat2;
CvMat projMat1 = mat1, projMat2 = mat2;
double pointImg1_a[2] = { 1168, 1140};
Mat pointImg1 = Mat(2,1, CV_64FC1, pointImg1_a);
CvMat _pointImg1 = cvMat(1,1,CV_64FC2,pointImg1_a);
double pointImg2_a[2] = { 1062, 1167};
Mat pointImg2 = Mat(2,1, CV_64FC1, pointImg2_a);
CvMat _pointImg2 = cvMat(1,1,CV_64FC2,pointImg1_a);
cvUndistortPoints(&_pointImg1,&_pointImg1,&camInt1,&camDist1);
cvUndistortPoints(&_pointImg2,&_pointImg2,&camInt2,&camDist2);
Mat point4D = Mat(4,1, CV_64FC1);
cv::triangulatePoints(mat1, mat2, pointImg1, pointImg2, point4D);
double w = point4D.at<double>(3,0);
double x = point4D.at<double>(0,0)/w;
double y = point4D.at<double>(1,0)/w;
double z = point4D.at<double>(2,0)/w;
cout << x << ", " << y << ", " << z << endl;
return 0;
我尝试不使用 cvUndistortPoints() 和其他坐标,结果有时是正确的,但并非总是如此。我真的不知道错误从何而来。 (我也是 openCV 的新手)感谢您的帮助。
最佳答案
你是不是错了:“CvMat _pointImg2 = cvMat(1,1,CV_64FC2,pointImg1_a);”
正确的应该是:“CvMat _pointImg2 = cvMat(1,1,CV_64FC2,pointImg2_a);”
关于c++ - 如何从 openCV 中使用 triangulatePoints() 获得良好的坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24129188/
嗨,我正在考虑开发一种文件传输程序,想知道我是否想要尽可能好的加密,我应该使用什么? 我会用 C# 开发它,所以我可以访问 .net 库 :P在我的 usb 上有一个证书来访问服务器是没有问题的,如果
我创建的这个计算两个数组的交集是线性的方法的复杂度(在良好、平均、最差的情况下)? O(n) public void getInt(int[] a,int[] b){ int i=0; int
我已经能够使用 RTCPeerConnection.getStats() API 获得 WebRTC 音频调用的各种统计信息(抖动、RTT、丢包等)。 我需要将整体通话质量评为优秀、良好、一般或差。
基本问题: 如果我正在讲述/修改数据,我应该通过索引硬编码索引访问文件的元素,即 targetFile.getElement(5);通过硬编码标识符(内部翻译成索引),即 target.getElem
在 Linux 上,我想知道要调用什么“C”API 来获取每个 CPU 的统计信息。 我知道并且可以从我的应用程序中读取 /proc/loadavg,但这是系统范围的负载平均值,而不是每个 CPU 的
在客户端浏览器中使用 fetch api,GET 或 POST 没有问题,但 fetch 和 DELETE 有问题。它似乎将 DELETE 请求方法更改为 OPTIONS。 大多数研究表明是一个cor
我是一名优秀的程序员,十分优秀!