21 releases (breaking)

0.15.0 Jun 24, 2024
0.14.1 Jun 23, 2023
0.14.0 Jan 16, 2023
0.13.0 May 2, 2022
0.2.1 Mar 16, 2020

#123 in Algorithms

Download history 222/week @ 2024-07-27 524/week @ 2024-08-03 281/week @ 2024-08-10 139/week @ 2024-08-17 120/week @ 2024-08-24 131/week @ 2024-08-31 175/week @ 2024-09-07 121/week @ 2024-09-14 192/week @ 2024-09-21 245/week @ 2024-09-28 324/week @ 2024-10-05 309/week @ 2024-10-12 405/week @ 2024-10-19 627/week @ 2024-10-26 488/week @ 2024-11-02 368/week @ 2024-11-09

1,906 downloads per month
Used in opencv-ros-camera

MIT/Apache

105KB
2K SLoC

Crates.io Documentation Crate License Dependency status build

📷 📐 Geometric models of cameras for photogrammetry

pinhole model image

(3D model by Adan, CC by 4.0)

About

The crate implements geometric models of cameras which may be useful for photogrammetry.

The crate provides a couple camera models, the pinhole perspective camera and the orthographic camera. Adding another camera model entails implementing the IntrinsicParameters trait. See the opencv_ros_camera crate for one example.

Also provided is the function best_intersection_of_rays() which determines the best 3D point corresponding to the intersection of multiple rays. Thus, this crate is also useful for multiple view geometry.

Characteristics:

  • Extensive use of static typing to ensure no unpleasant runtime surprises with coordinate system, matrix dimensions, and so on.
  • Serialization and deserialization using serde. Enable with the serde-serialize cargo feature.
  • Linear algebra and types from the nalgebra crate.
  • Possible to create new camera models by implementing the IntrinsicParameters trait. While the camera models implemented in this crate are linear, there is no requirement that implementations are linear. For example, the opencv_ros_camera crate exhibits distortion.
  • ExtrinsicParameters based on the nalgebra::Isometry3 type to handle the camera pose.
  • No standard library is required (disable the default features to disable use of std) and no heap allocations. In other words, this can run on a bare-metal microcontroller with no OS.
  • Extensive documentation and tests.
  • Requires rust version 1.40 or greater.

Testing

Unit tests

To run the basic unit tests:

cargo test

To run all unit tests:

cargo test --features serde-serialize

Test for no_std

Since the thumbv7em-none-eabihf target does not have std available, we can build for it to check that our crate does not inadvertently pull in std. The unit tests require std, so cannot be run on a no_std platform. The following will fail if a std dependency is present:

# install target with: "rustup target add thumbv7em-none-eabihf"
cargo build --no-default-features --target thumbv7em-none-eabihf

Code of conduct

Anyone who interacts with this software in any space, including but not limited to this GitHub repository, must follow our code of conduct.

License

Licensed under either of these:

Dependencies

~4MB
~82K SLoC