stereo-vision
All Data Structures Namespaces Functions Modules Pages
utils.h
1 /*
2  * Copyright (C) 2011 Department of Robotics Brain and Cognitive Sciences - Istituto Italiano di Tecnologia
3  * Authors: Vadim Tikhanoff
4  * email: vadim.tikhanoff@iit.it
5  * website: www.robotcub.org
6  * Permission is granted to copy, distribute, and/or modify this program
7  * under the terms of the GNU General Public License, version 2 or any
8  * later version published by the Free Software Foundation.
9  *
10  * A copy of the license can be found at
11  * http://www.robotcub.org/icub/license/gpl.txtd
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details
17  */
18 
19 #ifndef __ICUB_UTILS_H__
20 #define __ICUB_UTILS_H__
21 
22 #include <iostream>
23 #include <string>
24 #include <fstream>
25 #include <yarp/sig/Image.h>
26 #include <yarp/os/BufferedPort.h>
27 #include <yarp/os/RFModule.h>
28 #include <yarp/os/Network.h>
29 #include <yarp/os/Time.h>
30 #include <yarp/os/Stamp.h>
31 #include <cv.h>
32 #include <highgui.h>
33 
34 #include "GL/gl.h"
35 #if !defined(SIFTGPU_STATIC) && !defined(SIFTGPU_DLL_RUNTIME)
36 // SIFTGPU_STATIC comes from compiler
37 #define SIFTGPU_DLL_RUNTIME
38 // Load at runtime if the above macro defined
39 // comment the macro above to use static linking
40 #endif
41 
42 #ifdef SIFTGPU_DLL_RUNTIME
43  #include <dlfcn.h>
44  #define FREE_MYLIB dlclose
45  #define GET_MYPROC dlsym
46 #endif
47 
48 #include "SiftGPU.h"
49 
50 /**********************************************************/
51 class Utilities
52 {
53 public:
54  SiftMatchGPU *matcher;
55  SiftMatchGPU *matcherCheck;
56  SiftGPU *sift;
57  std::vector<float > descriptors1, descriptors2;
58  std::vector<SiftGPU::SiftKeypoint> keys1, keys2;
59  std::vector<cv::Point2f> pointsL, pointsR;
60  int num1, num2;
61  bool writeS;
62  void *hsiftgpu;
63 
64  Utilities();
65  ~Utilities();
66 
70  void initSIFT_GPU();
74  void extractMatch_GPU(cv::Mat &leftMat, cv::Mat &rightMat, double displacement=20.0);
75  void extractMatch_GPU(cv::Mat &leftMat, cv::Mat &rightMat, cv::Mat &matMatches, double displacement=20.0);
76  void getMatches(std::vector<cv::Point2f> & points1, std::vector<cv::Point2f> &points2);
77  void writeSIFTs(std::string filePath, std::vector<float> &des, std::vector<SiftGPU::SiftKeypoint>&points);
78  void writeMatch(std::string filePath,std::vector<cv::Point2f> &pointsL, std::vector<cv::Point2f> &pointsR);
79 };
80 
81 #endif
82 
83 //empty line to make gcc happy