i3drobotics / stereo-vision-toolkit

Stereo image processing suite
MIT License
30 stars 10 forks source link

HID and openCV capture can point to different devices #60

Open ghost opened 3 years ago

ghost commented 3 years ago

There is no common data value between HID and OpenCV Video Capture. Currently, both just make sure that they find a camera of the correct vendor and manufacture name but if two Deimos' are connected then there is a chance these will connect to different devices.

(See src/camera/StereoCameraDeimos.cpp)

Here the hid_open takes the vendor and manufacture id (0x2560,0xC114):

deimos_device = hid_open(0x2560, 0xC114, NULL);

Searching the windows registry it doesn't look like there is a common setting between the video capture and HID device.

However, looks like ecosystems has made changes to OpenCV to allow it to return device information, see here.

jveitchmichaelis commented 3 years ago

Oh this is fun. The order that devices appear in DShow should be identical to OpenCV though because they're enumerated in the same order. We can query basically anything that comes up in the properties tab in Device Manager I think?

We can probably query serial here, just after we've identified that the device is a Deimos: https://github.com/i3drobotics/stereo-vision-toolkit/blob/4fb97f47f4efaacb134201d365546dcc93399c82/src/camera/stereocameradeimos.cpp#L191

But is device path serial the same as some unique hardware serial?

The HID struct also has some info: https://github.com/i3drobotics/stereo-vision-toolkit/blob/4fb97f47f4efaacb134201d365546dcc93399c82/3rd_party/hidapi/include/hidapi/hidapi.h#L49

We query the serial on the camera, but we should maybe compare to what the HID struct contains too.

https://github.com/i3drobotics/stereo-vision-toolkit/blob/4fb97f47f4efaacb134201d365546dcc93399c82/src/camera/stereocameradeimos.cpp#L243