(I posted this on highend3d as well.)
Hello folks,
I had the idea to create a simple, vision-based 6-dof mouse, but it doesn’t appear it’s possible to create a device unless it is MIDI based.
The mouse would work as follows: I have code that can do real-time pose-estimation of a target image. The target pattern can be printed out on any printer. The code grabs frames from a camera connected to the computer – a consumer grade webcam will suffice. The code analyzes the image, locates the target if it is visible, and computes its position and orientation. The code is quick enough to keep up with frame rates of 15 fps, possibly 30, depending on your machine.
So you print out a target pattern, maybe 3 or 4 inches on a side, put a rigid backing on it and a handle, then wiggle it around in front of your webcam. If everything works as planned, you will be able to move objects in Maya with it, with a full 6 degrees of freedom.
There are a few limitations – rotations are limited to less than 40 degrees, and the entire target must be visible to the camera. It’s possible to add more cameras to give more range of movement, but that will have to wait for now. Also, the accuracy probably won’t suffice for really fine-grained work.
This is a first kick at the can, so it may not be a production quality tool, but I think even in this first iteration it may be more than a toy.
I started poking around in the Maya API, hoping to find a class for creating input devices, and there is a class called MPxMidiInputDevice which provides support for MIDI based devices. I pondered using it, and creating a virtual MIDI output device, then using a MIDI loopback utility to get the output back to Maya, but that seems a little convoluted, and apparently MIDI loopback tools are dangerous – you can lock your machine up if you get into a MIDI feedback situation.
Unless I hear otherwise from someone in this forum, I am going simply create a stand-alone app that will send move commands to Maya via a commandPort. I did a bit of testing, and it looks like this will work fine, but I would prefer to make something with tighter integration with Maya – right now the user will have to open the commandPort, make sure my mouse application is running and configured for the correct port – not a huge deal, but it’d be nice to simply fire up Maya and have it work.
So – does anyone know how to make a Maya input device?
Kevin Atkinson
Incidentally, I’ll make the utility available at my website as soon as it is in a useable state, if anyone is interested.