Avoiding dropped or missed images in FireWire cameras using FlyCapture1
Last Revision Date: 4/29/2016
This article describes some general conditions under which grabbed images may be missed, dropped or overwritten before the user can see them.
DETECTING DROPPED OR MISSED IMAGES
- Users who use FlyCaptureImagePlus in their programs have access to an image sequence number via the uiSeqNum member of the FlyCaptureImagePlus structure. This sequence number is generated by the driver and sequential images should have a difference of one. If the difference is greater than one, it indicates the number of missed images since the last flycaptureLockNext() call.
- Many of our IEEE-1394 digital cameras have embedded time stamp functionality (see "Imaging Products timestamping and different timestamp mechanisms"). If the camera is running at a set frame rate (e.g. 15fps = 1 frame every 66.6ms), the user can use the timestamps from two successive images to calculate the actual time between images.
CAUSE OF DROPPED OR MISSED IMAGES
If a user program is reporting “missed” images, this is a result of the missing images being overwritten in main memory. When flycaptureStart*() is called, four buffers in main memory are allocated that are used to hold the images that are streamed in from the camera. When a camera is started, it immediately begins capturing and streaming images via DMA to these memory buffers. Once these buffers are full, they are overwritten with consecutive images unless the user locks them.
Try the following suggestions to eliminate incidents of missing images:
-
- Allocate a larger number of memory buffers.
- Reduce system latency.
- Restrict the amount of processing that is being done between successive calls to retrievebuffer().
Note: System latency can be caused by overloading the CPU. To reduce this latency, increase system processing power.
The term ”dropped images” is often used to mean that images have not reached the memory buffers at all, but instead have been lost somewhere in transit between the camera and main memory. There are three main points where images can be dropped, and in most cases it will always be a full frame that gets dropped:
- On the camera itself, a frame transmit failure can occur. However, this is usually caused by either a serious problem or bug in the firmware or hardware of the camera, and is very rare.
- On the way from the camera, along the IEEE-1394 bus, to the PCI bus. However, this requires the IEEE-1394 bandwidth requirements to be exceeded (see "Maximum number of IEEE-1394 cameras on a signle 1394 bus").
- Along the PCI bus on the way to the CPU, where it generates an interrupt and gets sent to memory by the driver. However, this requires the PCI bus to be saturated. While our technical staff has never observed this directly, it might happen if multiple 1394b cards were each trying to send 80MB/s along the bus. It's important to note that the workings at this level are handled by the Windows 1394 driver system.
AVOIDING DROPPED OR MISSED IMAGES
We recommend the following practices to avoid dropped or missed images:
-
- Do not exceed IEEE-1394 bus bandwidth constraints.
- Avoid saturating the PCI bus.
- Install the latest version of our camera firmware.
- Use a fast system with an appropriate number of buffers allocated.