c++ - Is It Possible to Store cv::Point to cv::Mat? -
i want store points opencv matrix (cv::mat), possible or not? i've tried code:
cv::mat_<cv::point> matpoint; matpoint.at<cv::point>(0) = cv::point(2,2); std::cout << matpoint.at<cv::point>(0) << std::endl;
actually, compiled successfully, when run code got "floating point exception". know above code wrong, don't know other way it.
any appreciated. thank you
the correct way be:
// create 1x1 matrix , initialize elements (0,0) cv::mat_<cv::point> matpoint(1, 1, cv::point(0, 0)); // access element index 0 matpoint(0) = cv::point(2, 2); // alternative syntax targeting elements two-dimensional index: std::cout << matpoint(0, 0) << std::endl;
the .at<cv::point>(0)
syntax should work less convenient.
Comments
Post a Comment