New in Wolfram
Mathematica
8: Comprehensive Image Processing Environment
◄
previous
|
next
►
Application Areas
Track Moving Objects
Find and track objects of a specific color and shape in a live stream of images.
In[1]:=
X
trackObject := Module[{red, blue, c1, c2}, red = FillingTransform@ DeleteSmallComponents[ SelectComponents[Binarize[#, Norm[# - {1, 0, 0}] < .6 &], "Circularity", # > .5 &], 100]; blue = FillingTransform@ DeleteSmallComponents[ SelectComponents[Binarize[#, Norm[# - {0, 0, 1}] < .6 &], "Circularity", # > .5 &], 100]; {c1, c2} = Flatten[ComponentMeasurements[#, {"Centroid", "BoundingDiskRadius"}][[All, 2]], 1] & /@ {red, blue}; Show[#, Graphics[{Thickness[.01], Magenta, Circle @@ c1, Cyan, Circle @@ c2}]] ] & Dynamic[trackObject[CurrentImage[]]]
Play Animation
»
Stop Animation
»