ImageStitcher.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef IMAGESTITCHER_H
  2. #define IMAGESTITCHER_H
  3. #include <QObject>
  4. #include <QImage>
  5. #include <opencv2/core/core.hpp>
  6. #include <opencv2/highgui/highgui.hpp>
  7. #include <opencv2/calib3d.hpp>
  8. #include <opencv2/stitching.hpp>
  9. #include <opencv2/xfeatures2d.hpp>
  10. #include <opencv2/features2d/features2d.hpp>
  11. #include <opencv2/xfeatures2d/nonfree.hpp>
  12. #include <main.h>
  13. class param;
  14. using namespace std;
  15. using namespace cv;
  16. int curl_upload(const QString filename);
  17. class ImageStitcher : public QObject
  18. {
  19. Q_OBJECT
  20. Q_PROPERTY(QStringList p_list READ p_listGet WRITE p_listSet NOTIFY p_listChanged ) //图片路径
  21. signals:
  22. void stitchSuccess(QString result_path);
  23. void stitchFailed();
  24. void pathChanged(QStringList imagepath);
  25. void process(QString log_info);
  26. void p_listChanged();
  27. public:
  28. ImageStitcher();
  29. void optimizeSeam(cv::Mat leftImage, cv::Mat leftImageTransform, cv::Mat rightImageTransform, cv::Mat &dstImage, std::vector<cv::Point2f> sceneCorners);
  30. int stitch_default();
  31. Q_INVOKABLE void stitch_thread();
  32. QStringList p_listGet() const
  33. {
  34. return param::ptlist;
  35. }
  36. void p_listSet(QStringList n_list)
  37. {
  38. param::ptlist = n_list;
  39. emit p_listChanged();
  40. }
  41. void merge_pic(vector<Mat>& images);
  42. private:
  43. QString m_resultPath;
  44. QStringList m_imagepath;
  45. QFuture<int> future_stitch;
  46. };
  47. #endif // IMAGESTITCHER_H