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

Projection formulas are (almost definitely) incorrect #1

Open
achalddave opened this issue Jun 27, 2014 · 2 comments
Open

Projection formulas are (almost definitely) incorrect #1

achalddave opened this issue Jun 27, 2014 · 2 comments

Comments

@achalddave
Copy link

I've been trying to use these projection formulas: https://github.com/jysung100/activity_detection/blob/master/FeatureExtractor/featuresRGBD.cpp#L26

  // Given (x,y,z) coordinates, converts that point into its x pixel number in the 2D image.
  int xPixelFromCoords(double x, double y, double z)
  {
    return (int) (156.8584456124928 + 0.0976862095248 * x - 0.0006444357104 * y + 0.0015715946682 * z);
  }

  // Given (x,y,z) coordinates, converts that point into its y pixel number in the 2D image.
  int yPixelFromCoords(double x, double y, double z)
  {
    return (int) (125.5357201011431 + 0.0002153447766 * x - 0.1184874093530 * y - 0.0022134485957 * z);
  }

These purport to go from the joint's 3d coordinates to 2d coordinates, but they do not seem to work. I visualized the 2d joint locations after this projection, and they are significantly off; furthermore, it seems odd that you could project from 3d to 2d with a linear dot product (since projections should be scaled by z).

The correct formula should be as per OpenNI's formula, which is discussed by a developer here: https://groups.google.com/d/msg/unitykinect/1ZFCHO9PpjA/1KdxUTdq90gJ (Note that there is a minor mistake in the algebra, as I showed here: https://groups.google.com/d/msg/unitykinect/1ZFCHO9PpjA/0B2eHjrywj4J).

I'm however not sure if this function serves a different purpose, so I am not submitting a pull request. Further, this translation from 3d to 2d is not documented in CAD120 anywhere; it would be nice to incorporate the formula from that post into the README for the skeleton format to make 2d visualizations, among other things, easier.

@jysung
Copy link
Owner

jysung commented Jun 27, 2014

You are correct that this formula is incorrect. I just didn't had a chance to fix it yet.
If you can create a pull request, it will be great!

Thanks,
Jae

@achalddave
Copy link
Author

Thanks for the quick reply! Will send one later tonight or tomorrow.

Edit: I've committed the changes to my fork, but haven't had a chance to test it yet (not on a dev machine for a bit); will submit PR once I am.

achalddave added a commit to achalddave/activity_detection that referenced this issue Jun 29, 2014
The original projection formulas were incorrect. The updated ones are the ones used in OpenNI for projections, with two hardcoded constants that rely on sensor values; their derivation is described on the linked page.
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