www.pudn.com > firev0.01.rar > extractinvfeatvec.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 "image.hpp"
#include "rgbimage.hpp"
#include "colorpixel.hpp"
#include "invariantfeature.hpp"
#include "getpot.hpp"
#include "diag.hpp"
#include "invfeatvec.hpp"

using namespace std;
using namespace img;

void USAGE() {
  cout << "USAGE: extractInvFeatVec " << endl
       << "     -cvec    feature extraction (rgb version)" << endl
       << "     -gvec    feature extraction (grey version)" << endl
       << "        can get: -suffix (default: .colorinvfeatvec/.greyinvfeatvec)" << endl
       << "        can get: -samples (default: -1=all)" << endl
       << endl;
}

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

  vector unidentified=cl.unidentified_options(4,
                                                      "-cvec", 
                                                      "-gvec",
                                                      "-samples",
                                                      "-suffix"
                                                      );
  if(unidentified.size()!=0) {
    cout << "Unknown parameters: ";
    for(unsigned int i=0;i img;
    img.load(cl.follow("","-cvec"));
    
    InvFeatVec vec;
    vec.getData(img,cl.follow(10,"-R"),cl.follow(-1,"-samples"));
    vec.save(filename+string(cl.follow(".colorinvfeatvec","-suffix")));
    
  } else if(cl.search("-gvec")) {
    string filename=cl.follow("","-gvec");
    BaseImage img;
    img.load(cl.follow("","-gvec"));
    
    InvFeatVec vec;
    vec.getData(img,cl.follow(10,"-R"),cl.follow(-1,"-samples"));
    vec.save(filename+string(cl.follow(".greyinvfeatvec","-suffix")));
  } else {
    USAGE();
    exit(20);
  }
}