-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoinimages.py
35 lines (28 loc) · 1.01 KB
/
joinimages.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
28
29
30
31
32
33
34
35
import cv2
import numpy as np
import myUtils
#preparar alto y ancho del video
frameWidth = 640
frameHeight = 480
#invocar a la webcam
cap = cv2.VideoCapture(0)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
while True:
success, img = cap.read()
kernel = np.ones((5, 5), np.uint8)
print(kernel)
# path = "Assets/chily.png"
# img = cv2.imread(path)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
imgBlur = cv2.GaussianBlur(imgGray, (7, 7), 0)
imgCanny = cv2.Canny(imgBlur, 100, 200)
imgDilation = cv2.dilate(imgCanny, kernel, iterations=2)
imgEroded = cv2.erode(imgDilation, kernel, iterations=2)
# imgBlank = np.zeros((200, 200), np.uint8)
StackedImages = myUtils.stackImages(0.3, ([img, imgGray, imgBlur],
[imgCanny, imgDilation, imgEroded]))
cv2.imshow("Staked Images", StackedImages)
#mientras esto pasa obtenemos cada imagen si no solo toma cada que aprietas una tecla xD
if cv2.waitKey(1) & 0xFF == ord('q'):
break