MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / forward

Function forward

src/utils/cameraUndistortion.ts:84–92  ·  view source on GitHub ↗
(p: Vec2, i: CameraIntrinsics)

Source from the content-addressed store, hash-verified

82
83const perspectiveRadialStrategy: DistortionStrategy = {
84 forward(p: Vec2, i: CameraIntrinsics): Vec2 {
85 const { x, y } = p;
86 const r2 = x * x + y * y;
87 const R = _prFactor(r2, i);
88 // Tangential terms vanish exactly when p1=p2=0 (SIMPLE_RADIAL, RADIAL).
89 const dx = x * R + 2 * i.p1 * x * y + i.p2 * (r2 + 2 * x * x);
90 const dy = y * R + i.p1 * (r2 + 2 * y * y) + 2 * i.p2 * x * y;
91 return { x: x + dx, y: y + dy };
92 },
93
94 inverse(p: Vec2, i: CameraIntrinsics): UndistortResult {
95 let x = p.x;

Callers

nothing calls this directly

Calls 3

_prFactorFunction · 0.85
_fisheyeApplyDistortionFunction · 0.85
_radTanApplyDistortionFunction · 0.85

Tested by

no test coverage detected