6
$\begingroup$

I'm using ImageFeatureTrack to track several moving simple objects in a series of images, but sometimes it will fail to track stuffs, and why it fail is always a mystery to me:

This phenomenon can be easily illustrated by the following case of tracking the four corners of a simple moving Rectangle:

i = Table[
   Rasterize[
    Graphics[Rectangle[{-.9 + k .05, -.5}, {.1 + k .05, .5}], 
     PlotRange -> {{-1, 1}, {-1, 1}}], ImageSize -> {100, 100}], {k, 
    0, 16}];

ListAnimate@i

ImageFeatureTrack[
 First /@ Partition[i, 4], {{6, 74}, {54, 74}, {6, 26}, {54, 26}}]

ImageFeatureTrack[{i[[1]], 
  i[[1]]}, {{6, 74}, {54, 74}, {6, 26}, {54, 26}}]

the first returns:

{{{6., 74.}, {54., 74.}, {6., 26.}, {54., 26.}}, {Missing[], {63.9868, 74.0008}, Missing[], {63.9875, 26.0003}}, {Missing[], {73.9786, 73.9991}, Missing[], {73.978, 26.0037}}, {Missing[], {83.9614, 73.9959}, Missing[], {83.9597, 26.0084}}}

ImageFeatureTrack simply missed all corner 1 and 3 whill correctly tracked corner 2 and 4.

To make things wierder, in the second trial showing two IDENTICAL image, ImageFeatureTrack missed corner 1 and 3!!!

Am I missing something or it's simply a misbehaviour of ImageFeatureTrack?

How can I solve this problem?

$\endgroup$
  • $\begingroup$ Yes it is strange ... It works though if you just add the option MaxFeatureDisplacement -> {1, 1} ! (whatever actually these values are: {0.1,0.1} or {2,1}, ... but NOT too large like {20,20}) $\endgroup$ – SquareOne Sep 17 '16 at 9:07
  • $\begingroup$ @SquareOne That's truely wierd, the displacement in the first example is obviously larger than 1 pixel in each and every step. and in the second example, whatever this value is shouldn't effect the result as the displacement is 0! $\endgroup$ – Wjx Sep 17 '16 at 10:20
3
$\begingroup$

In your sequence, the first image has 2 corners that are too close to the boundary and ImageFeatureTrack has troubles tracking those.

If you rerun your experiments with added padding, things work as expected: i = ImagePad[#, 20, 1] & /@ i;

Also, in its current implementation ImageFeatureTrack is effectively dismissing specified coordinates that are not good enough to track. If your corner positions are specified a bit off, you may not be able to track them.

$\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.