I tried to implement this piece of code
import glob
import cv2
images = [cv2.imread(file) for file in glob.glob("C:\\Users\\DELL\\OneDrive\\Desktop\\New folder\\*.jpg")]
cv2.imshow(images,mat=0)
But its showing this error:
Traceback (most recent call last):
File "C:\Users\DELL\PycharmProjects\pythonProject\learn\project3.py", line 5, in <module>
cv2.imshow(images,mat=0)
TypeError: Can't convert object of type 'list' to 'str' for 'winname'
Can anyone please help me out to resolve this problem.
import glob
import cv2
images = [cv2.imread(file) for file in glob.glob("C:\Users\DELL\OneDrive\Desktop\New folder\*.jpg")]
for i in range(len(images)):
cv2.imshow("IMG"+str(i), images[i]) # the arguments of imshow are (name of image, image object)
Hope this works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.