jhavl / robotacademy-code

Code Translations for Robot Academy
MIT License
2 stars 3 forks source link

Images from videos code is convoluted in python #14

Closed Tobias-Fischer closed 10 months ago

Tobias-Fischer commented 1 year ago

https://robotacademy.net.au/masterclass/getting-images-into-a-computer/?lesson=632

@Tjeard0 is there really no easier way to extract images?

Tjeard0 commented 1 year ago

This definitely isn't the way the code was meant to be used looking at the documentation, I set it up to be as close to the matlab implementation as possible.

Currently it is set up using iterators so normally this would be processed in a for loop which is what is described in the documentation:

from machinevisiontoolbox import VideoFile video = VideoFile("traffic_sequence.mpg") len(video) for im in video: process image

I have checked and unfortunately the .grab function (used in the matlab video ) only exists for video cameras and not video files in the machine vision toolbox.

I can re-write the file if you like to use a for loop instead which would be the intended for the python implementation.

Tjeard0 commented 1 year ago

In the same folder I have written up a file: python-simplified.py which uses a for loop instead and limits to 6 frames like the matlab implementation. Let me know if this is a nicer way of doing it and I can update the main file