balintlaczko / VideoAnalysis

Non-realtime video analysis, exporting motiongrams and various quantitative features of movement in the video file.
https://www.uio.no/ritmo/english/research/labs/fourms/downloads/software/VideoAnalysis/
1 stars 0 forks source link

Add skipframe functionality #15

Closed balintlaczko closed 4 years ago

aleksati commented 4 years ago

Was this initially meant only as a functionality for the motiongrams, or for the entire output?

balintlaczko commented 4 years ago

I am not sure actually, but my idea is that maybe it would be useful to implement it for the source video playback (both framedump-style and online playback) - so then if you load a video of the 9-hour train ride from Bergen to Oslo (lol :D) you can for example skip 29 frames so you only get 1 frame / sec - or something like that... But I think it's definitely needed for the offline framedump, and it's a question if it's also necessary online.

aleksati commented 4 years ago

I see, yeah that would be nice! I'm sorry, but I´m not quite sure I get what you mean by "offline" and "online" playback in this context?

alexarje commented 4 years ago

Offline is the framedump (non-realtime) version. The realtime version will skip frames anyway if it cannot keep up to speed.

aleksati commented 4 years ago

I have an idea of a skipframe function but don’t know if I´m on the right track here. Could this be implemented between the [jit.qt.movie] and [jit.broca] using a [jit.matrixset] configuration to effectively record and output the wanted indexes? It would then use the framedump as input values.

I´ve uploaded a basic demo on this to Balints repo called «Frameskip_quickdemo_aleks.maxpat.», which shows very quickly how such a functionality could be made. I don't think it is very optimal, but with some work, I think it could do the job. Presuming of course, that I have understood this correctly.

Is this something worth pursuing further? I guess there are many ways of tackling this.

alexarje commented 4 years ago

I am my linux computer now, so cannot check your patch. But there is actually a skipframe function in the framedump message you can send to jit.qt.movie. If you send "framedump 4" for example it will skip 4 frames. Would be nice to let the user know how large the final motiongram should be. Then you will need to get the number of frames in the video, and then calculate the width/height in pixels based on the number of skipped frames.

aleksati commented 4 years ago

I see, hadn't noticed that! Yes, that would probably be a better approach. Thanks, I´ll look into this and the preview of the final motiongram size.

aleksati commented 4 years ago

I made it so the motiongram dimensions correspond to the videos' original parameters at first, but are re-calibrated based on the cropping. The other way is to bypass the cropping completely and make the motiongrams fixed to the videos' original dimension.

aleksati commented 4 years ago

This is implemented. Will commit later with @balintlaczko .