capture.retrieve(grey1, Highgui.CV_CAP_ANDROID_GREY_FRAME); // grey image
// artificial delay of 1 sec for testing; move camera
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
capture.retrieve(grey2, Highgui.CV_CAP_ANDROID_GREY_FRAME); // grey image
// frame differencing - i've tried scaling the values too, but that doesn't seem to help
Core.absdiff(grey1,grey2, grey2);
// this part is a bit summarized
Bitmap mBmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.RGB_565);
Utils.matToBitmap(grey2, mBmp);
Can anyone please suggest what might be the problem? Using this approach in regular OpenCV usually works fine.
thanks,
brigit
grey2 += Scalar(0, 0, 0, 255);
Core.absdiff(grey1,grey2, grey2);
Core.add(grey2, new Scalar(32, 32, 32, 255), grey2);
i added 32 just to see something. I am grabbing my frames 1--
Try to log both Mat-s as Strings and compare native addresses of their elements: the VideoCapture possibly returns a reference to its internal Mat that is overwritten on every frame (to avoid extra copying).You need to use Mat::clone() to make a copy of particular frame.
--