Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence Setup Math doesnt add-up

I have a NI IMAQ that Im trying to use to collect 300 consecutive
frames off a 60hz, 320x240 16 bit camera on Win2000 (1.5Ghz, 512MB).

Using the HLSequence sample project as the baseline, Im just changing
the NUM_SEQUENCE_BUFFERS to 300, and use GetTickCount (10ms
granularity) to time it:

unsigned long skippedBuffers[NUM_SEQUENCE_BUFFERS] = {0};
errChk(imgSequenceSetup (Sid, NUM_SEQUENCE_BUFFERS, (void
**)ImaqBuffers, skippedBuffers, TRUE, TRUE));

before = GetTickCount();
while ( status )
errChk(imgSessionStatus (Sid, &status, &currBufNum));
after = GetTickCount();

After several iterations, it seems the difference in ticks between the
before and after is around 1372... which at 10ms between each tick,
indicates over 13 seconds to complete! At 60hz, Im thinking 300 frames
SHOULD be about 5 seconds.

Are the buffers that IMAQ "Sequence" uses for the capture, internally
dma'd to the *PC's RAM* memory or is it actually using the *disk* to
store it?

I didnt see any way to timestamp each frame, but is there any way to
verify that the frames are infact contiguous?

0 Kudos
Message 1 of 4
(3,499 Views)
Hello,
As I understand your question you are measuring the time it takes to get all of your images into memory rather than the time for the camera to acquire the images.  As you have noticed, these times are not necessarily equivalent.  There is some delay from when the camera acquires an image and when it is extracted into memory.  The buffers used by IMAQ are in your PC's RAM, nothing is written to disk until you save a file.  I am not positive which development environment you are working with, but we do have several low level examples as well, and sometimes taking a look at these examples help confirm which buffer you are extracting.
 
If you are concerned that you are skipping frames, I suggest taking images of something which will show the continuity.  In other words something with either a clock or movement that is clearly defined to confirm your framerate.  Generally, the frame rate is clearly defined by the camera and will be consistent.
 
I hope that this helps.  If you have any more questions about this, let me know.
 
Regards,
Angela
Applications Engineer
0 Kudos
Message 2 of 4
(3,492 Views)
Thanks. So if the IMAQ buffers are in the PC RAM, then there should
be a limit to the number of frames I could grab... but as a test, I set
the sequence to grab 1000 frames which at 640x480x2 each would be more
memory than whats in my PC (512MB), yet it still works. I guess thats
a good thing, but just makes me wonder if frames are being dropped.

In terms of testing the frame rate visually, Im using VC++6, which
doesnt have some of the built-in library functions (save to tiff, save
to avi) that are available via VIs if using Labview for development.
Is there any add-on package for VC++ available for purchase that
includes these functions? If not, does anyone know of any commercial
software package that will convert raw frame/video data and make it
into an uncompressed tiff or avi file?

Cheers!



Little A wrote:
> Hello,
> As I understand your question you are measuring the time it takes to get all of your images into memory rather than the time for the camera to acquire the images.  As you have noticed, these times are not necessarily equivalent.  There is some delay from when the camera acquires an image and when it is extracted into memory.  The buffers used by IMAQ are in your PC's RAM, nothing is written to disk until you save a file.  I am not positive which development environment you are working with, but we do have several low level examples as well, and sometimes taking a look at these examples help confirm which buffer you are extracting.
>  
> If you are concerned that you are skipping frames, I suggest taking images of something which will show the continuity.  In other words something with either a clock or movement that is clearly defined to confirm your framerate.  Generally, the frame rate is clearly defined by the camera and will be consistent.
>  
> I hope that this helps.  If you have any more questions about this, let me know.
>  
> Regards,
> Angela
> Applications Engineer

0 Kudos
Message 3 of 4
(3,475 Views)
Hello,
 
There is a save function included with the IMAQ driver that you can use to save images, you can reference the IMAQ Function Reference for more information.  The function is as follows:
rval imgSessionSaveBufferEx(SESSION_ID sid, const void* buffer, const char* fileName);
 
Additionally, the Vision Development Module includes functions that can be called from VC++.  You can see the following sites for more information on this software.
 
I hope this helps.
 
Regards,
Angela
Applications Engineer
0 Kudos
Message 4 of 4
(3,458 Views)