Ask Your Question
1

Streaming Logitec C922 at 60fps with C++

asked 2017-08-25 04:16:44 -0600

gellpro gravatar image

Hi

I would like to capture images with a webcam (i.e. logitech C922) with C++. Does anyone succeed in capturing images with the webcam at 60fps and 720p? I read the code in the following thread and add "cap.set(CAP_PROP_FPS, 60)", but the frame rate was maintained at about 30fps. https://stackoverflow.com/questions/4...

Is it impossible to make the webcam capture images at this specification?

Environment Information OpenCv: 3.3.0 OS: Windows 10 Pro IDE: Visual Studio 2017 CPU: i7-7560U RAM 16GB USB: 3.0

Best regards, gellpro

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2017-08-25 07:00:41 -0600

LBerger gravatar image

try : cap.set(CAP_PROP_EXPOSURE, 0);

be sure you are not in dark, outside in sunny weather exposure time will be less than 1/1000s

edit flag offensive delete link more

Comments

Hi, LBerger. I apologize for this late reply. I tried cap.set(CAP_PROP_EXPOSURE,0) and cap.set(CAP_PROP_EXPOSURE, -DBL_MAX), but I could capture Images at only 5fps and 33.3fps, respectively. This frame rate was measured with the following codes: { time_t cap_start, cap_end; Mat frame; while (true) { double MAX_FRAME_NUM = 100; time(&cap_start); for (int n = 0; n < MAX_FRAME_NUM; n++) { cap >> frame; } time(&cap_end); double fps = MAX_FRAME_NUM / difftime(cap_end, cap_start); cout << "fps:" << fps << endl; cvWaitKey(0); } }

Additionally, I followed this instruction by Logitech: http://support.logitech.com/en_us/art... and set the lowest value at the Exposure. What can I do anything else?

gellpro gravatar imagegellpro ( 2017-09-05 10:45:41 -0600 )edit

I haven't got c922. you can try to reduce resolution. Try to set camera parameter using set(CAP_PROP_SETTINGS,0)

LBerger gravatar imageLBerger ( 2017-09-05 13:45:35 -0600 )edit
0

answered 2017-08-25 06:43:28 -0600

Ziri gravatar image

updated 2017-08-25 07:14:45 -0600

Try
int FPS = (int)cap.get(CAP_PROP_FPS);

if it doesn't work try :

  VideoCapture cap(YOUR_CAM_INDEX)
  time_t cap_start, cap_end;
  Mat frame;
  MAX_FRAM_NUM = 100;
  time(&start);
  for(int n = 0; n < MAX_FRAM_NUM n++){cap >> frame;}
  time(&end);
  double fps = fps  = MAX_FRAM_NUM / difftime (end, start);

  
I also checked code you posted and you're modifying width & height from source before calculating fps.

edit flag offensive delete link more

Comments

Is it an anwer?

LBerger gravatar imageLBerger ( 2017-08-25 06:57:55 -0600 )edit

Yes. i think the issue is the method used to check fps.

Ziri gravatar imageZiri ( 2017-08-25 07:16:17 -0600 )edit

Hi, Ziri. Thank you for your reply. I apologise for the delay in replying to you. I added codes you proposed. As the result, the value of fps was 33.3... and FPS was 60.0. The image shown with imshow wasn't updated obviously at 60fps. Is there anything I can do?

gellpro gravatar imagegellpro ( 2017-09-01 17:37:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-08-25 04:16:44 -0600

Seen: 1,759 times

Last updated: Aug 25 '17