Look for the opencv package in python with Pip, in the example below I am in a Ubuntu 16, in an env python3:
~$ pip search opencv | grep "^opencv"
opencv-python-armv7l (3.2.0) - opencv-python on armv7l.
opencv-contrib-python (3.2.0.7) - Wrapper package for OpenCV python bindings.
opencv-cython (0.4) - An alternative OpenCV wrapper
opencv-utils (0.0.2) - OpenCV Utilities
opencv-python (3.2.0.7) - Wrapper package for OpenCV python bindings.
opencv_cffi (0.2.2) - A random subset of OpenCV's functionality, wrapped via CFFI
opencv_engine (1.0.1) - OpenCV imaging engine for thumbor.
opencv_helpers (1.1) - Helper functions for opencv
opencvutils (0.9.2) - Simple OpenCV 3.x image processing functions
In that case we’ll install the fourth item:
pip install opencv-python
Or install the anaconda and end all package problems. :-)
Example of use
Capturing a video:
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
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()
This example was taken from the great documentation of the package, there an area of tutorials very good with various exercises, have fun.
Already tried:
pip install opencv-python
– gato
did not work, does not seem to exist a bilioteca in opencv Pip
– Leonardo
I used this tutorial in English for Ubuntu 16.04
– danieltakeshi