00001 /* 00002 * VisionGUI.qt.H 00003 * 00004 */ 00005 00006 #include <QtGui/QMainWindow> 00007 #include <QtGui/QImage> 00008 #include <QtCore/QString> 00009 #include <QtGui/QFileDialog> 00010 #include "Robots/BeoHawk/gui/ui_VisionGUI.qt.H" 00011 00012 #include "Component/ModelManager.H" 00013 #include "Component/OptionManager.H" 00014 #include "Component/ModelComponent.H" 00015 #include "Component/ModelParam.H" 00016 00017 #include "Robots/BeoHawk/vision/VisionBrainComponentI.H" 00018 #include "Image/Image.H" 00019 #include "Image/Pixels.H" 00020 00021 #include "Ice/RobotBrainObjects.ice.H" 00022 #include "Ice/RobotSimEvents.ice.H" 00023 #include "Ice/IceImageUtils.H" 00024 00025 #include <IceUtil/Thread.h> 00026 00027 #ifndef VISIONGUI_H_ 00028 #define VISIONGUI_H_ 00029 00030 class VisionGUI : public QMainWindow, public VisionBrainComponentI{ 00031 00032 Q_OBJECT 00033 00034 public: 00035 VisionGUI(OptionManager &mgr, 00036 const std::string &descrName = "VisionGUI", 00037 const std::string &tagName = "VisionGUI"); 00038 virtual ~VisionGUI(); 00039 00040 virtual void registerTopics(); 00041 virtual void updateFrame(Image<PixRGB<byte> > img, bool isFwdCamera); 00042 00043 signals: 00044 void imageReady(); 00045 00046 public slots: 00047 void updateImageLabel() { 00048 ui.imageLabel->setPixmap(QPixmap::fromImage(curImage)); 00049 } 00050 00051 void saveImage() { 00052 QString filename = QFileDialog::getSaveFileName(this, "Save Frame as...", "", 00053 "Images (*.png, *.jpg, *.bmp)"); 00054 curImage.save(filename); 00055 } 00056 00057 00058 private: 00059 Image<PixRGB<byte> > cleanImage; 00060 QImage curImage; 00061 Ui::VisionGUI ui; 00062 00063 }; 00064 00065 #endif /* VISIONGUI_H_ */