Why is the bwdist
and imhmin
image completely black? When I check the the two matrices in the workspace, the values seem fine. You can run this code in Matlab to check it out. The expected result is a grayscale image where the centre of each connected component has low intensity, while the edges of the connected components have high intensity. The pixel distance of the edges are further from the centroid and would have a high distance value. If the distance values are considered to be an intensity, thus high intensity at the edges.
Consider the 1's as the connected components to be distance transformed while the 0's are merely the background. I would like to have the background as 0's.
image = zeros(5,5);
image(2,2) = 1;
image(4,4) = 1;
binary = im2bw(image,graythresh(image));
distance = bwdist(binary,'cityblock');
hminima = imhmin(distance,5);
figure; imshow(binary)
figure; imshow(distace)
figure; imshow(hminima)
The needed result is something like this.