0

I am trying to grab consecutive frames from android using opencv VideoCapture class. Actually I want to implement optical flow on android for which i need 2 frames. I implemented optical flow in C first where I grabbed the frames using using cvQueryFrame and every thing work fine. But in android when I call

 if(capture.grab())
  {
     if(capture.retrieve(mRgba))

        Log.i(TAG, "first frame retrived");

  }
  if(capture.grab())
  {
    if(capture.retrieve(mRgba2))

    Log.i(TAG, "2nd frame retrived");
  }

and then subtract the matrices using Imgproc.subtract(mRgba,mRgba2,output) and then display the output it give me black image indicating that mRgba and mRgba2 are image frames with same data. Can any one help how to grab two different images. According to opencv documentation mRgba and mRgba2 should be different.

1
  • sorry it is core.subtract() not Imgproc.subtract() Commented Nov 8, 2011 at 13:17

1 Answer 1

2

This question is an exact duplicate of

read successive frames OpenCV using cvQueryframe

You have to copy the image to another memory block, because the capture always returns the same pointer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.