Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error while running the code #59

Open
dibyendu22 opened this issue Oct 19, 2022 · 2 comments
Open

Getting error while running the code #59

dibyendu22 opened this issue Oct 19, 2022 · 2 comments

Comments

@dibyendu22
Copy link

No description provided.

@dibyendu22
Copy link
Author

Press n to see the next sample >>> Press Esc to quit...
Traceback (most recent call last):

Overload resolution failed:

  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type
  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type

@nikitamalviya
Copy link

nikitamalviya commented Mar 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants