Raspberry Pi
See python development environment construction
Windows
Introducing tensorflow and opencv with anaconda
mac
When entering the system(opencv2)
$ brew install gcc
$ brew install cmake
$ brew install tesseract
$ brew tap homebrew/science
$ brew install opencv
$ ln -s /usr/local/Cellar/opencv/2.4.13.2/lib/python2.7/site-packages/cv2.so /Users/riki/.pyenv/versions/ML-2.7.13/lib/python2.7/site-packages/
When using anaconda(opencv3)
$ pyenv install anaconda3-4.1.1
$ cd <workspace with opencv3>
$ pyenv local anaconda3-4.1.1
$ conda install -c https://conda.anaconda.org/menpo opencv3
$ conda update hdf5
Use opencv's canny edge detection.
edge-detection.py
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
frame = cv2.Canny(frame, threshold1 = 100, threshold2=300)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Recommended Posts