I would lik to track the IntensityCentroid
of objects in sequentiell images by using ImageFeatureTrack
.
A set of 100 images (png, 8bit gray scale, each image contains 3 bright objects of interest) is available here: http://preview.tinyurl.com/z8b9u8v
For illustration: first image (50% reduced size):
For illustration: all images superposed (50% reduced size):
What I did:
ChoiceDialog[{FileNameSetter[Dynamic[imageDir],"Directory"],Dynamic[imageDir]}];
SetDirectory[imageDir];
fNames=FileNames["*.png"];
numFiles=Length[fNames];
images = Table[Import[fNames[[i]]], {i,1,numFiles}];
{w, h} = ImageDimensions[images[[1]]];
res = ImageFeatureTrack[images];
ListLinePlot[# &@Transpose[res], PlotStyle -> AbsoluteThickness[2],
AspectRatio -> Automatic]
The objects are tracked correctly:
But the found coordinates do not correspond to the IntensityCentroid
, nor Centroid
or Medoid
.
For the first 2 images I get:
res[[1 ;; 2, All, All]]
{{{36.5, 637.5}, {372.5, 30.5}, {733.5, 633.5}}, {{36.7581,
638.58}, {372.498, 32.5795}, {732.013, 631.847}}}
Compared to that I get with ComponentMeasurements
different coordinates:
(* first image *)
image = images[[1]];
t = FindThreshold[image, Method -> "Entropy"];
binImage = Binarize[image, t];
binImage2 = DeleteSmallComponents[binImage, 8];
newImage = ImageMultiply[image, binImage2];
ComponentMeasurements[newImage, "IntensityCentroid"][[All, 2]]
{{40.0884, 637.066}, {731.587, 633.121}, {374.29, 29.9678}}
ComponentMeasurements[newImage, "Centroid"][[All, 2]]
{{40.1854, 636.86}, {731.5, 632.77}, {374.088, 29.9706}}
ComponentMeasurements[newImage, "Medoid"][[All, 2]]
{{40.5, 636.5}, {731.5, 632.5}, {374.5, 29.5}}
(* second image *)
image = images[[2]];
t = FindThreshold[image, Method -> "Entropy"];
binImage = Binarize[image, t];
binImage2 = DeleteSmallComponents[binImage, 8];
newImage = ImageMultiply[image, binImage2];
ComponentMeasurements[newImage, "IntensityCentroid"][[All, 2]]
{{40.3237, 638.086}, {730.063, 631.506}, {374.309, 32.0791}}
ComponentMeasurements[newImage, "Centroid"][[All, 2]]
{{40.522, 637.764}, {729.906, 631.188}, {374.087, 32.2067}}
ComponentMeasurements[newImage, "Medoid"][[All, 2]]
{{40.5, 637.5}, {729.5, 631.5}, {374.5, 32.5}}
In the next step I called ImageFeatureTrack
with the coordinates determined in the first image when using IntensityCentroid
:
res = ImageFeatureTrack[
images, {{40.08839050131926, 637.0655233069481}, {731.5865089398592,
633.1207332490518}, {374.28972465774496, 29.967774188586418}}]
The output for the first 2 images is:
res[[1 ;; 2, All]]
{{{40.0884, 637.066}, {731.587, 633.121}, {374.29, 29.9678}},
{{40.2653, 638.126}, {730.079, 631.463}, {374.318, 32.0352}}}
As one can see the tracked coordinates in the second image differ from the coordinates determined with ComponentMeasurements[newImage, "IntensityCentroid"][[All, 2]]
.
How does ImageFeatureTrack
measures the objects' coordinates and which strategy is used to track them?
How can I force
ImageFeatureTrack
to use theIntensityCentroid
of objects for tracking?
IntensityCentroid
at each frame and use list manipulation to proceed your data to get the desired result? $\endgroup$ImageFeatureTrack
functions and if it can be combined withIntensityCentroid
. $\endgroup$ImageFeatureTrack
usesImageKeypoints[]
under-the-hood, and thus uses SURF feature detection to determine a point - and may make use of the strength of this "blob" in tracking. But the underlying point detection algorithm seems inaccessible. The only options are{Masking -> All, MaxFeatureDisplacement -> 15, MaxFeatures -> Automatic, MaxIterations -> 20, Tolerance -> 0.03
}` $\endgroup$ImageFeatureTrack
would be then useless. $\endgroup$ImageFeatureTrack[]
do point towards it being used for feature tracking in videos, i.e. from a computer vision point-of-view, rather than for tracking particles in scientific image series. Take a look at things like icy.bioimageanalysis.org/plugin/Spot_Tracking or imagej.net/TrackMate $\endgroup$