Mercurial Hosting > traffic-intelligence
changeset 126:336926453b28
added conversion function from keypoint vector to point vector and cleaned headers
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 17 Aug 2011 00:20:31 -0400 |
parents | 28907fde9855 |
children | d19d6e63dd77 |
files | c/cvutils.cpp include/cvutils.hpp |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/c/cvutils.cpp Tue Aug 16 19:35:07 2011 -0400 +++ b/c/cvutils.cpp Wed Aug 17 00:20:31 2011 -0400 @@ -1,11 +1,22 @@ #include "cvutils.hpp" -#include "opencv/cv.h" -#include "opencv/highgui.h" +//#include "opencv/cv.h" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/features2d/features2d.hpp" #include <iostream> +#include <vector> using namespace std; +using namespace cv; + +void keypPoints2Points(const vector<KeyPoint>& kpts, vector<Point2f>& points) { + points.clear(); + points.resize(kpts.size()); + + for (unsigned int i=0; i<kpts.size(); i++) + points[i] = kpts[i].pt; +} IplImage* allocateImage(const int& width, const int& height, const int& depth, const int& channels) { return ::allocateImage(cvSize(width, height), depth, channels);}
--- a/include/cvutils.hpp Tue Aug 16 19:35:07 2011 -0400 +++ b/include/cvutils.hpp Wed Aug 17 00:20:31 2011 -0400 @@ -1,7 +1,8 @@ #ifndef CVUTILS_HPP #define CVUTILS_HPP -#include "opencv2/highgui/highgui.hpp" // types are in opencv2/core/types_c.h +#include "opencv2/core/core.hpp" +#include "opencv2/features2d/features2d.hpp" class CvCapture; @@ -9,6 +10,8 @@ //static const int flipImage = CV_CVTIMG_FLIP; +void keypPoints2Points(const std::vector<cv::KeyPoint>& kpts, std::vector<cv::Point2f>& points); + /** Allocates a new IplImage. */ IplImage* allocateImage(const int& width, const int& height, const int& depth, const int& channels);