I have a vector of points and I want to put the value 255 for each point in a matrix , here what I've tried, it didn't work
.............................
cv::Mat result;
result =cv::Mat::zeros(frame.size(),CV_8UC1);
std::vector<cv::Point2f> vectorOFPoints;
...............................
for ( int i = 0 ; vectorOFPoints.size()-1;i++){
result.at<uchar>(vectorOFPoints.at<i>) = 255;
}
any idea how can I do this ? thanks in advance
You line in the loop is wrong, it should be
result.at<uchar>(vectorOFPoints.at<cv::Point2f>(i)) = 255;
But you may need you point type to be cv::Point instead of cv::Point2f (Don't know how it works with cv::Point2f)
std::vector<cv::Point> vectorOFPoints;
/* Code */
/* Loop */
result.at<uchar>(vectorOFPoints.at<cv::Point>(i)) = 255;
I think this may work (Didn't tested though)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.