i am working on frames of a video and i want to subtract one frame from other to find out the difference but i dont know how to proceed. i tried converting my bitmap frames into mat and then subtracting them but its not working. i am using opencv 2.4.3 for mat function. can anybody tell me how to do that. if possible explain with code snippets.
i tried something like this
Bitmap myBitmap1 = BitmapFactory.decodeFile("/mnt/sdcard/Frames/mpgFrames/image001.jpg");
Bitmap myBitmap2 = BitmapFactory.decodeFile("/mnt/sdcard/Frames/mpgFrames/image002.jpg");
int width = myBitmap1.getWidth();
int height = myBitmap1.getHeight();
Mat imgToProcess1 = new Mat(height, width, CvType.CV_8UC4);
Mat imgToProcess2 = new Mat(height, width, CvType.CV_8UC4);
Mat imgToProcess = new Mat(height, width, CvType.CV_8UC4);
Utils.bitmapToMat(myBitmap1, imgToProcess1);
Utils.bitmapToMat(myBitmap2, imgToProcess1);
imgToProcess = imgToProcess1-imgToProcess2;