# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 08:43:23 2020
@author: Aaron
"""
import cv2
import os.path
# import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
sf = [] #空间频率
Hue = [] #色度
Saturation = [] #饱和度
Value = [] #亮度
filepath = 'G:/video/Img' #图像文件所在目录
pathDir = os.listdir(filepath)
for allDir in pathDir:
videopath =r'G:/video/Img/'+allDir
image = cv2.imread(videopath)
hsv = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
H, S, V = cv2.split(hsv)
v = V.ravel()[np.flatnonzero(V)] #亮度非零的值
average_v = sum(v)/len(v) #平均亮度
Value.append(average_v)
s = S.ravel()[np.flatnonzero(S)] #饱和度非零的值
average_s = sum(s)/len(s) #