PARP Research Group University of Murcia, Spain


src/qvcore/qvcamera.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008, 2009. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #ifndef QVCAMERA_H
00026 #define QVCAMERA_H
00027 
00028 #include <QObject>
00029 #include <QString>
00030 #include <QDebug>
00031 
00032 #include <QVImage>
00033 #include <QVPropertyContainer>
00034 
00045 class QVCamera : public QObject, public QVPropertyContainer
00046 {
00047 #ifndef DOXYGEN_IGNORE_THIS
00048         Q_OBJECT
00049 public:
00050         QVCamera(QString name = QString());
00051         ~QVCamera();
00052 
00053         // Camera status:
00054         typedef enum { Closed, Running, RunningOneStep, Paused } TCameraStatus;
00055 
00057         typedef enum { SeekCurrent = 0, SeekPercentage = 1, SeekAbsolute = 2 } TSeekType;
00058 
00059         virtual bool openCam() = 0;
00060 
00061         // Getter functions:
00062         virtual unsigned int getRows() const = 0;
00063         virtual unsigned int getCols() const = 0;
00064         virtual double getFPS() const = 0;
00065         virtual double getSpeed() const = 0;
00066         virtual const QString getUrlBase() const = 0;
00067         virtual double getTimeLength() const = 0;
00068         virtual double getTimePos() const = 0;
00069         virtual bool isLiveCamera() const = 0;
00070         virtual unsigned int getFramesGrabbed() const = 0;
00071         virtual unsigned int getFramesRead() const = 0;
00072         virtual TCameraStatus getCameraStatus() const { return status; };
00073         virtual bool isClosed() const { return status == Closed; };
00074         virtual bool isRunning() const { return status == Running; };
00075         virtual bool isRunningOneStep() const { return status == RunningOneStep; };
00076         virtual bool isPaused() const { return status == Paused; };
00077 
00078 public slots:
00079         virtual bool grab() = 0;
00080         virtual void pauseCam() = 0;
00081         virtual void unpauseCam() = 0;
00082         virtual void nextFrameCam() = 0;
00083         virtual void setSpeedCam(double d) = 0;
00084         virtual void seekCam(TSeekType type, double pos) = 0;
00085         virtual void closeCam() = 0;
00086 
00087 signals:
00088         void newGrab();
00089         void newRead();
00090         void camClosed();
00091         void camOpened();
00092         void statusChange(QVCamera::TCameraStatus);
00093 
00094 protected:
00095         TCameraStatus status;
00096         void setStatus(TCameraStatus status) 
00097                 { this->status = status; emit statusChange(status); }
00098 
00099 #endif
00100 };
00101 
00102 #endif



QVision framework. PARP research group, copyright 2007, 2008.