feat(cameras): add Intrinsics.fov_deg() getter#55
Merged
Conversation
from_fov builds intrinsics from a field of view but there was no way to read the FOV back off an existing Intrinsics. Add fov_deg() -> (h, v), inverting from_fov per axis: fov = 2*degrees(atan((size/2)/f)). Handy for logging, sanity checks, and picking a rig radius. Fixes bamdadd#52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Intrinsics.from_fov(...)builds intrinsics from a field of view, but there was no getter to read the FOV back off an existingIntrinsics— useful for logging, sanity checks, and picking a rig radius.Adds
Intrinsics.fov_deg() -> tuple[float, float]next tomatrix(), returning(horizontal_fov_deg, vertical_fov_deg)by invertingfrom_fovper axis:Acceptance criteria
fov_deg()returns(h, v)in degreesIntrinsics.from_fov(60, 640, 480).fov_deg()[0] == pytest.approx(60)fy == fx) → vertical follows from the aspect ratio; independent-axis case round-trips both (90/60)ruffandmypyclean,pytestgreenTests
Three cases in
tests/test_cameras.py: horizontal round trip, square-pixel aspect (fov_y < fov_x for 640×480), and independent horizontal/vertical round trip. Full file: 15 passed.Fixes #52