📄 code.txt
字号:
% ---------------------------------------------------------------------
% fdlibmex_demo.m
%
% illustrates the usage of the fdlibmex face detection library by
% two examples
%
clear all
close all
% set mex file path for this platform ..
addpath(lower(computer));
% call without arguments to display help text ...
fprintf('\n--- fdlibmex help text ---\n');
fdlibmex
% load an example image
imgfilename = 'judybats.jpg';
img = imread(imgfilename);
% run the detector
pos = fdlibmex(img);
% display the image
imagesc(img)
colormap gray
axis image
axis off
% draw red boxes around the detected faces
hold on
for i=1:size(pos,1)
r = [pos(i,1)-pos(i,3)/2,pos(i,2)-pos(i,3)/2,pos(i,3),pos(i,3)];
rectangle('Position', r, 'EdgeColor', [1,0,0], 'linewidth', 2);
end
hold off
% show stats
fprintf('\n--- fdlibmex example ---\n');
fprintf('\n\t%d faces detected in \''%s\'' (see figure 1)\n\n', ...
size(pos,1), imgfilename);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -