How do I cast Point2f to Point2d?
I am trying to copy a vector of Point2f's into a vector of Point2d's. I am unable to directly cast the Point2f elements to Point2d, as in:
for (int i = 0 ; i < (int)vector1.size() ; i++)
{
vector2.push_back((cv::Point2d)vector1[i]);
}
The usual std way does not work either.
Example: std::vector<cv::Point2d> vector2(vector1.begin(), vector1.end());
I don't undestand your problem. Ihave try your example it works for me. What is your configuration opencv, pc ide..?
That's strange. I am using 2.4.11 on linux with cmake. It says "Call of overloaded Point_(cv::Point_<float>&) is ambiguous."
Either way, treating it as a Mat worked for me: cv::Mat(vector1).convertTo(vector2, cv::Mat(vector2).type())