PDA

View Full Version : Problem with memBufferCollection



dm230105
January 19, 2011, 20:07:05
Hi, could someone help me...
running the attached code, it save snapped pics and before to exit the full pCollection. Why last snapped image is in the first position ( I mean something like this pC0llection[0] ) inside the pCollection .


Tia
Dui

Stefan Geissler
January 20, 2011, 09:54:48
Hello

I think it is a relict of the old VB6 times, when the first element of an array had index 1 instead of 0.

dm230105
January 20, 2011, 10:16:40
Hello,
it seems strange because I haven't no problems running the same code with
libreries 2.xx. I updated the libraries to version 3.1.

Could you suggest me a solution, I sent you only few code lines needed to discovery the problem, but my program has a lot of code and I don't want to change it
thanks
Dui

Stefan Geissler
January 21, 2011, 10:40:50
Hello,

I must admit, I do not know, how this was in IC 2.1, this is more than 5 years ago.

After you have started your application, it seems, the first image buffer filled in the collection has index 1. This can easily be verified by following code:

if (m_cGrabber.isLive())
{
m_pSink->snapImages(1);
TRACE("Index : %d\n",m_pSink->getLastAcqMemBuffer()->getCollectionPos());
}

The output starts with "Index : 1".

Since I do not know, how you handle your image buffer collection, I can not give a good hint, what to do. However, the Membuffer has a sample description, that contains the sample start time. You may run through the membuffer collection and find the oldest membuffer using this. Then you can start handling the mem buffers beginning with this buffer. There is a similar sample in C# available here:
http://www.imagingcontrol.com/en_US/library/dotnet/iterating-an-image-sequence/
In the middle near "Find the oldest image in the ring buffer...." is the interesting part.

Also related links are:
http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descIFrame_getSampleDesc.htm
http://www.imagingcontrol.com/en_US/support/documentation/class/c_structrefstruct_tsMediaSampleDesc.htm

dm230105
January 21, 2011, 11:18:32
Thanks for your suggestion.

I really appreciate that.