-1
I’m trying to open images and show them on screen from a directory called 'Photos' with various images . jpg, but when the windows open they simply do not load the images and the interpreter does not return any error, it just stops working.
import cv2 as cv
from os import listdir, path
import time
path = path.dirname(path.realpath(__file__)) + "\Photos" #Traz o caminho do diretorio atual
files = [f for f in listdir(path)] #Armazena o nome dos arquivos numa lista
print(files) #['cat.jpg', 'cats 2.jpg', 'cats.jpg']
for file in files:
img = cv.imread(f'Photos/{file}')
cv.imshow(f"{file}", img)
time.sleep(10)
cv.destroyAllWindows()
cv.waitKey(0)
*None of these images takes up much space (the largest only has 312kbs)
Screen that should show the photo: [1]: https://i.stack.Imgur.com/pYy0P.png