I have GigE camera which has two channels, one is RGB and another one is IR (infrared). I can successfully acquire images using the code from RGB channel. However I cant acquire images from IR channel.
Can you please advise me how can I acquire the IR images? Thanks in advance.
# CVBpy Example Script
#
# 1. Discover all devices.
# 2. Load the first device found.
# 3. Acquire images.
#
import cvb
discover = cvb.DeviceFactory.discover_from_root()
mock_info = next((info for info in discover if "GenICam.vin" in info.access_token), None)
if mock_info is None:
raise RuntimeError("unable to find GenICam.vin")
with cvb.DeviceFactory.open(
mock_info.access_token, cvb.AcquisitionStack.Vin) as device:
stream = device.stream()
stream.start()
for i in range(10):
image, status = stream.wait()
if status == cvb.WaitStatus.Ok:
print("Acquired image: " + str(i))
stream.abort()
I would propose to use the GenTL acquisition stack which is quite new and supports a lot more functionality. This can be done by switching the device open command with this flag instead: cvb.AcquisitionStack.GenTL
Thank you for your reply. I got the following error using the code that given below
#import libraries
import cvb
import time
import itertools
#discover cameras
discover = cvb.DeviceFactory.discover_from_root()
mock_info = next((info for info in discover if "GenICam.vin" in info.access_token), None)
if mock_info is None:
raise RuntimeError("unable to find GenICam.vin")
#aquire and save images
#with cvb.DeviceFactory.open(
#mock_info.access_token, cvb.AcquisitionStack.Vin) as device:
#stream = device.stream()
#stream.start()
with cvb.DeviceFactory.open(
mock_info.access_token, cvb.AcquisitionStack.GenTL) as device:
device = cvb.DeviceFactory.open(device_info.access_token, cvb.AcquisitionStack.GenTL)
stream0 = device.stream(cvb.ImageStream, 0)
stream1 = device.stream(cvb.ImageStream, 1)
stream0.start()
stream1.start()
img_stream0, status_stream0, node_map_stream0 = stream0.wait()
img_stream1, status_stream1, node_map_stream1 = stream1.wait()
for i in range(10):
image, status = stream0.wait()
if status == cvb.WaitStatus.Ok:
print("Acquired image: " + str(i))
stream0.abort()
Traceback (most recent call last):
File "run2.py", line 24, in <module>
with cvb.DeviceFactory.open(
RuntimeError: Only TL Interfaces and TL Devices are supported.
When getting the mock info, try searching for the device name, not the GenICam.vin. Then the DeviceFactory.open will open the actual TL device, not the driver.
@usernv Thank you for your kind help and reply. Can you please guide me how to search the device name? I using the following code, but it not works. Thanks in advanced.
discover = cvb.DeviceFactory.discover_from_root()
mock_info = next((info for info in discover if "Device Name" in info.access_token), None)
if mock_info is None:
raise RuntimeError("unable to find GenICam.vin")
Either print all access_tokens in the discover list and check what device you want or try the name of the camera for a Genie Nano M-1920 I would try M-1920.
I print the discover list using the following code:
#discover cameras
discover = cvb.DeviceFactory.discover_from_root()
print (*discover)```
I got the following results.
<cvb.DiscoveryInformation object at 0x7fad587c93c0> <cvb.DiscoveryInformation object at 0x7fad587c90c0> <cvb.DiscoveryInformation object at 0x7fad587c9120>
could you please try to contact our support team directly for in-depth application development support? They can check with you and your application and what would be the best way to proceed in order to get the fastest results. Just write a message to:
Thank you. I have sent an email to the support. I am just wondering to know that is CVB support two channels together, I mean one channel is RGB and another one is NIR.
That depends what you mean by “support”. We do not have dedicated views (think GenICam Browser) for all possible colour formats as there are just too many and most of them very little to not really used. But it is always possible to get the data from the device using CVB. If there really is “no support at all”, the “worst case” woud be to get the device buffer as sent from the device. You would then need to check the device’s manual on how to convert the raw buffer and convert it yourself.
You can check the GenICam Browser if it’s one device with two streams or two devices with one stream. The available devices are listed after discovery on the left hand side. You’ll get duplicate entries for the GevSD and GevFD, so please ignore those. Then open the streams as shown above.
I used your code and it gave us the following error.
#discover cameras
discover = cvb.DeviceFactory.discover_from_root()
mock_info = next((info for info in discover if "GenICam.vin" in info.access_token), None)
with cvb.DeviceFactory.open(
mock_info.access_token, cvb.AcquisitionStack.PreferGenTL) as device:
stream0 = device.stream(cvb.ImageStream, 0)
stream1 = device.stream(cvb.ImageStream, 1)
stream0.start()
RuntimeError: this device supports only legacy streams
I think our support already told you this, too: We would need your CVB license and camera id to connect you with a business case as you have many questions regarding CVB which are (combined with non-forum support) beyond the scope of our free support especially without a verified camera or license purchase from us.
I also think with my above answers, you should be able to figure out how to open the device my name (not the GenICam.vin) and get the two streams from the device. If you need further guidance, the next steps would be to write your camera and license to the support so they can connect you with a business case.
This might be a bug. If you continue with stream.start() and stream.wait(), you can print the image or get information on it, it should be different then. Does that work for you?