Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is limiting my FPS?

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 = cap.read()
    now = time.time()
    print("cap.read() took: " + str(now - before))
    if(now - last >= 1):
        print(FPS)
        last = now
        FPS = 0
    else:
        FPS += 1
cap.release()

And the result is in the line of:

cap.read() took: 0.118262052536
cap.read() took: 0.118585824966
cap.read() took: 0.121902942657
cap.read() took: 0.116680860519
cap.read() took: 0.119271993637
cap.read() took: 0.117949008942
cap.read() took: 0.119143009186
cap.read() took: 0.122378110886
cap.read() took: 0.116139888763