Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

select multiple points with mouse (opencv 2.4.9,vs2010,winforms)

$
0
0
Hi, I'm trying to select multiple points by mouse (with cv::EVENT_LBUTTONDOWN). So I'm passing the std::vector to the Callback-Function: //setting the roi manually std::vector points; cv::Mat img = cv::imread("f:/open/me.jpg"); cv::namedWindow("Original"); cv::setMouseCallback("Original", mouse_call, (void*)&points); int X,Y; cv::imshow("Original",img); And in Callback: static void mouse_call(int event,int x,int y, int, void* param) { if(event==cv::EVENT_LBUTTONDOWN){ std::vector* ptPtr = (std::vector*)param; ptPtr->push_back(cv::Point(x,y)); } And, when I'm trying to access the vector-elements with: points[0].x points[0].y It's compiling, but at runtime i get an error: "Debug Assertion Failed " "Expression: vector subscript out of range" Any clue ? Thanks

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>