Rev | Line | |
---|
[138] | 1 | %Script markFeatures |
---|
| 2 | %For marking eye and mouth positions in face images. |
---|
| 3 | %Writes a file called Labels.mat, in which each row indexes an image, and |
---|
| 4 | %the columns are [x,y] positions of subject's right eye, [x,y] left eye, |
---|
| 5 | %and [x,y] of mouth. Specify the image directory and the destination |
---|
| 6 | %directory (Where you want the labels saved) at the top of the script. |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | imgdir = 'C:\Documents and Settings\Marian Bartlett\My Documents\TestDir\FaceImages\' |
---|
| 10 | destdir = 'C:\Documents and Settings\Marian Bartlett\My Documents\TestDir\' |
---|
| 11 | |
---|
| 12 | cd (imgdir) |
---|
| 13 | r = dir; |
---|
| 14 | |
---|
| 15 | %get marks |
---|
| 16 | marks = []; |
---|
| 17 | for i = 3:(size(r,1)) |
---|
| 18 | t = r(i).name; |
---|
| 19 | [X,map] = imread([ t ]); |
---|
| 20 | |
---|
| 21 | figure(1); |
---|
| 22 | colormap gray; |
---|
| 23 | if isfloat(X) |
---|
| 24 | image(gray2ind(mat2gray((X)))); |
---|
| 25 | else |
---|
| 26 | image(X); |
---|
| 27 | end |
---|
| 28 | title(t); |
---|
| 29 | disp 'Click subjects right eye, left eye, then mouth.' |
---|
| 30 | [m,n] = ginput(3); pos = round([m,n]); |
---|
| 31 | pos = reshape(pos',1,6); |
---|
| 32 | marks = [marks; pos]; |
---|
| 33 | end |
---|
| 34 | |
---|
| 35 | cd (destdir) |
---|
| 36 | save Labels marks r |
---|
Note: See
TracBrowser
for help on using the repository browser.