FLIR Knowledge Base
Search for...
Search
        |     
Exclude unwanted words:
Browse KB Articles
Go Back Printable Version Email This Article Bookmark This Article

Image Tearing Causes and Solutions

KB Number: 10367
Last Revision Date: 2/23/2016

Image Tearing Causes and Solutions

Technical Application Note TAN2010003

Revised February 23, 2016

 

Subject

Technical Application Note (TAN2010003): Image Tearing Causes and Solutions

10374

Applicable Product(s)

  • All FireWire and USB 2.0 imaging cameras

Application Note Description

This application note explains image tearing, how to detect it, its causes, and recommended solutions.

What is Image Tearing?

Image tearing refers to the display of images that appear broken or misaligned. Image tearing has been seen on both laptop and desktop systems, and across a variety of hardware platforms and operating systems. It is not specific to any particular system configuration, and has been known to occur with FireWire and USB 2.0 devices.

There is a difference between horizontal image tearing where the image appears torn due to a problem with the video display, and the broken or torn images resulting from corrupt data. The following sections explain some common causes of image tearing and suggest solutions.

The following images show examples of image tearing.


Figure 1
This example shows an offset between the top and bottom halves of the image.


Figure 2
This example shows a broken image with the bottom portion containing data from another image.

Figure 3
This example shows an image that appears torn both horizontally and vertically, and includes data from more than one image.

Detecting Torn Images with FlyCapture

With FlyCapture SDK version 2.0.3.19 and newer, you can detect when the camera transmits a torn image. To use this feature, the following additional components are required:

  • Firmware version 1.3.3.0 (or later) for the Chameleon or Firefly MV or FMVU cameras. This version of firmware provides a mechanism for cameras to re-synchronize after a FIFO overflow, so that subsequent image transmissions are not torn.
  • Version 2.0.3.19 (or later) of the pgrUSB driver. This version allows torn images to be detected in RetrieveBuffer() calls. On versions earlier than 2.1, a PGRERROR_ISOCH_RETRIEVE_BUFFER_FAILED error is returned, along with the string, "There was an image consistency issue with this image." On versions 2.1 or later, the error is PGRERROR_IMAGE_CONSISTENCY_ERROR.

To get the necessary software and firmware updates, visit the Point Grey downloads page.

Why does my USB 2.0 camera experience torn images more often than my FireWire camera?

Image tearing can happen on both FireWire and USB 2.0 cameras, but has different causes.

FireWire transfers a complete image to the PC at one time. Image data feeds into the FIFO buffer on the host adapter, where it is picked up. If the PC cannot keep up with grabbing the data from the controller’s FIFO, the FIFO overflows and data is dropped.

USB 2.0 transfers data differently. Data is stored in a FIFO on the USB 2.0 camera, and polled by the PC directly. The data is sent in 512-byte packets. The PC polls the device every time it wants to receive the next packet. If the PC does not grab the data from the camera’s FIFO quickly enough, the FIFO overflows and data is dropped.

The main limitation of USB 2.0, and the reason it may tear more often than FireWire, is the limited amount of resources on the camera, which keeps the FIFO buffer relatively small. USB 2.0 cameras depend on the PC to ask for data, so if the PC is too busy, the camera’s FIFO can overflow quickly. FireWire cameras do not depend on the PC to ask for data; it is sent to the host adapter at the proper rate, and the camera’s FIFO does not overflow. Since there are more resources on the host adapter, FIFO buffers are larger, reducing the chance for overflow. 

Why do only some USB 2.0 cameras experience torn images?

The FIFO buffers on Point Grey USB 2.0 cameras are the same size. However, different cameras may fill their FIFOs at different data rates, so one camera may fill up quicker than another. Any property that affects the data rate can contribute to overflowing, such as pixel clock, frame rate, line rate, and valid pixels in a line. In general, the slower the data rate, the less likelihood of a FIFO overflow, even if the PC does not poll as quickly as it should. For example, a Firefly MV-03MT may have fewer torn images than a Chameleon because it runs at a slower pixel clock and lower resolution (assuming the Chameleon is running at full resolution). However, a Firefly MV 13S2 may have more torn images than a Chameleon, since it runs at a higher pixel clock, assuming the same resolution.

Video Display Issues

Horizontal tearing, such as the example shown in Figure 1, is often a video display issue, rather than a problem with the actual image data. To verify that the image data is not corrupted, run the SaveToAVI example available with the FlyCapture SDK, and analyze each frame of the AVI.

If the image data is not corrupt, the most likely reason for image tearing is that the frame rate of the image display is not synchronized with the refresh rate of the monitor. The monitor video display buffer fills with data, which is then displayed. Sometimes the display buffer only partially fills before the monitor grabs it and displays it to the screen. This causes the tearing effect and is more noticeable if the camera is being panned and there is a significant difference in image content between frames. For recommendations on how to reduce this type of image tearing, contact our Technical Support team.

If the image data is corrupt, review the following sections to find the likely causes and solutions.

Hardware Issues

Hardware issues may contribute to torn images on both FireWire and USB. 2.0 cameras. Some problems are specific to the interface, while others are more general.

