Python about typeerror: required argument ‘mat’ (POS 2) not found error resolution

This error prompt means that the required parameter is not found, that is, the function in the code is missing the necessary parameter. Here’s an example of displaying a picture

import cv2
img = cv2.imread('./data/wiki.png')
cv2.imshow(img)
cv2.waitKey(0)

The following error occurs at runtime:

Traceback (most recent call last):
  File “D:/python_ opencv/ ss.py “, line 3, in <module>
    cv2.imshow(img)
TypeError: Required argument ‘mat’ (pos 2) not found

Process finished with exit code 1

A closer inspection shows that there are two necessary parameters from the CV2. Imshow() function, and another parameter is the name of the image window. The results are as follows

import cv2
img = cv2.imread('./data/wiki.png')
cv2.imshow('img',img)
cv2.waitKey(0)

Read More: