function LMphotoalbum(varargin); % % LMphotoalbum(D, pagename); % % or % % for i = 1:length(D); % folderlist{i} = D(i).annotation.folder; % filelist{i} = D(i).annotation.filename; % end % LMphotoalbum(folderlist, filelist, pagename); % % This function allows building an interface that communicates with the % LabelMe web annotation tool. % % It can be used to label specific images. % % You can use this to label images that have some characteristic that you % want. You can use this function in combination with the LMquery function. % % For instance, if you want to create a web page with images only of % kitchens so that the thumbnails are connected to the LabelMe web % annotation tool online, you can do the next thing: % % [D,j] = LMquery(D, 'folder', 'kitchen'); % LMphotoalbum(D, 'myphotoalbum.html'); % % This will create a web page with thumbnails of the selected images. But % more importantly, the images will be link with the LabelMe online tool. % So, whenever you will click on one image it will call the annotation tool % and will open that specific image showing the annotations available % online (not the local ones that you have). Now you can label more objects % in that image and download later the annotations. if nargin == 2 D = varargin{1} pagename = varargin{2}; for i = 1:length(D) folderlist{i} = D(i).annotation.folder; filelist{i} = D(i).annotation.filename; end ADDSUMMARY = 1; end if nargin > 2 folderlist = varargin{1}; filelist = varargin{2}; pagename = varargin{3}; ADDSUMMARY = 0; end Nimages = length(folderlist); webpage = 'http://labelme.csail.mit.edu/tool.html?collection=LabelMe' % Hearder page = {}; page = addline(page, 'LabelMe photoalbum'); page = addline(page, 'LabelMe
'); if ADDSUMMARY [names, counts] = LMobjectnames(D); [foo, ndxn] = sort(-counts); names = names(ndxn); counts = counts(ndxn); page = addline(page, 'Database summary:
'); page = addline(page, sprintf('There are %d images
', Nimages)); page = addline(page, sprintf('There are %d polygons
', sum(counts))); page = addline(page, sprintf('There are %d descriptions
', length(names))); page = addline(page, sprintf('Last update: %s
', date)); page = addline(page, ' List of objects:
'); page = addline(page, '
'); for no = 1:length(names) page = addline(page, sprintf('
  • %s (%d instances)
    ', names{no}, counts(no))); end page = addline(page, '
  • '); page = addline(page, '

    '); else page = addline(page, ' Photoalbum
    '); page = addline(page, '

    '); page = addline(page, sprintf('There are %d images.
    ', Nimages)); page = addline(page, 'Click on an image to visualize it with the online annotation tool
    '); end % Create links for each image for i = 1:Nimages imageline = sprintf('', ... folderlist{i}, filelist{i}); page = addline(page, ... [sprintf('%s', ... webpage, folderlist{i}, filelist{i}, imageline)]); end page = addline(page, '

    '); % Close web page page = addline(page, ''); % write web page fid = fopen(pagename,'w'); for i = 1:length(page); fprintf(fid, [page{i} '\n']); end fclose(fid); function page = addline(page, line) page = [page {line}];