updating open cv to version 3

asked 2014-01-16 19:48:47 -0600

Pranav Lal gravatar image

updated 2014-01-17 03:01:37 -0600

berak gravatar image

Hi all,

I have opencv version 2.3 installed on my raspberry pi running raspbian. I looked at http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html the tutorial talks about opencv 3.0.0. Is this still under development? If not, how do I upgrade to it? Please see below for installed version details pi@piprime ~ $ dpkg -l | grep libopencv
ii libopencv-calib3d2.3 2.3.1-11 armhf
computer vision Camera Calibration library
ii libopencv-core2.3 2.3.1-11 armhf
computer vision core library
ii libopencv-features2d2.3 2.3.1-11 armhf
computer vision Feature Detection and Descriptor Extraction library
ii libopencv-flann2.3 2.3.1-11 armhf
computer vision Clustering and Search in Multi-Dimensional spaces library
ii libopencv-highgui2.3 2.3.1-11 armhf
computer vision High-level GUI and Media I/O library
ii libopencv-imgproc2.3 2.3.1-11 armhf
computer vision Image Processing library
ii libopencv-legacy2.3 2.3.1-11 armhf
computer vision legacy library
ii libopencv-ml2.3 2.3.1-11 armhf
computer vision Machine Learning library
ii libopencv-objdetect2.3 2.3.1-11 armhf
computer vision Object Detection library
ii libopencv-video2.3 2.3.1-11 armhf
computer vision Video analysis library
pi@piprime ~ $

I want to upgrade because I want to run feature detection code. Please see the below python program as an example of what I want to run. Note: This program may have errors because I have been unable to test it.

import cv2
import time
#test program for monocular obstacle detection
vc = cv2.VideoCapture(-1)
if vc.isOpened(): # try to get the first frame
    print 'fetching first frame'
    rval, frame = vc.read()
else:
    rval = False
    print 'unable to fetch frame'
while rval:
    rval, frame = vc.read()
    time.sleep(100)
    frame=vc.read()
    print 'images read.'
    #we now have two images one second apart
    orb = cv2.ORB()
    kp1, des1 = orb.detectAndCompute(rval,None)
    kp2, des2 = orb.detectAndCompute(frame,None)
    print 'detection  done'
    bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
    matches = bf.match(des1,des2)
    print 'matches done.'
    matches = sorted(matches, key = lambda x:x.distance)
    print matches[0].distance
print 'end.'
edit retag flag offensive close merge delete