Skip to content Skip to sidebar Skip to footer

Process Video Frame By Frame In Opencv On Android

My goal is as follows: I have to read in a video that is stored on the sd card, process it frame for frame and then store it in a new file on the SD card again. The problem is that

Solution 1:

@Alekz: Yes, I found a solution. Even if it is additional overhead, it was sufficient for my research project.

The solution covers the usage of OpenCV 4 Android and JavaCV. I first use JavaCV to read in a frame one by another. Afterwards, I convert this frame to the format used by OpenCV, process the frame. Finally, I either display the processed frame directly on the screen or I convert it back to JavaCV and store it in a new file. Below you find the detailed solution for the different used frame formats.

  1. Grab three channel IplImage frame from video with the FrameGrabber
  2. Convert grabbed three channel frame to four channel IplImage frame
  3. Convert four channel frame to Android Bitmap image
  4. Convert Android Bitmap image to OpenCV Mat frame
  5. Process OpenCV Mat frame
  6. Convert Processed Mat frame to Android Bitmap image
  7. Convert Android Bitmap image to four channel IplImage frame
  8. Convert four channel IplImage frame to three channel IplImage
  9. Store three channel IplImage as frame in the video with the FrameRecorder

Solution 2:

You can open a video file in OpenCV with VideoCapture, and then use grab to get the next frame.

Is there a specific video codec you need support for?

OpenCv grab() documentation

Post a Comment for "Process Video Frame By Frame In Opencv On Android"