00001 /***************************************************************** 00002 * 00003 * This file is part of the FLIRTLib project 00004 * 00005 * FLIRTLib Copyright (c) 2010 Gian Diego Tipaldi and Kai O. Arras 00006 * 00007 * This software is licensed under the "Creative Commons 00008 * License (Attribution-NonCommercial-ShareAlike 3.0)" 00009 * and is copyrighted by Gian Diego Tipaldi and Kai O. Arras 00010 * 00011 * Further information on this license can be found at: 00012 * http://creativecommons.org/licenses/by-nc-sa/3.0/ 00013 * 00014 * FLIRTLib is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied 00016 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 * PURPOSE. 00018 * 00019 *****************************************************************/ 00020 00021 00022 00023 #ifndef FLIRTDEMO_H_ 00024 #define FLIRTDEMO_H_ 00025 00026 #include <gui/SensorStreamWidget.h> 00027 #include <gui/LaserReadingRenderer.h> 00028 #include <gui/PolarGridRenderer.h> 00029 #include <gui/InterestPointRenderer.h> 00030 #include <gui/RendererWidget.h> 00031 #include <gui/DetectorChooserPresenter.h> 00032 #include <gui/DescriptorChooserPresenter.h> 00033 #include <gui/MultiScaleDetectorPlotWidget.h> 00034 #include <gui/MultiScaleDetectorPresenter.h> 00035 #include <gui/MultiScaleCurvatureDetectorPresenter.h> 00036 #include <gui/MultiScaleNormalDetectorPresenter.h> 00037 #include <gui/ShapeContextPresenter.h> 00038 #include <gui/BetaGridPresenter.h> 00039 #include <gui/ParameterWidget.h> 00040 #include <gui/TabbedParameterWidget.h> 00041 #include <gui/SimplePeakFinderPresenter.h> 00042 #include <feature/Detector.h> 00043 #include <feature/ShapeContext.h> 00044 #include <feature/BetaGrid.h> 00045 #include <feature/RangeDetector.h> 00046 #include <feature/CurvatureDetector.h> 00047 #include <feature/NormalBlobDetector.h> 00048 #include <feature/NormalEdgeDetector.h> 00049 #include <sensorstream/CarmenLog.h> 00050 #include <sensorstream/LogSensorStream.h> 00051 #include <sensorstream/SensorStream.h> 00052 #include <utils/SimpleMinMaxPeakFinder.h> 00053 00054 #include <QtGui/QApplication> 00055 #include <QtGui/QGridLayout> 00056 #include <QtGui/QVBoxLayout> 00057 #include <QtGui/QTabWidget> 00058 #include <QtGui/QScrollArea> 00059 00060 #include <string> 00061 #include <iostream> 00062 00063 inline Color toColor(const QColor& _color) { return Color(_color.redF(), _color.greenF(), _color.blueF(), _color.alphaF());} 00064 00065 class FLIRTDemo: public QWidget { 00066 Q_OBJECT 00067 public: 00068 FLIRTDemo(QWidget* parent, SensorStream& sensor); 00069 00070 virtual ~FLIRTDemo(); 00071 00072 SensorStreamWidget *m_sensorWidget; 00073 RendererWidget *m_rendererWidget; 00074 RendererWidget *m_descriptorRendererWidget; 00075 LaserReadingRenderer* m_laserRenderer; 00076 LaserReadingRenderer* m_supportRenderer; 00077 00078 RangeDetector* m_detectorR; 00079 CurvatureDetector* m_detectorC; 00080 NormalBlobDetector* m_detectorNB; 00081 NormalEdgeDetector* m_detectorNE; 00082 MultiScaleDetectorPresenter* m_detectorPresenterR; 00083 MultiScaleCurvatureDetectorPresenter* m_detectorPresenterC; 00084 MultiScaleNormalDetectorPresenter* m_detectorPresenterNB; 00085 MultiScaleNormalDetectorPresenter* m_detectorPresenterNE; 00086 00087 QWidget* m_chooserW; 00088 DetectorChooserPresenter* m_chooser; 00089 DescriptorChooserPresenter* m_chooserD; 00090 00091 SimpleMinMaxPeakFinder* m_peakMR; 00092 SimplePeakFinder* m_peakR; 00093 SimplePeakFinderPresenter* m_peakMRPresenter; 00094 SimplePeakFinderPresenter* m_peakRPresenter; 00095 00096 SimpleMinMaxPeakFinder* m_peakMNE; 00097 SimplePeakFinder* m_peakNE; 00098 SimplePeakFinderPresenter* m_peakMNEPresenter; 00099 SimplePeakFinderPresenter* m_peakNEPresenter; 00100 00101 SimpleMinMaxPeakFinder* m_peakMNB; 00102 SimplePeakFinder* m_peakNB; 00103 SimplePeakFinderPresenter* m_peakMNBPresenter; 00104 SimplePeakFinderPresenter* m_peakNBPresenter; 00105 00106 SimplePeakFinder* m_peakC; 00107 SimplePeakFinderPresenter* m_peakCPresenter; 00108 00109 InterestPointRenderer* m_interestRenderer; 00110 PolarGridRenderer* m_polarRenderer; 00111 00112 ShapeContextGenerator *m_descriptorGeneratorS; 00113 ShapeContextPresenter *m_descriptorPresenterS; 00114 00115 BetaGridGenerator *m_descriptorGeneratorB; 00116 BetaGridPresenter *m_descriptorPresenterB; 00117 00118 QGridLayout *m_layout; 00119 QGridLayout *m_paramLayout; 00120 MultiScaleDetectorPlotWidget * m_plotWidget; 00121 SensorStream& m_sensor; 00122 QTabWidget* m_parameter; 00123 // QScrollArea *m_parameterScroll; 00124 00125 std::vector<InterestPoint *> m_points; 00126 std::vector<const OrientedPoint2D *> m_interestPoints; 00127 InterestPoint * m_currentPoint; 00128 std::vector<double> m_scales; 00129 std::vector<Color> m_colors; 00130 const LaserReading *m_reading; 00131 00132 public slots: 00133 virtual void next(); 00134 00135 virtual void next(int pos); 00136 00137 virtual void update(); 00138 00139 virtual void updateDescriptor(); 00140 00141 virtual void mousePressedGL(int button, int x, int y); 00142 00143 protected: 00144 void processReading(const AbstractReading* _read); 00145 void drawDescriptor(); 00146 }; 00147 00148 #endif