| 107 | std::vector<short> lut; |
| 108 | |
| 109 | IrCameraTables(const Freenect2Device::IrCameraParams &parent): |
| 110 | Freenect2Device::IrCameraParams(parent), |
| 111 | xtable(DepthPacketProcessor::TABLE_SIZE), |
| 112 | ztable(DepthPacketProcessor::TABLE_SIZE), |
| 113 | lut(DepthPacketProcessor::LUT_SIZE) |
| 114 | { |
| 115 | const double scaling_factor = 8192; |
| 116 | const double unambigious_dist = 6250.0/3; |
| 117 | size_t divergence = 0; |
| 118 | for (size_t i = 0; i < DepthPacketProcessor::TABLE_SIZE; i++) |
| 119 | { |
| 120 | size_t xi = i % 512; |
| 121 | size_t yi = i / 512; |
| 122 | double xd = (xi + 0.5 - cx)/fx; |
| 123 | double yd = (yi + 0.5 - cy)/fy; |
| 124 | double xu, yu; |
| 125 | divergence += !undistort(xd, yd, xu, yu); |
| 126 | xtable[i] = scaling_factor*xu; |
| 127 | ztable[i] = unambigious_dist/sqrt(xu*xu + yu*yu + 1); |
| 128 | } |
| 129 | |
| 130 | if (divergence > 0) |
| 131 | LOG_ERROR << divergence << " pixels in x/ztable have incorrect undistortion."; |
| 132 | |
| 133 | short y = 0; |
| 134 | for (int x = 0; x < 1024; x++) |
| 135 | { |
| 136 | unsigned inc = 1 << (x/128 - (x>=128)); |
| 137 | lut[x] = y; |
| 138 | lut[1024 + x] = -y; |
| 139 | y += inc; |
| 140 | } |
| 141 | lut[1024] = 32767; |
| 142 | } |
| 143 | |
| 144 | //x,y: undistorted, normalized coordinates |
| 145 | //xd,yd: distorted, normalized coordinates |
nothing calls this directly
no outgoing calls
no test coverage detected