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