| 1218 | } |
| 1219 | |
| 1220 | std::string InputCamera::toBundleString(bool negativeZ, bool recomputeFocal) const { |
| 1221 | |
| 1222 | std::stringstream ss; |
| 1223 | ss << std::setprecision(16); |
| 1224 | float focal; |
| 1225 | if (recomputeFocal) |
| 1226 | focal = 0.5f * h() / tan(fovy() / 2.0f); // We cannot set the focal but we need to compute it |
| 1227 | else |
| 1228 | focal = _focal; |
| 1229 | |
| 1230 | Eigen::Matrix3f r = transform().rotation().toRotationMatrix(); |
| 1231 | sibr::Vector3f t = -transform().rotation().toRotationMatrix().transpose() * position(); |
| 1232 | |
| 1233 | ss << focal << " " << k1() << " " << k2() << "\n"; // The focal is set to zero in the loading module we use fov=2.0f * atan( 0.5f*h / focal) here |
| 1234 | if (!negativeZ) { |
| 1235 | ss << r(0) << " " << r(1) << " " << r(2) << "\n"; |
| 1236 | ss << r(3) << " " << r(4) << " " << r(5) << "\n"; |
| 1237 | ss << r(6) << " " << r(7) << " " << r(8) << "\n"; |
| 1238 | ss << t(0) << " " << t(1) << " " << t(2) << "\n"; |
| 1239 | } |
| 1240 | else { |
| 1241 | ss << r(0) << " " << -r(2) << " " << r(1) << "\n"; |
| 1242 | ss << r(3) << " " << -r(5) << " " << r(4) << "\n"; |
| 1243 | ss << r(6) << " " << -r(8) << " " << r(7) << "\n"; |
| 1244 | ss << t(0) << " " << t(1) << " " << t(2) << "\n"; |
| 1245 | } |
| 1246 | |
| 1247 | return ss.str(); |
| 1248 | } |
| 1249 | |
| 1250 | std::vector<sibr::Vector2i> InputCamera::getImageCorners() const |
| 1251 | { |
no test coverage detected