- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectTracking.py
More file actions
Latest commit
35 lines (23 loc) · 912 Bytes
/
Copy pathObjectTracking.py
File metadata and controls
35 lines (23 loc) · 912 Bytes
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
importcv2
importnumpyasnp
kamera=cv2.VideoCapture(0)
kamera.set(3, 640) # set width en
kamera.set(4, 480) # set hight
# define range of .. color in HSV (blue) -mavi renk
dusuk=np.array([85, 50, 50])
yuksek=np.array([135, 255, 255])
whileTrue:
ret, goruntu=kamera.read() # ret kamarenın açık olup olmadığını kontrol ediyor açıksa True.
hsv=cv2.cvtColor(goruntu, cv2.COLOR_BGR2HSV)
# Threshold the HSV image to get only blue colors
mask=cv2.inRange(hsv, dusuk, yuksek) # hsv göre dusuk ,yuks filtreleme yaptık.
# Bitwise-AND mask and original image
sonResim=cv2.bitwise_and(goruntu, goruntu, mask=mask)
cv2.imshow('BGR ANA GORUNTU', goruntu)
cv2.imshow("mask", mask)
cv2.imshow("renk algılama", sonResim)
cv2.imshow('HSV',hsv)
ifcv2.waitKey(25) &0xFF==ord("q"):
break
kamera.release()
cv2.destroyAllWindows()