willprice / flowty

The swiss army knife for extracting optical flow
https://flowty.rtfd.org
16 stars 1 forks source link

Computing flow from a given frame range #40

Open AntonioMarsella opened 4 years ago

AntonioMarsella commented 4 years ago

Hi Will,

thank you for the awesome work!

I have to create optical flow from specific clips in a video. It would be great if it was possible to add the initial and final frames/times of the video we want to generate OF from.

Is it something already possible? I tried to dig into the code but I got a bit lost. In flowty/src/flowty/cv/videoio.pyx in the class VideoSource there is pos_frames(self) that I think it's what I need to use, but I don't know how to make it accessible with a command line.

Thank you very much!

AntonioMarsella commented 4 years ago

Hi Will,

thank you for the awesome work!

I have to create optical flow from specific clips in a video. It would be great if it was possible to add the initial and final frames/times of the video we want to generate OF from.

Is it something already possible? I tried to dig into the code but I got a bit lost. In flowty/src/flowty/cv/videoio.pyx in the class VideoSource there is pos_frames(self) that I think it's what I need to use, but I don't know how to make it accessible with a command line.

Thank you very much!

I didn't solve it, but if it could be useful for anyone, I used ffmpeg_extract_subclip(video_path, start_time, end_time, targetname=output_path) to trim the video where I needed and save them in a temporal folder, then used it to generate Optical Flow and eventually removed the temporal file after the optical flow has been generated.

This solution can be convenient for short clips, but not for long ones, since a lot of memory would be occupied. I think the smartest solution is not a big deal, since OpenCV allows to access the specif frame, but I still could not solve it.

Thank you for the beautiful script by the way!