I used for a few time the following setup:
- DH-MV-A7500MG20E camera
- Raspberry Pi 4 with Ubuntu 20.04
Now I’d like to switch to a new camera (DH-MV-A5501MG20E), but when I connect it, I have this exception {C-API call failed} ({LoadImageFile})
.
I tried these two setups (the connected camera, the PC and the Raspberry are always in the same subnet):
- Direct connection with the Raspberry using its ethernet port.
- Connection through a network switch: in this case I’m able to see and use the camera from my Windows 10 PC (using the GenICam Browser), but not from my Raspberry, even if I can ping it.
What do you thing I’m doing wrong? Do I have to reset some settings before connecting the new camera?
This is the code I’m using:
from config import *
import cv2
import cvb
import time
import numpy as np
import sys
if __name__ == '__main__':
while True:
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 = CAMERA_WIDTH
dev_node_map['Std::Height'].value = CAMERA_HEIGHT
exposure_node = dev_node_map["ExposureTime"]
exposure_node.value = CAMERA_EXPOSURE
stream = vin_device.stream
while True:
trigger = input('Press o to acquire: ')
if trigger == 'o':
trigger = ''
image, status = stream.get_snapshot()
np_image = cvb.as_array(image, copy=False)
cv2.imwrite('image' + '.png', np_image)
else: time.sleep(0.01)
except Exception as e:
print(e)
time.sleep(2)