File size: 578 Bytes
d4035c1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
function counts = LMcountobject(D, objectname, method)
% Returns the number of object instances of the class 'objectname' for each
% entry in the database.
%
% Example: to know how many side views of cars there are in every image:
% counts = LMcountobject(D, 'car+side');
%
if nargin == 2;
method = '';
end
n = length(D);
if nargin == 2
[D, j] = LMquery(D, 'object.name', objectname, method);
else
j = 1:n;
end
counts = zeros(n,1);
for i = 1:length(D);
if isfield(D(i).annotation,'object')
counts(j(i)) = length(D(i).annotation.object);
end
end
|