Look for the opencv package in python with the pip, in the example below I am in a ubuntu 16, in a 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 this case we will install the fourth item:
pip install opencv-python
Or install anaconda and get rid of 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 package documentation, an area of tutorials very good with several exercises, have fun.