Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Follow point in AVI
Replies: 1   Last Post: Jan 2, 2012 2:39 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Mark McClure

Posts: 193
Registered: 9/12/07
Re: Follow point in AVI
Posted: Jan 2, 2012 2:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Fri, Dec 30, 2011 at 7:06 AM, nlko <niko@homebound.de> wrote:

> I want to follow a horizontal movement of a black object on white
> background in an AVI.



It just so happens that I need to solve a similar question. Here's a
very short clip of a flying saucer from The Day the Earth Stood Still.

movie = Import["http://facstaff.unca.edu/mcmcclur/Saucer.mov",
"GraphicsList"];
ListAnimate[Image /@ movie]


We can find the location of the ship using Binarize. In this case,
we've got to block out the bottom since the white building has a color
similar to the ship. This is accomplished using ImageMultiply with a
black bottomed image.

marker = Image[Join[Table[1, {100}, {480}],
Table[0, {260}, {480}], 1]];
binaryMovie = Table[Binarize[ImageMultiply[frame, marker], 0.9],
{frame, movie}];


Let's check how it worked.

ListAnimate[binaryMovie]


If you need something like a center of mass, I guess you do to the following.

locations = Table[
Mean[N[Position[ImageData[frame], 1]]],
{frame, binaryMovie}];
locations = {#[[2]], 360 - #[[1]]} & /@ locations;


Here's a look.

ListAnimate[Image /@ Table[Graphics[Point[loc],
PlotRange -> {{0, 480}, {0, 360}}],
{loc, locations}]]


Mark McClure




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.