georgmartius / vid.stab

Video stabilization library
http://public.hronopik.de/vid.stab/
Other
838 stars 110 forks source link

Detect 'shaky' frames #84

Closed MarcoP91 closed 4 years ago

MarcoP91 commented 4 years ago

Hello Georg, first of all I would like to thank you for making this library, I found it useful and faster compared to ffmpeg deshake. I am trying to use the output file of the function vidstabdetect to detect frames in which the camera moves too much/ there is too much movement in. In order to compute a measure of movement, for now I am taking, for every frame, the first two coordinates of every LM object [(LM 1 1 279 81 48 0.513528 1.637587)] and for every point created this way compute its euclidean distance from (0,0), then sum all the distances. This method is giving me some results, however it is still not enough. I tried various filtering of those points (by thresholding contrast and discarding points too close to (0,0)), but without much improvement. Does it exist a more effective way to do this? Is computing an overall frame measure of movement using the vidstabdetect output file even possible to begin with?

georgmartius commented 4 years ago

Hi ZedZeal, Vidstab internally is also using that data to detect a global motion. You can run the vidstabtransform step with the debug option: See documentation: debug "Increase log verbosity if set to 1. Also the detected global motions are written to the temporary file global_motions.trf. Default value is 0."

georgmartius commented 4 years ago

Internally, it does some filtering to remove the potentially independent moving foreground. Good luck.