Skip to content

Commit

Permalink
Scale intrinsics by resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Timocop committed Dec 8, 2021
1 parent 281e4da commit f3cb301
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/psmoveservice/PSMoveTracker/PS3EyeTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,8 @@ void PS3EyeTracker::getCameraIntrinsics(
outDistortionP1 = static_cast<float>(cfg.distortionP1);
outDistortionP2 = static_cast<float>(cfg.distortionP2);


// ###Externet $TODO Scale precomputed intrinsics if its other than 480p.
// Distortion calibration should never be done at 240p anyways so this should be fine.
// So we can finally use 240p out of the box.
// 480p should be the default resolution for intrinsics.
const float N = static_cast<float>(getFrameWidth() / 640);

outFocalLengthX *= N; //F_PX
Expand Down Expand Up @@ -717,6 +715,20 @@ void PS3EyeTracker::setCameraIntrinsics(
cfg.distortionK3 = distortionK3;
cfg.distortionP1 = distortionP1;
cfg.distortionP2 = distortionP2;

// ###Externet $TODO Scale precomputed intrinsics if its other than 480p.
// 480p should be the default resolution for intrinsics.
const float N = static_cast<float>(getFrameWidth() / 640);

cfg.focalLengthX /= N; //F_PX
cfg.focalLengthY /= N; //F_PY
cfg.principalX /= N; //PrincipalX
cfg.principalY /= N; //PrincipalY
//outDistortionK1 /= N; //K1
//outDistortionK2 /= N; //K2
//outDistortionK3 /= N; //K3
//outDistortionP1 /= N; //P1
//outDistortionP2 /= N; //P2
}

CommonDevicePose PS3EyeTracker::getTrackerPose() const
Expand Down

0 comments on commit f3cb301

Please sign in to comment.