[vox-tech] pan and scan

Bill Kendrick vox-tech@lists.lugod.org
Sun, 16 Mar 2003 04:51:33 -0800


So I decided to write a little program using SMPEG that'll display
a video and apply different effects to it, realtime.

I've got some trivial ones, like a wind-style blur, black-and-white
and 9-color thresholds, sinus wave, and TV RGB pixel effect.

I then decided to work on one that's _kind_ of like an 'emboss' effect,
but it uses the difference of two frames.  Then I decided to go to bed.
Of course, that meant hitting the shower, at which point I decided I'd turn
that last effect into a kind of pan-and-scan effect.

So what I have is a little 128x128 rectangular view that stays in the
center of the window, and tries its best to 'follow the action' of the
video.

Right now, it's based on an average of the relative points in the image
where there was "a lot" of change since the last frame.  (Difference
between the two pixels is greater than some threshold.)

To keep it smooth, I'm keeping track of where I want to look at
separate from where I'm currently looking.  Then I use some vectors
(I guess you'd call them that) to determine what direction and how fast the
viewport is moving, in relation to the video's origin.

(Those vectors can cause an irritating 'wobble' sometimes, but it's not
too bad.  It's kind of funny, actually... it's like the video was filmed
by a drunk cameraman :^) ))


Anyway, I thought I'd see if anyone out here had any ideas of a better way
to achieve this computer-operated camera motion.

-- 
bill@newbreedsoftware.com                                            Hire me!
http://newbreedsoftware.com/bill/    http://newbreedsoftware.com/bill/resume/

PS - Of course, some videos work better than others.  Jamiroquai's
"Virtual Insanity" music video is great because the camera rarely moves.
This gives my code a chance to try to follow the singer as he moves around
the room.  Fat Boy Slim's "Weapon of Choice", a great video with
Christopher Walken dancing, is a bit worse, since the camera is moving
a lot; especially towards and away, versus just left/right/up/down.
Finally, Ginuine's "What's So Different" video is horrible, since there
are so many very fast cuts, and tons of movement all over the screen
(almost all of it done digitally; by a company that uses Linux, BTW :^) )

PPS - One other thing I'd like to do is try and 'weigh' the various points
on the screen based on how much they've changed.  This would let larger and
faster motions be seen as more important, and keep the pan's focus on them.
It might also be cool to try to zoom in and out, based on how much of the
screen, space-wise, changed.  Ugh.  I can feel myself getting seasick already!