Dear all,
I am working on a project in with I should store the position of objects in a video. In each frame I have different number of objects and each object fills different number of pixels. The good part is that I am able to find the rows and columns that each object fills and then I store rowNumber and columnNumber in variable r and c.
I use a loop on the number of video frames (lets say 1000 frames). I want to concatenate object positions over Video frames. I need to store the position of objects such that I can refer to each video frame and read them individually. However, when I use position=[position D], it concatenates structures after the other and I can not recognize which frame and object it is.
For example in frame1 I have 2380 objects so structure D is 1x2380 with 2 fields r and c. and the second frame I have 1100 objects, so D becomes 1x1100 with 2 fields of r and c. But, after using position=[position D], it gives me 1x 3480 structure with 2 fields of r and c. The problem is that I do not want to combine objects over frames. (I need the position of each object in each frame). So I need to concatenate structures (with different sizes) vertically.
maybe this sketch helps you understand better:
It describes that in the first frame of the video I have 2380 objects, then within this structure , the first object fills 131 rows and 131 column (131x1 double), the second object fills 11 rows and 11 columns, the third object fills 231 rows and column,....
Then in the second frame of the video we have different 1100 objects,....
This is a part of my code:
Image = imread(ImageFile, k);
bw = BinarizeImage( Image);
labelMap = labelmatrix(C);
Object = regionprops('table', labelMap, 'Area', 'Centroid', 'MajorAxisLength', 'MinorAxisLength', 'Eccentricity');
[D(m).r, D(m).c] = find(labelMap==m);