www.pudn.com > snake_vc++.rar > QtCvWrapper.h
#pragma once // Qt includes #include// forwared declarations class MainProgram; class MainWindow; class Snake; class QImage; class QPoint; // OpenCV includes #ifdef _CH_ #pragma package #endif #ifndef _EiC #include "cv.h" #include "highgui.h" #endif //! The QtCvWrapper implements a wrapper between Qt GUI and OpenCV framework /*! * The QtCvWrapper implements some connections between the Qt GUI and the Intel OpenCV * library. Also signal and slot connections from Qt to the non-Qt part are handeled * here. Most of the functions from the Snake class are initiated from this wrapper * when certain signals comming from the GUI. * * \param parent represents the connection to the Image-Processing part * \param gui holds the pointer to the GUI * */ class QtCvWrapper : public QObject { Q_OBJECT; public: //! constructs the wrapper between Qt and OpenCV QtCvWrapper(MainProgram* parent, MainWindow* gui); //! destructor ~QtCvWrapper(void); //! indicates if the iteration is schown or not inline bool iterate(){return m_iterate;}; //! indicates if the iteration is schown or not inline bool step(){return m_step;}; public slots: //! slot is called when a new image is opened to synchronize the IplImage void slotImageOpened(); //! when the snake buttin is hit the algorithm should start void slotSnakeButtonPressed(); //! just does a small demo with a simple ellipse in the image void slotTest(); //! does initialisation of the initial snake void slotInitCurve(); //! iteration visualisation is turned on void slotIterationOn(); //! iteration visualisation is turned off void slotIterationOff(); //! iteration visualisation is turned on with user interaction void slotIterationStep(); private: //! a simple test image with an ellipse is created void createTestImage(CvPoint center, CvSize axes, CvScalar color, CvScalar background); //! converts an ipl image to a qimage (hopefully) void convertImage(IplImage* src, QImage* dst); //! creates an ellipse with the initialized upper left and lower right boundingbox vertices CvPoint* createEllipse(QPoint ulPt, QPoint lrPt, int numSegments); MainProgram* m_parent; //! parent that created the wrapper MainWindow* m_gui; //! pointer to the actual gui Snake* m_snake; //! m_snake is used for applying the snake algorithm to m_iplImg IplImage* m_iplImg; //! the actual shown and processed image bool m_iterate; //! switches iterations on/off bool m_step; //! does stepwise iterations };