簡體   English   中英

如何顯示使用 python 選擇的文件夾中存在的所有圖像的長度(圖像數量)([以這種格式])

[英]How to display the length(no. of images) ([in this format]) of all the images present in the folders selected using python

圖片 = random.sample(range(1, 68),25)

我有 68 個文件夾,每個文件夾有 170 張圖片。 我需要選擇從上述命令生成的文件夾編號並顯示長度。 如何使用 python 做到這一點。

您可以通過以下方式獲取文件夾中圖像的形狀

DIR = '/content/images'
for name in os.listdir(DIR):
  im=cv2.imread('/content/images/'+name)
  print(im.shape)

輸出:

(183, 275, 3)
(191, 264, 3)
(194, 259, 3)
(210, 352, 3)
(1114, 1922, 3)
(194, 259, 3)

謝謝你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM