How Labeling objects in grayscale image in matlab

3 views (last 30 days)
Hi all,
I work with pathological image. and at the middle stage of the my method i give 0.3 gray value to background and 1 for the objects, and also there is pixels that does not belong to any of those. that pixels are in 0 gray value. Using this image i want to give label 1 to background and then i want to label objects start with 2. for seeded watershed. Can any one tell me how can i do this.. if you want i can upload this image.
Thank you all.
Best Regards, Pabudi.

Answers (2)

Image Analyst
Image Analyst on 23 Apr 2013
Please upload the image. You can use imquantize() followed by bwconncomp() and regionprops().

julian tuyin
julian tuyin on 28 Oct 2016
hi, im having a similar problem, what i did, was use the code from "Detecting a Cell Using Image Segmentation", on the image progressing help, and once you get the image with the filled holes, and obviously the border image, you can do.
im=BWdfill-BWsdil
%image= image with filled holes - image with dilated borders.
you will get what you are looking for, you'll just have to adjust your borders. after that you can easily do, BWLABEL and REGIONPROPS. but this wont ensure you have the background with label 1, as you can have an object in the (1,1), it would be better to do them on separate process.

Community Treasure Hunt

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

Start Hunting!