Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e675143114
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (66 sloc) 3.096 kb
/************************************************************************/
/* qt-opencv-multithreaded: */
/* A multithreaded OpenCV application using the Qt framework. */
/* */
/* CaptureThread.h */
/* */
/* Nick D'Ademo <nickdademo@gmail.com> */
/* */
/* Copyright (c) 2011 Nick D'Ademo */
/* */
/* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without restriction, */
/* including without limitation the rights to use, copy, modify, merge, */
/* publish, distribute, sublicense, and/or sell copies of the Software, */
/* and to permit persons to whom the Software is furnished to do so, */
/* subject to the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS */
/* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN */
/* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN */
/* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
/* SOFTWARE. */
/* */
/************************************************************************/
#ifndef CAPTURETHREAD_H
#define CAPTURETHREAD_H
// Qt header files
#include <QThread>
#include <QtGui>
// OpenCV header files
#include "opencv/highgui.h"
class ImageBuffer;
class CaptureThread : public QThread
{
Q_OBJECT
public:
CaptureThread(ImageBuffer *buffer, int deviceNumber);
void disconnectCamera();
void stopCaptureThread();
int getAvgFPS();
bool isCameraConnected();
int getInputSourceWidth();
int getInputSourceHeight();
private:
void updateFPS(int);
ImageBuffer *imageBuffer;
CvCapture *capture;
QTime t;
QMutex stoppedMutex;
int captureTime;
int avgFPS;
QQueue<int> fps;
int sampleNo;
int fpsSum;
volatile bool stopped;
protected:
void run();
};
#endif // CAPTURETHREAD_H
Jump to Line
Something went wrong with that request. Please try again.