code.txt
来自「基于MATLAB环境下的人脸识别代码」· 文本 代码 · 共 45 行
TXT
45 行
% ---------------------------------------------------------------------
% 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 + =
减小字号Ctrl + -
显示快捷键?