/* * mp_BHAT * * Author: Andrew Salamon * Date: Tue Jan 30 2007 * * Copyright (c) 2006 Machine Perception Laboratory * University of California San Diego. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 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. * 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. * * 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. * */ #ifndef __MP_BHAT_H__ #define __MP_BHAT_H__ #include /** This class loads and holds BHAT weight values for the CERT MLR detector. * The weights are loaded from a file in the constructor, which could fail and possibly throw an exception. */ class mp_BHAT { public: mp_BHAT( const std::string &_filename ); ~mp_BHAT(); const double *getWeights() const { return weights; } // Which directory (if any) we should look in to find data files void setDirectory( const std::string &dir ); const std::string &getDirectory(); void clearWeights(); bool getLoadError(); ///< Will be true if any errors occured during loading. unsigned int getCount() const { return count; } ///< Number of 'Action Units'. E.g. three for AU 1+2+4 std::string getSourceFile() const { return sourceFile; } ///< Name of the Matlab data file used to generate the weights files std::string getCreateDate() const { return createDate; } ///< Date the weights files were created std::string getCertVersion() const { return certVersion; } ///< SVN revision number of the data and source used to generate the weights files private: const double *weights; unsigned int count; std::string filename; std::string directory; bool loadError; ///< Will be set if any files failed to load. std::string sourceFile; std::string createDate; std::string certVersion; const double *loadWeights(); const double *loadWeightsBinary(); const double *loadWeightsXML(); }; #endif