-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
27 lines (21 loc) · 995 Bytes
/
main.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 numpy as np
import cv2
import argparse
from DoG import Difference_of_Gaussian
def plot_keypoints(img_gray, keypoints, save_path):
img = np.repeat(np.expand_dims(img_gray, axis = 2), 3, axis = 2)
for y, x in keypoints:
cv2.circle(img, (x, y), 5, (0, 0, 255), -1)
cv2.imwrite(save_path, img)
def main():
parser = argparse.ArgumentParser(description='main function of Difference of Gaussian')
parser.add_argument('--threshold', default=5.0, type=float, help='threshold value for feature selection')
parser.add_argument('--image_path', default='./testdata/1.png', help='path to input image')
args = parser.parse_args()
print('Processing %s ...'%args.image_path)
img = cv2.imread(args.image_path, 0).astype(np.float32)
### TODO ###
keypoint = Difference_of_Gaussian(args.threshold).get_keypoints(img)
plot_keypoints(img, keypoint, f'{args.image_path[:-4]}_threshold={int(args.threshold)}.png')
if __name__ == '__main__':
main()