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


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

Re: Follow point in AVI

Started byMark McClure <mcmcclur@unca.edu>
First post2012-01-02 07:39 +0000
Last post2012-01-02 07:39 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#7513 — Re: Follow point in AVI

FromMark McClure <mcmcclur@unca.edu>
Date2012-01-02 07:39 +0000
SubjectRe: Follow point in AVI
Message-ID<jdrn0f$8p9$1@smc.vnet.net>
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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web