2#include <opencv2/core.hpp>
3#include <opencv2/core/affine.hpp>
4#include "basalt/calibration/calibration.hpp"
10 using CvFovT = cv::Size_<ScalarT>;
11 using CvAffine3T = cv::Affine3<ScalarT>;
63 Stitcher(
const std::string &calibration_filepath);
77 Stitcher(
const std::string &calibration_filepath, ScalarT depth);
91 Stitcher(
const std::string &calibration_filepath,
const cv::Mat &depth);
237 CvFovT
fov(ScalarT fov_x, ScalarT fov_y);
362 CvAffine3T
transform(
const CvAffine3T::Mat3 &rotation,
const CvAffine3T::Vec3 &translation = CvAffine3T::Vec3(0, 0, 0));
373 CvAffine3T
transform(
const CvAffine3T::Vec3 &rotation,
const CvAffine3T::Vec3 &translation = CvAffine3T::Vec3(0, 0, 0));
387 void stitch(
const std::vector<cv::Mat> &images,
const std::vector<ScalarT> &exposure, cv::Mat &pano);
397 void stitch(
const std::vector<cv::Mat> &images, cv::Mat &pano);
414 void stitch(
const std::vector<cv::Mat> &images,
const std::vector<ScalarT> &exposure, ScalarT depth, cv::Mat &pano);
431 void stitch(
const std::vector<cv::Mat> &images,
const std::vector<ScalarT> &exposure,
const cv::Mat &depth, cv::Mat &pano);
487 bool build_maps =
true, build_vigns =
true, build_mask =
true, build_mirrors =
true;
488 bool use_mask_as_vign =
false;
491 std::vector<cv::UMat> maps;
492 ScalarT vign_thresh = 0.5;
493 cv::Mat depth_dynamic;
494 ScalarT depth_static = 0.0;
495 CvFovT fov_ = {M_PI * 2.0, M_PI};
497 basalt::Calibration<ScalarT> calib;
498 std::vector<cv::UMat> vigns, vigns_base;
499 std::vector<cv::UMat> response;
500 std::vector<cv::UMat> weights, weights_base, weights_raw;
503 std::unique_ptr<DeviceData> dev;
cv::Size resolution(const cv::Size &resolution)
Set the output resolution for the panorama.
void setDepth(const cv::Mat &depth)
Sets a per-point depth map for the panorama.
Stitcher()
Constructs an empty Stitcher object.
bool buildInternals()
Builds all necessary internal data structures required for stitching.
ScalarT fovX(ScalarT fov)
Set the horizontal field of view (FOV) for the panorama.
bool useMaskAsVignette(bool use)
Sets whether to use the mask as vignette.
int height() const
Get the current output height for the panorama.
cv::Size resolution(int width, int height)
Set the output resolution for the panorama.
void stitch(const std::vector< cv::Mat > &images, const std::vector< ScalarT > &exposure, cv::Mat &pano)
Stitches the provided input images into a single panoramic image.
ScalarT vignetteThreshold() const
Get the current vignette threshold.
CvFovT fov(ScalarT fov_x, ScalarT fov_y)
Set the field of view (FOV) for the panorama.
const basalt::Calibration< ScalarT > & calibration() const
Returns a read-only reference to the calibration data.
CvAffine3T transform(const CvAffine3T::Vec3 &rotation, const CvAffine3T::Vec3 &translation=CvAffine3T::Vec3(0, 0, 0))
Set the transformation using a rotation vector and translation vector.
void setDepth(ScalarT depth)
Sets a uniform depth for the panorama.
int width() const
Get the current output width for the panorama.
ScalarT fovX() const
Get the current horizontal field of view (FOV) for the panorama.
CvAffine3T transform(const CvAffine3T::Mat3 &rotation, const CvAffine3T::Vec3 &translation=CvAffine3T::Vec3(0, 0, 0))
Set the transformation using rotation matrix and translation vector.
void buildMirrors()
Builds the vignette map and weight mirrors for multi-channel images.
int width(int width)
Set the output width for the panorama.
void buildVignettes()
Builds the vignette maps.
Stitcher(const std::string &calibration_filepath, const cv::Mat &depth)
Constructs a Stitcher object with the specified calibration file and per-point depth.
void buildMask()
Builds the masks and finalizes the weights.
bool buildMaps()
Builds the lookup tables and initial proximity-based weights.
cv::Size resolution() const
Get the current output resolution for the panorama.
Stitcher(const std::string &calibration_filepath, ScalarT depth)
Constructs a Stitcher object with the specified calibration file and uniform depth.
CvFovT fov() const
Get the current field of view (FOV) for the panorama.
Stitcher(const std::string &calibration_filepath)
Constructs a Stitcher object with the specified calibration file.
void loadCalibration(const std::string &calibration_filepath)
Loads camera calibration data from the specified file.
ScalarT vignetteThreshold(ScalarT threshold)
Set the vignette threshold used to generate vignette maps.
~Stitcher()
Destructor for the Stitcher class.
ScalarT fovY() const
Get the current vertical field of view (FOV) for the panorama.
void stitch(const std::vector< cv::Mat > &images, const std::vector< ScalarT > &exposure, const cv::Mat &depth, cv::Mat &pano)
Stitches the provided input images into a single panoramic image.
CvFovT fov(CvFovT fov)
Set the field of view (FOV) for the panorama.
CvAffine3T transform(const CvAffine3T &transform)
Set the transformation from body to calibration coordinate system.
bool useMaskAsVignette() const
Gets whether the mask is used as vignette.
void stitch(const std::vector< cv::Mat > &images, const std::vector< ScalarT > &exposure, ScalarT depth, cv::Mat &pano)
Stitches the provided input images into a single panoramic image.
CvAffine3T transform(const CvAffine3T::Mat4 &affine)
Set the transformation using an affine matrix.
void stitch(const std::vector< cv::Mat > &images, cv::Mat &pano)
Stitches the provided input images into a single panoramic image.
CvAffine3T transform() const
Get the current transformation from body to calibration coordinate system.
ScalarT fovY(ScalarT fov)
Set the vertical field of view (FOV) for the panorama.
int height(int height)
Set the output height for the panorama.