lhicountobject.m
来自「This code can parse any image in matlab.」· M 代码 · 共 25 行
M
25 行
function counts = LHIcountobject(D, objectname);
% 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 = LHIcountobject(D, 'car+side');
%
n = length(D);
counts = zeros(n,1);
if nargin == 2
[D, j] = LHIquery(D, 'object.name', objectname);
else
j = 1:n;
end
for i = 1:length(D);
if isfield(D(i).annotation,'object')
counts(j(i)) = length(D(i).annotation.object);
else
count(j(i)) = 0;
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?