Drawing rotated rect using python

asked 2018-04-13 10:37:14 -0500

Temp gravatar image

I am trying to draw rotated rectangle on image. I am using

        rect = cv2.minAreaRect(np.array([(boxes[i][1],boxes[i][2]),(boxes[i][3],boxes[i][2]),(boxes[i][3],boxes[i][2]),(boxes[i][3],boxes[i][4])]))
        box = cv2.boxPoints(rect)
        box = np.int0(box)

Where boxes[i] is array of [xmin,ymin,xmax,ymax], however this keep throwing errors

rect = cv2.minAreaRect(boxes[i][1:])
cv2.error: OpenCV(3.4.1) C:\bld\opencv_1520732670222\work\opencv-3.4.1\modules\imgproc\src\convhull.cpp:137: error: (-215) total >= 0 && (depth == 5 || depth == 4) in function cv::convexHull

How can i draw rotated rectangle on image?

edit retag flag offensive close merge delete