| 27 | reflection_data_dir = "/data/ganguanhao/datasets/VOCdevkit/VOC2012/JPEGImages/" # please replace this with path to your desired reflection set |
| 28 | |
| 29 | def read_image(img_path, type=None): |
| 30 | img = cv2.imread(img_path) |
| 31 | if type is None: |
| 32 | return img |
| 33 | elif isinstance(type,str) and type.upper() == "RGB": |
| 34 | return cv2.cvtColor(img, cv2.COLOR_BGR2RGB) |
| 35 | elif isinstance(type,str) and type.upper() == "GRAY": |
| 36 | return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) |
| 37 | else: |
| 38 | raise NotImplementedError |
| 39 | |
| 40 | reflection_image_path = os.listdir(reflection_data_dir) |
| 41 | reflection_images = [read_image(os.path.join(reflection_data_dir,img_path)) for img_path in reflection_image_path[:200]] |