2011年10月16日日曜日

Compiling and Installing OpenCV 2.2 on Ubuntu

Compiling and Installing
Download source from:
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/


Then apply the following modifications
https://code.ros.org/trac/opencv/changeset/5206

Then,
cd OpenCV-2.2.0
mkdir build
cd build
cmake .
make 
sudo make install


Sample python code
A sample code  to grab images and show it.
Press q to finish.


import cv


capture = cv.CaptureFromCAM(0)#CreateCameraCapture(0)
cv.NamedWindow("Test", cv.CV_WINDOW_AUTOSIZE)
    
while 1:
    img = cv.QueryFrame(capture)    
    cv.ShowImage("Test", img)
    c = cv.WaitKey(2)
    print c
    if c ==ord('q'):
        break



0 件のコメント:

コメントを投稿