The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

output.m

Go to the documentation of this file.
00001 %
00002 %  output.m
00003 % 
00004 %   Created by Rhan Dahl on Thu Apr 18 2002.
00005 %  
00006 %   Copyright (c) 2002 Machine Perception Laboratory 
00007 %   University of California San Diego.
00008 % 
00009 % Please read the disclaimer and notes about redistribution 
00010 % at the end of this file. 
00011 % 
00012 
00013 function [] = output(ci)
00014 
00015 
00016 ci = shape_all_features(ci);
00017 
00018 fid = fopen('ci.xml', 'w');
00019 
00020 windowsize = ci.patchSize;
00021 
00022 fprintf(fid, '<?xml version="1.0"?>\n\n');
00023 fprintf(fid, '<FeatureDB>\n');
00024 
00025 indent(fid, 1);
00026 fprintf(fid, '<PatchSize value="%d"/>\n', ci.patchSize);
00027 
00028 indent(fid, 1);
00029 fprintf(fid, '<NormWindow topLeftX="%d" topLeftY="%d" botRtX="%d" botRtY="%d"/>\n', ci.hwj(1)-1, ci.hwi(1)-1, ci.hwj(4)-1, ci.hwi(4)-1);
00030 
00031 indent(fid, 1);
00032 fprintf(fid, '<Cascades>\n');
00033 for cascade = 1:ci.numCascade
00034 
00035   indent(fid, 2);
00036   fprintf(fid, '<Cascade ');
00037   fprintf(fid, 'cid="%d" ', cascade-1);
00038   fprintf(fid, 'start="%d" ', ci.cascade(cascade).start-1);
00039   fprintf(fid, 'end="%d" ', ci.cascade(cascade).end-1);
00040   fprintf(fid, 'thresh="%g"', ci.cascade(cascade).thresh);
00041   fprintf(fid, '/>\n');
00042 
00043 end
00044 indent(fid, 1);
00045 fprintf(fid, '</Cascades>\n');
00046 
00047 
00048 indent(fid, 1);
00049 fprintf(fid, '<Features>\n');
00050 for feature = 1:ci.numClassifiers,
00051 
00052   indent(fid, 2);
00053   fprintf(fid, '<Feature ');
00054   fprintf(fid, 'fid="%d" ', feature-1);
00055   fprintf(fid, 'alpha="%g" ', ci.Alphas(feature));
00056   fprintf(fid, 'bias="%g" ', ci.Bias(feature));
00057   fprintf(fid, 'weight="%d" ', ci.Weights{feature});
00058   fprintf(fid, 'abs="%d"', ci.abs(feature));
00059   fprintf(fid, '>\n');
00060 
00061   
00062   for corner = 1:length(ci.shape_feature(feature).c)
00063     x = ci.shape_feature(feature).i(corner) - 1;
00064     y = ci.shape_feature(feature).j(corner) - 1;
00065     c = ci.shape_feature(feature).c(corner);
00066 
00067     indent(fid, 3);
00068     fprintf(fid, '<Corner x="%d" y="%d" value="%d"/>\n', y, x, c);
00069   end
00070   indent(fid, 2);
00071   fprintf(fid, '</Feature>\n');
00072 end
00073 indent(fid, 1);
00074 fprintf(fid, '</Features>\n');
00075 
00076 indent(fid, 1);
00077 fprintf(fid, '<StdAdjusts ');
00078 fprintf(fid, 'length="%d">\n',length(ci.std_adjust));
00079 for StdAdjust = 1:length(ci.std_adjust)
00080   indent(fid, 2);
00081   fprintf(fid, '<v ');
00082   fprintf(fid, 'val="%g"', ci.std_adjust(StdAdjust));
00083   fprintf(fid, '/>\n');
00084 end
00085 indent(fid, 1);
00086 fprintf(fid, '</StdAdjusts>\n');
00087 
00088 
00089 fprintf(fid, '</FeatureDB>\n');
00090 
00091 fclose(fid);
00092 
00093 function [ ] = indent(fid, x)
00094   for i = 1:x
00095     fprintf(fid, '  ');
00096   end
00097 
00098 
00099 %%%%%%%%%%%%%%%%%%%%%
00100 % Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00101 % 
00102 %    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00103 %    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
00104 %    3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
00105 % 
00106 % THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00107 

Generated on Mon Nov 8 17:07:46 2004 for MPT by  doxygen 1.3.9.1