-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_compare.py
27 lines (21 loc) · 921 Bytes
/
test_compare.py
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
import cv2
import Preprocessing_img as pre
import Similarity_img as sim
# img_org = cv2.imread('test/eeeeeeeeeeeeeeeeee.jpg')
img_org = cv2.imread('D:/test_darknet/FLASK-API-Y4/forV4/test/s32.jpg')
print(img_org.shape)
img_org = pre.resize_with_max(img_org, )
print(img_org.shape)
img_gamma = pre.gamma_correction(img_org,0.7)
img_gray = cv2.cvtColor(img_gamma, cv2.COLOR_BGR2GRAY)
print(img_gray.shape)
img_denoise = cv2.fastNlMeansDenoising(img_gray, None, 8, 7, 21)
# img_blur = cv2.medianBlur(img_gray, 5)
# img_blur = cv2.GaussianBlur(img_gray, (3, 3), cv2.BORDER_DEFAULT)
th3 = cv2.adaptiveThreshold(img_denoise, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)
cv2.imshow('img_org', pre.resize_perten(img_org, 7))
cv2.imshow('img_grey', pre.resize_perten(img_gray, 7))
cv2.imshow('filtered', pre.resize_perten(th3, 7))
print(sim.compare_img(img_org,th3))
cv2.waitKey(0)
cv2.destroyAllWindows()