MATLAB: How to obtain true length (pixel-center to pixel-center) of convex hulls in a multi-object image

conveximage processing

I need to compute the length of the convex hulls of multiple particles in an image (example image, see: loess_image_black-white). I first tried the following: the total distance between the corner points of matlab's convex hulls (regionprops('ConvexHull'). However, this does not give me the true length because convex hull draws along the outside of the pixels (red line) instead of pixel center to pixel center (green line).
So what I would like: per object the [x,y] coordinates of the centers of the pixels that form the convex points (blue plusses). I hope there is an easy solution!

Best Answer

Yes, I really hate that regionprops consider pixels to have an area. You get the same issue that BoundingBox is offset by 0.5 from the integer pixel centre.
stats = regionprops(something, 'PixelList');
hull = convhull(stats.PixelList(:, 1), stats.PixelList(:, 2)) %possibly add the 'simplify' option
should work.
Related Question