process Android image with opencv
I have this code :
protected Bitmap processFrame(byte[] data) {
Mat mat = new Mat(mFrameHeight, mFrameWidth, CvType.CV_8UC3);
mat.put(0, 0, data);
//process mat with native code
Utils.matToBitmap(mat, mBitmap);
return mBitmap;
}
private Camera.PreviewCallback previewCallback = new Camera.PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera camera) {
Bitmap bmp = processFrame(data);
if (bmp != null) {
//draw bmp
}
}
};
at some point I define the bitmap as:
mBitmap = Bitmap.createBitmap(mFrameWidth, mFrameHeight, Bitmap.Config.RGB_565);
The result is the same camera frames captured but in gray scale repeated 3 times horizontally, I tried CvType.CV_8UC4 and they are repeated 4 times instead.
I need to display the whole image as is using the same steps
Does anybody catch the mistake ??