#include "opencv2/stitching/detail/motion_estimators.hpp"

#ifndef bundle_adjustment_h
#define bundle_adjustment_h

class BundleAdjustment {
private:
	cv::Ptr<cv::detail::BundleAdjusterBase> adjuster;
	cv::Mat_<uchar> refine_mask;
	bool do_wave_correct;
	cv::detail::WaveCorrectKind wave_correct;

public:
	BundleAdjustment(std::string ba_cost_func, // ray or reprojection
		float confidence_threshold, // threshold
		std::string ba_refine_mask, // mask for refinement
		bool do_wave_correct, // perform wave correction?
		cv::detail::WaveCorrectKind wave_correct); // type of wave correction

	int bundle_adjustment(std::vector<cv::detail::ImageFeatures> &features, // vector stores image features
		std::vector<cv::detail::MatchesInfo> &pairwise_matches, // vector stores matches between images
		std::vector<cv::detail::CameraParams> &cameraParameters, // vector stores camera matrices e.g. rotation
		float &warped_image_scale);
};

#endif
