728x90
파이썬 기준입니다
import cv2
import numpy as np
import glob
path = '/path/your/input' # 경로 입력
exts = ['.jpg, '.png', '.jpeg', '.bmp'] # 확장자명 입력
data_list = []
for ext in exts:
data_list+=glob.glob(path+'/*'+ext)
img_norm = list()
img_std = list()
for data in data_list:
img = cv2.imread(data, cv2.IMREAD_COLOR).astype(np.float32)/255.0
if len(img.shape) <2: # 흑백 이미지는 제외
continue
mean,std = np.mean(img, axis=(0,1)), np.std(img, axis=(0,1))
img_norm.append(mean)
img_std.append(std)
print(np.mean(img_norm, axis=0), np.mean(img_std, axis=0))
728x90