l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Mar 17 07:34

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] pan and scan
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] pan and scan

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

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!
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.