w2d_time.cpp
Go to the documentation of this file.
00001 /*
00002  * w2d_time.cpp
00003  *
00004  *  Created on: Oct 19, 2010
00005  *      Author: erublee
00006  */
00007 
00008 #include <iostream>
00009 
00010 #include <wavelet2d/wavelet2d.h>
00011 
00012 #include "pano_core/ImageAtom.h"
00013 #include "pano_core/feature_utils.h"
00014 #include "pano_core/QuadTree.h"
00015 
00016 #include <opencv2/opencv.hpp>
00017 #include <brief_descriptor/brief.h>
00018 #include <iostream>
00019 #include <fstream>
00020 #include <list>
00021 #include <string>
00022 
00023 #include <opencv2/core/core.hpp>
00024 #include <opencv2/highgui/highgui.hpp>
00025 
00026 using namespace cv;
00027 using namespace wavelet2d;
00028 using namespace std;
00029 using namespace pano;
00030 
00031 inline void rescaleFloatImage(cv::Mat& img)
00032 {
00033   using namespace cv;
00034   Mat flimage;
00035   img.convertTo(flimage, CV_32F);
00036   std::vector<Mat> channels;
00037   split(flimage, channels);
00038   for (size_t k = 0; k < channels.size(); k++)
00039   {
00040     Mat cc = channels[k];
00041     double fmin, fmax;
00042     cv::minMaxLoc(cc, &fmin, &fmax);
00043     //        if( fmax > 1.0 )
00044     //            fmax = 255.0 ;
00045     //        else
00046     //            fmax = 1.0;
00047     channels[k] = 255. * ((channels[k] - fmin) / (fmax - fmin));
00048   }
00049 
00050   merge(channels, flimage);
00051   flimage.convertTo(img, CV_8U);
00052 }
00053 
00054 list<string> getImageList(istream& input) {
00055   list<string> imlist;
00056   while (!input.eof() && input.good()) {
00057     string imname;
00058     input >> imname;
00059     if(!input.eof() && input.good())
00060       imlist.push_back(imname);
00061   }
00062   return imlist;
00063 }
00064 
00065 
00066 int main(int ac, char**av)
00067 {
00068 
00069 
00070 
00071   if(ac != 3){
00072     cerr << "usage : " << av[0] << " directory imagelist.txt" << endl;
00073     return 1;
00074   }
00075 
00076   std::ifstream input(av[2]);
00077   std::string directory = av[1];
00078 
00079   cout << "directory " << directory << endl;
00080   std::list<string> img_names = getImageList(input);
00081 
00082 
00083   if(img_names.empty()){
00084     cerr << av[2] << "does not contain a list of images" << endl;
00085     return 1;
00086   }
00087 
00088 
00089 
00090   vector<Mat> images;
00091 
00092   while(!img_names.empty())
00093   {
00094 
00095     string image_name = img_names.back();
00096     img_names.pop_back();
00097 
00098     images.push_back(imread(image_name));
00099   }
00100 
00101   namedWindow("small",CV_WINDOW_KEEPRATIO);
00102 
00103   namedWindow("gradient",CV_WINDOW_KEEPRATIO);
00104   for(size_t i=0; i < images.size();i++){
00105     Mat img_r = images[i];
00106     Mat img;
00107     resize(img_r,img,Size(img_r.size().width/10,img_r.size().height/10),0,0,CV_INTER_AREA);
00108 
00109     Mat img_grad;
00110 
00111     Sobel(img,img_grad,CV_32F,1,1);
00112 
00113     Mat w,J;
00114     Rodrigues(Mat::eye(3,3,CV_32F),w,J);
00115 
00116 
00117 
00118 
00119 
00120 
00121     imshow("small",img);
00122     imshow("gradient",img_grad);
00123     waitKey(1000);
00124 
00125   }
00126   return 0;
00127 
00128 }


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