image_cropper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, Dirk Thomas, TU Darmstadt
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
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  * * Neither the name of the TU Darmstadt nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef rqt_image_Enhancer__ImageCropper_H
34 #define rqt_image_Enhancer__ImageCropper_H
35 
36 #include <rqt_gui_cpp/plugin.h>
37 
38 #include <ui_image_cropper.h>
39 
41 #include <sensor_msgs/Image.h>
42 
43 #include <opencv2/core/core.hpp>
44 
45 #include <QImage>
46 #include <QList>
47 #include <QMutex>
48 #include <QString>
49 #include <QSize>
50 #include <QWidget>
51 
52 #include <vector>
53 
54 namespace rqt_image_cropping {
55 
57  : public rqt_gui_cpp::Plugin
58 {
59 
60  Q_OBJECT
61 
62 public:
63 
64  ImageCropper();
65 
66  virtual void initPlugin(qt_gui_cpp::PluginContext& context);
67 
68  virtual bool eventFilter(QObject* watched, QEvent* event);
69 
70  virtual void shutdownPlugin();
71 
72  virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const;
73 
74  virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings);
75 
76 protected slots:
77 
78  virtual void updateTopicList();
79 
80 protected:
81 
82  virtual QList<QString> getTopicList(const QSet<QString>& message_types, const QList<QString>& transports);
83 
84  virtual void selectTopic(const QString& topic);
85 
86 protected slots:
87 
88  virtual void onInTopicChanged(int index);
89 
90  virtual void onOutTopicChanged();
91 
92 // virtual void onZoom1(bool checked);
93 
94  virtual void onDynamicRange(bool checked);
95 
96  virtual void onSelectionInProgress(QPoint p1, QPoint p2);
97 
98  virtual void onSelectionFinished(QPoint p1, QPoint p2);
99 
100  virtual void onRemoveSelection();
101 
102 protected:
103 
104  virtual void callbackImage(const sensor_msgs::Image::ConstPtr& msg, const sensor_msgs::CameraInfoConstPtr &ci);
105 
106  virtual void publishCrop();
107 
108  virtual void enforceSelectionConstraints(QPoint & p);
109 
110  Ui::ImageCropperWidget ui_;
111 
112  QWidget* widget_;
113 
116 
117  sensor_msgs::Image::ConstPtr sens_msg_image_;
118  sensor_msgs::CameraInfoConstPtr camera_info_;
119 
122 
123  QImage qimage_;
126 
128 
129  QRectF selection_;
130 
135 
136  bool selected_;
137 
138 };
139 
140 }
141 
142 #endif // rqt_image_enhancer__ImageCropper_H
sensor_msgs::Image::ConstPtr sens_msg_image_
image_transport::CameraSubscriber subscriber_
virtual void selectTopic(const QString &topic)
virtual void onInTopicChanged(int index)
virtual void onDynamicRange(bool checked)
virtual QList< QString > getTopicList(const QSet< QString > &message_types, const QList< QString > &transports)
virtual bool eventFilter(QObject *watched, QEvent *event)
virtual void onSelectionFinished(QPoint p1, QPoint p2)
virtual void callbackImage(const sensor_msgs::Image::ConstPtr &msg, const sensor_msgs::CameraInfoConstPtr &ci)
image_transport::CameraPublisher publisher_
virtual void onSelectionInProgress(QPoint p1, QPoint p2)
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
virtual void saveSettings(qt_gui_cpp::Settings &plugin_settings, qt_gui_cpp::Settings &instance_settings) const
Ui::ImageCropperWidget ui_
virtual void restoreSettings(const qt_gui_cpp::Settings &plugin_settings, const qt_gui_cpp::Settings &instance_settings)
sensor_msgs::CameraInfoConstPtr camera_info_
virtual void enforceSelectionConstraints(QPoint &p)


hector_rqt_plugins
Author(s): Dirk Thomas, Thorsten Graber, Gregor Gebhardt
autogenerated on Mon Jun 10 2019 13:36:34