| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef COLMAP_SRC_BASE_UNDISTORTION_H_ |
| | #define COLMAP_SRC_BASE_UNDISTORTION_H_ |
| |
|
| | #include "base/reconstruction.h" |
| | #include "util/alignment.h" |
| | #include "util/bitmap.h" |
| | #include "util/misc.h" |
| | #include "util/threading.h" |
| |
|
| | namespace colmap { |
| |
|
| | struct UndistortCameraOptions { |
| | |
| | double blank_pixels = 0.0; |
| |
|
| | |
| | |
| | double min_scale = 0.2; |
| | double max_scale = 2.0; |
| |
|
| | |
| | int max_image_size = -1; |
| |
|
| | |
| | |
| | |
| | |
| | double roi_min_x = 0.0; |
| | double roi_min_y = 0.0; |
| | double roi_max_x = 1.0; |
| | double roi_max_y = 1.0; |
| | }; |
| |
|
| | |
| | |
| | class COLMAPUndistorter : public Thread { |
| | public: |
| | COLMAPUndistorter( |
| | const UndistortCameraOptions& options, |
| | const Reconstruction& reconstruction, const std::string& image_path, |
| | const std::string& output_path, const int num_related_images = 20, |
| | const CopyType copy_type = CopyType::COPY, |
| | const std::vector<image_t>& image_ids = std::vector<image_t>()); |
| |
|
| | private: |
| | void Run(); |
| |
|
| | bool Undistort(const image_t image_id) const; |
| | void WritePatchMatchConfig() const; |
| | void WriteFusionConfig() const; |
| | void WriteScript(const bool geometric) const; |
| |
|
| | UndistortCameraOptions options_; |
| | const std::string image_path_; |
| | const std::string output_path_; |
| | const CopyType copy_type_; |
| | const int num_patch_match_src_images_; |
| | const Reconstruction& reconstruction_; |
| | const std::vector<image_t> image_ids_; |
| | std::vector<std::string> image_names_; |
| | }; |
| |
|
| | |
| | class PMVSUndistorter : public Thread { |
| | public: |
| | PMVSUndistorter(const UndistortCameraOptions& options, |
| | const Reconstruction& reconstruction, |
| | const std::string& image_path, |
| | const std::string& output_path); |
| |
|
| | private: |
| | void Run(); |
| |
|
| | bool Undistort(const size_t reg_image_idx) const; |
| | void WriteVisibilityData() const; |
| | void WriteOptionFile() const; |
| | void WritePMVSScript() const; |
| | void WriteCMVSPMVSScript() const; |
| | void WriteCOLMAPScript(const bool geometric) const; |
| | void WriteCMVSCOLMAPScript(const bool geometric) const; |
| |
|
| | UndistortCameraOptions options_; |
| | std::string image_path_; |
| | std::string output_path_; |
| | const Reconstruction& reconstruction_; |
| | }; |
| |
|
| | |
| | class CMPMVSUndistorter : public Thread { |
| | public: |
| | CMPMVSUndistorter(const UndistortCameraOptions& options, |
| | const Reconstruction& reconstruction, |
| | const std::string& image_path, |
| | const std::string& output_path); |
| |
|
| | private: |
| | void Run(); |
| |
|
| | bool Undistort(const size_t reg_image_idx) const; |
| |
|
| | UndistortCameraOptions options_; |
| | std::string image_path_; |
| | std::string output_path_; |
| | const Reconstruction& reconstruction_; |
| | }; |
| |
|
| | |
| | |
| | |
| | class PureImageUndistorter : public Thread { |
| | public: |
| | PureImageUndistorter(const UndistortCameraOptions& options, |
| | const std::string& image_path, |
| | const std::string& output_path, |
| | const std::vector<std::pair<std::string, Camera>>& |
| | image_names_and_cameras); |
| |
|
| | private: |
| | void Run(); |
| |
|
| | bool Undistort(const size_t reg_image_idx) const; |
| |
|
| | UndistortCameraOptions options_; |
| | std::string image_path_; |
| | std::string output_path_; |
| | const std::vector<std::pair<std::string, Camera>>& image_names_and_cameras_; |
| | }; |
| |
|
| | |
| | class StereoImageRectifier : public Thread { |
| | public: |
| | StereoImageRectifier( |
| | const UndistortCameraOptions& options, |
| | const Reconstruction& reconstruction, const std::string& image_path, |
| | const std::string& output_path, |
| | const std::vector<std::pair<image_t, image_t>>& stereo_pairs); |
| |
|
| | private: |
| | void Run(); |
| |
|
| | void Rectify(const image_t image_id1, const image_t image_id2) const; |
| |
|
| | UndistortCameraOptions options_; |
| | std::string image_path_; |
| | std::string output_path_; |
| | const std::vector<std::pair<image_t, image_t>>& stereo_pairs_; |
| | const Reconstruction& reconstruction_; |
| | }; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | Camera UndistortCamera(const UndistortCameraOptions& options, |
| | const Camera& camera); |
| |
|
| | |
| | |
| | |
| | void UndistortImage(const UndistortCameraOptions& options, |
| | const Bitmap& distorted_image, |
| | const Camera& distorted_camera, Bitmap* undistorted_image, |
| | Camera* undistorted_camera); |
| |
|
| | |
| | |
| | void UndistortReconstruction(const UndistortCameraOptions& options, |
| | Reconstruction* reconstruction); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | void RectifyStereoCameras(const Camera& camera1, const Camera& camera2, |
| | const Eigen::Vector4d& qvec, |
| | const Eigen::Vector3d& tvec, Eigen::Matrix3d* H1, |
| | Eigen::Matrix3d* H2, Eigen::Matrix4d* Q); |
| |
|
| | |
| | void RectifyAndUndistortStereoImages( |
| | const UndistortCameraOptions& options, const Bitmap& distorted_image1, |
| | const Bitmap& distorted_image2, const Camera& distorted_camera1, |
| | const Camera& distorted_camera2, const Eigen::Vector4d& qvec, |
| | const Eigen::Vector3d& tvec, Bitmap* undistorted_image1, |
| | Bitmap* undistorted_image2, Camera* undistorted_camera, Eigen::Matrix4d* Q); |
| |
|
| | } |
| |
|
| | #endif |
| |
|