www.pudn.com > firev0.01.rar > globaltexturefeature.hpp


/*
This file is part of the FIRE -- Flexible Image Retrieval System

FIRE is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

FIRE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with FIRE; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
#ifndef __globaltexturefeature_hpp
#define __globaltexturefeature_hpp

#include "image.hpp"
#include "rgbimage.hpp"



class GlobalTextureFeature : public BaseFeature {
public:
  GlobalTextureFeature();
  virtual const double operator[](const unsigned int i) const;
  virtual const unsigned int size() const;
  void calculate(const ::img::RGBImage &image);
  void calculate(const ::img::BaseImage &image);
  void save(const ::std::string filename) const;
  void load(const ::std::string filename) ;
    
private:
  vector data_;
  
  /**
   *	Fractal dimension feature computation.
   *	1 feature value is calculated.
   */
  void calc_fractal_dim(const ::img::BaseImage & image,	double & fractal_dim);
  
  /**
   *	Histogram feature computation.
   *	2 feature values are calculated.
   */
  void calc_histogramm(const ::img::BaseImage & image, double &Coarseness, double &Entropy);
  
  /**
   *	Circular Moran function.
   *	8 feature values are calculated.
   */
  void Circ_Moran(const ::img::BaseImage &image,
                  double & Circ1,  double & Circ2,
                  double & Circ3,  double & Circ4,
                  double & Circ1m, double & Circ2m,
                  double & Circ3m, double & Circ4m);
  
  /**
   *	Calculate SGLD statistics for a (hard-wired) number of distances, angles.
   *	Number of distances = 2 (1,2).
   *	Number of angles = 4 (0 deg =0, 45 deg =1, 90 deg =2, 135 deg. =3).
   *	Thus, 32 feature values are calculated.
   *
   *	@param mean						size (2*4)
   *	@param contrast					size (2*4)
   *	@param angular_second_moment	size (2*4)
   *	@param entropy					size (2*4)
   */
  void sgld_statistics(const ::img::BaseImage &image,
                       vector &mean,
                       vector &contrast,
                       vector &angular_second_moment,
                       vector &entropy);
  
  
};


#endif