StudentCV / PyPylon

pylon wrapper for Python
Other
5 stars 3 forks source link

connecting to a remote camera with only IP #13

Closed netanelf closed 6 years ago

netanelf commented 6 years ago

Hi, Currently I connect to cameras that are found by:

factory = pylon.TlFactory.GetInstance() 
ptl = factory.CreateTl('BaslerGigE') 
detected_devices = ptl.EnumerateDevices() 
c = ptl.CreateDevice(detected_devices[0]) 
cam_obj = pylon.InstantCamera(c)

Sometimes there are cameras behind routers that are not listed in EnumerateDevices() In pylon, you can connect to these cameras if you know their IP, as described in: https://www.baslerweb.com/en/sales-support/knowledge-base/frequently-asked-questions/what-is-the-add-remote-gige-camera-feature-in-pylon-for/14874/

Did someone manage to this manually through the library? Thanks,

netanelf commented 6 years ago

Ok, Fond the answer (or at least a usable way):

  1. create a factory:
        factory = pylon.TlFactory.GetInstance()
        ptl = factory.CreateTl('BaslerGigE')
  2. use the factory to create an empty DeviceInfo object
        empty_camera_info = ptl.CreateDeviceInfo()
  3. update the IpAddress property
        empty_camera_info.SetPropertyValue('IpAddress', 'yout_ip_address, ie 192.168.1.1')
  4. Build a camera with the Device info:
        camera_device = ptl.CreateDevice(empty_camera_info)
        cam_obj = pylon.InstantCamera(camera_device)

This worked great for me,

Netanel