-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageProcessingTest.py
More file actions
45 lines (32 loc) · 1.2 KB
/
imageProcessingTest.py
File metadata and controls
45 lines (32 loc) · 1.2 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
import cv2
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import subprocess
imNum = 0
lightDict = {}
lightList = []
os.mkdir(f'Images/CircImages/{sys.argv[1]}')
for image in os.listdir(f'Images/{sys.argv[1]}'):
f = os.path.join(f'Images/{sys.argv[1]}', image)
if os.path.isfile(f):
light = cv2.imread(f'Images/{sys.argv[1]}/c{imNum}.png')
lightRGB = np.copy(light)
lightRGB = cv2.cvtColor(lightRGB, cv2.COLOR_RGB2BGR)
lightGrey = np.copy(light)
lightGrey = cv2.cvtColor(lightGrey, cv2.COLOR_RGB2GRAY)
lightBlur = cv2.GaussianBlur(lightGrey, (21, 21), 0)
(minVal, maxVal, minLoc, maxLoc) = cv2.minMaxLoc(lightBlur)
lightCirc = cv2.circle(lightRGB, maxLoc, 21, (0, 0, 255), 4)
cv2.imwrite(f'Images/CircImages/{sys.argv[1]}/c{imNum}Alt.jpg', lightCirc)
lightDict[f'Images/{sys.argv[1]}/c{imNum}.jpg'] = maxLoc
lightList.append(maxLoc)
imNum += 1
else:
continue
with open(r'./lightCoords.txt', 'w') as txt:
for item in lightList:
txt.write(f"{item}\n")
# scp = ["scp", f"/home/orion/Code/Python/2DLighting/lightCoords.txt", "pi@192.168.10.223:"]
# subprocess.run(scp)