import cv2
import os

def load_images_from_folder(folder):
    images = []; FNS=[]
    for filename in os.listdir(folder):        
        img = cv2.imread(os.path.join(folder,filename))        
        if img is not None:
            images.append(img); FNS.append(filename)
    return images,FNS

folder='RED1'; 
images,FNS=load_images_from_folder(folder);
FNS2,images2 = zip(*sorted(zip(FNS, images)))
print('FNS=',FNS,' FNS2=',FNS2)
nn=0
for frame in images2: 
    cv2.imshow('frame',frame)
    print(nn,FNS2[nn],frame.shape)
    if(cv2.waitKey(1000) & 0xFF == ord('q')): pass
    nn+=1

