CAVAPA-GUI  30.5.2014
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Slots | Public Member Functions | Protected Member Functions | List of all members
cavapa_gui::SourceScene Class Reference

SourceScene draws a video stream and configures camera parameters. More...

#include <sourcescene.h>

Inheritance diagram for cavapa_gui::SourceScene:

Public Slots

void setCameraXRot (float value)
 Sets the camera rotation around X axis. More...
 
void setCameraYRot (float value)
 Sets the camera rotation around Y axis. More...
 
void setCameraZRot (float value)
 Sets the camera rotation around Z axis. More...
 
void setCameraHeight (float value)
 Sets the camera height. More...
 
void setCameraFov (float value)
 Sets the camera field of view. More...
 
void setDrawGridEnabled (bool enabled)
 Sets if the grid should be drawn. More...
 
void setDrawCalibrationPointsEnabled (bool enabled)
 Sets if the calibration points should be drawn. More...
 

Public Member Functions

 SourceScene (QWidget *parent=0)
 Constructs a new SourceScene having the specified parent widget. More...
 
float getCameraXRot ()
 Returns the camera rotation around X axis. More...
 
float getCameraYRot ()
 Returns the camera rotation around Y axis. More...
 
float getCameraZRot ()
 Returns the camera rotation around Z axis. More...
 
float getCameraHeight ()
 Returns the camera height. More...
 
float getCameraFov ()
 Sets the field of view of the camera. More...
 
QVector3D getCameraLookDirection ()
 Gets the camera look direction. More...
 
QVector3D getCameraPosition ()
 Gets the camera position. More...
 
cavapa::camera getCameraSettings ()
 Gets the camera settings. More...
 
void setCameraSettings (cavapa::camera settings)
 Sets camera settings. More...
 
CalibrationPoints getCalibrationPoints ()
 Gets the calibration points. More...
 
void addCalibrationlPoint (QPointF point)
 Adds a new calibration point. More...
 
void setAddCalibrationPointsEnabled (bool enabled)
 Sets if adding calibration points should be possible. More...
 
void updateImage (const cv::Mat &image)
 Updates the background image. More...
 

Protected Member Functions

void mouseReleaseEvent (QMouseEvent *e)
 Reacts to a mouse release event: If right mouse button was released, display a context menu that has the actions for managing the calibration points. More...
 
void mousePressEvent (QMouseEvent *e)
 Reacts to a mouse press event by highlighting the closest calibration point. More...
 
void timerEvent (QTimerEvent *e)
 The timer event. More...
 
void initializeGL ()
 Initializes the OpenGL scene.
 
void resizeGL (int w, int h)
 Resizes the GL viewport. More...
 
void drawBackgroundImage ()
 Draws the background image.
 
void drawGrid ()
 Draws the grid.
 
void drawCalibrationPoints (QPainter &painter)
 Draws the calibration points.
 
void paintGL ()
 Paints the GL scene.
 
void initShaders ()
 Initializes the shaders.
 
void setGlViewport ()
 Sets the GL viewport.
 
void calculateViewPort ()
 Calculates the viewport maintaining the video aspect ratio.
 
QPointF getRelativeVideoPosition (QPoint widgetPoint)
 Calculates the relative position of a point in the video. More...
 

Detailed Description

SourceScene draws a video stream and configures camera parameters.

Draws an image that can be changed to display a video. A grid that represents how the ground would look with the current camera parameters is drawn on top of the image. The camera parameters can be modified and retrieved.

It's also possible to add calibration points to the widget through the right click menu. The calibration points are ment for a situation where there are multiple cameras filming the same situation from different angles. The calibration points can be used to mark where the same spot exists in both cameras. One calibration point can be highlighted by left clicking to help differentiate points that might be close to each other.

Author
Oskari Leppäaho

Constructor & Destructor Documentation

cavapa_gui::SourceScene::SourceScene ( QWidget *  parent = 0)
explicit

Constructs a new SourceScene having the specified parent widget.

Parameters
parentThe parent widget.

Member Function Documentation

void cavapa_gui::SourceScene::addCalibrationlPoint ( QPointF  point)
inline

Adds a new calibration point.