General Hardware Issues

Here are some common hardware issues that may contribute to torn images with both FireWire and USB 2.0 cameras:

  • Inadequate power supply: Ensure adequate power is provided to the camera. Power consumption specifications can be found in the camera's Technical Reference or Getting Started manual, available on the Point Grey downloads site. For more information, see KB 10303 Providing power to Point Grey cameras.
  • Slow CPU speed: Ensure the host system has a fast CPU. A fast processor should help with the speed at which data can be pulled off the PCI bus.
  • Cables that exceed the maximum recommended length: For cable recommendations, see the camera’s Technical References, available on the Point Grey downloads site.
  • Older motherboards that use integrated graphics controllers: Integrated graphics controllers usually allocate a portion of available physical memory for moving image data, which reduces the amount of memory available for other operations. Use a PCIe video card with dedicated video memory. This applies to most other on-board devices, such as audio cards.

Note: Disabling onboard devices may reduce image tearing.

FireWire Hardware Issues

PCMCIA 1394 or CardBus controllers on laptop systems often have difficulty keeping up with required data transfer rates. Here are some possible solutions:

Power-Saving Features on Host Systems

Power-saving features added to the chipsets of more recent CPUs can interfere with data transmission. Adjusting the settings of some of these features may address image tearing when running Point Grey cameras at higher data rates.

Sleep State

Torn images may result from the CPU entering a sleep state. Point Grey provides a command prompt utility to disable CPU sleep states.

Download Point Grey Research PGRIdleStateFix utility (.zip)

For information about usage and parameters, run PGRIdleStateFix from the command prompt. The parameters are:

  • Disable — disables all processor sleep states
  • enable — enables processor sleep states
  • print — prints the current status of processor sleep states

Power Management of USB Root Hubs

Follow these steps to turn off the power-saving features of USB root hubs on your system:

  1. Open Device Manager.
  2. Expand the Universal Serial Bus Controllers group.
  3. Right-click USB Root Hub and choose Properties.
  4. Select Power Management.
  5. Uncheck Allow the computer to turn off this device to save power.

Enhanced Halt State (FireWire)

Use of the C1E Enhanced Halt State can cause image tearing. This is primarily due to C1E slowing the transfer of image data off the FireWire host adapter card, which results in FIFO overflows. In some cases, it is possible to disable this feature in the host system's BIOS. If this is not possible, use the following utility to adjust the CPU settings to turn off the C1E state:

Download Point Grey Research EnhancedHaltState utility (.zip)

Insufficient Bandwidth (FireWire)

With FireWire cameras, certain bandwidth issues may contribute to image tearing. For example, if the host system or PC cannot keep up with data rates across the 1394 PCI or laptop PCMCIA bus, corrupt images may occur. Reasons for these types of situations include:

  • The PCI bus becomes saturated.
  • The memory bus bandwidth becomes saturated.
  • The PC cannot keep up with the interrupts being generated.

PCI bus saturation is a common situation and can happen for a number of reasons, including:

  • Running multiple FireWire cameras at high frame rates that push bandwidth limits.
  • Large hard disk reads/writes.
  • Heavy network traffic.

When the PCI bus is saturated, the system cannot keep up with the data rates going across it. As a result, images cannot be pulled off the 1394 PCI card fast enough. The isochronous FIFO buffers on-board the card gradually fill with image data from the camera, and eventually a general FIFO overflow occurs. These overflows can result in:

  • Tears through the middle of an image due to data packets being dropped and the current image being filled by data from the next image (Figure 2 above).
  • Broken images that are made up of many different images (Figure 3 above).
  • Images that are dropped completely (see KB 10189 Avoiding dropped or missed images using FlyCapture).

Typically, synchronization packets prevent repeated image tearing. When data is dropped, the current image is torn, but the image corrects itself for the next frame, unless data is dropped from that image as well. Note that general FIFO overflows occur at the lowest level of the Windows IEEE 1394 substructure, making them beyond the control of Point Grey drivers and software.

Laptop C3 Power State Transition (FireWire)

Corrupted data when using the IEEE 1394 port on a laptop computer can be caused by too much latency in the C3 power state transition, which causes buffer overruns on the host adapter. The interrupts associated with the processor's ability to dynamically change speeds conflict with the high demand on the processor that is needed when streaming video or data across the IEEE 1394 port. This is seen on laptops from various manufacturers.

Troubleshooting Image Tearing

The following suggestions may help to avoid torn images, depending on system components and configuration, speed and/or hardware:

  • To determine whether the problem is due to video display issues or corrupt data, run the SaveToAVI example in FlyCapture and analyze each frame of the AVI.
  • Use FlyCapture’s torn image detecting features.
  • Ensure the camera is adequately powered.
  • Use compatible hardware, including PC, cables, and hubs.
  • Disable power-saving features.
  • If possible, lower the overall data rate by lowering the frame rate or using a Format_7 mode that transmits lower-resolution images using region of interest and/or pixel binning.

A combination of solutions may be required to minimize occurrence of torn images.

Was this article helpful?

Go Back Printable Version Email This Article Bookmark This Article