Sunday, 15 March 2015

gcc - OpenCV Mat template code porting from Windows to Ubuntu -



gcc - OpenCV Mat template code porting from Windows to Ubuntu -

this 2nd time face problem. previously, posted here , fixed. lastly time, effort made ubuntu precise. updated scheme new ubuntu lts 14.04 , problem occurs 1 time again , old prepare doesn't seem work

template <class numtype> void drawcircles(cv::mat& image, const cv::mat_<cv::vec<numtype, 2> > points, cv::scalar color) { point2d p0; (int = 0; < points.cols; i++) { p0.x = cvround(points.at<cv::vec<numtype, 2> >(0, i)[0]); p0.y = cvround(points.at<cv::vec<numtype, 2> >(0, i)[1]); circle(image, p0, 5, color, 2, 8); } }

i've tried add together template keyword hints discussed here. specifically:

p0.x = cvround(points.at<cv::template vec<numtype, 2> >(0, i)[0]);

still no help original error is:

error: expected primary-expression before ‘>’ token

by way, same code compiled cleanly in windows vs2008 or vs2010

thank you!

i had create simple illustration test it. not useful, proves compiles okay. 99% of way there.

#include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> template <class numtype> void drawcircles( cv::mat& image, const cv::mat_<cv::vec<numtype, 2> > points, cv::scalar color) { // added cv namespace cv::point2d p0; (int = 0; < points.cols; i++) { // added template phone call @ rather vec p0.x = cvround(points.template at<cv::vec<numtype, 2> >(0, i)[0]); p0.y = cvround(points.template at<cv::vec<numtype, 2> >(0, i)[1]); circle(image, p0, 5, color, 2, 8); } } int main(){ cv::mat image; cv::mat_<cv::vec2d> points; cv::scalar color; drawcircles( image, points, color ); homecoming 0; }

templates gcc ubuntu-14.04

No comments:

Post a Comment