I have a binary image with some objects, and I want to get some characteristics of these objects.
I = imread('coins.png');
B = im2bw(I, 100/255); B = imfill(B, 'holes');
RP = regionprops(B, 'Area', 'Centroid');
RP
becomes a structure array:
10x1 struct array with fields:
Area
Centroid
I need to make from this structure 2 arrays called Areas
and Centroids
.
How to make it without loops?
Using loops we can go this way:
N = numel(RP);
Areas = zeros(N, 1); Centroids = zeros(N, 2);
for idx=1:N,
Areas(idx) = RP(idx).Area;
Centroids(idx, :) = RP(idx).Centroid;
end