-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (31 loc) · 1.38 KB
/
main.py
File metadata and controls
33 lines (31 loc) · 1.38 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
# ---------------------------------------------------------------------------
# This program detects ekare's stickers in a given input file from Resources
# and writes to a file inside the Output folder using the detector_method
#
# (C) 2022 Ahmet Uyar, Derin Berktay, Özgür Güler, VA, United States
# email: auyar19@ku.edu.tr, bberktay19@ku.edu.tr, oguler@ekareinc.com
#
# ---------------------------------------------------------------------------
import cv2
import numpy as np
import os
from detector import *
import glob
'''
files = glob.glob('Webcam_tests/*.jpeg',
recursive = True)
'''
files = glob.glob('Resources/*.jpeg',
recursive = True)
for file in files:
unchanged_img = cv2.imread(file, cv2.IMREAD_COLOR)
final = detectormethod(unchanged_img)
if(final[0] == 1):
new_img = final[5]
cv2.circle(new_img, (int(final[3] + final[1]/2), int(final[4] + final[1]/2)), int(final[1]/2), (0, 255, 0), 10)
cv2.circle(new_img, (int(final[3] + final[1]/2), int(final[4] + final[1]/2)), 1, (0, 0, 255), 30)
cv2.rectangle(new_img, (final[3],final[4]), (final[3] + final[2], final[4] + final[1]), (0, 0, 255),10)
#path = 'Webcam_outputs/'
path = 'Output/'
cv2.imwrite(os.path.join(path, str(file[10:23])), new_img)
#cv2.imwrite(os.path.join(path, str(file[10:23])), final[6]) # looking for the mask