hi, i am developing android app using android sdk camera. on camera preview i need the frame content so i am using PreviewCallback to return the data in byte array, now my problem is saving the data in mat object the mat return gray images:
public void onPreviewFrame(byte[] data, Camera camera) {
Mat src = new Mat(previewSize.height, previewSize.width, CvType.CV_8U, new Scalar(255));
src.put(0, 0, data);
Highgui.imwrite("/mnt/sdcard/1.jpg", src);
}
anybody can help me to generate argb images
note: i am using NV21 in preview image format.