-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_annotation.m
43 lines (36 loc) · 1.23 KB
/
show_annotation.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
39
40
41
42
43
function show_annotation(imgfile, annotation_file);
%%
%% imgfile: string
%% annotation_file: string
%%
IMTYPE = 'jpg';
GUIDELINE_MODE = 1;
%% Parameters
%label_abbrev = {'LE', 'RE', 'LN', 'NB', 'RN', 'LM', 'RM'};
LARGEFONT = 28;
MEDFONT = 18;
BIG_WINDOW = get(0,'ScreenSize');
SMALL_WINDOW = [100 100 512 480];
%% load the annotated data
load(annotation_file, 'box_coord', 'obj_contour');
%% Read and display image
ima = imread(imgfile);
ff=figure(1); clf; imagesc(ima); axis image; axis ij; hold on;
% black and white images
if length(size(ima))<3
colormap(gray);
end
set(ff,'Position',SMALL_WINDOW);
%% show box
box_handle = rectangle('position', [box_coord(3), box_coord(1), box_coord(4)-box_coord(3), box_coord(2)-box_coord(1)]);
set(box_handle, 'edgecolor','y', 'linewidth',5);
%% show contour
obj_contour = round(obj_contour);
for cc = 1:size(obj_contour,2)
if cc < size(obj_contour,2)
plot([obj_contour(1,cc), obj_contour(1,cc+1)]+box_coord(3), [obj_contour(2,cc), obj_contour(2,cc+1)]+box_coord(1), 'r','linewidth',4);
else
plot([obj_contour(1,cc), obj_contour(1,1)]+box_coord(3), [obj_contour(2,cc), obj_contour(2,1)]+box_coord(1), 'r','linewidth',4);
end
end
title(imgfile);