Open
Description
After creating the Camera
object, if the camera is opened by anything other than device id, then the device id will be incorrect. This means that all other Camera
methods that use the device id will be acting on another camera.
The problem of using device id to initialize cameras is that in a muti camera setup we don't know which id each camera has. So serial numbers is used instead.
Example:
# Two cameras get initialized by serial number so both return the same
# default id of zero (which is not updated after opening the camera).
# Reading device information then always returns information for the
# camera with device ID zero.
>>> from ximea import xiapi
>>> c1 = xiapi.Camera()
>>> c2 = xiapi.Camera()
>>> print('c1 device ID = %d; c2 device ID = %d'
... % (c1.dev_id, c2.dev_id))
c1 device ID = 0; c2 device ID = 0
>>> c1.open_device_by_SN('00982350')
xiAPI: ---- xiOpenDeviceBy API:V4.19.11.00 started ----
[....]
xiAPI: ---- Device opened. Model:MQ042MG-CM SN:00982350 FwF1: API:V4.19.11.00 ----
>>> c2.open_device_by_SN('38880050')
xiAPI: ---- xiOpenDeviceBy API:V4.19.11.00 started ----
[...]
xiAPI: ---- Device opened. Model:MQ042MG-CM SN:38880050 FwF1: API:V4.19.11.00 ----
>>> print('c1 device ID = %d; c2 device ID = %d'
... % (c1.dev_id, c2.dev_id))
c1 device ID = 0; c2 device ID = 0
>>> print('c1 device SN = %s; c1 device SN = %s'
... % (c1.get_device_info_string('device_sn'),
... c2.get_device_info_string('device_sn')))
c1 device SN = b'00982350'; c1 device SN = b'00982350'