Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

get multiple image with PCI-1410.

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..

 

0 Kudos
Message 1 of 5
(3,818 Views)

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

0 Kudos
Message 2 of 5
(3,805 Views)

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.

 

0 Kudos
Message 3 of 5
(3,778 Views)

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);

0 Kudos
Message 4 of 5
(3,773 Views)
after testing again. I can get images from different cameras. But image is not correct. I uploaded 3 different images form my cameras. - I tested with 3 cameras. 1st images from channel 0 is always fine. but 2 other imges are always not correct. - inserted file 0_.jpg was fine one. please check this and give me the solutions. Thanks.
Download All
0 Kudos
Message 5 of 5
(3,756 Views)