1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import cv2

def read_images(folder_path):
images = []
for filename in os.listdir(folder_path):
img_path = os.path.join(folder_path, filename)
if os.path.isfile(img_path):
img = cv2.imread(img_path)
if img is not None:
images.append(img)
return images

def getfilepaths(folder_path):
paths = []
for filename in os.listdir(folder_path):
img_path = os.path.join(folder_path, filename)
paths.append(img)
return paths

def main():
folder_path = '/path/to/folder'
images = read_images(folder_path)
paths = getfilepaths(folder_path)


if __name__ == '__main__':
main()