#ifndef IMAGEPIPELINE_H
#define IMAGEPIPELINE_H

#include <QObject>
#include <vector>

#include <QFutureWatcher>

#include "profile.h"
#include "cameras.h"

class ImagePipeline: public QObject
{
	Q_OBJECT

private:

	Cameras* cameras_;
	Profile profile_;
	bool invalid_ = true;
	std::vector<QFutureWatcher<cv::Mat>*> futureImageWatchers_;
	bool simpleStichingAlg_;

	static cv::Mat process(const Profile profile, std::vector<Camera::Image> images, bool simpleStich);
	static void applyDarkMap(cv::Mat& image, const cv::Mat &darkmap);

private slots:

	void apply(std::vector<Camera::Image> images);
	void imageFinished();

signals:
	void sigInvalidProfile(QString message);
	void sigResult(Camera::Image image);
	void statusMsg(QString msg);

public slots:
	void setProfile(const Profile& profile);

public:
	ImagePipeline(Cameras* cameras, bool simpleStichingAlg = false, QObject* parent = nullptr);
};

#endif // IMAGEPIPELINE_H
