Ask Your Question

OpenCV with Logitech Pro 4000 on the Raspberry Pi

asked 2013-02-13 23:44:59 -0600

DuskFyre gravatar image

updated 2013-02-16 17:39:26 -0600

Hello everyone!

I have been attempting to use OpenCV to take pictures on the Raspberry Pi (Raspbian), but it does not seem to work for me. Whenever I run any camera-related programs, the window opens correctly, but only a grey image is displayed.

I have tested the webcam on my computer and it works fine. Additionally, the camera works with other, different webcam programs (Specifically, GuvCview). Here is the code I am currently using:

import as cv
import time

cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
capture = cv.CaptureFromCAM(0)

while True:

    frame = cv.QueryFrame(capture)
    cv.ShowImage("w1", frame)
if cv.WaitKey(10) == 27:  #Break on ESC


Thank you for your help!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-04-30 11:32:42 -0600

thePhi gravatar image

updated 2014-04-30 11:34:01 -0600

For me,


is not working. Try :

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

    #capture frame-by-frame
    ret = cap.set(3,160) #set Width 
    ret = cap.set(4, 120) #set Heigth
    #ret = cap.set(5, .0) NOT working on Logitech QuickCam: No FPS setting :(
    ret, frame =

    #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'):
# When everything done, release the capture
edit flag offensive delete link more

answered 2013-02-18 02:17:33 -0600

It looks like some OS related issue. Are you sure, that all needed drivers are loaded and works properly. OpenCV uses standard V4L and V4L2 interfaces for cameras. Is it properly enabled on your platform?

edit flag offensive delete link more

Question Tools


Asked: 2013-02-13 23:44:59 -0600

Seen: 1,261 times

Last updated: Apr 30 '14