www.pudn.com > firev0.01.rar > extractinvfeathisto.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
*/
#include 
#include 
#include "diag.hpp"
#include "getpot.hpp"
#include "featureextraction.hpp"
#include "fuzzy3histo.hpp"
#include "rgbimage.hpp"
#include "relfeatureextraction.hpp"
#include "basetools.hpp"
using namespace std;
using namespace diag;
using namespace img;


void USAGE(string error="") {
  if(error!="") {
    cout << "ERROR: " << error << endl;
  }
  cout << "USAGE: " << endl
       << "   extractinvfeathisto" << endl
       << "      -frgb, -fgrey or -rel for different feature histograms" << endl
       << "      -suffix" << endl
       << "      -suffix" << endl
       << "      -featurefunction" << endl
       << "      -steps" << endl
       << "      -samples" << endl
       << "      -scalingStart" << endl
       << "      -scalingMulti" << endl
       << "      -scalingStop"<< endl
       << "      -rotationAngle (default: 360)" << endl
       << endl;
}

int main(int argc, char ** argv) {
  GetPot cl(argc, argv);

  string cmdline="";

  for(int i=0;i unidentified=cl.unidentified_options(12,
                                                      "-h",
                                                      "-suffix",
                                                      "-featurefunction",
                                                      "-steps",
                                                      "-samples",
                                                      "-frgb",
                                                      "-fgrey",
                                                      "-rel",
                                                      "-scalingStart",
                                                      "-scalingMulti",
                                                      "-scalingStop",
                                                      "-rotationAngle"
                                                      );
  if(unidentified.size()!=0) {
    cout << "Unknown parameters: ";
    for(unsigned int i=0;i img;
    img.load(filename);
    BaseImage grey=img.greyImage();
    
    MDHistogram histo=extractRelationalFeatureHistogram(grey,
                                                                     cl.follow("rel:X1=0Y1=0X2=0Y2=4","-featurefunction"),
                                                                     cl.follow(8,"-steps"),
                                                                     cl.follow(-1,"-samples")
                                                                     );
    
    histo.save(filename+string(cl.follow(".relhisto","-suffix")),cmdline);
    
  } else {
    USAGE();
    exit(20);
  }
  
  printCmdline(argc,argv);
}