added assay images
This commit is contained in:
parent
7ac73274a6
commit
f73d534481
BIN
res/essay/2-5-1_bgr.png
Normal file
BIN
res/essay/2-5-1_bgr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 426 KiB |
BIN
res/essay/2-5-1_bgr_expanded.png
Normal file
BIN
res/essay/2-5-1_bgr_expanded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 427 KiB |
BIN
res/essay/2-5-1_bgr_histogram.png
Normal file
BIN
res/essay/2-5-1_bgr_histogram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
res/essay/2-5-1_hsv.png
Normal file
BIN
res/essay/2-5-1_hsv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 KiB |
BIN
res/essay/2-5-1_hsv_expanded.png
Normal file
BIN
res/essay/2-5-1_hsv_expanded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 KiB |
BIN
res/essay/2-5-1_hsv_histogram.png
Normal file
BIN
res/essay/2-5-1_hsv_histogram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
@ -16,53 +16,68 @@ def histNormalize(hist):
|
||||
for i in range(len(hist)):
|
||||
hist[i][0] = (hist[i][0] - min_val)/(max_val - min_val)
|
||||
|
||||
DATASET_PATH = "C:\\Users\\Tom\\Desktop\\Files\\Repositories\\EV5_Beeldherk_Bomen\\res\\trees\\"
|
||||
SAVE_PATH = "C:\\Users\\Tom\\Desktop\\Files\\Repositories\\EV5_Beeldherk_Bomen\\res\\essay\\"
|
||||
IMAGE = "berk_sq1_original.png"
|
||||
|
||||
# DATASET_PATH = "C:\\Users\\Tom\\Desktop\\Files\\Repositories\\snake-vault\\TREES\\dataset\\"
|
||||
# full_img = cv2.imread(DATASET_PATH + "alder\\1.jpg", 1)
|
||||
full_img = cv2.imread(DATASET_PATH + IMAGE, 1)
|
||||
assert full_img is not None, "Path is wrong: " + DATASET_PATH + IMAGE
|
||||
|
||||
DATASET_PATH = "..\\..\\..\\res\\trees\\"
|
||||
full_img = cv2.imread(DATASET_PATH + "berk_sq1_original.png", 1)
|
||||
assert full_img is not None, "Path is wrong"
|
||||
|
||||
bgr_img = cv2.resize(full_img, (0, 0), fx=0.25, fy=0.25)
|
||||
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)
|
||||
BGR = np.concatenate((bgr_img[:, :, 0], bgr_img[:, :, 1], bgr_img[:, :, 2]),
|
||||
axis=1)
|
||||
cv2.imshow("BGR - Expanded", BGR)
|
||||
|
||||
cv2.imshow('HSV', hsv_img)
|
||||
HSV = np.concatenate((hsv_img[:, :, 0], hsv_img[:, :, 1], hsv_img[:, :, 2]),
|
||||
axis=1)
|
||||
cv2.imshow("HSV - Expanded", HSV)
|
||||
|
||||
cv2.imwrite(SAVE_PATH + "2-5-1_bgr.png", bgr_img)
|
||||
cv2.imwrite(SAVE_PATH + "2-5-1_bgr_expanded.png", BGR)
|
||||
|
||||
cv2.imwrite(SAVE_PATH + "2-5-1_hsv.png", hsv_img)
|
||||
cv2.imwrite(SAVE_PATH + "2-5-1_hsv_expanded.png", HSV)
|
||||
|
||||
print("BGR")
|
||||
mean, std = imgStats(bgr_img)
|
||||
print(mean)
|
||||
print(std)
|
||||
print()
|
||||
|
||||
mean, std = imgStats(hsv_img)
|
||||
print(mean)
|
||||
print(std)
|
||||
print()
|
||||
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
hist = cv2.calcHist([bgr_img], [0], None, [256], [0,256])
|
||||
plt.plot(hist, label='B', c='b')
|
||||
hist = cv2.calcHist([bgr_img], [1], None, [256], [0,256])
|
||||
plt.plot(hist, label='G', c='g')
|
||||
hist = cv2.calcHist([bgr_img], [2], None, [256], [0,256])
|
||||
plt.plot(hist, label='R', c='r')
|
||||
plt.title("BGR histogram")
|
||||
plt.xlabel("Waarde van pixels [0-255]")
|
||||
plt.ylabel("Hoeveelheid pixels")
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
plt.show()
|
||||
|
||||
print("HSV")
|
||||
mean, std = imgStats(hsv_img)
|
||||
print(mean)
|
||||
print(std)
|
||||
|
||||
hist = cv2.calcHist([hsv_img], [0], None, [256], [0,256])
|
||||
plt.plot(hist, label='H')
|
||||
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')
|
||||
plt.title("HSV histogram")
|
||||
plt.xlabel("Waarde van pixels [0-255]")
|
||||
plt.ylabel("Hoeveelheid pixels")
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
plt.show()
|
||||
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyAllWindows()
|
Loading…
Reference in New Issue
Block a user