Change from RPi
This commit is contained in:
parent
7d7518f565
commit
a56c4621a0
|
@ -1,9 +1,9 @@
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
frameWidth = 640
|
frameWidth = 400
|
||||||
frameHeight = 480
|
frameHeight = 500
|
||||||
cap = cv2.VideoCapture(1)
|
cap = cv2.VideoCapture(0)
|
||||||
cap.set(3, frameWidth)
|
cap.set(3, frameWidth)
|
||||||
cap.set(4, frameHeight)
|
cap.set(4, frameHeight)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ cv2.createTrackbar("SAT Max", "HSV", 255, 255, empty)
|
||||||
cv2.createTrackbar("VALUE Min", "HSV", 0, 255, empty)
|
cv2.createTrackbar("VALUE Min", "HSV", 0, 255, empty)
|
||||||
cv2.createTrackbar("VALUE Max", "HSV", 255, 255, empty)
|
cv2.createTrackbar("VALUE Max", "HSV", 255, 255, empty)
|
||||||
|
|
||||||
cap = cv2.VideoCapture('vid1.mp4')
|
|
||||||
frameCounter = 0
|
frameCounter = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -78,8 +78,8 @@ def getLaneCurve(img, display = 2):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
cap = cv2.VideoCapture('vid1.mp4')
|
cap = cv2.VideoCapture(0)
|
||||||
initialTrackBarVals = [116, 138, 20, 232]
|
initialTrackBarVals = [96, 139, 48, 218]
|
||||||
utils.initializeTrackbars(initialTrackBarVals)
|
utils.initializeTrackbars(initialTrackBarVals)
|
||||||
frameCounter = 0
|
frameCounter = 0
|
||||||
curveList = []
|
curveList = []
|
||||||
|
@ -92,7 +92,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
success, img = cap.read()
|
success, img = cap.read()
|
||||||
img = cv2.resize(img,(480,240))
|
img = cv2.resize(img,(480,240))
|
||||||
curve = getLaneCurve(img, display = 1)
|
curve = getLaneCurve(img, display = 2)
|
||||||
print(curve)
|
print(curve)
|
||||||
#cv2.imshow('Vid', img)
|
#cv2.imshow('Vid', img)
|
||||||
cv2.waitKey(1)
|
cv2.waitKey(1)
|
||||||
|
@ -100,3 +100,4 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
4
utils.py
4
utils.py
|
@ -5,8 +5,8 @@ import numpy as np
|
||||||
|
|
||||||
def thresholding(img):
|
def thresholding(img):
|
||||||
imgHsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
|
imgHsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
|
||||||
lowerWhite = np.array([19,0,150])
|
lowerWhite = np.array([0,0,180])
|
||||||
upperWhite = np.array([170,70,255])
|
upperWhite = np.array([179,255,255])
|
||||||
maskWhite = cv2.inRange(imgHsv,lowerWhite,upperWhite)
|
maskWhite = cv2.inRange(imgHsv,lowerWhite,upperWhite)
|
||||||
return maskWhite
|
return maskWhite
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue