When trying to use a webcam in a computer vision application as part of a real-time control system, the latency is often just as important as the frame rate. Unfortunately, the latency for a webcam is often not specified, especially not for low-cost webcams.
One simple way to measure the webcam latency is to point the camera at a computer screen that is displaying the view from the camera and also printing the current time on the screen. You end up with infinite recursion images like this:
|Latency Test Images|
The difference between the time which is overlaid on the image (the largest type) and the time shown in the image from the webcam (the next largest) is the latency. The Python / OpenCV2 code I used to capture these screenshots is up on Github.
Here are the results for three cameras I measured:
|Camera||Model No.||Latency (ms)||Frame-Rate (fps)|
|ELP USB with Camera 2.1mm Wide Angle Mjpeg 5megapixel Hd Camera USB for Industrial, Machine Vision||ELP-USB500W02M-L21||~115 to ~130||10|
|ELP 2megapixel Hd Free Driver USB Camera Support Mjpeg Linux Android Windows Developing Board,usb Camera Module||ELP-USBFHD01M-L36||~105||30|
|PlayStation Eye||PS3 Eyecam||~75||60|
All cameras were set to capture at 640 x 480. The above cameras are all consumer grade cameras, costing about $45 for the ELP models, and only $5 (!) for the PS3 Eyecam. As a comparison point, $280 would get you the Slim-3U from Optitrack which is specifically designed for motion capture and has a 8.33ms latency. Let me know if you find any other sub-$100 cameras that perform better!
This camera has a nice image quality, but the frame rate is slow and the latency was inconsistent. The lagginess of this camera is very evident upon first usage of the camera.
This camera had good image quality, tolerable latency, and a 30fps rate. I tested the version with a 3.6mm lens, but the base camera model USBFHD01M is also available with a 170degree fisheye lens or 2.1mm lens. There is a nice review of this camera here.
This is the camera that I ultimately chose for my computer vision project.
For a cost of $5, this is a very interesting camera. The latency of this camera was the most consistent, and it is also capable of higher frame rates. In order to use it on a Windows system, you will want to purchase a driver from Code Laboratories at a cost of $2.99 (it works very well). One tip, you may need to create a cleye.config file and save it in “C:\Program Files\Code Laboratories\CL-Eye Driver” to get greater than 30fps from the camera/driver. This file contains this text:
<?xml version=”1.0″ encoding=”UTF-8″?>
<item name=”mode” value=”advanced” />
The image quality from this camera was not that great though (you can see it’s image is more blurry than from the other two camera), so that is why I did not choose this camera for my project. It would be great for applications where there is fast motion and image quality is not as critical.
Industrial cameras and other links
In addition to the Optitrack camera mentioned above, here are a few more cameras I found discussed on Reddit that offer low latency. These are higher cost industrial cameras:
This is a project that measured latency using the same technique shown here using a Pi camera on a Raspberry pi.