Ask Your Question

What is limiting my FPS?

asked 2015-01-05 12:38:16 -0500

Jaman42 gravatar image

Hi, I plan on building a ROV and I am working on my video feed atm. I will be using fiber optics for all communications and I am tinkering with opencv to stream a webcam feed with python. I might choose to use IP cameras but I wanted to learn more about how to capture frames from a webcam in python first. Since I didn't know what I was going to use in the end I bought a cheap-as-they-get noname USB webcam just to try and get everything working. This camera feed is going to be used for navigation, a seperate video recorder will probably be used for recording video.

Enough about that, now to my issue. I am getting only 8 FPS when I am capturing the frames but I suspect that is due to the cheap webcam. The webcam is connected to a pcduino 3 nano which is connected to a arduino for controlling thrusters and reading sensors. I never thought of how to utilize hardware in encoding and decoding images, I don't know enough about that part yet to tell if I can utilize any of the hardware.

Do you guys believe it's my web cam that is the bottleneck? Is it a better idea to use a IP camera or should I be able to get a decent FPS using a webcam connected to a pcduino 3 nano capturing frames with opencv?

Im programming in Python, this is the test I made:

import cv2, time
FPS = 0
cap = cv2.VideoCapture(0)

last = time.time()

for i in range(0,100):
    before = time.time()
    rval, frame =
    now = time.time()
    print(" took: " + str(now - before))
    if(now - last >= 1):
        last = now
        FPS = 0
        FPS += 1

And the result is in the line of: took: 0.118262052536 took: 0.118585824966 took: 0.121902942657 took: 0.116680860519 took: 0.119271993637 took: 0.117949008942 took: 0.119143009186 took: 0.122378110886 took: 0.116139888763
edit retag flag offensive close merge delete


Just wondering are you building in debug or release mode? I am guessing the first, which will drop the FPS drastically. But yeah most cheap ass webcams only supply around 20 FPS...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-06 07:00:49 -0500 )edit

Hi thank you for your answer, the code I posted is what I tried. Just as a test to see what FPS I could achieve. I tried it on my main PC to see if it was any different and it wasn't. That should mean that the webcam is the issue assuming I can get much better result with the code above. I ordered a new webcam that can deliver 30 fps to test with. Is it much quicker to do it in c or should I be able to get good results with Python as well?

Jaman42 gravatar imageJaman42 ( 2015-01-08 11:46:29 -0500 )edit

The language doesn't matter, the fact if you are using DEBUG or RELEASE builds does matter alot... can you please elaborate?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-09 02:59:24 -0500 )edit

I think I misunderstood you, I am using a release build of Opencv. I thought interpreted languages like Python was slower then compiled like C, it isn't? Or just to little to notice doing something like this?

Jaman42 gravatar imageJaman42 ( 2015-01-09 12:11:57 -0500 )edit

No the difference between python and c++ should be minimal ... lets wait the result of the other cam...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-09 12:33:32 -0500 )edit

Good to see you got it fixed! Strange tough that there still exist cameras with only 8 FPS -_-

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-12 06:39:08 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-01-12 04:18:27 -0500

Jaman42 gravatar image

I got the new webcamera and did get 30fps using the same code, my camera didn't handle low lighting very well but with the help of a flashlight I got there :)

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-01-05 12:38:16 -0500

Seen: 1,982 times

Last updated: Jan 05 '15