smoothing edges on line using openCV

Viewed 146

I have a small script that detects a barbell plate on a video and draws a line that follows the barbell movement across the video. The problem is that the line becomes very sharp at some places and I need to have a kind of smooth curve that would look nice.

I tried implementing it using cv2.line and cv2.polylines but I was not able to reach the desired affect. The drawn line looks the same when using cv2.line and cv2.polylines Here is the function that draws the line:

def draw_trajectory(frame, coordinates):
    coordinates = np.int32(coordinates)

    cv2.polylines(
        frame,
        np.int32([coordinates[:,:-1]]),
        False,
        (255, 255, 0),
        4,
        lineType=cv2.LINE_AA,
    )

it works fine but the line doesn't look very nice. Any advice will be highly appreciated. Thanks

0 Answers
Related