From 3c0513d38ec549b6a55d2d792723c23e6c806510 Mon Sep 17 00:00:00 2001 From: Rhymer-Lcy <1014917866@qq.com> Date: Tue, 24 Jun 2025 18:58:27 +0800 Subject: [PATCH 1/6] Add fisheye OpenCV undistort module --- .../include/vikit/equidistant_camera.h | 3 +++ vikit_common/src/equidistant_camera.cpp | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/vikit_common/include/vikit/equidistant_camera.h b/vikit_common/include/vikit/equidistant_camera.h index 72a5e43..b1f2f96 100644 --- a/vikit_common/include/vikit/equidistant_camera.h +++ b/vikit_common/include/vikit/equidistant_camera.h @@ -137,6 +137,9 @@ class EquidistantCamera : public AbstractCamera { virtual double fy() const { return fy_; }; virtual double cx() const { return cx_; }; virtual double cy() const { return cy_; }; + + // Undistort the input image to correct lens distortion + void undistortImage(const cv::Mat& input, cv::Mat& output) const; }; } // end namespace vk diff --git a/vikit_common/src/equidistant_camera.cpp b/vikit_common/src/equidistant_camera.cpp index 2fa5224..ed582e2 100644 --- a/vikit_common/src/equidistant_camera.cpp +++ b/vikit_common/src/equidistant_camera.cpp @@ -108,4 +108,25 @@ world2cam(const Vector2d& uv) const return px; } +void EquidistantCamera::undistortImage(const cv::Mat& input, cv::Mat& output) const +{ + // Return original image if no distortion parameters are available + if(!distortion_) { + output = input.clone(); + return; + } + // Build camera intrinsic matrix K + cv::Mat K = cv::Mat::eye(3, 3, CV_64F); + K.at(0,0) = fx_; // Focal length in x direction + K.at(1,1) = fy_; // Focal length in y direction + K.at(0,2) = cx_; // Principal point x-coordinate + K.at(1,2) = cy_; // Principal point y-coordinate + // Prepare distortion coefficients (k1, k2, k3, k4) + cv::Mat D = (cv::Mat_(4,1) << k1_, k2_, k3_, k4_); + // Create new camera matrix (using same intrinsics by default) + cv::Mat new_K = K.clone(); + // Apply fisheye lens undistortion using OpenCV + cv::fisheye::undistortImage(input, output, K, D, new_K); +} + } // end namespace vk From 4044f6d554d9d532ab74fdbafd57b041503c4a45 Mon Sep 17 00:00:00 2001 From: Rhymer-Lcy <1014917866@qq.com> Date: Tue, 24 Jun 2025 19:43:54 +0800 Subject: [PATCH 2/6] Added OpenCV-based fisheye distortion correction to the equidistant_camera model in vikit_common. --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2ca0b79..c55b4fc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,19 @@ -VIKIT ------ +## Vikit for FAST-LIVO2 -Vikit (Vision-Kit) provides some tools for your vision/robotics project. -Far from stable. +Vikit (Vision-Kit) is a lightweight and efficient library designed to provide essential camera models, mathematical utilities, and interpolation functions required for the FAST-LIVO2 framework. + +📬 For further assistance or inquiries, please feel free to contact Chunran Zheng at zhengcr@connect.hku.hk. + +### Supported Camera Models +Vikit offers support for a diverse range of camera models, including: + +- Pinhole + Radtan +- Pinhole + Equidistant(Added OpenCV-based fisheye distortion correction to the equidistant_camera model in vikit_common) +- Pinhole + ATAN +- Pinhole + Polynomial +- Omni + Polynomial + +These models adapt to various camera configurations and distortion characteristics. + +### Acknowledgments +Special thanks to the [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) from the [UZH-RPG group](https://rpg.ifi.uzh.ch/) for their foundational work and inspiration in the development of this library. From 09ba8251275cc469791c1f4440e71a7879693dd7 Mon Sep 17 00:00:00 2001 From: Rhymer-Lcy <1014917866@qq.com> Date: Tue, 24 Jun 2025 21:28:36 +0800 Subject: [PATCH 3/6] Added OpenCV-based fisheye distortion correction to the equidistant_camera model in vikit_common. --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c55b4fc..49cec8c 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,18 @@ Vikit (Vision-Kit) is a lightweight and efficient library designed to provide es Vikit offers support for a diverse range of camera models, including: - Pinhole + Radtan -- Pinhole + Equidistant(Added OpenCV-based fisheye distortion correction to the equidistant_camera model in vikit_common) +- Pinhole + Equidistant **(with OpenCV-based fisheye distortion correction)** - Pinhole + ATAN - Pinhole + Polynomial - Omni + Polynomial These models adapt to various camera configurations and distortion characteristics. +### Project Lineage & Modifications +This repository is a fork of the ROS2-compatible [`rpg_vikit`](https://github.com/integralrobotics/rpg_vikit) (itself derived from the [original work](https://github.com/uzh-rpg/rpg_vikit) by Chunran Zheng). Key enhancements include: +- **Added OpenCV-based fisheye distortion correction** to the equidistant camera model in `vikit_common`. + ### Acknowledgments -Special thanks to the [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) from the [UZH-RPG group](https://rpg.ifi.uzh.ch/) for their foundational work and inspiration in the development of this library. +Special thanks to: +- The [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) from [UZH-RPG group](https://rpg.ifi.uzh.ch/) for foundational work +- [integralrobotics](https://github.com/integralrobotics) for the ROS2-compatible port From 6b3aff78296eccf6760276709e85e41f826a04b4 Mon Sep 17 00:00:00 2001 From: Rhymer-Lcy <1014917866@qq.com> Date: Tue, 24 Jun 2025 21:37:05 +0800 Subject: [PATCH 4/6] feat: integrate OpenCV fisheye distortion correction for equidistant camera model --- README.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 49cec8c..e40a367 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ ## Vikit for FAST-LIVO2 -Vikit (Vision-Kit) is a lightweight and efficient library designed to provide essential camera models, mathematical utilities, and interpolation functions required for the FAST-LIVO2 framework. +Vikit (Vision-Kit) is a lightweight and efficient library providing essential camera models, mathematical utilities, and interpolation functions for the FAST-LIVO2 framework. -📬 For further assistance or inquiries, please feel free to contact Chunran Zheng at zhengcr@connect.hku.hk. +📬 For further assistance or inquiries, please contact Chunran Zheng at zhengcr@connect.hku.hk. ### Supported Camera Models -Vikit offers support for a diverse range of camera models, including: +Vikit supports the following camera models: - Pinhole + Radtan - Pinhole + Equidistant **(with OpenCV-based fisheye distortion correction)** @@ -13,13 +13,18 @@ Vikit offers support for a diverse range of camera models, including: - Pinhole + Polynomial - Omni + Polynomial -These models adapt to various camera configurations and distortion characteristics. +These models accommodate diverse camera configurations and distortion characteristics. -### Project Lineage & Modifications -This repository is a fork of the ROS2-compatible [`rpg_vikit`](https://github.com/integralrobotics/rpg_vikit) (itself derived from the [original work](https://github.com/uzh-rpg/rpg_vikit) by Chunran Zheng). Key enhancements include: -- **Added OpenCV-based fisheye distortion correction** to the equidistant camera model in `vikit_common`. +### Project Lineage +This repository is maintained as a downstream fork with the following lineage: +1. Original work: [xuankuzcr/rpg_vikit](https://github.com/xuankuzcr/rpg_vikit) by Chunran Zheng +2. ROS2-compatible port: [integralrobotics/rpg_vikit](https://github.com/integralrobotics/rpg_vikit) + +### Enhancements +The following key improvements have been implemented: +- Integrated OpenCV-based fisheye distortion correction into the equidistant camera model (`vikit_common` module) ### Acknowledgments -Special thanks to: -- The [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) from [UZH-RPG group](https://rpg.ifi.uzh.ch/) for foundational work -- [integralrobotics](https://github.com/integralrobotics) for the ROS2-compatible port +Special recognition to: +- [UZH-RPG group](https://rpg.ifi.uzh.ch/) for foundational [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) research +- [integralrobotics](https://github.com/integralrobotics) for the ROS2 compatibility implementation From a62ddbbba377f9bd4f03cf9ae574b56d66ef329c Mon Sep 17 00:00:00 2001 From: Rhymer-Lcy <1014917866@qq.com> Date: Wed, 25 Jun 2025 09:47:38 +0800 Subject: [PATCH 5/6] [Feat] integrate OpenCV fisheye distortion correction for equidistant camera model. --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e40a367..227b510 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,15 @@ These models accommodate diverse camera configurations and distortion characteri ### Project Lineage This repository is maintained as a downstream fork with the following lineage: -1. Original work: [xuankuzcr/rpg_vikit](https://github.com/xuankuzcr/rpg_vikit) by Chunran Zheng -2. ROS2-compatible port: [integralrobotics/rpg_vikit](https://github.com/integralrobotics/rpg_vikit) +1. Original work: [xuankuzcr/rpg_vikit](https://github.com/xuankuzcr/rpg_vikit) by Chunran Zheng. +2. ROS2-compatible port: [integralrobotics/rpg_vikit](https://github.com/integralrobotics/rpg_vikit). ### Enhancements The following key improvements have been implemented: -- Integrated OpenCV-based fisheye distortion correction into the equidistant camera model (`vikit_common` module) +- Integrated OpenCV-based fisheye distortion correction into the equidistant camera model (`vikit_common` module). ### Acknowledgments Special recognition to: -- [UZH-RPG group](https://rpg.ifi.uzh.ch/) for foundational [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) research -- [integralrobotics](https://github.com/integralrobotics) for the ROS2 compatibility implementation +- [UZH-RPG group](https://rpg.ifi.uzh.ch/) for foundational [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) research. +- [Chunran Zheng](https://github.com/xuankuzcr/rpg_vikit) for developing the ROS1-compatible fork [xuankuzcr/rpg_vikit](https://github.com/xuankuzcr/rpg_vikit) specifically adapted for FAST-LIVO2. +- [integralrobotics](https://github.com/integralrobotics) for porting Chunran Zheng's version to ROS2 in their [rpg_vikit implementation](https://github.com/integralrobotics/rpg_vikit). \ No newline at end of file From fee3d50ae2af472fb27eb62b4526dd4b32ede8ef Mon Sep 17 00:00:00 2001 From: Rhymer-Lcy <1014917866@qq.com> Date: Wed, 25 Jun 2025 09:49:08 +0800 Subject: [PATCH 6/6] [Feat] integrate OpenCV fisheye distortion correction for equidistant camera model. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 227b510..46659c0 100644 --- a/README.md +++ b/README.md @@ -27,5 +27,5 @@ The following key improvements have been implemented: ### Acknowledgments Special recognition to: - [UZH-RPG group](https://rpg.ifi.uzh.ch/) for foundational [rpg_vikit](https://github.com/uzh-rpg/rpg_vikit) research. -- [Chunran Zheng](https://github.com/xuankuzcr/rpg_vikit) for developing the ROS1-compatible fork [xuankuzcr/rpg_vikit](https://github.com/xuankuzcr/rpg_vikit) specifically adapted for FAST-LIVO2. +- [Chunran Zheng](https://github.com/xuankuzcr/rpg_vikit) for developing the ROS1-compatible version [xuankuzcr/rpg_vikit](https://github.com/xuankuzcr/rpg_vikit) specifically adapted for FAST-LIVO2. - [integralrobotics](https://github.com/integralrobotics) for porting Chunran Zheng's version to ROS2 in their [rpg_vikit implementation](https://github.com/integralrobotics/rpg_vikit). \ No newline at end of file