How obtain coordinates of pixels within bwboundaries in Matlab

时间:2019-04-17 00:02:21

标签: matlab image-processing

Suppose I have an image

enter image description here

and then I use the code below

I=imread("image.bmp");
imshow(I); hold on; [B,L,N] = bwboundaries(I);
for k=1:length(B),
    boundary = B{k};
    plot(boundary(:,2), boundary(:,1),'.r')
end

The boundaries then look like

enter image description here

However, I don't just want the x,y coordinates of each pixel ON the boundaries. I also want the x,y coordinates of each pixel INSIDE the boundaries also

Is there a way to do this in Matlab?

EDIT: I want to store the row/column numbers for each object in separate matrices. So matrix A1 should store the row/column numbers for the white pixels in the big object, matrix A2 should store the row/column numbers for the white pixels in the circular object

0 个答案:

没有答案