28 #ifndef RTABMAP_IMAGEVIEW_H_
29 #define RTABMAP_IMAGEVIEW_H_
31 #include "rtabmap/gui/rtabmap_gui_export.h"
33 #include <QGraphicsView>
34 #include <QtCore/QRectF>
35 #include <QtCore/QMultiMap>
36 #include <QtCore/QSettings>
37 #include <opencv2/features2d/features2d.hpp>
49 class RTABMAP_GUI_EXPORT
ImageView :
public QWidget {
57 void saveSettings(QSettings & settings,
const QString & group =
"")
const;
58 void loadSettings(QSettings & settings,
const QString & group =
"");
60 QRectF sceneRect()
const;
61 bool isImageShown()
const;
62 bool isImageDepthShown()
const;
63 bool isFeaturesShown()
const;
64 bool isLinesShown()
const;
68 bool isGraphicsViewMode()
const;
69 bool isGraphicsViewScaled()
const;
70 bool isGraphicsViewScaledToHeight()
const;
71 const QColor & getDefaultBackgroundColor()
const;
72 const QColor & getDefaultFeatureColor()
const;
73 const QColor & getDefaultMatchingFeatureColor()
const;
74 const QColor & getDefaultMatchingLineColor()
const;
75 const QColor & getBackgroundColor()
const;
76 float getDepthColorMapMinRange()
const;
77 float getDepthColorMapMaxRange()
const;
80 float viewScale()
const;
82 void setFeaturesShown(
bool shown);
83 void setImageShown(
bool shown);
84 void setImageDepthShown(
bool shown);
85 void setLinesShown(
bool shown);
86 void setGraphicsViewMode(
bool on);
87 void setGraphicsViewScaled(
bool scaled);
88 void setGraphicsViewScaledToHeight(
bool scaled);
89 void setDefaultBackgroundColor(
const QColor & color);
90 void setDefaultFeatureColor(
const QColor & color);
91 void setDefaultMatchingFeatureColor(
const QColor & color);
92 void setDefaultMatchingLineColor(
const QColor & color);
93 void setBackgroundColor(
const QColor & color);
94 void setDepthColorMapRange(
float min,
float max);
96 void setFeatures(
const std::multimap<int, cv::KeyPoint> & refWords,
const cv::Mat & depth = cv::Mat(),
const QColor & color = Qt::yellow);
97 void setFeatures(
const std::vector<cv::KeyPoint> & features,
const cv::Mat & depth = cv::Mat(),
const QColor & color = Qt::yellow);
98 void addFeature(
int id,
const cv::KeyPoint & kpt,
float depth, QColor color);
99 void addLine(
float x1,
float y1,
float x2,
float y2, QColor color,
const QString & text = QString());
100 void setImage(
const QImage & image,
const std::vector<CameraModel> & models = std::vector<CameraModel>(),
const Transform & pose =
Transform());
101 void setImageDepth(
const cv::Mat & imageDepth);
102 void setImageDepth(
const QImage & image);
103 void setFeatureColor(
int id, QColor color);
104 void setFeaturesColor(QColor color);
105 void setAlpha(
int alpha);
106 void setFeaturesSize(
int size);
107 void setLinesWidth(
int width);
108 void setSceneRect(
const QRectF & rect);
110 const QMultiMap<int, rtabmap::KeypointItem *> &
getFeatures()
const {
return _features;}
113 void clearFeatures();
116 virtual QSize sizeHint()
const;
119 void configChanged();
122 virtual void paintEvent(QPaintEvent *event);
123 virtual void resizeEvent(QResizeEvent* event);
124 virtual void contextMenuEvent(QContextMenuEvent *
e);
125 virtual void mouseMoveEvent(QMouseEvent * event);
128 void sceneRectChanged(
const QRectF &rect);
131 void updateOpacity();
132 void computeScaleOffsets(
const QRect & targetRect,
float & scale,
float & offsetX,
float & offsetY)
const;