How to install opencv 2.9 for python?

Before installing the development version of OpenCV, I'd suggest to use this code to set the capture size (from the link you posted I assume you're using python):

import cv2

cap = cv2.VideoCapture(device_no)
cap.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width)
cap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, height)

To install the development version of opencv (3.0.0-dev today) please follow the steps below:

cd $HOME
mkdir opencv_src
cd opencv_src/
git clone https://github.com/Itseez/opencv.git
cd opencv/
mkdir release
cd release/
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

Open terminal, then launch python interpeter:

python

then, import opencv:

import cv2

finally, print version:

cv2.__version__

if you want to install the latest development version of opencv, you can follow the instructions of the official documentation of opencv from here

Tags:

Python

Opencv