forked from AntonioRedondo/ImageFeatureDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindowImage.h
More file actions
75 lines (66 loc) · 2.09 KB
/
windowImage.h
File metadata and controls
75 lines (66 loc) · 2.09 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
/*
* 2010-2015 (C) Antonio Redondo
* http://antonioredondo.com
* https://github.com/AntonioRedondo/ImageFeatureDetector
*
* Code under the terms of the GNU General Public License v3.
*
*/
#ifndef WINDOWIMAGE_H
#define WINDOWIMAGE_H
#include <QtWidgets>
#include <opencv2/opencv.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/xfeatures2d/nonfree.hpp>
#include "ui_windowImage.h"
using namespace std;
using namespace cv;
using namespace xfeatures2d;
class WindowImage : public QScrollArea, Ui::windowImage {
Q_OBJECT
public:
WindowImage(QImage* image, QString windowTitle, int windowType=normal);
void zoomIn();
void zoomOut();
void zoomOriginal();
void zoomBestFit();
void resetImage();
void applyHarris(int sobelApertureSize, int harrisApertureSize, double kValue, int threshold, bool showProcessedImage);
void applyFast(int threshold, bool nonMaxSuppression);
void applySift(double threshold, double edgeThreshold, int nOctaves, int nOctaveLayers, bool showOrientation);
void applySurf(double threshold, int nOctaves, int nOctaveLayers, bool showOrientation);
enum windowType {normal=0, duplicated=1, fromWebcam=2, do4=3};
enum featureType {none=0, harris=1, fast=2, sift=3, surf=4};
QImage* mImage;
QPixmap mPixmap;
QString mImageZoom;
QString mImageTime;
QString mImageKeypoints;
QString mImageDimensions;
QString mImageSize;
QString mWindowTitle;
QString mUid;
QString mOriginalUid;
int mWindowType, mFeatureType, mImageN;
float mCurrentFactor;
protected:
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
private:
void showProcessedImage(Mat processedImage);
void scaleImage();
void scrollImage(QPoint* pos);
void adjustScrollBar(QScrollBar* scrollBar);
QImage convertMat2QImage(const cv::Mat_<double> &src);
QPixmap mPixmapOriginal;
QSize mOriginalSize;
QPoint mLastPoint;
QLocale* mLocale;
QPainter* mPainter;
bool mModified;
int mOriginalWidth, mOiginalHeight;
float mScaleFactorAbove100, mScaleFactorUnder100, mFactorIncrement;
};
#endif