python opencv 显示文件夹下所有的图片(文件夹下还有文件夹)

import os
import cv2
import numpy as np

def imshow(path):
im_gray = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
im_color = cv2.applyColorMap(im_gray, cv2.COLORMAP_JET)
# save image
cv2.namedWindow(‘input_image’, cv2.WINDOW_AUTOSIZE)
cv2.imshow(‘input_image’, im_color)
cv2.waitKey(0)

data_path = ‘./data/hand_pose_test’
signal = os.listdir(data_path)
for fsingal in signal:
filepath = data_path+ ‘/’ + fsingal
filename = os.listdir(filepath)
for fname in filename:
ffpath = filepath+"/"+fname
path = ffpath
print(path)
imshow(path)

你可能感兴趣的:(习惯养成,手势识别)