Compare commits
No commits in common. "5fae9c9a0d87c23a6f98fe249e486e1857c65208" and "3ae6b41c62558a797e1a51be29de10a474c62b92" have entirely different histories.
5fae9c9a0d
...
3ae6b41c62
@ -1,26 +1,18 @@
|
||||
import cv2
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
def imgStats(img):
|
||||
mean = np.zeros(3)
|
||||
std = np.zeros(3)
|
||||
for i in range(img.shape[2]):
|
||||
mean[i] = np.mean(hsv_img[:, :, i])
|
||||
std[i] = np.std(hsv_img[:, :, i])
|
||||
return mean, std
|
||||
|
||||
DATASET_PATH = "C:\\Users\\Tom\\Desktop\\Files\\Repositories\\snake-vault\\TREES\\dataset\\"
|
||||
DATASET_PATH = "C:\\Users\\tomse\\Documents\\Dataset\\"
|
||||
|
||||
full_img = cv2.imread(DATASET_PATH + "alder\\1.jpg", 1)
|
||||
bgr_img = cv2.resize(full_img, (0, 0), fx=0.25, fy=0.25)
|
||||
bgr_img = cv2.resize(full_img, (0, 0), fx=0.2, fy=0.2)
|
||||
hsv_img = cv2.cvtColor(bgr_img, cv2.COLOR_BGR2HSV)
|
||||
|
||||
# cv2.imshow('BGR',bgr_img)
|
||||
# cv2.imshow('HSV',hsv_img)
|
||||
# cv2.imshow('HSV - H',hsv_img[:, :, 0])
|
||||
# cv2.imshow('HSV - S',hsv_img[:, :, 1])
|
||||
# cv2.imshow('HSV - V',hsv_img[:, :, 2])
|
||||
cv2.imshow('BGR',bgr_img)
|
||||
cv2.imshow('HSV',hsv_img)
|
||||
cv2.imshow('HSV - H',hsv_img[:, :, 0])
|
||||
cv2.imshow('HSV - S',hsv_img[:, :, 1])
|
||||
cv2.imshow('HSV - V',hsv_img[:, :, 2])
|
||||
|
||||
|
||||
hist = cv2.calcHist([hsv_img], [0], None, [256], [0,256])
|
||||
plt.plot(hist, label='H')
|
||||
@ -28,11 +20,6 @@ hist = cv2.calcHist([hsv_img], [1], None, [256], [0,256])
|
||||
plt.plot(hist, label='S')
|
||||
hist = cv2.calcHist([hsv_img], [2], None, [256], [0,256])
|
||||
plt.plot(hist, label='V')
|
||||
|
||||
mean, std = imgStats(hsv_img)
|
||||
print(mean)
|
||||
print(std)
|
||||
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
plt.show()
|
||||
|
Loading…
Reference in New Issue
Block a user