I have implemented an android application that starts the camera and send all the preview buffer down to native components using JNI interface. Since the preview data is in NV21 image format, I need to create a cv::Mat instance from it. I searched for it and found the below solution:
cv::Mat _yuv(height, width, CV_8UC1, (uchar *) imagebuffer);
where imagebuffer is jbyte*
However, don't get the expected image in the output image. It's all filled with some random lines etc. Does anyone know how exactly I can do it?