Parameters
pointThe new point. The point should be in relative coordinates, i.e. x and y coordinates range from 0 to 1.
CalibrationPoints cavapa_gui::SourceScene::getCalibrationPoints ( )
inline

Gets the calibration points.

Returns
The the calibration points.
float cavapa_gui::SourceScene::getCameraFov ( )
inline

Sets the field of view of the camera.

Returns
The field of view of the camera.
float cavapa_gui::SourceScene::getCameraHeight ( )
inline

Returns the camera height.

Returns
The camera height.
QVector3D cavapa_gui::SourceScene::getCameraLookDirection ( )

Gets the camera look direction.

Returns
A unit vector that defines the direction the camera is pointing to.
QVector3D cavapa_gui::SourceScene::getCameraPosition ( )

Gets the camera position.

Returns
The camera position as 3D vector.
cavapa::camera cavapa_gui::SourceScene::getCameraSettings ( )

Gets the camera settings.

Returns
The camera settings.
float cavapa_gui::SourceScene::getCameraXRot ( )
inline

Returns the camera rotation around X axis.

Returns
The camera X rotation.
float cavapa_gui::SourceScene::getCameraYRot ( )
inline

Returns the camera rotation around Y axis.

Returns
The camera Y rotation.
float cavapa_gui::SourceScene::getCameraZRot ( )
inline

Returns the camera rotation around Z axis.

Returns
The camera Z rotation.
QPointF cavapa_gui::SourceScene::getRelativeVideoPosition ( QPoint  widgetPoint)
inlineprotected

Calculates the relative position of a point in the video.

Parameters
widgetPointThe point which position to calculate.
Returns
A corresponding point with coordinates in range from 0 to 1.
void cavapa_gui::SourceScene::mousePressEvent ( QMouseEvent *  e)
protected

Reacts to a mouse press event by highlighting the closest calibration point.

Parameters
eThe QMouseEvent.
void cavapa_gui::SourceScene::mouseReleaseEvent ( QMouseEvent *  e)
protected

Reacts to a mouse release event: If right mouse button was released, display a context menu that has the actions for managing the calibration points.

Parameters
*eThe QMouseEvent.
void cavapa_gui::SourceScene::resizeGL ( int  w,
int  h 
)
protected

Resizes the GL viewport.

Parameters
wThe new viewport width.
hThe new viewport height.
void cavapa_gui::SourceScene::setAddCalibrationPointsEnabled ( bool  enabled)
inline

Sets if adding calibration points should be possible.

Parameters
enabledSpecifies if adding calibration points should be possible.
void cavapa_gui::SourceScene::setCameraFov ( float  value)
slot

Sets the camera field of view.

Parameters
valueThe new field of view.
void cavapa_gui::SourceScene::setCameraHeight ( float  value)
slot

Sets the camera height.

Parameters
valueThe new camera height.
void cavapa_gui::SourceScene::setCameraSettings ( cavapa::camera  settings)

Sets camera settings.

Parameters
settingsThe new camera settings.
void cavapa_gui::SourceScene::setCameraXRot ( float  value)
slot

Sets the camera rotation around X axis.

Parameters
valueThe new camera X rotation.
void cavapa_gui::SourceScene::setCameraYRot ( float  value)
slot

Sets the camera rotation around Y axis.

Parameters
valueThe new camera Y rotation.
void cavapa_gui::SourceScene::setCameraZRot ( float  value)
slot

Sets the camera rotation around Z axis.

Parameters
valueThe new camera Z rotation.
void cavapa_gui::SourceScene::setDrawCalibrationPointsEnabled ( bool  enabled)
inlineslot

Sets if the calibration points should be drawn.

Parameters
enabledSpecifies whether the calibration points should be drawn or not.
void cavapa_gui::SourceScene::setDrawGridEnabled ( bool  enabled)
inlineslot

Sets if the grid should be drawn.

Parameters
enabledSpecifies whether the grid should be drawn or not.
void cavapa_gui::SourceScene::timerEvent ( QTimerEvent *  e)
protected

The timer event.

Handles updating the OpenGL widget.

Parameters
*eThe QTimerEvent.
void cavapa_gui::SourceScene::updateImage ( const cv::Mat &  image)

Updates the background image.

Use this to update the video frames.

Parameters
imageThe new background image.
Remarks
This assumes that the image format is RGB888.

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