Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect mapping of depth to color #27

Open
thibautvdu opened this issue Aug 5, 2014 · 1 comment
Open

Incorrect mapping of depth to color #27

thibautvdu opened this issue Aug 5, 2014 · 1 comment

Comments

@thibautvdu
Copy link
Contributor

Hi there ! Thanks for your great work.

I couldn't get a proper alignment by setting true to the function initDepthstream so I did some changes.

I think the mapping routine in the update method might be wrong and the result of the method INuiCoordinateMapper::MapDepthFrameToColorFrame might have been misunderstood as the comment // if mapping depth to color, upscale depth point it. The result argument pColorPoints (cf doc) map a depth image index with a color image position and not a depth image index with a depth image position.

Thus :
depthPixels[i] = depthLookupTable[ ofClamp(depthPixelsRaw[pts[i].y * depthFormat.dwWidth + pts[i].x] >> 4, 0, depthLookupTable.size()-1 ) ];

Should be :
int colorImageIndex = pts[i].y * depthFormat.dwWidth + pts[i].x;
depthPixels[colorImageIndex] = depthLookupTable[ofClamp(depthPixelsRaw[i] >> 4, 0, depthLookupTable.size() - 1)];

If I do not mistake, you can have a look at my fork. The result seems correct for my usage, yet the accuracy is not satisfactory. I am looking for a way to use the background segmentation from the toolkit in OF now.

@joshuajnoble
Copy link
Owner

Cool! Can you submit a pull request for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants