Im currently trying to start a aquistion with a softwaretrigger in Python. I set nodes to the right values (this values work with the vb.net grabberocx example. The documentation is a bit lacking in cvbpy regarding softwaretrigger ( what does softwaretrigger.send_trigger return and how does it work with stream.start()?)
Can anybody provide me a minimal working example for this?
My regards Mucki
Hi @Mucki
to send a softwaretrigger you have to configure the camera a certain way that might differ from camera to camera:
Basically the following Nodes have to be set:
TriggerMode -> “On”
TriggerSource -> “Software” (If you use an external trigger change this accordingly)
Now you can acquire a new image by just clicking the “Execute”-Button in the TriggerSoftware node.
Note:
Some nodes write property depend on their parents state.
You can not set the TriggerSource as long as the TriggerMode is “Off”.
Keep that in mind while programming.
I have written a small example using CVBpy to achieve what you are aiming for:
import os
import cvb
device = cvb.DeviceFactory.open(os.path.join(cvb.install_path(), "drivers", "GenICam.vin"), port=0)
dev_node_map = device.node_maps["Device"]
triggerModeNode = dev_node_map["TriggerMode"]
triggerModeNode.value = "On"
triggerSourceNode = dev_node_map["TriggerSource"]
triggerSourceNode.value = "Software"
softwareTrigger = dev_node_map["TriggerSoftware"]
I hope this is what you were looking for.
Cheers
Chris
Thanks for your answer, but i think that is not what im looking for. I set the nodes to on and software already. I dont want to execute the Softwaretrigger in the GenicamBrwoser but in Python using CVBpy. your working example sets the noddes to the right values ( i did that too) and you initialized a node softwaretrigger. But how do i send the trigger and save an image afterwards?
Hi @Mucki,
the softwareTrigger is a CommandNode, you can execute this node with the following call:
softwareTrigger.execute()
Before doing so, you might want to start the stream, thus you can call stream.wait() after triggering a new image:
stream = device.stream
stream.start()
// softwaretrigger here
image = stream.wait()
You can save the image with:
image.save("ImagePath")
So the complete working example :
import os
import cvb
device = cvb.DeviceFactory.open(os.path.join(cvb.install_path(), "drivers", "GenICam.vin"), port=0)
dev_node_map = device.node_maps["Device"]
triggerModeNode = dev_node_map["TriggerMode"]
triggerModeNode.value = "On"
triggerSourceNode = dev_node_map["TriggerSource"]
triggerSourceNode.value = "Software"
softwareTrigger = dev_node_map["TriggerSoftware"]
stream = device.stream
stream.start()
softwareTrigger.execute()
image = stream.wait()
image.save("ImagePath")
If you need further introduction or examples for pixel access or async streaming, you might want to have a look into your tutorialsfolder:
C:\Program Files\STEMMER IMAGING\Common Vision Blox\Tutorial\Image Manager\CVBpy
Cheers
Chris
Thank you for the fast answer. I didnt know, that softwaretrigger could be executed via .execute(). Now it is working as i intended