i want to find the coordinates of labeled images .i got labeled values but issue is to separate the labels in separate array which just show me coordinates of label 1 and in the same way for the rest of my all labels till max for particular image
i got labels on 8-neighborhood basis and also show me max number of labels
L = bwlabel(B,8) mx=max(max(L))
i also showed all labels separately in figure form but rather than figure i need coordinates of those labeled object and for figures i used this (for loop)
actually i don't need to show figures i want coordinates of those figures which will store separately in some separate array of variables like label 1's coordinates will store in one array for label 2 in other array and so on till end please help me out ...I'll be thankful to you
No products are associated with this question.
You can get the number of objects directly from the second return argument of bwlabel:
[labeledImage, numberOfRegions] = bwlabel(binaryImage);
You don't need to do it like you did this way:
With your second set of code, an attempt to show individual regions, you said that you don't want to do that (so why put it?), and that instead you want the x,y coordinates of the pixels in each region. You can get this from the PixelList measurement of regionprops:
measurements = regionprops(labeledImage, 'PixelList');
I rarely use this, so I'm wondering why you think you need to use it. What are you going to do next with those coordinates after you have them? These coordinates are not useful in themselves. They would only be useful as input to some next step of your algorithm. Perhaps I can tell you how to do the next step in a more efficient way, just like I could have told you to use ismember instead of "[x y]=find(L==s);" if you had wanted to look at individual regions.