Passing Camera frame in android as a Mat [closed]
In the openCV implementation of Android part I have a method called onCameraFrame()
which returns the input frame
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
mNativeDetector.match(inputFrame.rgba());
return inputFrame.rgba();
}
and in the jni side I am receiving it as
Mat mMat1 = (*((Mat*)inputMat));
But when i try to compare it I get this error
OpenCV Error: Assertion failed (type == src2.type() && src1.cols ==
src2.cols && (type == CV_32F || type == CV_8U)) in void
cv::batchDistance(cv::InputArray, cv::InputArray, cv::OutputArray, int,
cv::OutputArray, int, int, cv::InputArray, int, bool), file
/home/reports/ci/slave/50-SDK/opencv/modules/core/src/stat.cpp, line 1797
How to solve this error and pass the Cameraframe mats for comparison ?
it looks like you can use cv::batchDistance() only with 1-channel Mat's ( like a single channels, or grayscale ) . what you are passing in is a 4 chan rgba Mat.
ofc. you could call:
but no idea, if that's what you wanted.
I tried both it doesnt work
there's 2 inputarrays. check the other one, too.
@berak : What input array ? I dont get it ?
Check all your arguments that you are passing to the batchDistance() function. It seems that there is still a parameter with wrong dimensions! Just loop in debug through your code, before executing the exact line, look at which values your input elements have, maybe print their type to be sure.