shreya
shreya

Reputation: 11

TypeError: cv2_imshow() takes 1 positional argument but 2 were given : google colab cv related problems

visualize_boxes(self, image_name, boxes1, boxes2)
                ........
--->          cv2_imshow("bounding boxes", img)
              #cv2.waitKey(100)

at this line it shows cv2_imshow() takes 1 positional argument but 2. Earlier I changed cv2.image format according to what google colab understands and commented on the cv2.waitkey(), is this creating?

Upvotes: 1

Views: 16211

Answers (1)

Varun P
Varun P

Reputation: 141

No,cv2.waitkey() is not causing this. The syntax of cv2_imshow() is wrong. You need to do something along the lines of this because cv2_imshow takes only 1 argument:

import cv2
from google.colab.patches import cv2_imshow
img = cv2.imread("img.png")
cv2_imshow(img)

For further details you can view the official colab advanced output guide here.

Upvotes: 1

Related Questions