if file_name.endswith('.jpg') or file_name.endswith('.JPG'):


如果是则返回True


for root,dirs,files in os.walk(dir):
    for file in files:
        file_name = os.path.join(root,file)
        #print(file_name)
        img = cv2.imread(file_name)
        print(file_name)
        if file_name.endswith('.jpg') or file_name.endswith('.JPG'):