MATLAB: How to find the density of an object in an image

image processingImage Processing ToolboxMATLABStatistics and Machine Learning Toolbox

I have an image of a cell. Inside it there are a lot of small organelles. I want to find out how close are they to each other, some kind of density measure but not exactly. I want to find the nearest neighbor to every organelle. I tried to use BWdist but it measure distance between pixels and in my image – not every organelle equals one pixel. do you have any ideas how to measure this? in the attached image – I want to look only at the small black dots and to find out how far are they from each other
thank you for your help!

Best Answer

Use regionprops to get centroid, then pdist2 to get nearest neighbor distances.
Related Question