-
Notifications
You must be signed in to change notification settings - Fork 0
OpenCV Setup
Alec Graves edited this page Apr 18, 2018
·
3 revisions
- Go to https://www.anaconda.com/download/
- download install python 2.7 version for your os
- Windows set-up instructions:
- Open the conda
.exe
- Choose an installation location (use the default if you are unsure, only for your user)
-
Make sure the checkbox that asks if you want to add to PATH is checked!
- If you miss this, just uninstall and repeat installation process.
- Or add conda to your path manually if you are elite.
- Open the conda
- Linux set-up instructions:
cd ~/Downloads/ sudo bash <minicondafile.sh> <go through setup> <yes you want to add to path>
- Windows set-up instructions:
- Open the terminal
conda install -c menpo opencv
test.py
import cv2
print(cv2.__version__)
cap = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ans = False
while ans == False:
ret, frame = cap.read()
ans = ret
# Our operations on the frame come here
frame = cv2.flip(frame, flipCode=1)
# ^ that command flips the image about y axis, making the camera act like a mirror
# Display the resulting frame
cv2.imshow('frame', frame)
#pause, allowing the image to be displayed
if cv2.waitKey(1)== ord('q'):
break #quit if you press q during the pause
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
( to run it from the terminal: python test.py
)
https://thecodacus.com/opencv-object-tracking-colour-detection-python/