So I'm working on a computer vision project that grabs video from my webcam and detects faces in each frame. Earlier yesterday morning I was capping out at 30 frames per second, which is what I believe to be the max for my webcam. As the day became night and I was wrapping up my work on a portion of the project, I noticed that my newly compiled version was only getting around 8 frames per second. Confused, I looked into my frame grabbing + face detection code.

"Maybe I can only detect faces in a certain region of the image, based on where the face was in the previous image?" No, still 8fps. Hmm.

"How about I lower the resolution of the image, that would definitely help!" I tried that, but no speed boost came either. What??

I start to dig deeper. Maybe I'm not linking my libraries correctly, and it's using an older library I compiled. So I recompile that. Nothing.

"Am I low on resources?" I close out of all my other apps. Nothing.
Okay, wtf. Now I just comment out the face detection code entirely, and only grab webcam frames.

8fps. ?????

Suddenly, I get an idea. I get out of my desk, walk over to the doorway of my room, and flip the light on. I sit back down, and run my code.


The stupid webcam switches to "night mode" when it detects low light, which restricts its ability to output frames at high speed and caps at 8fps. Damn, I felt like a fool 😂

  • 11
    If you own a canon dslr you may can use it as a webcam and have much more control.
    Good luck with your project. :)
  • 2
    @heyheni great idea, I do have one!
  • 5
    I've guessed what the problem and solution will be when I've read "when day become a night". I had the same problem when having fun with computer vision.
  • 1
    @heyheni how? I was writing a direct show driver for the EOS 6&7D to get a Livestream from the camera. Never got it stable tough :(
  • 4
    Haha yep. If you don't have enough light all you can do is take longer exposures. If the shutter speed is more than 1/30 you can't take 30 frames in a second anymore.
Add Comment