0

I use this code to generate annotation on images to make identification with opencv

import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
from skimage import io
def geration_bb (img, threshold, rect_th, path):
    boxes = prediction(img, threshold)
    for i in range(len(boxes)):
        cv2.rectangle(img,boxes[i][0],boxes[i][1],color =(255, 0, 0),thickness=rect_th)
    plt.figure(figsize=(10,10))
    plt.imshow(img)
    plt.xticks([])
    plt.yticks([])
    plt.show()
    # for to save the prediction figure 
    io.imsave(path, img)

the error generated

error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'rectangle'
> 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
>  - argument for rectangle() given by name ('color') and position (3)
>  - argument for rectangle() given by name ('color') and position (3)`enter code here`

0 Answers0