Install python 3.6 with opencv 3.3.0 in windows 10
I want to using new method for mouse tracking. but it looks like not support python2.7.
so I need to get a environment of python 3.6 and opencv 3.3.0
It is much much easier! because it already have pip and have a option to automatic add Path.
print (cv2.__version__)
cap = cv2.VideoCapture(0) #0 is 1st camera, 1 is 2nd
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray )
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
so I need to get a environment of python 3.6 and opencv 3.3.0
It is much much easier! because it already have pip and have a option to automatic add Path.
- install python 3.6
- if you had install older version of python. please uninstall them before install new version.
- download python 3.6.3 from https://www.python.org/downloads/
- run the "python-3.6.3.exe", remember to select "Add Python 3.6 to PATH" and install
- go to cmd, type "pip", make sure pip is installed.
- install opencv 3.3.0
- download the correct .whl file from https://pypi.python.org/pypi/opencv-python
- run cmd
- type "pip install packagename.whl" (packagename is the name of your .whl file)
- after it complete. goto IDLE and use following code the makesure it works.
import cv2
print (cv2.__version__)
cap = cv2.VideoCapture(0) #0 is 1st camera, 1 is 2nd
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',gray )
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
Comments
Post a Comment