GroupClassifier::GroupClassifier(char *trained_boost_filename, RegionClassifier *character_classifier) :  character_classifier_(character_classifier)
{

	assert(trained_boost_filename != NULL);
	assert(character_classifier != NULL);

	ifstream ifile1(trained_boost_filename);
	if (ifile1) 
	{
		//fprintf(stdout,"Loading boost character classifier ... \n");
		boost_.load(trained_boost_filename, "boost");
	} else {
		fprintf(stderr,"Boost character classifier, file not found! \n");
		exit(-1);
	}
}
示例#2
0
文件: check.C 项目: XuQiao/HI
void check() {
    /*
     TString   name = "../filelistMWGfvtx.dat";
     TString   namec = "../filelistMWGfvtxcalib.dat";
     TString   name1 = "../filelistMWGfvtx1.dat";
     TString   name2 = "../filelistMWGfvtx2.dat";
     TString   name1c = "../filelistMWGfvtx1calib.dat";
     TString   name2c = "../filelistMWGfvtx2calib.dat";

    */
    TString   name = "../filelistMWGmb.dat";
    TString   namec = "../filelistMWGmbcalib.dat";
    TString   name1 = "../filelistMWGmb1.dat";
    TString   name2 = "../filelistMWGmb2.dat";
    TString   name1c = "../filelistMWGmb1calib.dat";
    TString   name2c = "../filelistMWGmb2calib.dat";

    //  ofstream fout("checkfvtx.out");
    //ofstream fout("checkfvtx1.out");
    ofstream fout("checkmb.out");
    // for(int i=0;i<1376;i++){
    float bbcv;
    float bbcvc;
    float bbcv1;
    float bbcv1c;
    float bbcv2;
    int nfvtxtrack1;
    int nfvtxtrack1c;
    int nfvtxtrack2;
    int nfvtxtrack2c;
    for(int i=0; i<754; i++) {
        if(i!=693 && i!=44)continue;
        //    for(int i=256;i<258;i++){
        //  if(i!=170 && i!=171 && i!=174 && i!=178 && i!=257 && i!=300 && i!=460 && i!=491 && i!=535 && i!=621)continue;
        //    if(i!=43)continue;
        TString ifile(readline(Form("%s",name.Data()),i));
        TString ifilec(readline(Form("%s",namec.Data()),i));
        TString ifile1(readline(Form("%s",name1.Data()),i));
        TString ifile2(readline(Form("%s",name2.Data()),i));
        TString ifile1c(readline(Form("%s",name1c.Data()),i));
        TString ifile2c(readline(Form("%s",name2c.Data()),i));
        TFile *f = TFile::Open(ifile);
        TFile *fc = TFile::Open(ifilec);
        TFile *f1 = TFile::Open(ifile1);
        TFile *f2 = TFile::Open(ifile2);
        TFile *f1c = TFile::Open(ifile1c);
        TFile *f2c = TFile::Open(ifile2c);
        TTree *t = (TTree*)f->Get("tree");
        TTree *tc = (TTree*)fc->Get("tree");
        TTree *t1 = (TTree*)f1->Get("tree");
        TTree *t2 = (TTree*)f2->Get("tree");
        TTree *t1c = (TTree*)f1c->Get("tree");
        TTree *t2c = (TTree*)f2c->Get("tree");
        t->SetBranchAddress("bbcv",&bbcv);
        tc->SetBranchAddress("bbcv",&bbcvc);
        t1->SetBranchAddress("bbcv",&bbcv1);
        t1c->SetBranchAddress("bbcv",&bbcv1c);
        t2->SetBranchAddress("bbcv",&bbcv2);
        t1->SetBranchAddress("nfvtxtrack",&nfvtxtrack1);
        t1c->SetBranchAddress("nfvtxtrack",&nfvtxtrack1c);
        t2->SetBranchAddress("nfvtxtrack",&nfvtxtrack2);
        t2c->SetBranchAddress("nfvtxtrack",&nfvtxtrack2c);
        cout<<t->GetEntries()<<"\t"<<tc->GetEntries()<<"\t"<<t1->GetEntries()<<"\t"<<t1c->GetEntries()<<"\t"<<t2->GetEntries()<<"\t"<<t2c->GetEntries()<<"\t";
        fout<<t->GetEntries()<<"\t"<<tc->GetEntries()<<"\t"<<t1->GetEntries()<<"\t"<<t1c->GetEntries()<<"\t"<<t2->GetEntries()<<"\t"<<t2c->GetEntries()<<"\t";
        // cout<<ifile<<"\t";//<<t2->GetEntries();
        t->GetEntry(t->GetEntries()-100);
        tc->GetEntry(tc->GetEntries()-100);
        t1->GetEntry(t1->GetEntries()-100);
        t1c->GetEntry(t1c->GetEntries()-100);
        t2->GetEntry(t1->GetEntries()-100);
        t2c->GetEntry(t1c->GetEntries()-100);
//            t->GetEntry(0);
//            t1->GetEntry(0);
        //          cout<<bbcv<<"\t"<<bbcvc<<"\t"<<bbcv1<<"\t"<<bbcv1c<<"\t"<<bbcv2<<endl;
        //          cout<<nfvtxtrack1<<"\t"<<nfvtxtrack1c<<"\t"<<nfvtxtrack2<<"\t"<<nfvtxtrack2c<<endl;
//           fout<<t->GetEntries()<<"\t"<<tc->GetEntries()<<"\t"<<t1->GetEntries()<<"\t"<<t1c->GetEntries()<<"\t"<<t2->GetEntries()<<"\t"<<t2c->GetEntries();
        if(tc->GetEntries()!=t2c->GetEntries() || nfvtxtrack1c != nfvtxtrack2c)
            //  if(tc->GetEntries()!=t1c->GetEntries() || bbcvc!=bbcv1c)
        {
            cout<<"BAD";
            fout<<"BAD";
        }
        if(tc->GetEntries()!=0)
            if(1.0*t->GetEntries() / tc->GetEntries()>1.01)
            {
                cout<<"Number BAD!";
                fout<<"Number BAD!";
            }
        if(t1c->GetEntries()!=0)
            if(1.0*t1->GetEntries() / t1c->GetEntries()>1.01)
            {
                cout<<"Number1 BAD!";
                fout<<"Number1 BAD!";
            }
        if(t2c->GetEntries()!=0)
            if(1.0*t2->GetEntries() / t2c->GetEntries()>1.01)
            {
                cout<<"Number2 BAD!";
                fout<<"Number2 BAD!";
            }
//            if(bbcv!=bbcv1) cout<<"BAD!";
        cout<<endl;
        fout<<endl;
        f->Close();
        fc->Close();
        f1->Close();
        f1c->Close();
        f2->Close();
        f2c->Close();
    }
}
示例#3
0
int CmdPull::execute (std::string& output)
{
  context.footnote ("The 'pull' command is deprecated, and will be removed in a subsequent release.");

  std::vector <std::string> words = context.a3.extract_words ();
  std::string file;
  if (words.size ())
    file = words[0];

  Uri uri (file, "pull");
  uri.parse ();

  if (uri._data.length ())
  {
		Directory location (context.config.get ("data.location"));

    if (! uri.append ("{pending,undo,completed}.data"))
      throw format (STRING_CMD_PULL_NOT_DIR, uri._path);

		Transport* transport;
		if ((transport = Transport::getTransport (uri)) != NULL)
		{
			transport->recv (location._data + "/");
			delete transport;
		}
		else
		{
      // Verify that files are not being copied from rc.data.location to the
      // same place.
      if (Directory (uri._path) == Directory (context.config.get ("data.location")))
        throw std::string (STRING_CMD_PULL_SAME);

      // copy files locally

      // remove {pending,undo,completed}.data
      uri._path = uri.parent();

      Path path1 (uri._path + "undo.data");
      Path path2 (uri._path + "pending.data");
      Path path3 (uri._path + "completed.data");

      if (path1.exists() && path2.exists() && path3.exists())
      {
//        if (confirm ("xxxxxxxxxxxxx"))
//        {
          std::ofstream ofile1 ((location._data + "/undo.data").c_str(), std::ios_base::binary);
          std::ifstream ifile1 (path1._data.c_str()                    , std::ios_base::binary);
          ofile1 << ifile1.rdbuf();

          std::ofstream ofile2 ((location._data + "/pending.data").c_str(), std::ios_base::binary);
          std::ifstream ifile2 (path2._data.c_str()                    , std::ios_base::binary);
          ofile2 << ifile2.rdbuf();

          std::ofstream ofile3 ((location._data + "/completed.data").c_str(), std::ios_base::binary);
          std::ifstream ifile3 (path3._data.c_str()                    , std::ios_base::binary);
          ofile3 << ifile3.rdbuf();
//        }
      }
      else
      {
        throw format (STRING_CMD_PULL_MISSING, uri._path);
      }
		}

    output += format (STRING_CMD_PULL_TRANSFERRED, uri.ToString ()) + "\n";
  }
  else
    throw std::string (STRING_CMD_PULL_NO_URI);

  return 0;
}
示例#4
0
int main(int argc, char* argv[])
{
	string cfgfile;
	char* file1;
	char* file2;
	char* resultfile;

	//check inputs
    if (argc < 4) { 
        cout << "VIDEO ALIGNMENT\n"; 
        cout << "--------------------------------------------------\n"; 
        cout << "Syntax: align <video1> <video2> <result> [config]\n"; 
        cout << "\n"; 
        cout << "Example 1: align.exe video1.avi video2.avi result.txt\n"; 
        cout << "\n"; 
        cout << "Example 2: align.exe video1.avi video2.avi result.txt myconfig.ini\n"; 
        cout << "\n";         
		cout << "--------------------------------------------------\n"; 
        cout << "TCL Research America\n"; 
        cout << "Armin Kappeler\n"; 
        cout << "08//29//2013\n"; 
        cin.get();
        exit(0);
    } else { // if we got enough parameters...
		file1 = argv[1];
		file2 = argv[2];
		resultfile = argv[3];

		if (argc >=5) {
			cfgfile = argv[4];
		}else {
			cfgfile = "config.ini";
		}

		ofstream ofile(resultfile);
		if (!ofile) {
			cout << "Invalid input argument 3: invalid output filename\n";
			exit(0);
		}
		ofile.close();		
		ifstream ifile1(file1);
		if (!ifile1) {
			cout << "Invalid input argument 1: First video doesn't exist\n";
			exit(0);
		}
		ifile1.close();
		ifstream ifile2(file2);
		if (!ifile2) {
			cout << "Invalid input argument 2: Second video doesn't exist\n";
			exit(0);
		}
		ifile2.close();
		ifstream ifile3(cfgfile);
		if (!ifile3) {
			cout << "No configuration file found (Default filename: \"config.ini\")\n";
			exit(0);
		}
		ifile3.close();
	}
	//load configuration
	cout << "READ CONFIGURATION FILE\n";
	ConfigFile cfg(cfgfile);
	SequentialAlignment sa;
	loadConfiguration(cfg,sa);

	//call Video Alignment
	cout << "VIDEO SEQUENCE ALIGNMENT\n";
	sa.alignVideos(file1, file2, resultfile);

	return 0;
}