0

Is it possible in python to extract frames from a LIVE video using opencv. I am trying to write code for a text recognition software. Using opencv and tesseract but I cant get tesseract to review the video unless it is in frames.

1
  • 3
    yes it is possible Commented Jan 19, 2020 at 20:38

1 Answer 1

1

My man, you need to extract each video frame and parse it as a cv Mat. Here's a snippet code (in C++) that reads an mp4 video, extracts each frame and converts it to an OpenCV matrix:

// Video input: std::string filePath= "C://myPath//"; std::string videoName = "videoTest.mp4"; // Open video file: cv::VideoCapture vid( filePath + videoName ); // Check for valid data: if ( !vid.isOpened() ){ std::cout<<"Could not read video"<<std::endl; //handle the error here... } //while the vid is opened: while( vid.isOpened() ){ // Mat object: cv::Mat inputFrame; // get frame from the video vid >> ( inputFrame); // carry out your processing //... } 

For this C++ implementation, I've previously #included for OpenCV's video io definitions.

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

1 Comment

Thanks this will really help.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.