android opencv matrix,java - Basic matrix multiplication in OpenCV for Android - Stack Overflow

I'm probably being incredibly stupid here but I'm having trouble doing some basicaly Mat multiplication using OpenCV for Android.

I have two Mat's both of the same type, CV_64F

mat1 has size: 3 rows, 3 cols

mat2 has size: 3 rows, 1 cols

I want to multiply them to give the product mat3 of size 3 rows, 1 cols.

I've tried using:

Mat mat3 = new Mat(3, 1, CvType.CV_64F);

Core.multiply(mat1, mat2, mat3);

But I get an error:

CvException

[org.opencv.core.CvException:/home/andreyk/OpenCV2/trunk/opencv_2.3.1.b2/modules/core/src/arithm.cpp:1253:

error: (-209) The operation is neither 'array op array' (where arrays

have the same size and the same number of channels), nor 'array op

scalar', nor 'scalar op array' in function void cv::arithm_op(const

cv::_InputArray&, const cv::_InputArray&, const cv::_OutputArray&,

const cv::_InputArray&, int, void (*)(const uchar, size_t, const

uchar*, size_t, uchar*, size_t, cv::Size, void*), bool, void*)

What am I doing wrong?

Thanks for any help in advance.

EDIT:

If it helps, the 3x3 matrix mat2 is the result of Imgproc.getPerspectiveTransform and the rest of the code is as follows:

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);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值