From: Krithika Mohan on
Hi,

I have the following problem,

I have a sequence of images of moving cells, some of the cells try to
merge and split in subsequent frames. In order to track their movement
I tried to label the cells in each of the frames and tried to track
their centroid positions. Now the problem is my labelling for each
cell varies from frame to frame, due to which my tracks are
inaccurate.
How should I tackle this problem, what should I do so that I assign
unique ID's to each of the cells and at the same time monitor the
process of cell splitting and merging of some of the cells.
From: ImageAnalyst on
MATLAB labels from top down then left to right. If your objects move,
it may not have the same label in each image. In that case, you need
to let MATLAB first label the image, and then figure out yourself
which label corresponds to the label of the prior frame. If the
objects are not moving too fast, and don't overlap each other then I'd
probably try to keep track of the centroids. You can then develop an
N by 1 matrix where the element index is the label MATLAB assigned to
the object, and the value of the matrix at that element is the new
label that you want to assign to it (which is the label that that
object has in prior frames). You can use intlut() on your labeled
image to create a labeled image with the labels that you want. It's
really not too hard at all. Just have a for loop where you look at
every object in the current frame. In there have a for loop where you
compare that object to each of the objects from the prior frame.
After that inner loop, keep track of which prior object matched the
best. Now you have your N by 1 matrix, so just call intlut on your
current labeled matrix to remap it to your prior labels, then do your
measurements (regionprops probably) with your new labels. Not too
bad. You have to put in some sanity checks such as throwing out
objects if they don't match close enough to any of the prior objects,
or you can keep them and give them a new label - that sort of thing.

The only trouble you might run into is if your objects move so much
from one frame to the next that you can't really tell where one object
went to, or if some objects come into view or leave the view (in which
case you'd have to inspect more than just the centroid to find the
proper objects), or if the objects change shape and position and
count. If the image changes too much it could be impossible (for
example you're tracking cars on a New York City street but you're
snapping photos only every 5 minutes).
From: ImageAnalyst on
See my answer on your duplicate posting.