#include <fstream>
#include <iostream>
#include <time.h>
#include <thread>

#include "find_features.h"
#include "feature_matching.h"
#include "homography_estimator.h"
#include "bundle_adjustment.h"
#include "warp_images.h"
#include "seam_compensator.h"
#include "blender.h"
#include "opencv2/opencv_modules.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/stitching/detail/util.hpp"

#ifndef stitching_h
#define stitching_h

void readSettings(); // method to read settings from configuration file
void setValue(std::string category, std::string value); // method to set stitching pipeline settings

void joinAndStitch(int frameNumber, int noOfFrames); // method to wait for threads and output stitched frames to video

int stitch(int argc, char* argv[]); // stitching pipeline

// method to multithread the blending process
void blendThread(std::vector<cv::Mat> frames, // frames to stitch
		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,
		bool try_gpu,
		int blend_strength,
		std::vector<cv::Mat> &results, // vector to store stitched frames
		int begin, // index to results vector on where the thread must start writing frames
		double work_scale,
		float warped_image_scale,
		cv::Ptr<cv::WarperCreator> warper_creator,
		int no_of_videos,
		std::vector<cv::Size> full_image_sizes,
		int width, // width of output video
		int height); // height of output video

#endif
