00001 #ifndef _QCamAutoAlign_hpp_
00002 #define _QCamAutoAlign_hpp_
00003
00004 #include "QCam.hpp"
00005 #include "ShiftInfo.hpp"
00006 #include <stdio.h>
00007 #include <string>
00008
00009 class QPushButton;
00010 class QCamFindShift;
00011 class ShiftInfo;
00012 class QHistogram;
00013 class QVectorMap;
00014 class QCamSlider;
00015 class QFrameDisplay;
00016 class QHGroupBox;
00017 class QCheckBox;
00018
00022 class QCamAutoAlign : public QCam {
00023 Q_OBJECT;
00024
00025
00026 public:
00027 QCamAutoAlign();
00028 QCamFrame yuvFrame() const;
00029 void setTracker(QCamFindShift * tracker);
00030 virtual const QSize & size() const;
00031 virtual void resize(const QSize &s);
00032 virtual const QSize * getAllowedSize() const { return QCam::getAllowedSize();}
00033 public slots:
00034 void reset();
00035 protected slots:
00036 void shifted(const ShiftInfo & );
00037 private slots:
00038 void setCropValue(int crop) {cropValue_=crop/100.0;}
00039 void setImageCenter(bool center) {center_=center;}
00040 private:
00041 QWidget * buildGUI(QWidget *);
00044 void shiftFrame(const ShiftInfo & shift,
00045 const QCamFrame orig,
00046 QCamFrame & shifted,
00047 float crop,bool center);
00048 bool connectEveryThing();
00049 void unConnectEveryThing();
00050 QCamFindShift * tracker_;
00051 ShiftInfo currentShift_;
00052 QCamFrame yuvFrame_;
00053
00054 QHGroupBox * findShiftWidget_;
00055 QWidget * findShiftCtrl_;
00056 #define ONE_MAP 1
00057 #if ONE_MAP
00058 QVectorMap * shiftMap_;
00059 #else
00060 QHistogram * shiftXhisto_;
00061 QHistogram * shiftYhisto_;
00062 #endif
00063 QCamSlider * scaleSlider_;
00064 QCheckBox * centerButton_;
00065 QCamSlider * cropSlider_;
00066 bool center_;
00067 float cropValue_;
00068 QSize currentSize_;
00069 string fifoName_;
00070 FILE * fifo_;
00071 };
00072 #endif