fourMs / MGT-python

Musical Gestures Toolbox for Python
https://www.uio.no/ritmo/english/research/labs/fourms/downloads/software/musicalgesturestoolbox/mgt-python/index.html
GNU General Public License v3.0
52 stars 11 forks source link

Filtering function oddities in motiongram() #274

Open alexarje opened 1 year ago

alexarje commented 1 year ago

I just tried the various filtering functions, threshold and type, but they don't seem to work. See here for a threshold of 0.0:

Screenshot from 2023-01-12 09-33-49

Is this related to the FFmpeg change?

joachimpoutaraud commented 1 year ago

I tested the function on both Windows and Linux OS but it seems to work properly. Did you use the last version of musicalgestures (1.2.6)?

test

Note that the default non-thresholded motiongram using ffmpeg is a bit more noisy compared to using OpenCV. This is due to the different kind of processing involved as well as the temporal averaging denoiser that is applied (see #109)

alexarje commented 1 year ago

Yes, I get some effect, but perhaps less than I had expected. The filter goes from 0 to 1 right? So I would expect that when you filter at 0.0 you would get a lot of noise, while at 0.9 very little signal?

joachimpoutaraud commented 1 year ago

Yes from 0 to 1, the problem is related to the way FFmpeg filters each motion frame. I suspect that because there is not a lot of color possibility in FFmpeg, the threshold cannot be very precise. However, if you want I can add the possibility to use traditional filtering but it will take more time to process.

Here are some examples with a threshold set to zero: FFMPEG >>> Processing time: 16.667 s dance_mgy_0

TRADITIONAL >>> Processing time: 81.574 s dance_mgy

alexarje commented 8 months ago

I test this yesterday, and see that the visual differences are quite large between the old and new function. See motiongrams of the same video made with the default settings of the old and new.

gJB_sFM_c09_d08_mJB0_ch08_mgy-1-684x1024

aist_mgx

It would be good to investigate a little more what we can do to improve the filtering of the motiongrams with the new function. The speed benefit is huge, so it would be very nice to work in FFmpeg. Perhaps a midterm solution could be to add the option of using both?