-
Notifications
You must be signed in to change notification settings - Fork 0
/
annotationDetail.m
62 lines (46 loc) · 1.57 KB
/
annotationDetail.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
%%
%Get content of the directory
contents = dir ('*.jpg');
excelFilename = 'test.xlsx';
%Preallocating Variables
height = zeros(numel(contents),1);
width = zeros(numel(contents),1);
nameFile{numel(contents),1} = [];
annPoint = zeros(numel(contents),1);
%Loop to iterate through images
for i = 1:numel(contents)
%Processing for Image details
filename = contents(i).name;
readImage1 = imread(filename);
[path name] = fileparts(filename);
out_filename = sprintf('%s.jpg', name);
[x1,y1,z1] = size(readImage1);
height(i) = x1;
width(i) = y1;
nameFile(i) = {out_filename};
%Processing for Annotation details
matFileName = sprintf('%s_ann.mat', name);
m = matfile(matFileName);
[numrow, numcol] = size(m, 'annPoints');
annPoint(i) = numrow;
end
%Writing Values to Excel file
xlswrite(excelFilename,nameFile,1,'A2');
xlswrite(excelFilename,height,1,'B2');
xlswrite(excelFilename,width,1,'C2');
xlswrite(excelFilename,annPoint,1,'D2');
cell4height=[ 'B' num2str(i)];
cell4width = [ 'C' num2str(i)];
cell4name = [ 'A' num2str(i)];
A = [out_filename];
xlswrite(excelFilename,{out_filename},1,cell4name);
xlswrite(excelFilename,x1,1,cell4height);
xlswrite(excelFilename,y1,1,cell4width);
m = matfile('Image002_ann_Copy.mat');
[numrow, numcol] = size(m, 'annPoints');
filename = 'Image002_ann_Copy.mat';
m = matfile(filename);
filename = 'test.xlsx';
readImage1=imread('Image044.jpg');
[x1,y1,z1] = size(readImage1);
xlswrite(filename,x1)