Ask Your Question
1

How to draw a line on Mat?

asked 2016-03-04 00:44:42 -0600

cv_new gravatar image

updated 2016-03-04 00:45:00 -0600

I find the Core.line doesn't work in opencv 3.1 for java verison. What should it be? Thanks.

Mat Img = new Mat();
Point pt1 = new Point(x1, y1);
Point pt2 = new Point(x2, y2);
Core.line(Img, pt1, pt2, new Scalar(0,255,0), 3);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-03-04 00:46:58 -0600

berak gravatar image

with opencv3, all drawing functions (line,circle,putText, etc.) were moved to Imgproc, so:

Imgproc.line(Img, pt1, pt2, new Scalar(0,255,0), 3);
edit flag offensive delete link more

Comments

1

Thank you.

cv_new gravatar imagecv_new ( 2016-03-04 00:48:52 -0600 )edit

yea, it's a known source of confusion ;)

berak gravatar imageberak ( 2016-03-04 01:08:51 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-04 00:44:42 -0600

Seen: 11,113 times

Last updated: Mar 04 '16