Resize matrix in Java
Hello,
I am trying to resize a matrix of CvType.CV_32S to a smaller matrix. Every time I use the Imgproc.resize() methode, I am getting the following exception:
OpenCV Error: Assertion failed (func != 0) in cv::resize, file ........\opencv\modules\imgproc\src\imgwarp.cpp, line 1970 CvException [org.opencv.core.CvException: cv::Exception: ........\opencv\modules\imgproc\src\imgwarp.cpp:1970: error: (-215) func != 0 in function cv::resize ]
My code looks linke this:
Imgproc.resize(img16u, liveMatHalfRawData, new Size(img16u.rows()/2,img16u.cols()/2), 0, 0,
Imgproc.INTER_CUBIC);
Thanks for help,
reem
btw, did you want
new Size(img16u.cols()/2,img16u.rows()/2)
?of course, the new liveMatHalfRawData-matrix should have the half size of the old one. that means to me, that rows and cols schould be half also.
oh i only meant , that you might have swapped rows & cols there.
the img16u-matrix is quadratic. but I really dont understand the problem. or maybe the resize()-method is not able to resize() 32Bit-singned-Int Matrices.
ah, ok. but you seem to be right, there's no entry for ints here
but it doesent work with other types. if you want to reproduce the error, here some code:
you still got an int mat there. (you tried to put float data into it, but that does not change the type)
Hey,
using a float-array instead of an int-array solved the problem. And dont forget to change the
But of course I had to waste more memory, because of the unneeded float-arrays...
Regards, reem