Open dibyendu22 opened 1 year ago
There an issue with the order or structure of the coordinates passed to cv2.line(), also the corners_int are in float values.
Replace the function drawRotatedBox with the below function in the module data_process/kitti_bev_utils.py
def drawRotatedBox(img, x, y, w, l, yaw, color):
bev_corners = get_corners(x, y, w, l, yaw)
corners_int = np.round(bev_corners).astype(int) # Convert coordinates to integers
cv2.polylines(img, [corners_int], True, color, 2)
# Extract coordinates of the endpoints of the diagonal line
pt1 = (corners_int[0, 0], corners_int[0, 1]) # Top-left corner
pt2 = (corners_int[2, 0], corners_int[2, 1]) # Bottom-right corner
# Draw the diagonal line
cv2.line(img, pt1, pt2, (255, 255, 0), 2)
The modified function : The function extracts the coordinates of the top-left and bottom-right corners from corners_int and creates tuples (x, y) for each point. These tuples are then passed as arguments pt1 and pt2 to cv2.line() to draw the diagonal line across the rotated box. By ensuring that the coordinates are correctly structured as tuples of integers, this modification should resolve the error you're encountering when drawing the diagonal line.
Press n to see the next sample >>> Press Esc to quit... Traceback (most recent call last):