Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7513

Re: Follow point in AVI

From Mark McClure <mcmcclur@unca.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Follow point in AVI
Date 2012-01-02 07:39 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jdrn0f$8p9$1@smc.vnet.net> (permalink)
References <201112301206.HAA08399@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Follow point in AVI Mark McClure <mcmcclur@unca.edu> - 2012-01-02 07:39 +0000

csiph-web