microcosm / ofxKinectV2-OSC

Get KinectV2 skeletons into openFrameworks on your Mac
65 stars 16 forks source link

Odd coordinates coming from framework #4

Open mihai-moldovan opened 9 years ago

mihai-moldovan commented 9 years ago

Hi, when testing the Kinect near its limits (window margins in the Windows application) the coordinates yielded by the adddon were very odd, sometime getting negative. After some debugging I found this code in DataTransform/Parser.cpp

ofVec3f Parser::orient(ofVec3f &point){
    point.x = ofMap(point.x, -1, 1, 0, ofGetWidth());
    point.y = ofMap(point.y, -1, 1, ofGetHeight(), 0);
    point.z = ofMap(point.z, 0, 2, 30, 10);
    return point;
}

Although it should fit most of the normal users, it doesn't give a correct perception of the actual joint position, especially if one needs the position relative to real world, not the one relative to OF window.

The coordinates received by Kinect are in meters, with the origin in the kinect itself. So x axis is paralel to Kinect, y axis is perpendicular to x axis going up-down, and z axis perpendicular on XoY plane.

Basically the addon returns readable data for a cube of 2 meters size and maps this cube to the window dimensions.

I think it's better to just send the actual real world position and let the developer map the coordinates to whatever other system he wants.

my working copy looks like this:

ofVec3f Parser::orient(ofVec3f &point){
    //point.x = ofMap(point.x, -1, 1, 0, ofGetWidth());
    //point.y = ofMap(point.y, -1, 1, ofGetHeight(), 0);
    //point.z = ofMap(point.z, 0, 2, 30, 10);
    return point;
}

Thanks, Mihai

microcosm commented 9 years ago

Hey, thanks. Good point. When I get a sec I'll simply make both options available through the API.