| 71 | }; |
| 72 | |
| 73 | void RegistrationImpl::distort(int mx, int my, float& x, float& y) const |
| 74 | { |
| 75 | // see http://en.wikipedia.org/wiki/Distortion_(optics) for description |
| 76 | float dx = ((float)mx - depth.cx) / depth.fx; |
| 77 | float dy = ((float)my - depth.cy) / depth.fy; |
| 78 | float dx2 = dx * dx; |
| 79 | float dy2 = dy * dy; |
| 80 | float r2 = dx2 + dy2; |
| 81 | float dxdy2 = 2 * dx * dy; |
| 82 | float kr = 1 + ((depth.k3 * r2 + depth.k2) * r2 + depth.k1) * r2; |
| 83 | x = depth.fx * (dx * kr + depth.p2 * (r2 + 2 * dx2) + depth.p1 * dxdy2) + depth.cx; |
| 84 | y = depth.fy * (dy * kr + depth.p1 * (r2 + 2 * dy2) + depth.p2 * dxdy2) + depth.cy; |
| 85 | } |
| 86 | |
| 87 | void RegistrationImpl::depth_to_color(float mx, float my, float& rx, float& ry) const |
| 88 | { |
nothing calls this directly
no outgoing calls
no test coverage detected