LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence Acquisition

hi everybody,
i'm trying to get a sequence of images with the vision functions.
with imaqEasyAcquire() everthing works fine and i get one camera image.
but with:
imaqSetupSequence (sid, images, nbOfImages, skipCount, IMAQ_NO_RECT);
imaqStartAcquisition (sid);
i get only black picture when i try to save one image of the sequence to a .png
my second idea was to check the status of acquisition before saving my image - that produced an endless loop...

best regards,
malte



#define _NIWIN
#include "niimaq.h"
#include "stdafx.h"
#include <windows.h>
#include "nimachinevision.h"
#include <iostream>
#include "nivision.h"

using namespace std;

static Image* myImage=NULL;
static INTERFACE_ID iid;
static SESSION_ID sid;
static Image** images = NULL;
static int imageArraySize = 0;
static Image *resultImage = NULL;

int main(int argc, char* argv[])
{

   const char*        fileName="test.png";
   unsigned long    nbOfImages;
   unsigned long    skipCount;
   int                       i;
   PixelValue         divisor;

   
   nbOfImages=10;
   skipCount=0;

   imgInterfaceOpen ("img0", &iid);
   imgSessionOpen (iid, &sid);
   myImage = imaqCreateImage (IMAQ_IMAGE_I16, 0);
   resultImage = imaqCreateImage (IMAQ_IMAGE_I16, 0);

   
   images = (Image **) malloc(nbOfImages * sizeof(Image *));
   for(i=0; i<nbOfImages; i++) {images[i] = imaqCreateImage (IMAQ_IMAGE_I16, 0);}
   imageArraySize = nbOfImages;

   imaqSetupSequence (sid, images, nbOfImages, skipCount, IMAQ_NO_RECT);
   imaqStartAcquisition (sid);
   
   //imgSessionStatus (sid, &acqInProgress, &bufNum); /* here is the mentioned check of acquisition status */
  // while(acqInProgress){cout<<acqInProgress<<endl;}   
   

   imaqWritePNGFile(myImage, fileName, 750, NULL);
 
   if(images)
            {
                for(i=0; i<imageArraySize; i++)
                    imaqDispose (images[i]);
                
                free(images);
            }
   // Close the interface and the session
   if(resultImage) imaqDispose (resultImage);
   if(myImage) imaqDispose (myImage);

   
   imgClose (sid, TRUE);
   imgClose (iid, TRUE);
   
   return 0;

}

Message Edited by asmodi on 12-02-2005 03:24 AM

0 Kudos
Message 1 of 3
(3,247 Views)
See my reply in this thread.
0 Kudos
Message 2 of 3
(3,206 Views)

Hi! After you start acquisition you must use the function imaqGrab() to get the images...in your program I can't find an acquire function like imaqEasyAcquire, imaqSnap or imaqGrab... Try to insert one of these functions!... In your program you only create the image, but you don't fill it with data...

Regards,

G.M. 

0 Kudos
Message 3 of 3
(3,192 Views)