Open lucasw opened 3 months ago
Need basic pinhole camera functions - https://github.com/rust-cv/cv doesn't support 6 distortion coefficients (and is not being maintained much, so no expectation it'll get added).
Transform a set of xyz points given a transform - probably nalgebra can do this.
The only cv function needed:
cv::undistortPoints(points2d_in_camera, ideal_points, camera_matrix, dist_coeff); -> maybe can adapt rust-cv
The code to adapt is here https://github.com/opencv/opencv/blob/4.x/modules/calib3d/src/undistort.dispatch.cpp#L409 (what happens with _Dk after that block though?). Could make a simplified C++ version and test that it operates identically, then adapt the simplified version to rust.
Or just use the opencv rust wrapper https://docs.rs/opencv/latest/opencv/calib3d/fn.undistort_points.html / https://docs.rs/opencv/latest/opencv/calib3d/fn.undistort_image_points.html
Including opencv:
opencv = "0.92.1"
warning: clang-sys@1.8.1: could not execute `llvm-config` one or more times, if the LLVM_CONFIG_PATH environment variable is set to a full path to valid `llvm-config` executable it will be used to try to find an instance of `libclang` on your system: "couldn't execute `llvm-config --prefix` (path=llvm-config) (error: No such file or directory (os error 2))"
error: failed to run custom build command for `clang-sys v1.8.1`
Maybe need to roll back to an older version?
Have the rust conversion of undistortPoints working here: https://github.com/lucasw/vimjay/blob/eliminate_build_warnings/src/bin/camera_fov_plane_intersection.rs#L19-L130
(not yet doing anything for R/P matrices, but don't need those)
Next need to make the polygon get published like in python and C++ versions, then this will be done.
Use https://github.com/lucasw/rustros_tf/tree/roslibrust
Do https://github.com/lucasw/tf_demo/issues/4 first
Convert this: https://github.com/lucasw/vimjay/blob/eliminate_build_warnings/src/standalone/camera_info_to_plane.cpp