简体   繁体   中英

Can't get the same image result based on opencv RotatedRect tutorial

I used Ubuntu14.04 LTS and opencv 3.0, I followed the following code in the link. In the console, I got init opengl available. However, the image I got was total different with that in the following link. Could anyone help me figure this out? Thanks. http://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#RotatedRect ,

Mat image(200, 200, CV_8UC3, Scalar(0));
RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);

Point2f vertices[4];
rRect.points(vertices);
for (int i = 0; i < 4; i++)
    line(image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0));

Rect brect = rRect.boundingRect();
rectangle(image, brect, Scalar(255,0,0));

imshow("rectangles", image);
waitKey(0);

My result

I rebuild the opencv3.0 based on http://rodrigoberriel.com/2014/10/installing-opencv-3-0-0-on-ubuntu-14-04/ , and then I got the same result as in the tutorial. It works for me now.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM