create mask for constant (nonchanging) portion of video
Posted: 2015-09-01T08:32:58-07:00
I have been a long time ImageMagick user, huge fan. This question is more about theory than syntax.
I have a compressed ultrasound video clip that has a portion at the top (usually 25-75 pixels) that has personal patient information. I'd like to get this value automatically. This upper portion of the clip does not change. Here's a sample clip:
http://www.ultrasoundoftheweek.com/clip ... 1_copy.mp4.
My original theory was to take a still every 5 seconds using ffmpeg:
Then resize to 1 pixel wide using mogrify to average out changes across the clip:
Then look at the difference between images:
Last, use trim to determine how much would come off the top.
1) At this point, I'm not satisfied with the output I'm getting from the difference step. I'm getting difference at the top when I can see no appreciable difference between stills. Playing with threshold doesn't seem to effect much.
2) Also, can anyone help me with the trim output step (looking for first grey pixel from top)?
3) Would another approach be more reliable?
Thanks in advance!
I have a compressed ultrasound video clip that has a portion at the top (usually 25-75 pixels) that has personal patient information. I'd like to get this value automatically. This upper portion of the clip does not change. Here's a sample clip:
http://www.ultrasoundoftheweek.com/clip ... 1_copy.mp4.
My original theory was to take a still every 5 seconds using ffmpeg:
Code: Select all
ffmpeg -i test.mp4 -vf fps=1 -y out%04d.bmp
Code: Select all
mogrify -resize 1x600! *.bmp
Code: Select all
convert *.bmp -compose difference -composite -threshold 0 -separate -evaluate-sequence Add difference.jpg
Last, use trim to determine how much would come off the top.
Code: Select all
Code?
2) Also, can anyone help me with the trim output step (looking for first grey pixel from top)?
3) Would another approach be more reliable?
Thanks in advance!