I am trying to draw a trajectory on an image and saving these trajectory points as std::vector<cv::Point> trajectoryPoint
and I would like to access the data inside.
This a short snippet from my code:
cv::line(currentFrame, trajectoryPoint.back(), cv::Point(x, y), Scalar(255, 255, 255), 1, 8);
trajectoryPoint.push_back(Point(x, y));
std::cout << trajectoryPoint.at() << std::endl;
Normally, in Matlab it is easy to see the data inside vectors. However, I don't know how to continuously print out the data while drawing in C inside trajectoryPoint
. Any suggestions?
CodePudding user response:
you can try to wrap a cv::Mat
around it (which has nice printing ops):
std::vector<cv::Point> trajectoryPoint = ...
cv::Mat viz(trajectoryPoint);
std::cout << viz << std::endl;