Blobs being labelled incorrectly when changing between consecutive images

Hi there, I'm having trouble with the labelling and identification of objects within an image. I'm conducting an experiment where I'm trying fruit and conducting image analysis on it to examine the shrinkage over time. As such I have about 20 photos with 5 slices in them. It works fine up until the 18th photo when the slice that was originally labelled '5' switches to '4'. I then use regionprops for analysing the area change but I am getting incorrect values due to the label swapping between 4 and 5. The slices remain in the same approximate area and shift a little depending on how well the photo is taken but they do not completely switch positions entirely.
I was just wondering if there is anyway the label swapping can be avoided?

 Accepted Answer

The situation might be different for complicated objects, but most of the time the blobs end up labeled according to which blob has the lowest linear index. The linear index increases most rapidly with increasing columns, and less rapidly with increasing row. A blob that shifted one pixel to the left could certainly end up having an extreme upper left before a different blob.
In some cases it is useful to account for this by doing the labeling on the transpose of the image, but that is not really a general solution.
For tracking purposes, you should perhaps look at blob centroids, or some measure such as "if we suppose the blob centroid moved to point A, then what is the average distance the pixels would have moved?"

More Answers (0)

Products

Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!