#include "opencv2/stitching/detail/blenders.hpp"
#include "opencv2/stitching/detail/camera.hpp"
#include "opencv2/stitching/detail/exposure_compensate.hpp"
#include "opencv2/stitching/detail/motion_estimators.hpp"
#include "opencv2/stitching/detail/warpers.hpp"
#include "opencv2/stitching/warpers.hpp"

#ifndef blender_h
#define blender_h

class Blender {
private:
	cv::Mat image_warped, image_warped_temp; // matrices related to original images
	cv::Mat dilated_mask, seam_mask, mask, mask_warped; // matrices related to image masks

	cv::Ptr<cv::detail::Blender> blender;
	cv::Ptr<cv::detail::RotationWarper> warper;

	double compose_work_aspect, compose_scale; // image/camera scales

public:
	Blender(double &work_scale,
		float &warped_image_scale,
		cv::Ptr<cv::WarperCreator> &warper_creator,
		int no_of_videos,
		std::vector<cv::detail::CameraParams> &cameraParameters, // vector stores camera matrices e.g. rotation
		std::vector<cv::Size> &full_image_sizes, // vector stores size of original images/frames
		std::vector<cv::Point> &corners, // vector to store positions of image corners
		std::vector<cv::Size> &sizes); // vector to store image sizes

	int blend(std::vector<cv::Mat> &video_frames, // vector stores video frames
		std::vector<cv::detail::CameraParams> &cameraParameters, // vector stores camera matrices e.g. rotation
		std::vector<cv::Point> &corners, // vector to store positions of image corners
		std::vector<cv::Size> &sizes, // vector to store image sizes
		cv::Ptr<cv::detail::ExposureCompensator> &compensator,
		std::vector<cv::Mat> &masks_warped, // vector to store warped image masks
		int blend_type, // feather or multi-band
		bool try_gpu, // use GPU?
		float blend_strength, // higher value = more blending
		cv::Mat &result, // matrix to store the final panoramic image/frame
		cv::Mat &result_mask); // matrix to store the final image mask
};

#endif
