Bilişim dünyasına kaliteli, özgün ve Türkçe içerikler kazandırmayı hedefleyen bir platform..

friends friends friends

Python İle Dizinden Resimleri Okumak

import cv2
import glob

#file dizininde sadece .jpg uzantılı dosyaları okumak istersek
#PATH="C:\\Users\\USER-PC\\Desktop\\file\\*.jpg"

#file dizininde tüm dosyaları okuyacak
PATH="C:\\Users\\USER-PC\\Desktop\\file\\"


path=glob.glob(PATH)

for file in path:
    #print(file)
    img=cv2.imread(file)
    cv2.imshow("Image",img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

Resimlerin Boyutları

import cv2
import glob

PATH="C:\\Users\\USERNAME-PC\\Desktop\\file\\*.jpg"
path=glob.glob(PATH)

for file in path:
    #print(file)
    img=cv2.imread(file)
    #resim boyutları
    height, width, channels = img.shape
    print(height, width, channels)

    cv2.imshow("Image",img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
python dosyaları okumak resimleri okumak
0 Beğeni
Python
Önceki Yazı

Count number of files and directories in Python

30 Ağu. 2022 tarihinde yayınlandı.
Sonraki Yazı

Css text portrait

30 Ağu. 2022 tarihinde yayınlandı.
arrow