Camera and multi-view geometry foundations for MoonBit: small fixed-size math, projection, distortion, homography, epipolar constraints, and RANSAC.
moon add cxh04/moon-cv-geometry///|
test "project a 3D camera point" {
let k = @camera.CameraIntrinsics::new(fx=500.0, fy=500.0, cx=320.0, cy=240.0)
let p = @core.Point3::new(x=1.0, y=2.0, z=4.0)
let pixel = @camera.project_point(p, k)
assert_true(@core.almost_equal(pixel.x, 445.0))
assert_true(@core.almost_equal(pixel.y, 490.0))
}moon run examples/project_point
moon run examples/undistort
moon run examples/homography
moon run examples/fundamental_ransacmoon check --target all
moon test --target all
moon fmt
moon infofn estimate_essential_from_fundamental(f : FundamentalMatrix, k_left : Mat3, k_right : Mat3) -> EssentialMatrixfn estimate_fundamental_ransac(left : ArrayView[Point2], right : ArrayView[Point2], config? : RansacConfig) -> RansacResult[FundamentalMatrix] raise GeometryErrorfn estimate_homography_from_four(src : ArrayView[Point2], dst : ArrayView[Point2]) -> Homography raise GeometryErrorfn estimate_homography_ransac(src : ArrayView[Point2], dst : ArrayView[Point2], config? : RansacConfig) -> RansacResult[Homography] raise GeometryErrorfn homography_reprojection_error(h : Homography, src : Point2, dst : Point2) -> Double raise GeometryErrorfn mat34_from_rows(r0 : (Double, Double, Double, Double), r1 : (Double, Double, Double, Double), r2 : (Double, Double, Double, Double)) -> Mat34fn mat3_from_rows(r0 : (Double, Double, Double), r1 : (Double, Double, Double), r2 : (Double, Double, Double)) -> Mat3fn project_point(camera_point : Point3, intrinsics : CameraIntrinsics, distortion? : Distortion) -> Point2 raise GeometryErrorfn project_point_with_pose(world_point : Point3, intrinsics : CameraIntrinsics, pose : CameraPose, distortion? : Distortion) -> Point2 raise GeometryErrorfn undistort_point_iterative(distorted : Point2, distortion : Distortion, iterations? : Int) -> Point2Camera and multi-view geometry foundations for MoonBit: small fixed-size math, projection, distortion, homography, epipolar constraints, and RANSAC.