- 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.
How do I calculate the packet delay for a GigE Vision camera to prevent dropped frames?
67 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2012-10-5
编辑: MathWorks Support Team
2023-12-24
I am using a GigE Vision compliant camera with the Image Acquisition Toolbox GigE Vision adaptor. However, after a number of frames are acquired the acquisition stops and the following error message is displayed:
ERROR: gige: Block/frame 23 is being dropped because a lost packet is unable to be resent.There are several possible causes for packets being lost. See the troubleshooting information in the "Configuring GigE Vision Devices" section of the Image Acquisition Toolbox documentation.
How can I calculate the recommended packet delay corresponding to my camera settings?
采纳的回答
MathWorks Support Team
2023-12-23
编辑:MathWorks Support Team
2023-12-24
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.
Note:
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.
CalculatePacketDelay(vid, framesPerSecond)
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.
CalculateFrameRate(vid, framesToAcquire)
Example:
>> vid = videoinput('gige', 1, 'Mono8');
>> src = getselectedsource(vid);
>> src.PacketSize = 9014;
>> framesToAcquire = 5;
>> framesPerSecond = CalculateFrameRate(vid, framesToAcquire)
ans =
10.0003
>> 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)
delay =
7.2098e+04
>> 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.
1 个评论
Julia Antoniou
2018-7-5
Hi David,
Apologies for the delayed reply. I would recommend contacting MathWorks Technical Support directly about this question. You can do so here:
https://www.mathworks.com/support/contact_us.html
更多回答(1 个)
cr
2015-12-7
编辑:cr
2015-12-8
On my camera (Basler ACE2500 14gm), packetSize setting behaves in a manner opposite to what's been described here. The default packetSize is 2000 and when I increase it to 8192 (with Jumbosize set to 9014) the CPU usage still remains very high (over 90% for 8fps Mono8). Hence, increasing the PackDelay setting even to 10000 as next step doesn't help much (The vendor software does 8fps while not using CPU above 25%). However, if I reduce packetSize to 500 it helps the CPU usage magically. The packetDelay setting then kicks in to reduce CPU load even further. With packetSize of 300 and delay of 8000 I'm able to closely match vendor software performance. I don't know if these guidelines and settings work for anyone or the general recommendations here depend of camera/driver, etc but they certainly didn't work for me and, worse, are misguiding. The attached utility files often suggest packetDelay values that make camera return no images. E.g. With 10fps and the settings aforementioned, the packetDelay suggested was 250, an unusable value.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GigE Vision Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!