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

Function _glslFullOpenCV

src/shaders/undistortion.ts:815–826  ·  view source on GitHub ↗
(p: Vec2, i: CameraIntrinsics)

Source from the content-addressed store, hash-verified

813
814// Mirrors distortFullOpenCV() — covers all perspective-radial sub-models.
815function _glslFullOpenCV(p: Vec2, i: CameraIntrinsics): Vec2 {
816 const x = p.x, y = p.y;
817 const r2 = x * x + y * y;
818 const r4 = r2 * r2;
819 const r6 = r4 * r2;
820 const num = 1.0 + i.k1 * r2 + i.k2 * r4 + i.k3 * r6;
821 const denom = 1.0 + i.k4 * r2 + i.k5 * r4 + i.k6 * r6;
822 const radial = num / denom - 1.0;
823 const dx = 2.0 * i.p1 * x * y + i.p2 * (r2 + 2.0 * x * x);
824 const dy = i.p1 * (r2 + 2.0 * y * y) + 2.0 * i.p2 * x * y;
825 return { x: x + x * radial + dx, y: y + y * radial + dy };
826}
827
828// Mirrors distortFOV().
829function _glslFOV(p: Vec2, i: CameraIntrinsics): Vec2 {

Callers 1

glslForwardReferenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected