Search code examples
videoprogramming-languagesmatrixvideo-processingavi

How avi video file can be transformed into series of matrices?


i want to analyse videos given in avi format. For that I need to represent video as series of matrices. Every matrix represents one frame from the video. How can I do it? I prefer to use Python and Java but other options are also welcomed.


Solution

  • You can try OpenCV. It has C, C++ and Python API. It treats images as matrices, so reading the video will result in matrices.

    Talking about the C++-Interface (Python is similar), there is cv::VideoCapture class. You can initialize such an object with your video file name. Then you can grab each frame separately and retrieve it into a matrix (cv::Mat).