EditDepthArea.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef RTABMAP_EDITDEPTHAREA_H
29 #define RTABMAP_EDITDEPTHAREA_H
30 
31 #include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
32 
33 #include <QColor>
34 #include <QImage>
35 #include <QPoint>
36 #include <QWidget>
37 #include <opencv2/opencv.hpp>
38 #include "rtabmap/utilite/UCv2Qt.h"
39 
40 class QMenu;
41 class QAction;
42 
43 namespace rtabmap {
44 
45 class RTABMAP_GUI_EXPORT EditDepthArea : public QWidget
46 {
47  Q_OBJECT
48 
49 public:
50  EditDepthArea(QWidget *parent = 0);
51 
52  void setImage(const cv::Mat & depth, const cv::Mat & rgb = cv::Mat());
53  cv::Mat getModifiedImage() const;
54  bool isModified() const {return modified_;}
55 
56  void setPenWidth(int newWidth);
57  int penWidth() const { return myPenWidth_; }
58  void setClusterError(double error) { clusterError_ = error; }
59  double clusterError() const { return clusterError_; }
60  void setColorMap(uCvQtDepthColorMap type);
61 
62 public Q_SLOTS:
63  void resetChanges();
64 
65 protected:
66  virtual void mousePressEvent(QMouseEvent *event);
67  virtual void mouseMoveEvent(QMouseEvent *event);
68  virtual void mouseReleaseEvent(QMouseEvent *event);
69  virtual void paintEvent(QPaintEvent *event);
70  virtual void resizeEvent(QResizeEvent *event);
71  virtual void contextMenuEvent(QContextMenuEvent * e);
72 
73 private:
74  void drawLineTo(const QPoint &endPoint);
75  void computeScaleOffsets(const QRect & targetRect, float & scale, float & offsetX, float & offsetY) const;
76 
77  bool modified_;
80  double clusterError_;
81  QImage imageRGB_;
82  QImage image_;
83  cv::Mat originalImage_;
84  QPoint lastPoint_;
85 
86  QMenu * menu_;
87  QAction * showRGB_;
88  QAction * removeCluster_;
90  QAction * resetChanges_;
91  QAction * setPenWidth_;
94  QAction * colorMapRedToBlue_;
95  QAction * colorMapBlueToRed_;
96 };
97 
98 }
99 
100 #endif
rtabmap::EditDepthArea::menu_
QMenu * menu_
Definition: EditDepthArea.h:86
rtabmap::EditDepthArea::clusterError
double clusterError() const
Definition: EditDepthArea.h:59
rtabmap::EditDepthArea::penWidth
int penWidth() const
Definition: EditDepthArea.h:57
rtabmap::EditDepthArea::colorMapBlackToWhite_
QAction * colorMapBlackToWhite_
Definition: EditDepthArea.h:93
rtabmap::EditDepthArea::removeCluster_
QAction * removeCluster_
Definition: EditDepthArea.h:88
uCvQtDepthColorMap
uCvQtDepthColorMap
Definition: UCv2Qt.h:30
type
rtabmap::EditDepthArea::lastPoint_
QPoint lastPoint_
Definition: EditDepthArea.h:84
rtabmap::EditDepthArea::showRGB_
QAction * showRGB_
Definition: EditDepthArea.h:87
rtabmap::EditDepthArea::setClusterError
void setClusterError(double error)
Definition: EditDepthArea.h:58
rtabmap::EditDepthArea::originalImage_
cv::Mat originalImage_
Definition: EditDepthArea.h:83
UCv2Qt.h
error
void error(const char *str)
rtabmap::EditDepthArea::colorMapRedToBlue_
QAction * colorMapRedToBlue_
Definition: EditDepthArea.h:94
rtabmap::EditDepthArea::resetChanges_
QAction * resetChanges_
Definition: EditDepthArea.h:90
rtabmap::EditDepthArea::imageRGB_
QImage imageRGB_
Definition: EditDepthArea.h:81
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
rtabmap::EditDepthArea::colorMapBlueToRed_
QAction * colorMapBlueToRed_
Definition: EditDepthArea.h:95
rtabmap::EditDepthArea::clusterError_
double clusterError_
Definition: EditDepthArea.h:80
rtabmap::EditDepthArea::setPenWidth_
QAction * setPenWidth_
Definition: EditDepthArea.h:91
rtabmap::EditDepthArea::clusterErrorCluster_
QAction * clusterErrorCluster_
Definition: EditDepthArea.h:89
rtabmap::EditDepthArea::colorMapWhiteToBlack_
QAction * colorMapWhiteToBlack_
Definition: EditDepthArea.h:92
rtabmap::EditDepthArea::modified_
bool modified_
Definition: EditDepthArea.h:77
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::EditDepthArea::scribbling_
bool scribbling_
Definition: EditDepthArea.h:78
rtabmap::EditDepthArea::image_
QImage image_
Definition: EditDepthArea.h:82
rtabmap::EditDepthArea::myPenWidth_
int myPenWidth_
Definition: EditDepthArea.h:79
rtabmap::EditDepthArea
Definition: EditDepthArea.h:45
rtabmap::EditDepthArea::isModified
bool isModified() const
Definition: EditDepthArea.h:54


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:09