我在Eclipse中使用opencv-2.4.9
和Java拼接两个图像。我的代码从warpPerspective()
抛出以下异常:
OpenCV Error: Assertion failed ((M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 3 && M0.cols == 3) in warpPerspective
warpPerspective
方法调用:
Imgproc.warpPerspective(hsv, result, homoghraphy,
new Size(2 * input.cols(), input1.rows))
Homgraphy Matrix类型是:
scene = Mat [ 3*3*CV_32FC2,
isCont = true,
isSubmat = false,
nativeObj = 0x7f32a0130160,
dataAddr = 0x7f32a01301e0 ]
有人可以解释为什么会抛出这个异常吗?
答案 0 :(得分:0)
这个答案是错误的,正确答案位于对此答案的评论中。
答案 1 :(得分:0)
实际上问题在于单应矩阵的类型。单应矩阵是一维数学矩阵。问题中提到的同形矩阵是二维数组,这就是为什么它不起作用。我必须将其类型从“2”更改为“1”才能使其正常工作。