need help c920

asked 2014-10-25 19:30:39 -0600

Hi all ! I have a problem with my Logitech c920. Under windows 7 32 (My VS c++ application and commercial) after some minutes the camera turn off, under ubuntu 64 the same (in VLC, cheese, my opencv programs, gtk uvc, skype ...), but after install windows 8 the camera work fine long time and no problem. I try the same code, other webcam and all right on 7,8 and ubuntu 14.10, but no the c920. forgotten windows 7 im trying to get working the c920 under ubuntu, I use Gtk uvc viewer and video4linux to disable auto focus and other uvc driver option but the problem persist, after some minutes, the camera auto turn off freezing the image and showing "VIDIOC_DQBUF: no such device"

My code is:

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <time.h>
#include <stdio.h>
using namespace cv;
using namespace std;

int main() {
VideoCapture cap(1);

time_t start, end;
double fps;
int counter = 0;
double sec;
time(&start);
if(!cap.isOpened())
return -1;

Mat frame;
cap >> frame;
namedWindow("cam");

cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
cap.set(CV_CAP_PROP_FPS, 20);

while (true)
{
    cap >> frame;
    imshow("cam", frame);

    time(&end);
    ++counter;
    sec = difftime (end, start);
    fps = counter / sec;
    printf("FPS = %.2f\n", fps);

    if (waitKey(30) >= 0)
    break;
}
cap.release();
cvDestroyWindow( "cam" );
return 0;
}

Thanks :)

edit retag flag offensive close merge delete

Comments

I used the C920 and C930 in commercial applications in Debian 64 bit (wheezy and squeeze). This is very unusual, since I can leave the camera on in large amount of time. Seems me more a hardware issue.."VIDIOC_DQBUF: no such device" means that the camera disconnected itself (maybe overheat). Did you tested this camera in applications such as guvcview ?

R.Saracchini gravatar imageR.Saracchini ( 2014-10-27 04:50:27 -0600 )edit