ProjectedTextures
Prototype software for spacial augmented reality applications.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Camera Class Referenceabstract

#include <Camera.h>

Inheritance diagram for Camera:
OpenCvCam PsEyeCam

Public Slots

void setViewMatrix (QMatrix4x4 viewMat)
 
virtual void setExposure (int exposure)=0
 
virtual void setGain (int gain)=0
 

Signals

void newFrame ()
 
void newFps (int fps)
 

Public Member Functions

 Camera (QString name, int frameWidth, int frameHeight, int targetFps, int bufferSize, QString calibrationFile)
 
virtual ~Camera (void)
 
void stop ()
 
void stopAndDelete ()
 
QString getName ()
 
Mat getFrameMat (bool grayscale=false)
 
QImage getFrameQImage (bool grayscale=false)
 
bool isConnected ()
 
int getFrameWidth ()
 
int getFrameHeight ()
 
int getFPS ()
 
int getTargetFPS ()
 
QString getCalibrationFile ()
 
QMatrix4x4 getProjMat ()
 
QMatrix4x4 getViewMat ()
 

Protected Member Functions

void run ()
 
virtual void grabFrame ()=0
 
void submitFrame (Mat m, bool mono)
 
void updateFPS (int timeElapsed)
 
QImage matToQImage (const Mat &mat)
 

Protected Attributes

QString name
 
QList< FrameframeBuffer
 
int bufferSize
 
int maxConcurrentReads
 
int frameWidth
 
int frameHeight
 
int targetFps
 
int curFrameIdx
 
QMutex curFrameMutex
 
QMutex stopMutex
 
volatile bool doStop
 
bool connected
 
QString calibrationFile
 
QMatrix4x4 projMat
 
QMatrix4x4 viewMat
 
QTime t
 
int captureTime
 
QQueue< int > fpsQueue
 
int avgFPS
 

Static Protected Attributes

static const int fpsQueueLength = 32
 

Detailed Description

Constructor & Destructor Documentation

Camera::Camera ( QString  name,
int  frameWidth,
int  frameHeight,
int  targetFps,
int  bufferSize,
QString  calibrationFile 
)
Parameters
namedescriptive name of the camera for display
frameWidththe width of a captured frame
frameHeightthe height of a captured frame
targetFpsthe frames per second we would like to have
bufferSizenumber of frames that are buffered
calibrationFilepath to a calibration file in ARToolKitPlus-compatible format
Camera::~Camera ( void  )
virtual

Member Function Documentation

QString Camera::getCalibrationFile ( )
inline

returns the filename of the used calibration file

int Camera::getFPS ( )
inline

returns actual average frames per second

int Camera::getFrameHeight ( )
inline

returns the frame height

Mat Camera::getFrameMat ( bool  grayscale = false)

returns pixel data of the latest non-blocked frame in the buffer

QImage Camera::getFrameQImage ( bool  grayscale = false)

returns pixel data of the latest non-blocked frame in the buffer as QImage

int Camera::getFrameWidth ( )
inline

returns the frame width

QString Camera::getName ( )
inline

returns camera's descriptive name

QMatrix4x4 Camera::getProjMat ( )
inline

get the projection matrix of the camera view

int Camera::getTargetFPS ( )
inline

returns the desired frames per second

QMatrix4x4 Camera::getViewMat ( )
inline

get the view matrix of the camera view

virtual void Camera::grabFrame ( )
protectedpure virtual

process of actually capturing a frame. to be implemented in derived classes.

Implemented in PsEyeCam, and OpenCvCam.

bool Camera::isConnected ( )
inline

is the camera connected and therefore ready to use?

QImage Camera::matToQImage ( const Mat &  mat)
protected

convert an OpenCV Mat to a QImage

void Camera::newFps ( int  fps)
signal

signals that the average fps have been updated

void Camera::newFrame ( )
signal

signals that a new frame is available

void Camera::run ( )
protected

main loop; captures frames and stores them to buffer.

virtual void Camera::setExposure ( int  exposure)
pure virtualslot

set a new camera exposure

virtual void Camera::setGain ( int  gain)
pure virtualslot

set a new camera gain

void Camera::setViewMatrix ( QMatrix4x4  viewMat)
inlineslot

set a new view matrix

void Camera::stop ( )

stop the whole thread

void Camera::stopAndDelete ( )

Camera commits suicide

void Camera::submitFrame ( Mat  m,
bool  mono 
)
protected

stores m in a slot of the framebuffer, that is not used by any thread

void Camera::updateFPS ( int  timeElapsed)
protected

Member Data Documentation

int Camera::avgFPS
protected
int Camera::bufferSize
protected

size of the frameBuffer

QString Camera::calibrationFile
protected

path to calibration file

int Camera::captureTime
protected
bool Camera::connected
protected

is the camera ready to use?

int Camera::curFrameIdx
protected

index of the freshest frame in the buffer

QMutex Camera::curFrameMutex
protected

provides thread safety for the curFrameIdx

volatile bool Camera::doStop
protected

set to true if the thread should stop soon

QQueue<int> Camera::fpsQueue
protected
const int Camera::fpsQueueLength = 32
staticprotected
QList<Frame> Camera::frameBuffer
protected

stores a couple of camera frames. not related to GPU-framebuffers..

int Camera::frameHeight
protected
int Camera::frameWidth
protected
int Camera::maxConcurrentReads
protected

the number of threads that are allowed to read from the buffer at the same time

QString Camera::name
protected

descriptive name of the camera

QMatrix4x4 Camera::projMat
protected

the projection matrix of the camera view (derived from intrinsic camera parameters)

QMutex Camera::stopMutex
protected

provides thread safety for killing the thread

QTime Camera::t
protected
int Camera::targetFps
protected

desired frames per second

QMatrix4x4 Camera::viewMat
protected

the view matrix of the camera view (derived from extrinsic camera parameters)


The documentation for this class was generated from the following files: