mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
Updated ImageView with GraphicsView mode disabled by default. Updated DataRecorder.
This commit is contained in:
@@ -34,6 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QWidget>
|
||||
#include <rtabmap/core/SensorData.h>
|
||||
#include <rtabmap/utilite/UTimer.h>
|
||||
#include <rtabmap/utilite/UMutex.h>
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
@@ -55,17 +58,21 @@ public:
|
||||
|
||||
public slots:
|
||||
void addData(const rtabmap::SensorData & data);
|
||||
void showImage(const rtabmap::SensorData & data);
|
||||
void showImage(const cv::Mat & image, const cv::Mat & depth);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
void handleEvent(UEvent * event);
|
||||
|
||||
private:
|
||||
UMutex memoryMutex_;
|
||||
Memory * memory_;
|
||||
ImageView* imageView_;
|
||||
QLabel* label_;
|
||||
UTimer timer_;
|
||||
int dataQueue_;
|
||||
QString path_;
|
||||
bool processingImages_;
|
||||
int count_;
|
||||
int totalSizeKB_;
|
||||
};
|
||||
|
||||
} /* namespace rtabmap */
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace rtabmap {
|
||||
|
||||
class KeypointItem;
|
||||
|
||||
class RTABMAPGUI_EXP ImageView : public QGraphicsView {
|
||||
class RTABMAPGUI_EXP ImageView : public QWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
@@ -55,48 +55,57 @@ public:
|
||||
void saveSettings(QSettings & settings, const QString & group = "") const;
|
||||
void loadSettings(QSettings & settings, const QString & group = "");
|
||||
|
||||
void resetZoom();
|
||||
|
||||
bool isImageShown() const;
|
||||
bool isImageDepthShown() const;
|
||||
bool isFeaturesShown() const;
|
||||
bool isLinesShown() const;
|
||||
int getAlpha() const {return _alpha;}
|
||||
bool isGraphicsViewMode() const;
|
||||
bool isGraphicsViewScaled() const;
|
||||
|
||||
float viewScale() const;
|
||||
|
||||
void setFeaturesShown(bool shown);
|
||||
void setImageShown(bool shown);
|
||||
void setImageDepthShown(bool shown);
|
||||
void setLinesShown(bool shown);
|
||||
void setGraphicsViewMode(bool on);
|
||||
void setGraphicsViewScaled(bool scaled);
|
||||
void setBackgroundColor(const QColor & color);
|
||||
|
||||
void setFeatures(const std::multimap<int, cv::KeyPoint> & refWords, const QColor & color = QColor(255, 255, 0, 70));
|
||||
void setFeatures(const std::vector<cv::KeyPoint> & features, const QColor & color = QColor(255, 255, 0, 70));
|
||||
void setFeatures(const std::multimap<int, cv::KeyPoint> & refWords, const QColor & color = Qt::yellow);
|
||||
void setFeatures(const std::vector<cv::KeyPoint> & features, const QColor & color = Qt::yellow);
|
||||
void addFeature(int id, const cv::KeyPoint & kpt, QColor color);
|
||||
void addLine(float x1, float y1, float x2, float y2, QColor color);
|
||||
void setImage(const QImage & image);
|
||||
void setImageDepth(const QImage & image);
|
||||
void setFeatureColor(int id, const QColor & color);
|
||||
void setFeaturesColor(const QColor & color);
|
||||
void setFeatureColor(int id, QColor color);
|
||||
void setFeaturesColor(QColor color);
|
||||
void setAlpha(int alpha);
|
||||
void setSceneRect(const QRectF & rect);
|
||||
|
||||
const QMultiMap<int, rtabmap::KeypointItem *> & getFeatures() const {return _features;}
|
||||
|
||||
void clearLines();
|
||||
void clear();
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
signals:
|
||||
void configChanged();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent * e);
|
||||
virtual void wheelEvent(QWheelEvent * e);
|
||||
|
||||
private slots:
|
||||
void updateZoom();
|
||||
|
||||
private:
|
||||
void updateOpacity();
|
||||
void computeScaleOffsets(float & scale, float & offsetX, float & offsetY) const;
|
||||
void drawFeatures(QPainter * painter);
|
||||
void drawLines(QPainter * painter);
|
||||
|
||||
private:
|
||||
int _zoom;
|
||||
int _minZoom;
|
||||
QString _savedFileName;
|
||||
int _alpha;
|
||||
|
||||
@@ -107,10 +116,16 @@ private:
|
||||
QAction * _showLines;
|
||||
QAction * _saveImage;
|
||||
QAction * _setAlpha;
|
||||
QAction * _graphicsViewMode;
|
||||
QAction * _graphicsViewScaled;
|
||||
|
||||
QGraphicsView * _graphicsView;
|
||||
QMultiMap<int, rtabmap::KeypointItem *> _features;
|
||||
QGraphicsPixmapItem * _image;
|
||||
QGraphicsPixmapItem * _imageDepth;
|
||||
QList<QGraphicsLineItem*> _lines;
|
||||
QGraphicsPixmapItem * _imageItem;
|
||||
QGraphicsPixmapItem * _imageDepthItem;
|
||||
QPixmap _image;
|
||||
QPixmap _imageDepth;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -34,13 +34,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QtGui/QPen>
|
||||
#include <QtGui/QBrush>
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
class RTABMAPGUI_EXP KeypointItem : public QGraphicsEllipseItem
|
||||
{
|
||||
public:
|
||||
KeypointItem(qreal x, qreal y, int r, const QString & info, const QColor & color = Qt::green, QGraphicsItem * parent = 0);
|
||||
KeypointItem(int id, const cv::KeyPoint & kpt, const QColor & color = Qt::green, QGraphicsItem * parent = 0);
|
||||
virtual ~KeypointItem();
|
||||
|
||||
void setColor(const QColor & color);
|
||||
@@ -56,7 +57,8 @@ private:
|
||||
void hideDescription();
|
||||
|
||||
private:
|
||||
QString _info;
|
||||
int _id;
|
||||
cv::KeyPoint _kpt;
|
||||
QGraphicsRectItem * _placeHolder;
|
||||
int _width;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user