How to draw different shapes on an image in openCV? -
i beginner in opencv. know c++ , android programming. have decided shift on opencv. in project, using opencv detecting reddish color ball through photographic camera , getting coordinates. using these coordinates, want draw same line or shape on separate white image. example, if utilize user moves ball write alphabet w in air, , have received coordinates of ball position, want draw w on separate image. not asking code, little help , guidance.
thanks in advance.
if have coordinates easy. first create cv::mat , set white.
cv::mat image; image.setto(cv::scalar(255,255,255));
then if have begin , end coordinates can draw line using opencv line function.
cv::line(image, cv::point(initial_coords.x, initial_coords.y), cv::point(end_coords.x, end_coords.y), cv::scalar(0,0,255));
finally w utilize puttext function
cv::puttext(image, "text", cv::point(coords.x, coords.y), cv::font_hershey_script_simplex, 2, scalar::all(255), 3,8);
if need erase window before adding new things utilize 1 time again
image.setto(cv::scalar(255,255,255));
opencv image-processing computer-vision
No comments:
Post a Comment