MATLAB: Finding pixels in connected component

bounding boxcomponentconnectedconnected componentImage Processing Toolboxpixelregionprops

Hi
I need to know how to get access to any white pixel in a connected component. Are there any functions to get the coordinates of white pixels? With that I have to start a traversal algorithm to draw a bounding box around the connected component in the image. Please help me out. Thank you very much!

Best Answer

Call regionprops(). You can ask for PixelIdxList which will give you the index (location) of every pixel in the blob. But if you just want the bounding box, no need to do some traversal algorithm, just ask regionprops() for the 'BoundingBox'. See my image segmentation tutorial for a demo: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862