[MPlayer-users] Stabilizer filter in MEncoder?

rr rr at rr.sote.hu
Mon Sep 27 16:23:00 CEST 2004


i am not too good in english, but i am interested in stabilzer filter. 
(my first video, about 1 hour, with a big zoom have Alzheimer simptome)

so i begun write a filter, (mplayer  ->jpeg ->filter ->mplayer)

the first algorithm make 5 avrage raw, and 5 avrage colomn, and simply try 
which moving is the minimum difference. after it tries to guess it with 1/8 
pixel precision with a very simple interpolation. The proplem is, if the 
algorithm eliminate the moving, there will be remining the rotateing. (in 
that case around the center of the picture).
so i need very precize moving value, in different place of picture ie. up and 
down, or left and right. I got two angle, but this values is frequntly 
different. ( i have choosen the min abs(a,b,(a+b)/2))

it made wrong result around zooming, but i can correct it - in this special 
case, in my klipp . 

my second algorithm tried to invert the picture ie. the location -> color 
function. this function - of course - not invertable, but i take 16*16*16 
color, and i take the avrage locationto a color . after it a normal 
correlatio made a good value to the mesure of difference. from the same 
datas, i get a moving, a rotateing and a zooming value, but these are 
unusable, becase the big unprecisity. This algorithm is quicker, and usable 
the "drop" a frame because of the blitz. (? little,quick  "lamp" on camera, 
my english ). This correlation value is usable to estimate wether there is 
zooming, usually.

my third algorithm, i have not coded this, is linear interpolation in the 
second picture, so i get a diference form each pixel. after it i can use 
"minimum quadrat" algorithm to estimate a 2x2 matrix (rotate and zoom) and 
the moving vector. But i have no time ...

I think that to make difference between the local and global moving is not too 
important, but in my video there is no quick moving. My first algorithm 
seemed to usefull, but the result contained some error, much less than the 
original. ( i compared a frame with next, the second, the third, and the 
fourth, and i tried to estimate the precise value from this 4 data. the angle 
from the rows, and coloumn was rather "additive", but different. I need more 
value if a frame was too different)

A windows program (pinnacle?)contains this feature, but it has no parameter, 
and on my film it made nothing( i have not see difference). In my 720x576 
video, it has to correct about 50 pixel, i thing this program knows less. 
(and i dont know what about rotating)

So IMHO this is a very usefull feature, if somebody write it. 
the most important parameter IMHO is the max correction (in pixel), and the 
program _must_ know correcting the random rotation.

Really i dont know how compress algorithms knows, the measure of moving. It 
can be simplier, i dont know

quoted form Richard F
i think the basic idea would be to buffer several frames ahead and do
motion estimation on them all, then throw out small, 'localized'
motion that doesn't match the overall motion direction of the frame,
and finally analyze the global motion of several consecutive frames to
decide whether it's jerking (back-and-forth) or actual panning
(consistent motion in one direction). then you have to shift the
jerked frames to compensate, and finally crop all the frames a little
bit to make up for the fact that you're missing pixels at the edges of
compensated frames.

the hard steps are distinguishing between local&global motion (a
person moving in the frame vs the camera panning), and between
jerking&panning (requires analyzing several frames as a group rather
than each one individually).

Radnai András
egyketto3 at rr.sote.hu

More information about the MPlayer-users mailing list