Identify camera by name

Using VideoIO.jl, can I somehow get the “factory name” of the available cameras?

I’d like to be able to select a specific camera. This should work across all platforms (so I can’t make a USB rule or similar).

Here, I list the available functioning devices:

good_camera(device) = try
  cam = opencamera(device)
  read(cam)
  close(cam)
  return true
catch ex
  return false
end

function list_cameras()
  cameras = copy(VideoIO.CAMERA_DEVICES)
  filter!(good_camera, cameras)
end

but I’d rather get similar data to when using v4l2-ctl --list-devices:

shell> v4l2-ctl --list-devices
C270 HD WEBCAM (usb-0000:01:00.0-3):
        /dev/video2
        /dev/video3
        /dev/media1

C922 Pro Stream Webcam (usb-0000:43:00.3-4):
        /dev/video0
        /dev/video1
        /dev/media0

and be able to select, say, C270 HD WEBCAM (which in this case is in /dev/video2).

I would suggest to elaborate a bit on the VideoIO camera/IO API: There should be an iterable type, e.g. VideoIOCameraProvider, which could return VideoIOCamera’s, and there should be functions similar to what has been done for Teledyne FLIR/PointGrey Spinnaker cameras and Basler Pylon cameras for getting camera vendor name, model name and serial number from a “VideoIOCamera”:

I would also suggest to put the definition of such functions in an interface package, e.g. GitHub - IHPSystems/Cameras.jl: A Julia interface for cameras , such that VideoIO/LibAV camera provider and cameras are interchangeable with e.g. Basler cameras, PointGrey/FLIR cameras etc.

I am elaborating on Cameras.jl and PylonCameras.jl at the moment. Planning to add support for NVIDIA Jetson camera API (libargus), GitHub - IHPSystems/argus_julia_wrapper, and Pleora eBUS SDK for JAI cameras.

1 Like