-
Notifications
You must be signed in to change notification settings - Fork 0
/
imgedit.h
64 lines (53 loc) · 1.98 KB
/
imgedit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef IMGEDIT_H
#define IMGEDIT_H
#include <QObject>
#include <QDebug>
#include <QThread>
#include <QtDebug>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/types_c.h>
#include<opencv2/photo.hpp>
#include<opencv2/xphoto.hpp>
#include <chrono>
using namespace std;
using namespace cv;
class ImgEdit : public QObject
{
Q_OBJECT
public:
explicit ImgEdit(QObject *parent = nullptr);
//update Functions MUST clear imRedo and call pushUndo with currect Mat
cv::Mat getMat() const; //ONLY use this to get Mats
void openMat(string &filename);
void redo();//call when triggered in ui
void undo();//call when triggered in ui
void greyScale();
void flipMat(int fp, bool tp);/**fp (flip) =1, 0,-1.
tp(transponse) true or false
flip vert = 0,false
horrizontal = 1,false
90 = 1,true. 90ac=0,true. 180 =-1,0
**/
void cartoonise();
void oilPainting();
void invert();
void whiteBal(string mode);
void contBright(double contrast, int brightness);
void HLS(int hue, int light, int sat );
signals:
private:
cv::Mat mImg;//image to work with
vector<cv::Mat> imUndo;//stores previous mats
vector<cv::Mat> imRedo;//stores mats that are undone, should be cleared when an update is called
void setCurrMat(cv::Mat im); //all functions should use this to set current working Mat (imMat)
bool ifGrey(Mat *im);
void toColour(Mat &src, Mat &dst);
const int imMax = 100;//to add limit to amount of images to be saved
bool compMat(const Mat & a, const Mat & b);
void pushUndo(Mat inMat);//call everytime an update to mMat is complete so it is stored,
void popUndo();//call when undo is called to get last image, the current image should be added to another vector (pushRedo)
void pushRedo(Mat inMat);//call when popUndo is to add undone images to redo
void popRedo();//call when redo is called, call pushUndo to add it to to the undo stack
};
#endif // IMGEDIT_H