Matx33d 点产品在 OpenCV 中不起作用
Matx33d dot product not working in OpenCV
我的print
函数定义为:
void print(std::string matname, cv::Matx33d A) {
fprintf(stdout, "%s = [n", matname.c_str());
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
fprintf(stdout, "%15.10lf", A(i,j));
}
fprintf(stdout, "n");
}
fprintf(stdout, "];n");
}
我设计了一个矩阵H
并在以下代码中使用它:
print("H", H);
cv::Matx33d Hinv = H.inv();
print("H^-1", Hinv);
cv::Matx33d HdHinv(H.ddot(Hinv));
print("H*H^-1", HdHinv);
cv::Matx33d HinvdH(Hinv.ddot(H));
print("H^-1*H", HinvdH);
但是,输出如下所示:
H = [
0.0386192492 0.1756336675 0.0245675072
0.1756336675 1.3649487597 -0.2727645303
0.0245675072 -0.2727645303 -0.5635269575
];
H^-1 = [
45.9140372920 -5.0221718200 4.4325541956
-5.0221718200 1.2173491959 -0.8081812555
4.4325541956 -0.8081812555 -1.1901116767
];
H*H^-1 = [
3.0000000000 0.0000000000 0.0000000000
0.0000000000 0.0000000000 0.0000000000
0.0000000000 0.0000000000 0.0000000000
];
H^-1*H = [
3.0000000000 0.0000000000 0.0000000000
0.0000000000 0.0000000000 0.0000000000
0.0000000000 0.0000000000 0.0000000000
];
相反似乎确实工作正常,但是为什么我从点积中得到这些值?我是否使用ddot
不正确?我已经在Matlab
中测试了这个点积,我得到了单位矩阵(精度高达 10 位小数(,所以我相信H
和Hinv
是正确生成的。
"点积" != "矩阵乘法"。事实上,cv::Matx33d::ddot ()
甚至不返回矩阵,而是返回标量。我还没有尝试过,但可能operator*
会按照你的意图去做——就像这样:
cv::Matx33d HdHinv = H * Hinv;
相关文章:
- Opencv GStreamer管道在Raspberry Pi 4上不起作用
- 用于 N 个最佳匹配的 OpenCV 模板匹配不起作用
- Opencv在2013年第5季度不起作用.应用程序总是在窗口中崩溃
- Opencv 链接 CMAKE 不起作用 Ubuntu 16.04 Docker
- OPENCV C IMSHOW不起作用
- 我的OPENCV不起作用
- Opencv ml 头文件不起作用
- OpenCV Canny 之后的 ConvexPoly 不起作用
- OpenCV像素操作有时不起作用
- 套接字不起作用,当添加 opencv libriary
- 在Linux(Raspbian)中,OpenCV集(CV_CAP_PROP_FPS,60)不起作用
- opencv 将较小的图片放在较大的副本中不起作用
- 为什么 openCV 的转换功能不起作用?
- 使用 OpenCV 的琐碎随机森林不起作用,与 sklearn 不同
- 视频抓取不起作用 OpenCV
- 将opencv图像转换为gdi位图不起作用取决于图像大小
- OpenCV c++HoughLines转换不起作用
- opencv中的Core.add方法在Android上不起作用
- OpenCV - 网络摄像头不起作用
- OpenCV imshow() 不起作用