Raspberry Pi
Siehe Aufbau der Python-Entwicklungsumgebung
Windows
Einführung von Tensorflow und OpenCV mit Anaconda
mac
Beim Betreten des Systems(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/
Bei Verwendung von Anakonda(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
Verwenden Sie die [Canny Edge Detection] von opencv (http://labs.eecs.tottori-u.ac.jp/sd/Member/oyamada/OpenCV/html/py_tutorials/py_imgproc/py_canny/py_canny.html).
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