【发布时间】:2012-04-27 10:11:44
【问题描述】:
我在这里可能非常愚蠢,但我在使用 OpenCV for Android 进行一些基本的 Mat 乘法时遇到了麻烦。
我有两个相同类型的 Mat,CV_64F
mat1 的大小:3 行,3 列mat2 的大小:3 行,1 列
我想将它们相乘以得到大小为 3 行、1 列的产品 mat3。
我尝试过使用:
Mat mat3 = new Mat(3, 1, CvType.CV_64F);
Core.multiply(mat1, mat2, mat3);
但我得到一个错误:
CvException [org.opencv.core.CvException:/home/andreyk/OpenCV2/trunk/opencv_2.3.1.b2/modules/core/src/arithm.cpp:1253: 错误:(-209)该操作既不是“数组操作数组”(其中数组 具有相同的大小和相同的通道数),也不是'array op 函数 void cv::arithm_op(const cv::_InputArray&, 常量 cv::_InputArray&, 常量 cv::_OutputArray&, const cv::_InputArray&, int, void (*)(const uchar, size_t, const uchar*, size_t, uchar*, size_t, cv::Size, void*), bool, void*)
我做错了什么?
感谢您提前提供任何帮助。
编辑:
如果有帮助,3x3 矩阵mat2 是Imgproc.getPerspectiveTransform 的结果,其余代码如下:
Mat mat1 = new Mat(3, 1, CvType.CV_64F);
mat1.put(0, 0, 2.0);
mat1.put(1, 0, 0.5);
mat1.put(2, 0, 1.0);
Mat mat3 = new Mat(3, 1, CvType.CV_64F);
Core.multiply(mat2, mat1, mat3);
【问题讨论】:
标签: java android opencv matrix multiplication