Skip to content

Instantly share code, notes, and snippets.

@papr
Created October 7, 2019 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papr/b258e0e944604375752eae502b4ad3d5 to your computer and use it in GitHub Desktop.
Save papr/b258e0e944604375752eae502b4ad3d5 to your computer and use it in GitHub Desktop.

Third-Party Camera Requirements for Pupil Capture

Third-party cameras - Pupil Capture supports third-party USB cameras that fulfill the following criteria:

  1. UVC compatible (Chapters below refer to this document)
  2. Support Video Interface Class Code 0x0E CC_VIDEO (see A.1)
  3. Support Video Subclass Code 0x02 SC_VIDEOSTREAMING (see A.2)
  4. Support for the UVC_VS_FRAME_MJPEG (0x07) video streaming interface descriptor subtype (A.6)
  5. Support UVC_FRAME_FORMAT_COMPRESSED frame format

Access Pupil cameras via libuvc These are the steps that pyuvc uses to access Pupil cameras:

  1. Use uvc_init() to create a context
  2. Use uvc_get_device_list() to enumerate available devices
  3. Use uvc_open() to create a device handle for a given device from step 2
  4. Use uvc_get_format_descs() to enumerate available format descriptions
  5. Enumerate available frame sizes and rates for format descriptions with the bDescriptorSubtype == UVC_VS_FRAME_MJPEG
  6. Get a stream control handle by passing UVC_FRAME_FORMAT_COMPRESSED and a valid frame size/rate combination to uvc_get_stream_ctrl_format_size()
  7. Open the stream with vc_stream_open_ctrl()
  8. Start the stream with uvc_stream_start() passing 2.0 as bandwidth_factor
  9. Use uvc_stream_get_frame() to access frames
  10. Use uvc_stream_stop() to stop the stream
  11. Use uvc_stream_close() to close the stream
  12. Use uvc_close() to close the device handle
  13. Use uvc_unref_device() to unrefence the selected device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment