31 Vec3 cameras_mass_center = Vec3::Zero();
32 for (
int i = 0; i < all_cameras.size(); ++i) {
33 cameras_mass_center += all_cameras[i].t;
35 cameras_mass_center /= all_cameras.size();
38 double max_distance = 0.0;
39 for (
int i = 0; i < all_cameras.size(); ++i) {
40 double distance = (all_cameras[i].t - cameras_mass_center).squaredNorm();
46 if (max_distance == 0.0) {
47 LG <<
"Cameras position variance is too small, can not rescale";
51 double scale_factor = 1.0 /
sqrt(max_distance);
54 for (
int i = 0; i < all_cameras.size(); ++i) {
55 int image = all_cameras[i].image;
57 camera->
t = camera->
t * scale_factor;
61 for (
int i = 0; i < all_points.size(); ++i) {
62 int track = all_points[i].track;
64 point->
X = point->
X * scale_factor;
vector< ProjectivePoint > AllPoints() const
Returns all points.
vector< ProjectiveCamera > AllCameras() const
Returns all cameras.
ProjectivePoint * PointForTrack(int track)
Returns a pointer to the point corresponding to track.
ProjectiveCamera * CameraForImage(int image)
Returns a pointer to the camera corresponding to image.
const ProjectiveReconstruction & reconstruction
void EuclideanScaleToUnity(EuclideanReconstruction *reconstruction)
ccl_device_inline float distance(const float2 &a, const float2 &b)