* References the tree's root item at path "/"
open_framegrabber ('Ensenso-NxLib', 0, 0, 0, 0, 0, 0, 'default', 0, 'Raw', -1, 'false', 'Item', '/', 0, 0, RootHandle)
* Open the camera and reference the camera's item at path "/Cameras/BySerialNo/1234"
* replace "1234" with your camera's serial number
Serial := '1234'
open_framegrabber ('Ensenso-NxLib', 0, 0, 0, 0, 0, 0, 'default', 0, 'Raw', 'auto_grab_data=0', 'false', 'Stereo', Serial, 0, 0, CameraHandle)
set_framegrabber_param (CameraHandle, 'grab_data_items', 'Images/DisparityMap')
* Set the camera to trigger on a falling edge on the GPIO port
set_framegrabber_param (CameraHandle, 'Parameters/Capture/TriggerMode', 'FallingEdge')
for Index := 1 to 10 by 1
* Trigger cameras that are not yet armed and waiting for a hardware trigger (e.g. when taking the first image)
set_framegrabber_param (RootHandle, 'do_execute', 'Trigger')
while (1)
* Call Retrieve in a loop to poll for newly arrived images; you could also use the Timeout parameter here if you don't want to poll
set_framegrabber_param (RootHandle, 'Execute/Parameters/Timeout', 0)
set_framegrabber_param (RootHandle, 'do_execute', 'Retrieve')
get_framegrabber_param (RootHandle, 'Execute/Result/' + Serial + '/Retrieved', Retrieved)
if (Retrieved == 'true')
break
endif
endwhile
* Trigger the camera again, so that it is immediately armed for the next trigger again
set_framegrabber_param (RootHandle, 'do_execute', 'Trigger')
* Compute the disparity map, point map, and process the data according to your needs (see Grabbing 3D Data for an example on this)
...
endfor
|