00001 /* 00002 * pano_py.h 00003 * 00004 * Created on: Dec 20, 2010 00005 * Author: erublee 00006 */ 00007 00008 #ifndef PANO_PY_H_ 00009 #define PANO_PY_H_ 00010 #include <boost/python.hpp> 00011 #include <boost/python/stl_iterator.hpp> 00012 #include <iostream> 00013 #include <string> 00014 #include <vector> 00015 #include <list> 00016 #include <iterator> 00017 #include <boost/foreach.hpp> 00018 #include <pano_core/pano_core.h> 00019 #include <opencv2/core/core.hpp> 00020 #include <opencv2/legacy/legacy.hpp> 00021 namespace pano_py{ 00022 00023 namespace bp = boost::python; 00024 00025 class Options 00026 { 00027 public: 00028 pano::Camera camera; 00029 cv::Size stitch_size; 00030 std::string directory; 00031 std::string stitch_output; 00032 std::list<std::string> image_names; 00033 pano::SVDRSolverParams fitter_params; 00034 }; 00035 class StitchProgressCallable 00036 { 00037 public: 00038 virtual ~StitchProgressCallable() 00039 { 00040 } 00041 virtual int onProgress(int progress){ 00042 return 0; 00043 } 00044 }; 00045 00046 00047 00048 00049 template<typename T> 00050 void container_assign(T& l, bp::object o) { 00051 // Turn a Python sequence into an STL input range 00052 00053 bp::stl_input_iterator<typename T::value_type> begin(o), end; 00054 l.assign(begin, end); 00055 } 00056 00057 template<typename T> 00058 bp::object container_get(const T& l) { 00059 bp::list o; 00060 BOOST_FOREACH(const typename T::value_type & x, l){ 00061 o.append(x); 00062 } 00063 return o; 00064 } 00065 00066 bool stitch(Options opts, StitchProgressCallable* callback); 00067 00068 void wrap_SVDRSolverParams(); 00069 void wrap_Camera(); 00070 void wrap_Options(); 00071 void wrap_BlurDetector(); 00072 void wrap_stitch(); 00073 void wrap_glob(); 00074 00075 } 00076 #endif /* PANO_PY_H_ */