Today I made some tests with this setup:
- Raspberry Pi with Raspberry OS (works better than Ubuntu): desktop version so that I could configure my device (and save all the settings) through the GUI (I saved the configuration for both the cameras using the GenICamBrowser)
- Dahua camera A5501MG20E
- Dahua camera A7500MG20E
After few fixes I was able to make CVB run on the RPi and I could see and configure both my cameras. Then I installed the Python libraries and I was able to run my test script:
import cvb
from config import *
import cv2
import time
import numpy as np
import sys
if __name__ == '__main__':
try:
with cvb.DeviceFactory.open(cvb.install_path() + "/drivers/GenICam.vin") as vin_device:
dev_node_map = vin_device.node_maps["Device"]
dev_node_map['Std::Width'].value = 2592
dev_node_map['Std::Height'].value = 2048
exposure_node = dev_node_map["ExposureTime"]
exposure_node.value = CAMERA_EXPOSURE
stream = vin_device.stream
if True:
trigger = input('Press o to acquire: ')
if trigger == 'o':
trigger = ''
image, status = stream.get_snapshot()
image.save('image' + '.png')
np_image = cvb.as_array(image, copy=False)
cv2.imwrite('image_np' + '.png', np_image)
else:
time.sleep(0.01)
except Exception as e:
print(e)
When I run the script I left opened the GenICamBrowes window and I could access the camera, but after closing that window, I was not able to reopen it and now if I try to open it through the terminal, I receive this error:
* failed to add service - already in use?
==============================
CVB Leaked Handles Summary
==============================
@0xb2626860
@0xb261d638
@0xb261d4a0
...
@0xb26105a0
@0xb26091c8
:> 53 CVB handles.
And now also the other camera gives back the {C-API call failed} ({LoadImageFile})
error.
What could have caused this issue?