WSLで実行する場合は下記参照
https://dev.classmethod.jp/articles/wsl-x-window/
# -*- coding: utf-8 -*-
import cv2
import glob
import json
target = "target/*.png"
print("target:"+target)
data_BasePath = sorted(glob.glob(target))
print("target:"+target)
data_BasePath = sorted(glob.glob(target))
print("image Num:"+ str(len(data_BasePath)))
yesno_dict={}
# for idx_inter, data_BasePath_png in enumerate(data_BasePath):
idx_inter = 0
while True:
data_BasePath_png = data_BasePath[idx_inter]
# 入力画像のロード
img = cv2.imread(data_BasePath_png)
img = cv2.resize(img, (img.shape[1]*4, img.shape[0]*4))
cv2.imshow("input", img)
k = cv2.waitKey(0)
if k == 27: # wait for ESC key to exit
break
elif k == ord('y'):
imgbool = "1"
elif k == ord('n'):
imgbool = "0"
elif k == ord('p'):
idx_inter = idx_inter - 2
else:
idx_inter = idx_inter - 1
print([data_BasePath_png, imgbool])
yesno_dict[data_BasePath_png] = imgbool
idx_inter = idx_inter + 1
print(yesno_dict)
cv2.destroyAllWindows()
tf = open("myDictionary.json", "w")
json.dump(yesno_dict, tf)
tf.close()