changing file path of vid for tracking on new dev branch

main
mwinter 1 year ago
parent 128a0fc928
commit 45eac7a8f3

@ -18,7 +18,7 @@ port = 57120
client = SimpleUDPClient(ip, port) # Create client
# Read video (eventually will be the live capture from the camera)
video = cv2.VideoCapture("/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem/recs/a_history_of_the_domino_problem_final_documentation_hq.mp4")
video = cv2.VideoCapture("/home/mwinter/Portfolio/a_history_of_the_domino_problem/a_history_of_the_domino_problem_git_rebase/recs/a_history_of_the_domino_problem_final_documentation_hq.mp4")
# Exit if video not opened.
if not video.isOpened():
@ -32,8 +32,8 @@ if not ok:
print('Cannot read video file')
sys.exit()
#frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
#frame = cv2.GaussianBlur(frame,(5,5),cv2.BORDER_DEFAULT)
#frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
#frame = cv2.GaussianBlur(frame,(5,5),cv2.BORDER_DEFAULT)
# all this for selecting ROI
#xROI = cv2.selectROI('Tracking', initFrame)
@ -57,8 +57,8 @@ centroidY = [0, 0]
def track(frame, ROI, centroid, update):
if(update):
crop = frame[int(ROI[1]):int(ROI[1]+ROI[3]), int(ROI[0]):int(ROI[0]+ROI[2])]
crop = cv2.cvtColor(crop, cv2.COLOR_RGB2GRAY)
crop = cv2.GaussianBlur(crop,(7,7),cv2.BORDER_DEFAULT)
crop = cv2.cvtColor(crop, cv2.COLOR_RGB2GRAY)
crop = cv2.GaussianBlur(crop,(7,7),cv2.BORDER_DEFAULT)
#ret, thresh = cv2.threshold(crop, 100, 255, cv2.THRESH_OTSU + cv2.THRESH_BINARY)
ret,thresh = cv2.threshold(crop, 50, 255, 0)
@ -77,7 +77,7 @@ def detect_motion():
# grab global references to the video stream, output frame, and
# lock variables
global vs, outputFrame, lock
frameCountMod = 0
centroidX = [0, 0]
centroidY = [0, 0]
@ -107,17 +107,17 @@ def detect_motion():
# Display result
#cv2.imshow("Tracking", frame)
#cv2.imshow("Crop", crop)
with lock:
outputFrame = frame.copy()
# Exit if ESC pressed
#k = cv2.waitKey(1) & 0xff
#if k == 27 :
#if k == 27 :
# cv2.destroyWindow('Tracking')
# break
@app.route('/')
def index():
"""Video streaming home page."""
@ -145,7 +145,7 @@ def generate():
continue
# yield the output frame in the byte format
yield(b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' +
yield(b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' +
bytearray(encodedImage) + b'\r\n')
@ -159,4 +159,4 @@ if __name__ == '__main__':
t = threading.Thread(target=detect_motion)
t.daemon = True
t.start()
app.run(host='10.0.0.5', threaded=True)
app.run(host='127.0.0.1', port=5000, threaded=True)

Loading…
Cancel
Save