| 03/13/2009 12:43 PM |
| Python Color Tracking |
|
Color tracking is simple in teory, but hard to do in practice. It's all about finding the pixels that fit's the properties you are looking for. Using OpenCV and Python, makes the process alot easier: You can download OpenCV for Python here: http://code.google.com/p/ctypes-opencv/ It's OpenSource as you might guessed. Connecting to your camera is as simple as:
To do some simple color-tracking, create a mask with all the pixels withing a given range of colors:
OpenCV works in BGR color-space. HSV or Lab color-space might be a better choice To convert the frame into HSV use: cvCvtColor(frame, frame, CV_BGR2HSV) Just remember to set the color-space back to BGR before displaying the image: cvCvtColor(frame, frame, CV_HSV2BGR) Next, split the mask into seperated - connected parts, by finding the contour:
From here it's just a matter of filtering out the contours you don't want. Some might be too large or too small, or maybe you only want convex shapes:
When you've got the contours you want, find the center-coordinates:
Now that's teory.. In the real-world, you got lightning, shadows, noise, and so on. But i hope you got the basic idea how to do color-tracking by now. For a more complex tracker, you'll might wan't to look at Motion-Segmentation, Background statistics, Dilate, Erode, FloodFill, PolyApprox... It's all in OpenCV. Here's a demo video of the color-tracker in action. I'm using Qt as GUI, and a Pickle-Socket that sends the computed data to Maya in form of a dictionary. I use a Maya-Plane that represent my screen in 3D-space, so that it's easy to adjust the relationship between screen-space and 3d-space. The Maya-plane can have any number of reference-objects that are constrained to the 3d-model. The tracked objects will automaticly constrain to a reference object, when it get's close enough. |
| 06/04/2008 03:24 PM |
| HP Video |
|
A short video i have created as part of a school assignment. |
| 06/02/2008 10:12 AM |
| Animation Pipeline |
|
I'll be working on a new pipeline for 3D-Animation this month as part of a school-project. Follow the development here: http://sites.google.com/site/mjpipeline |
| 06/01/2008 06:02 PM |
| Maya Wiimote |
|
This video shows me controlling a cube in Maya with candle-light using a wii-remote. It's created by using Python and pyBluez to connect to the wii-remote with bluetooth and bind it to Maya. Each Wiimote has an infrared-camera in it, and since candle-light emits infrared light, it's possible to track the motion of the candles. This could be extended to create a simple and cheep motion-capture device. |
| 12/11/2008 02:49 PM |
| Hotkey Manager |
|
This is one of my farvorit scripts right now. It's a UI that let's me create hotkeys, menus and triggers very quickly.. I haven't completely finished it yet, put my plan is to use this UI to setup Maya to work more intutive.. For example, having hotkeys and menus change depending on what i'm doing at the moment.. The idea is to create a faster workflow by letting Maya guess what I might wan't to do now, depending on what i did before, and then change my hotkey/menu setup. It also let me setup Triggers very quickly, which are commands that automaticly run when 'things happens'.. For example, to have a script that runs each time a new transform node is created or when a connection is made...
![]() |
| 04/02/2007 09:22 PM |
| Camera Navigator |
|
Uses a Photoshop-like control to pan/zoom the 3d-view. The camera never moves or changes perspective, it's just like zooming/tracking on a 2d picture. "" |
| 03/28/2007 09:16 PM |
| History Tweaker |
|
A simple script that lets you go back in the history, and change earlier stages of a model.. The changes will be added to the object Construction-History. This might also be useful for when creating blendshapes. Watch the Video! "" |
| 12/11/2008 02:49 PM |
| First Version of CodeNode |
|
A Screenshot of my first version of CodeNode, at a very early stage. The concept is use connections and 3d-objects to generate code. In this way, lines of code can flow from object to object, creating a more dynamic code-structure instead of the linear text-file-structure, and making it more fun to be a scripter :). As shown in this very simple example, the height and width of 'pCube1' controls the height/width of the window to the right. 'kodeNode1' is getting some code from 'deleteWinNode'. Maya handles the creation and deletion of connections, and automaticly execute the final code. Right now, i'm only testing the idea in Maya, but my plan is to make it a stand-alone application.
|