PDA

View Full Version : Using a USB device trigger to capture image from video feed



David
August 12, 2014, 01:04:01
Hi,
I would be grateful if anyone can suggest how to go about using a USB trigger device to initiate capturing an image. After reding the .NET help I have a test application with the following test forms with my PC connected to an image capture box.

- a form using the .NET imagingControl for a live video feed.
- a form with 2 buttons and picture control as per the demo to snap an image from the video feed and then save to image file to display in the picture control.

...the next thing on my list is to somehow use the input of a HID USB device instead of the first button to snap an image.

For context the device in question is an Endoscope with 2 buttons and connected to the image capture box, which is then connected to my PC.

Many thanks
David

Stefan Geissler
August 12, 2014, 09:03:12
David

USB "Trigger" devices can act as game controllers, that means like a joystick. They usually have the joystick button only, like the footswitch:
http://www.theimagingsource.com/en_US/products/accessories/foot-switches/fsu2112/
In your software, you must handle the game controller and on a button click you call MemorySnapImage to save an image.
You may refer to:
http://msdn.microsoft.com/en-us/library/bb648757.aspx

Of course, there are also other USB I/O devices available, which usually come with drivers and an own API.

David
August 12, 2014, 12:12:52
Thanks for the initial feedback.

David
August 12, 2014, 12:36:59
I don't suppose you know what keycode or other data the footswitch sends via input from the USB device to help to know what to look for?

Thanks

Stefan Geissler
August 12, 2014, 14:50:24
David,


I don't suppose you know what keycode or other data the footswitch sends via input from the USB device to help to know what to look for?

The footswitch acts as game controller. Therfore, you can use it as game controller. It is button 1. You can see this in the game controller applett.

David
August 12, 2014, 19:42:08
Thanks Stefan, I will investigate further.

David
September 2, 2014, 18:42:55
Thanks Stefan, I will investigate further.

I just wanted to do a recap for all interested parties. Stefan pointed me in the right direction which is "how can I poll for the button click in .net".
As he mentioned the device is recognised as a game controller I researched DirectX a bit and then came across SlimDX http://slimdx.org/download.php. This provided the appropriate .net SDK to allow me to poll for the button.

I can post an example if anyone is interested.