0

I've been using OpenCV and MoviePy to get images out of a video (1 image per second) and once extracted, I analyze the image with pytesseract. The part where the script extract images takes quite a bit of time. Is it possible or is there a function that I've overlooked in MoviePy or OpenCV that allows video frames to be analyzed without having to create images first? This could tremendously speed up the process.

Current steps:

  1. Scan and extract 1fps with a specific video as argument
  2. From each of those images, perform analysis on a specific area

Desired:

  1. Perform analysis on a specific area of the video itself at 1 fps.

If this function exists, please inform me. Otherwise, would there be a workaround for this? Suggestions?

Thanks!!

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
c0nfluks
  • 53
  • 5
  • 1
    cv.VideoCapture, determine frame rate, drop frames you don't need, ... – Christoph Rackwitz Jul 23 '22 at 20:34
  • @ChristophRackwitz It seems like your reply has been cutout. I can't read pass ", ..." – c0nfluks Jul 23 '22 at 21:25
  • Can you explain the reason you use MoviePy? OpenCV must be enough for that. – Hihikomori Jul 24 '22 at 10:40
  • You can use iter_frames to get an iterator of images as RGB pixel values without saving them to image files first. for frame in VideoFileClip('myvideo.mp4').iter_frames(). You may need to convert the resulting arrays for tesseract. https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html#moviepy.video.VideoClip.VideoClip.iter_frames – DanG Dec 05 '22 at 05:37

0 Answers0