GenerateHtml

PURPOSE ^

GenerteHtml - Generates html page for experimental results

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 GenerteHtml - Generates html page for experimental results

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % GenerteHtml - Generates html page for experimental results
0002 %
0003 
0004 addpath common
0005 
0006 Iname = {'pelican 2_big.jpg','pelican3.jpg',...
0007     'pelican4.jpg','pelican5.jpg','pelican6.jpg',...
0008     'pelican7.jpg','pelican8.jpg','pelican9.jpg',...
0009     'pelican10.jpg'};
0010 Iname_pelican = Iname;
0011 imScale = [0.25 0.4 0.4 0.4 ...
0012     0.22 0.36 0.5 0.4 0.3];
0013 
0014 category = 'pelican';
0015 overlay_pelican = cell(length(imScale),1);
0016 j_detection = 1;
0017 for i = 1:length(imScale)
0018     load(sprintf('result/%s/detectionResult%d_%s.mat',category,j_detection,Iname{i}),...
0019                 'im','mask','S3Map','M2Map');
0020     overlay_pelican{i} = im + 400 * mask;
0021 end
0022 
0023 Iname = {'l1.jpg','l2.jpg','l3.jpg','l4.jpg','l5.jpg',...
0024     'l6.jpg','l7.jpg','l8.jpg','l9.jpg','l10.jpg',...
0025     'l11.jpg','l12.jpg','l13.jpg','l14.jpg','l15.jpg',...
0026     'l16.jpg','l17.jpg','l18.jpg','l19.jpg','l20.jpg',...
0027     'l21.jpg', 'l22.jpg','l23.jpg','l24.jpg','l25.jpg',...
0028     'l26.jpg','l27.jpg','l28.jpg','l29.jpg','l30.jpg',...
0029     'l4_dup.jpg', 'l12_dup.jpg', 'l12_dup2.jpg'};
0030 Iname_egret = Iname;
0031 imScale = [1.2 1.2 1 2 1,...
0032     1 1.2 0.9 0.9 1,...
0033     0.95 1 1.1 1 1,...
0034     1.1 0.8 1.2 1.2 0.9,...
0035     .55 .3,.3 .25 .3 ...
0036     .3 .4,.3 .35 .3,...
0037     1.15 1.1 1.2];
0038 category = 'egret';
0039 overlay_egret = cell(length(imScale),1);
0040 j_detection = 1;
0041 for i = 1:length(imScale)
0042     load(sprintf('result/%s/detectionResult%d_%s.mat',category,j_detection,Iname{i}),...
0043                 'im','mask','S3Map','M2Map');
0044     overlay_egret{i} = im + 400 * mask;
0045 end
0046 
0047 %%
0048 selected_egret = 1:33;
0049 selected_pelican = 1:9;
0050 
0051 overlay = [overlay_egret(selected_egret);overlay_pelican(selected_pelican)];
0052 Iname = [Iname_egret(selected_egret) Iname_pelican(selected_pelican)];
0053 
0054 %% write the html code for reproducibility page
0055 
0056 % delete the previous version
0057 html_dir = 'document/html';
0058 if ~exist(html_dir,'dir')
0059     mkdir(html_dir);
0060 else
0061 %     rmdir(html_dir,'s');
0062 %     mkdir(html_dir);
0063 end
0064 html_path = sprintf('%s/exp.html',html_dir);
0065 html = fopen(html_path,'w');
0066 
0067 html_img_dir = 'document/html/img/';
0068 if ~exist(html_img_dir,'dir')
0069     mkdir(html_img_dir);
0070 end
0071 
0072 tmp = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n';
0073 tmp = [tmp '<html xmlns="http://www.w3.org/1999/xhtml">\n'];
0074 tmp = [tmp '<head profile="http://gmpg.org/xfn/11">\n'];
0075 tmp = [tmp '<title>Active Ellipsoid</title>\n'];
0076 tmp = [tmp '</head>\n'];
0077 fprintf(html,tmp);
0078 fprintf(html, '<body>\n');
0079 fprintf(html, '<h1> Active Ellipsoid Experiment </h1>');
0080 fprintf(html, '<p> ');
0081 fprintf(html, [' A two-level active basis model is contructed and used to detect egrets in images, with moderate deformation, ' ...
0082     'and location/scale uncertainty.' ...
0083     ]);
0084 fprintf(html, ' </p> <br/>');
0085 
0086 for k = 1:length(overlay)
0087     if k <= length(selected_egret)
0088         im = imread(sprintf('image/egret/%s',Iname{k}));
0089     else
0090         im = imread(sprintf('image/pelican/%s',Iname{k}));
0091     end
0092     
0093     for c = 1:3
0094         frames{2*(k-1)+1,c} = im(:,:,c); % source image
0095         frames{2*(k-1)+2,c} = overlay{k}; % overlay
0096     end
0097     
0098     for c = 1:3
0099         channel{c} = displayImages(frames(2*(k-1)+(1:2),c),2,size(im,1),size(im,2),...
0100             true,0,0);
0101     end
0102     
0103     towrite = zeros(size(channel{1}),'uint8');
0104     for c = 1:3
0105         towrite(:,:,c) = channel{c};
0106     end
0107     
0108     % eps figure
0109     figure;
0110     imshow(towrite);
0111     saveas(gcf,sprintf('document/html/img/%s.eps',Iname{k}),'epsc');
0112     close;
0113     % jpg figure
0114     imwrite(uint8(towrite),sprintf('document/html/img/%s',Iname{k}));
0115 end
0116 
0117 % move the shape script template to the image folder
0118 src = 'result/egret/egret_template.eps';
0119 dst = 'document/html/img/egret_template.eps';
0120 copyfile(src,dst);
0121 src = 'result/egret/template.png';
0122 dst = 'document/html/img/egret_template.png';
0123 copyfile(src,dst);
0124 
0125 
0126 fprintf(html, '<hr /> \n');
0127 fprintf(html, sprintf('<h3>%s</h3>','egret and pelican examples'));
0128 tmp = sprintf('<p>The shape script is a two level active basis template: </p>\n');
0129 tmp = [tmp '<img src=img/egret_template.png width=400 alt="" />'];
0130 tmp = [tmp '<a href=img/egret_template.eps>eps</a>'];
0131 fprintf(html, tmp);
0132 
0133 tmp = sprintf('<p>The following figure illustrates the detection result using the above shape script. ');
0134 tmp = [tmp '</p>\n'];
0135 fprintf(html, tmp);
0136 
0137 for k = 1:length(overlay)
0138     % output the figure to html
0139     new_img_name = sprintf('%s_activebasis.png',category);
0140     fprintf(html, sprintf('<img src="img/%s" alt="" height="100" /> \n',Iname{k}) );
0141     fprintf(html, sprintf('<a href=img/%s.eps>eps</a>\n',Iname{k}) );
0142 end
0143 
0144 fprintf(html, '</body> </html> \n');
0145 fclose(html);
0146

Generated on Sat 23-Jan-2010 22:26:10 by m2html © 2005