-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscratch.py
More file actions
59 lines (51 loc) · 1.34 KB
/
scratch.py
File metadata and controls
59 lines (51 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import cv2
import numpy as np
import main
from numba import cuda
from skimage import metrics
# print(cuda.gpus)
# shape = np.array([500, 500, 3])
# img = np.ones(shape)
# blank = np.zeros([500, 500, 4])
# cv2.imshow("blank", blank)
# cv2.waitKey()
#
targetimg = cv2.imread("images\\manatee.png")
guessimg = cv2.imread("images\\20191209_2317_GA1088.png")
calcsize = 300
shape_orig = targetimg.shape
calcshape = (calcsize, int(calcsize * shape_orig[0] / shape_orig[1]))
img_calc = cv2.resize(targetimg, calcshape)
img_gues = cv2.resize(guessimg, calcshape)
cv2.imshow("target", img_calc)
cv2.imshow("guess", img_gues)
cv2.waitKey()
print(metrics.mean_squared_error(img_calc, img_gues))
print(metrics.normalized_root_mse(img_calc, img_gues))
# targetimg = cv2.imread("green.png")
# targetimg = cv2.resize(targetimg, (100, 100))
#
# img = cv2.imread(r"images\fkm8s0.png")
# cv2.imshow("original", img)
# cv2.imshow("target", targetimg)
# cv2.waitKey()
#
# R = img[:,:,0]
# G = img[:,:,1]
# B = img[:,:,2]
#
# err = main.rico_mse(targetimg, img)
# err2 = main.rico_mse(img, targetimg)
# print(err, err2)
# shape = img.shape
# vcat = img
# numcols = 4
#
# for i in range(0, numcols):
# vcat = np.concatenate((vcat, img))
#
# vcat = cv2.resize(vcat, (int(500*shape[1]/(shape[0]*numcols)), 500))
#
# cv2.imshow("hcat", vcat)
# cv2.imwrite("wtf.jpg", vcat)
# cv2.waitKey()