Main /

Assignment 3

PmWiki

pmwiki.org

edit SideBar

Assignment 3

Assignment 3 -- KINECT

Implement "3D MOUSE":

EXTENDED DEADLINE: For in-class demo on Oct 12

  • Install Kinect drivers etc: KinectInstallationGuide
  • Add to the glview.c or C++OpenCVExample.cpp code that finds the center of the closest blob (in terms of depth).
  • Write a game that uses such X/Y/Z information
  • Optional: Write a 2 person game

MORE HINTS:

  • Please find attached code for the histogram demonstration that I gave in class. This code draws the histogram of the depth image from kinect. I have added comments wherever required. This is the multi-threaded implementation but you just need to bother about the main function specifically the infinite while loop.
  • You just need to play with the "depthImg" inside while(!die) loop. depthImg is a single channel 8bit Image. Each pixel will have a value between 0-255. 0 is the closest and 255 is the farthest. You can also access directly the matrix depthf (some opencv functions need the matrix as input, such as minMaxLoc or threshold, see below)
  • More tips: You don't need to use the histogram to find the closest blob, you can also just find the depth value of the closest pixel in the depth map with: minMaxLoc(depthf,&minVal,...) (look up the documentation for minMaxLoc) and then threshold all pixels that are closer minVal+10 with the threshold function (look up in the documentation how to call threshold). The output of the threshold function then can be used to find the center of the blob, as we discussed in class. (you also need to allocated a few more matrices and images, but you'll figure it out :)
  • To compile on linux or Mac using OpenCV2.3.1, use the following command or change your makefile accordingly:

g++ -I/usr/local/include/ -I/usr/local/include/opencv/ -I/usr/local/include/libfreenect -L/usr/local/lib -lfreenect -lopencv_legacy kinectHistogram.cpp -o kinectHistogram

  • Those who have used Macports for freenect installation may need to use the following command to compile:

g++ -I/usr/local/include/ -I/usr/local/include/opencv/ -I/opt/local/include/libfreenect -L/usr/local/lib -L/opt/local/lib -lfreenect -lopencv_legacy kinectHistogram.cpp -o kinectHistogram

(All) | Edit SideBar Page last modified on October 07, 2011, at 02:28 AM Edit Page
Powered by PmWiki