03-20-2009 02:43 AM
sorry. there is a mistake.
I want to get 4 images with PCI-1410.
I coded like this.
...
imgInterfaceOpen("img0", &ifid);
imgSessionOpen(ifid, &sid);
Rect rect;
rect.height=IMG_HEIGHT;// 640
rect.left=0;
rect.top=0;
rect.width=IMG_WIDTH; // 480
imaqSetupGrab(sid, rect);
image = imaqGrab (sid, image, 1) // Image *image;
..
In this case, I can get only one image.
so.. could you let me know, how to get 4 images ??
thanks..
03-20-2009 04:10 PM
Hi James,
You might want to look at the sequence or ring examples located in C:\Documents and Settings\All Users\Documents\National Instruments\CVI\samples\IMAQ
They show how to acquire a sequence of images and perform acquisitions in a loop, extracting any buffer of the ring that you configured.
-Christophe
03-22-2009 08:36 PM
Thanks Christophe.
I checked the example.
but I can't understand. sorry..
could you tell me more detail.
I want to get 4 images from 4 different cameras with pci-1410.
please help me.
Thanks.
03-22-2009 10:13 PM
I coded like this.
Init part.
unsigned int bufSize, bufCmd;
imgInterfaceOpen("img0", &ifid);
imgInterfaceReset(ifid);
imgSessionOpen(ifid, &sid);
imgGetAttribute (sid, IMG_ATTR_ROI_WIDTH, &AcqWinWidth);
imgGetAttribute (sid, IMG_ATTR_ROI_HEIGHT, &AcqWinHeight);
imgGetAttribute (sid, IMG_ATTR_BYTESPERPIXEL, &bytesPerPixel);
imgCreateBufList(NUM_RING_BUFFERS, &Bid);
bufSize = AcqWinWidth * AcqWinHeight * bytesPerPixel;
for (i = 0; i < NUM_RING_BUFFERS; i++)
{
imgCreateBuffer(sid, IMG_HOST_FRAME, bufSize, (void**)&ImaqBuffers[i]);
imgSetBufferElement(Bid, i, IMG_BUFF_ADDRESS, (uInt32)ImaqBuffers[i]);
imgSetBufferElement(Bid, i, IMG_BUFF_SIZE, bufSize);
bufCmd = (i == (NUM_RING_BUFFERS - 1)) ? IMG_CMD_LOOP : IMG_CMD_NEXT;
imgSetBufferElement(Bid, i, IMG_BUFF_COMMAND, bufCmd);
imgSetBufferElement(Bid, i, IMG_BUFF_CHANNEL, i);
}
imgMemLock(Bid);
imgSessionConfigure(sid, Bid);
when capture selected
imgSessionAcquire(sid, TRUE, NULL);
uInt32 lastAcquiredBuffer;
void* bufferAddress = NULL;
int bufferIndex;
for (bufferIndex = 0; bufferIndex < IMAGE_SIZE; bufferIndex++)
{
imgGetAttribute (sid, IMG_ATTR_LAST_VALID_BUFFER, &bufferIndex);
imgGetBufferElement (Bid, bufferIndex, IMG_BUFF_CHANNEL, &channel);
image[bufferIndex] = MakeImage(AcqWinWidth, AcqWinHeight);
info = GetImageInfo(image[bufferIndex]);
memcpy(info.imageStart, ImaqBuffers[bufferIndex], AcqWinWidth*AcqWinHeight);
DrawImage(image[bufferIndex], m_rtImage[bufferIndex]);
imaqDisplayImage(image[bufferIndex], bufferIndex+1, 0);
}
imgSessionReleaseBuffer(sid);
imgMemUnlock(Bid);
03-23-2009 02:01 AM