Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquisition.GetLastImage based on Gige camera external trigger doesn't give me the latest image

I am planning on using the camera's trigger input to start capturing the image. I have 4 cameras, but I only need 1 image each time. \

Here are the steps I am using:

 

1.  Set the camera to exteral trigger

2. PLC send the trigger to camera to take the picture

3. Read the image from camera.

 

It only works for the first time becasue it can get the first image, then never refresh the image again..

 

Here are the sample codes I use:

 

                     _session = New ImaqdxSession("Name")

                    _session.Acquisition.Configure(ImaqdxAcquisitionType.SingleShot, 1)
  
                    _session.Acquisition.Start();

                    _session.Acquisition.GetImageAt(_currImage, 0)
 
The piece of code is running when the PLC sends the trigger to camera. I was wondering whether it might be caused by no image was taken at that time.
 
I also tried
               _session.Acquisition.GetLastImage(_currImage)
 
Same behavior..
 
The strange thing is if I change the codes like the following
 
                    _session = New ImaqdxSession("Name")
                    _session.Acquisition.Configure(ImaqdxAcquisitionType.Continuous, 1)
  
                    _session.Acquisition.Start();

                    _session.Acquisition.GetLastImage(_currImage)

 
It only works when 2 trigger sent from PLC. Should I use _session.Acquisition.GetNextImage(_currImage) instead?
 
Question:
How I do know the new image is arrived?               
 
 
0 Kudos
Message 1 of 4
(3,806 Views)

How are you running the repeat acquisition? I assume you are running it a loop of some sort. Are you closing the IMAQdx session at any point? This will help understand why we are seeing the behavior you are getting.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,785 Views)
Session is start once at the initialization , and get closed when the application is end. I am using the loop to read the image constantly.
0 Kudos
Message 3 of 4
(3,781 Views)

Have you tried looking into the text based vision examples for IMAQdx? There is a triggered grab example that you could use to help you.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,762 Views)