2
$\begingroup$

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):

enter image description here

For illustration: all images superposed (50% reduced size):

enter image description here

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:

enter image description here

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 the IntensityCentroid of objects for tracking?

$\endgroup$
  • $\begingroup$ can you get out the data of IntensityCentroid at each frame and use list manipulation to proceed your data to get the desired result? $\endgroup$ – Wjx Jul 5 '16 at 11:09
  • $\begingroup$ The question is about how ImageFeatureTrack functions and if it can be combined with IntensityCentroid. $\endgroup$ – mrz Jul 5 '16 at 20:26
  • 1
    $\begingroup$ I'm guessing that ImageFeatureTrack uses ImageKeypoints[] 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$ – dr.blochwave Jul 5 '16 at 21:18
  • $\begingroup$ For accurate scientific subpixel measurements where it is necessary to define the method on how objects positions should be determined and tracked ImageFeatureTrack would be then useless. $\endgroup$ – mrz Jul 5 '16 at 21:29
  • 2
    $\begingroup$ @mrz well there is your answer. The examples for 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$ – dr.blochwave Jul 6 '16 at 11:14
2
$\begingroup$

Answer from Wolfram Technical Support :

In general ImageFeatureTrack automatically determines a set of feature points in the images to track. To track specific features we have the following options: either we can take a sequence of related images and find a common feature in them such as the IntensityCentroid or we can find the coordinates of some feature in the first image and then tracks the new coordinates of the same feature as it changes from one related image to the next.

In the first case one uses the function ImageMeasurements[{image1, image2, ...,imageN}, property] such as:

ImageMeasurements[{image1, image2, ...,imageN}, "IntensityCentroid"]

In the second case we use ImageFeatureTrack with ImageMeasurements to identify the coordinates of the required feature, such as:

ImageFeatureTrack[{image1, image2, ...,imageN}, ImageMeasurements[image1, property]] 

In the particular case of IntensityCentroid we have:

ImageFeatureTrack[{image1, image2, ...,imageN}, 
   ImageMeasurements[image1, "IntensityCentroid"]] 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.