glob_deserial.cpp
Go to the documentation of this file.
00001 /*
00002  * glob_deserial.cpp
00003  *
00004  *  Created on: Oct 24, 2010
00005  *      Author: ethan
00006  */
00007 
00008 #include "pano_core/ImageAtom.h"
00009 #include "pano_core/feature_utils.h"
00010 #include "pano_core/QuadTree.h"
00011 #include "pano_core/MoleculeProcessor.h"
00012 #include "pano_core/CaptureEngine.h"
00013 #include "pano_core/ModelFitter.h"
00014 #include "pano_core/Blender.h"
00015 
00016 #include <sstream>
00017 #include <iostream>
00018 #include <list>
00019 
00020 #include <opencv2/core/core.hpp>
00021 #include <opencv2/highgui/highgui.hpp>
00022 
00023 using namespace std;
00024 using namespace cv;
00025 using namespace pano;
00026 
00027 int main(int ac, char ** av)
00028 {
00029   if (ac != 2 && ac != 3)
00030   {
00031     cout << "usage: " << av[0] << " <glob.yml or glob.yml.gz> [glob path]" << endl;
00032     return 1;
00033   }
00034 
00035   string out_name = "blended.deserialed.jpg";
00036   string glob_yml = av[1];
00037   string glob_path = "";
00038   if(ac == 3)
00039     glob_path = av[2];
00040 
00041   MoleculeGlob glob;
00042   FileStorage fs(glob_yml, FileStorage::READ);
00043   if (!fs.isOpened())
00044   {
00045     std::cerr << "bad yml file!" << endl;
00046     return 1;
00047   }
00048 
00049   cout << "deserializing...";
00050   cout.flush();
00051   glob.deserialize(fs["glob"]);
00052 
00053   if(glob_path.size())
00054     glob.overideDirectory(glob_path);
00055   cout << " done." << endl;
00056 
00057   cout << "blending...";
00058   cout.flush();
00059 
00060   Ptr<ImageMolecule> molecule = glob.getMerged();
00061 
00062   BlenderSimple blender;
00063   //BlenderMultiband blender;
00064   Mat blended(Size(3000,1500),CV_8UC3);
00065 
00066   blender.BlendMolecule( *molecule, blended);
00067   imwrite(out_name,blended);
00068 
00069   cout << " done." << endl;
00070   namedWindow("blended",CV_WINDOW_KEEPRATIO);
00071   imshow("blended",blended);
00072   while(char(waitKey()) != 'q'){
00073           cout << "press 'q' to quit" << endl;
00074   }
00075 
00076   return 0;
00077 }


pano_core
Author(s): Ethan Rublee
autogenerated on Mon Mar 14 2016 10:56:54