forked from sourenaKhanzadeh/face_detection_ml_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlook_at_test_images_gt.m
38 lines (33 loc) · 1.04 KB
/
look_at_test_images_gt.m
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
29
30
31
32
33
34
35
36
37
38
imageDir = 'test_images';
imageList = dir( fullfile( imageDir, '*.jpg'));
fid = fopen('test_images_gt.txt');
gt_bounding_boxes = textscan(fid, '%s %d %d %d %d');
fclose(fid);
nImages = length(imageList);
for i = 1:nImages
close all
imageName = imageList(i).name;
fprintf('Visualizing faces in %s\n', imageName)
im = im2double(imread(fullfile( imageDir, imageName)));
if(size(im,3) > 1)
im = rgb2gray(im);
end
faces = strcmp(imageName, gt_bounding_boxes{1,1});
faces = find(faces);
figure(1)
imshow(im)
hold on;
for j = 1:length(faces)
bbox = [gt_bounding_boxes{2}(faces(j)) ...
gt_bounding_boxes{3}(faces(j)) ...
gt_bounding_boxes{4}(faces(j)) ...
gt_bounding_boxes{5}(faces(j))];
plot_rectangle = [bbox(1), bbox(2); ...
bbox(1), bbox(4); ...
bbox(3), bbox(4); ...
bbox(3), bbox(2); ...
bbox(1), bbox(2)];
plot( plot_rectangle(:,1), plot_rectangle(:,2) , 'g-')
end
pause;
end