www.pudn.com > firev0.01.rar > extractcolorhisto.cpp


/*
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
*/
/**
* @file   extractColorHisto.cpp
* @author Thomas Deselaers
* @date   Mon Jun 23 19:04:38 2003
* 
* @brief Extract color histogram from an image.
* 
* 
* Copyright notice
* © Thomas Deselaers 
* All right reserved
*
* This software may not be published and not used for any comercial
* applications without explicit written agreement from the author
* 
*/

#include 
#include 
#include "getpot.hpp"
#include "diag.hpp"
#include "image.hpp"
#include "rgbimage.hpp"
#include "mdhistogram.hpp"
#include "histogram.hpp"
#include "pseudorgbhisto.hpp"

using namespace img;

void extractMDColorHisto(const char *fn, int steps) {
  string filename(fn);

  RGBImage image;
  
  image.load(fn);
  
  MDHistogram< ColorPixel > mdhisto(ColorPixel(0,0,0),steps,ColorPixel(255,255,255),3);
  for(unsigned int y=0;y image;
  
  image.load(fn);
  
  PseudoRGBHistogram histo(ColorPixel(0,0,0),steps,ColorPixel(255,255,255));
  for(unsigned int y=0;y image;
  
  image.load(fn);
  
  Histogram histo(0,steps,255);
  for(unsigned int y=0;y] (-pseudocolorhisto|-greyhisto|-mdcolorhisto) " << endl;
}

int main(int argc, char **argv) {
  GetPot cl(argc, argv);
  
  if(cl.search("-mdcolorhisto")) {
    extractMDColorHisto(cl.follow("no filename given","-mdcolorhisto"),cl.follow(8,"-steps"));
  } else if(cl.search("-pseudocolorhisto")) {
    extractPseudoMDColorHisto(cl.follow("no filename given","-pseudocolorhisto"),cl.follow(64,"-steps"));
  } else if(cl.search("-greyhisto")) {
    extractGreyHisto(cl.follow("no filename given", "-greyhisto"),cl.follow(256,"-steps"));
  } else {
    USAGE();
  }
}