Как я могу создать большой BoundingBox из множества маленьких BoundingBox для распознавания лиц
Я использовал предварительно обученный базовый код модели обнаружения лица (matlab) для обнаружения лица, определения позы и ориентира с помощью предварительно обученных моделей. и у меня есть следующие результаты: 2
Мой вопрос: как я могу получить большую ограничивающую рамку для извлечения обнаруженного лица, например: 3
Вы можете скачать код и изображения отсюда: https://www.ics.uci.edu/~xzhu/face/face-release1.0-basic.zip
% compile.m should work for Linux and Mac.
% To Windows users:
% If you are using a Windows machine, please use the basic convolution (fconv.cc).
% This can be done by commenting out line 13 and uncommenting line 15 in
% compile.m
compile;
% load and visualize model
% Pre-trained model with 146 parts. Works best for faces larger than 80*80
load face_p146_small.mat
% % Pre-trained model with 99 parts. Works best for faces larger than 150*150
% load face_p99.mat
% % Pre-trained model with 1050 parts. Give best performance on localization, but very slow
% load multipie_independent.mat
disp('Model visualization');
visualizemodel(model,1:13);
disp('press any key to continue');
pause;
% 5 levels for each octave
model.interval = 5;
% set up the threshold
model.thresh = min(-0.65, model.thresh);
% define the mapping from view-specific mixture id to viewpoint
if length(model.components)==13
posemap = 90:-15:-90;
elseif length(model.components)==18
posemap = [90:-15:15 0 0 0 0 0 0 -15:-15:-90];
else
error('Can not recognize this model');
end
ims = dir('images/*.jpg');
for i = 1:length(ims),
fprintf('testing: %d/%d\n', i, length(ims));
im = imread(['images/' ims(i).name]);
clf; imagesc(im); axis image; axis off; drawnow;
tic;
bs = detect(im, model, model.thresh);
bs = clipboxes(im, bs);
bs = nms_face(bs,0.3);
dettime = toc;
% show highest scoring one
figure,showboxes(im, bs(1),posemap),title('Highest scoring detection');
% show all
%figure,showboxes(im, bs,posemap),title('All detections above the threshold');
fprintf('Detection took %.1f seconds\n',dettime);
disp('press any key to continue');
pause;
close all;
end
disp('done!');
Я думаю, что кординаты маленьких ограничивающих рамок определяются как:
** bs.xy = **
313 209 352 248
305 209 344 248
305 209 344 248
321 209 360 248
329 209 368 248
313 193 352 232
313 177 352 216
313 161 352 200
313 153 352 192
289 153 328 192
281 153 320 192
273 153 312 192
281 145 320 184
273 145 312 184
265 153 304 192
249 137 288 176
257 129 296 168
273 121 312 160
289 129 328 168
305 137 344 176
337 153 376 192
345 153 384 192
353 153 392 192
345 145 384 184
353 145 392 184
361 153 400 192
377 137 416 176
369 129 408 168
353 129 392 168
...
385 225 424 264
385 209 424 248
393 185 432 224
393 161 432 200