Note: Before configuring the camera GigE streaming parameters in MATLAB, make sure the Gigabit Ethernet card/adapter configuration and network connection settings are according to the "GigE Vision Quick Start Configuration Guide" (attached at the end of this article as GigEVisionQuickStart.pdf).
The following documentation pages contain additional configuration and troubleshooting information:
The dropped frame error message can be caused by GigE packets being lost as a result of high CPU load.
To lower the CPU load when acquiring images with the GigE adaptor try the following:
1. Raise the value of the PacketSize source property while making sure it is not larger than the Ethernet card jumbo frame/packet size.
Note: With some hardware configurations the dropped frame error might be encountered when the PacketSize is equal to the Ethernet card jumbo frame size, so try using smaller PacketSize values (for example, if the Ethernet card Jumbo frame is 9000 bytes, try setting the PacketSize to 8000).
2. For optimum performance and to prevent dropped frames configure the camera to insert an appropriate delay between packets by setting the PacketDelay source property.
- The PacketDelay property is available for Image Acquisition Toolbox 4.2 (R2011b) and above
- Starting in MATLAB R2013a the toolbox does an automatic configuration of the PacketSize value. This should lead to increased performance and lower CPU load. Due to this optimization of PacketSize, you may need to adjust your PacketDelay accordingly.
The recommended PacketDelay value depends on the PacketSize, camera resolution (image height and width), pixel format (for example 'Mono8'), camera frame rate, and other camera specific settings.
The attached CalculatePacketDelay.m and CalculateFrameRate.m scripts can be used to calculate the recommended PacketDelay value.
The 'CalculatePacketDelay.m' script will calculate the recommended packet delay corresponding to the frame rate the camera is set to operate at and it takes as input arguments the video input object and the camera frame rate.
Depending on the camera model, the camera frame rate may be obtained as a device specific property, but it can also be estimated (or verified) with the 'CalculateFrameRate.m' script, which acquires a specified number of frames to determine an effective frame rate.
>> vid = videoinput('gige', 1, 'Mono8');
>> src = getselectedsource(vid);
>> src.PacketSize = 9014;
>> framesToAcquire = 5;
>> framesPerSecond = CalculateFrameRate(vid, framesToAcquire)
>> delay = CalculatePacketDelay(vid, framesPerSecond)
Calculating Packet Delay for:
FrameRate = 10, PacketSize = 9014, FrameHeight = 656, FrameWidth = 490, VideoFormat = Mono8
Time stamp tick frequency (ticks/s): 31250000.0
Used gigabit bandwitdh: 2.6
Packet Delay: 72097.8 (ticks)
>> src.PacketDelay = delay;
Note: To prevent acquisition stopping due to a dropped frame error, use the PacketDelay value recommended for your camera configuration parameters. Using values arbitrarily larger or smaller is not likely to provide a correct configuration for the GigE streaming process.