From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

imgSessionSaveBufferEx

Hallo,

i use the PCI 1428 frame grabber (without vision) to aquire images and to process them. My idea was to aquire 15 images with the sequence function.

For save an image as png I used before the function imgSessionSaveBufferEx when a snap was taken. Is there also a pssibility to use this function to save more than one pic, i.g. in a sequence process? I couldn't find an answer here.. 
My Problems are:
1. if i use the imgSessionSaveBufferEx function during the sequence,
imgSessionSaveBufferEx(Sid,ImaqBuffers[currBufNum],"test.png")
He would overwrite the test.png with every new taken image, because i couln't find a possibility how to make the file name variable. (By the way, i think this would also speed down my aqcuisition process, so maybe this idea isn't so clever).
2. If i try to save the images after the sequence finished (after timeKillEvent() function) i have still the problem, that i  have to enter the code for every buffernumber like
imgSessionSaveBufferEx(Sid,ImaqBuffers[0],"Buffer0.tif");
imgSessionSaveBufferEx(Sid,ImaqBuffers[1],"Buffer1.tif");
imgSessionSaveBufferEx(Sid,ImaqBuffers[3],"Buffer2.tif");
imgSessionSaveBufferEx(Sid,ImaqBuffers[4],"Buffer3.tif");

and so on. So is there any possibility to make the data file varible?

Thanks a lot for helping!

greetings

martin
0 Kudos
Message 1 of 4
(3,436 Views)
Ok, hello again.. I have a solution, which is ok for my problem:

    char dateiname[20];
    int buf_num = 0;  

 for (buf_num=0;buf_num<NUM_SEQUENCE_BUFFERS; buf_num++)
   {
   sprintf(dateiname, "buffer%d.tif", buf_num );
   imgSessionSaveBufferEx(Sid,ImaqBuffers[2],dateiname);
   }

But i have another question. My camera has a framerate of 30frames/second, So is it right, if I say, that these 30 frames are exactly my 30 buffers in such a sequence ?
Or is there a time delay and tehre are some frames skipped?
It's because i wanted to know if the datatransfer to my PC RAM is fast enough, or i if should use the onboard memory..
My frame has 1Mpixel with 12 bit infomration a pixel.. So i have about 2 MByte/frame.. In a second it's then 60 Mbyte, which have to be transfered and stored.
I read once, that the frame grabber transfers with 100MByte/second into my PC RAM. So i don't need any onboard memory to buffer my images, right?


greetings

martin
0 Kudos
Message 2 of 4
(3,432 Views)
Hello everyone,
                       in my code iam storing the image data in memory allocation but later on when i try to load the images from the allocated memory then every time it load the last image every time. Here is the code that i have written. Could any one help me what is the problem in there.
 
 BOOL* volatile stop = (BOOL*)lpdwParam;
 
  alloc =  (char*)malloc(1000*sizeof(char));
                    if (alloc==NULL)
    {
     exit (1);
    }

 
    while(!*stop && !error) 
 {
  t2 = GetTickCount();
  
  // Get the frame after tne next Vertical Blank
  errChk(imgGrab (Sid, &ImaqBuffer, TRUE));
  
        
             
        
                 
   for (n=0;n<250; n++)
             {
               alloc[n]=&ImaqBuffer[n];
        }
        alloc[1]='\0';
     //if(k==0)
     {
    
             
    // sprintf (filename, "c:\\tmp\\%4.4d.bmp", j);
    // imgSessionSaveBufferEx(Sid, &alloc,filename);
   
   //j++;
     }
  
        k++;
     alloc = alloc+2;
         
    if(k>2)
    {
   
       
  loop:  
           
   
            //buf[1]='\0';
   //free(alloc);
   
   sprintf (filename, "c:\\tmp\\%4.4d.bmp", j);
         j++;
   imgSessionSaveBufferEx(Sid,&alloc,filename);
   free(alloc);
   alloc=alloc-2;
   
         SetWindowText (HFrame, filename);
   
   goto loop;
  
       
    }
 
Please i need your help.
 
0 Kudos
Message 3 of 4
(3,364 Views)

thanks for the solution.

0 Kudos
Message 4 of 4
(2,604 Views)