LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Grab images.

Hi! I'm trying to grab images with my NI PCI-1407 board, but I see only the first image...
The code of the Grab button is:
 
   int CVICALLBACK Grab (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
{
 switch (event)
  {
  case EVENT_COMMIT:
  
   // Configura l'acquisizione.
  
   imaqSetupGrab(session1, IMAQ_NO_RECT);
   
   // Grab.
   
   imaqGrab(session1, image, FALSE);
   
   // Visualizzazione delle immagini.
   
   imaqDisplayImage(image, 0, TRUE);
   break;
  }
 return 0;
0 Kudos
Message 1 of 7
(3,873 Views)
Hi,

NI-IMAQ installs examples to work with CVI, so under:

C:\Program Files\National Instruments\CVI71\samples\IMAQ\Grab

you can use directly HLgrab.prj that performs a grab acquisition.

If you don't have these examples then you have to modify the ni-imaq installation and add the support for CVI.

Best Regards

AmbuA

0 Kudos
Message 2 of 7
(3,846 Views)
Thanks, but I've already seen the examples...the problem still occurs!!!
0 Kudos
Message 3 of 7
(3,852 Views)
Hi,

are you able to perform a grab acquisition from Measurement & Automation (MAX)?

Here there is a link that explains how test your board under MAX.

http://www.ni.com/support/imaq/

If you aren't able to grab in MAX probably there is an installation issue or you camera doesn't submit the standard.

Best regards

AmbuA

0 Kudos
Message 4 of 7
(3,822 Views)
Yes, with MAX everything works and the settings are right (I've made my own configuration file)...  The problem is that I see only the first image and then the image remain the same, there isn't new image...
0 Kudos
Message 5 of 7
(3,822 Views)
 
Hi

Maybe this answer is not useful anymore, because of the time you wrote the question. I had a similar problem to the one you have, and it's because the function imaqGrab doesn't mean that is acquiring continuously, it works like the function imaqSnap but as you configure it previously with the function imaqStartAcquisition, the time of the acquisition is less than in the others. So if you want to be acquiring images continuously you have to be calling it (the function imaqGrab) with a timer. Something like:
 
   int CVICALLBACK Grab (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
{
 switch (event)
  {
  case EVENT_COMMIT:
  
   // Configura l'acquisizione.
  
   imaqSetupGrab(session1, IMAQ_NO_RECT);
   
   break;
  }
 return 0;
}
 
int CVICALLBACK Imaq_loop (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{

 switch (event) {
  case EVENT_TIMER_TICK:
   // Grabs the image.
   
   imaqGrab(session1, image, FALSE);
   
   // Visualizzazione delle immagini.
   
   imaqDisplayImage(image, 0, TRUE);
 
0 Kudos
Message 6 of 7
(3,744 Views)
Sorry i couldn't put all the code in the previous one:
 
 
   int CVICALLBACK Grab (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
{
 switch (event)
  {
  case EVENT_COMMIT:
  
   // Configura l'acquisizione.
  
   imaqSetupGrab(session1, IMAQ_NO_RECT);
   
   //Enables the timer
   SetCtrlAttribute (panelHandle, PANEL_TIMER, ATTR_ENABLED, TRUE);

   break;
  }
 return 0;
}
 
int CVICALLBACK Imaq_loop (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{

 switch (event) {
  case EVENT_TIMER_TICK:
   // Grabs the image.
   
   imaqGrab(session1, image, FALSE);
   
   // Visualizzazione delle immagini.
   
   imaqDisplayImage(image, 0, TRUE);
 
   break;
  }
 
 
 
Then you should have another function to stop the acquisition and the timer.
 
Best regards
 
Juan
Message 7 of 7
(3,739 Views)