1 | initial version |
To draw a point use a small circle or simply set the value at the given coordinates. In C++:
// draws the curve using dots
int lineWidht = 3;
for (int i = 0; i < pointList.size(); i++) {
pt = pointList[i];
// draw the dots using filled circle
circle(mat, pt, cvRound((double)lineWidht / 2), Scalar(255, 255, 255), -1);
// OR draw 1px point using direct assigment
if ((pt.x<mat.cols) && (pt.y<mat.rows) && (pt.x*pt.y >= 0))
mat.at<Vec3b>(pt.y, pt.x) = Vec3b(255, 0, 255);
}
To draw a curve from a list of points use polyline as @LorenaGdL.
2 | No.2 Revision |
To draw a point use a small circle or simply set the value at the given coordinates. In C++:
// draws the curve using polylines and line width (RED)
cv::polylines(mat, pointList, false, Scalar(0, 0, 255), lineWidht);
// draws the curve using dots
int lineWidht = 3;
for (int i = 0; i < pointList.size(); i++) {
pt = pointList[i];
// draw the dots using filled circle
circle (GREEN)
circle(mat, pt, cvRound((double)lineWidht / 2), Scalar(255, Scalar(0, 255, 255), 0), -1);
// OR draw 1px point using direct assigment
assigment (MAGENTA)
if ((pt.x<mat.cols) && (pt.y<mat.rows) && (pt.x*pt.y >= 0))
mat.at<Vec3b>(pt.y, pt.x) = Vec3b(255, 0, 255);
}
To draw a curve from a list of points use polyline as @LorenaGdL.@LorenaGdL.