SourceScene draws a video stream and configures camera parameters. More...
#include <sourcescene.h>
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... | |
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.
|
explicit |
Constructs a new SourceScene having the specified parent widget.
parent | The parent widget. |
|
inline |
Adds a new calibration point.
point | The new point. The point should be in relative coordinates, i.e. x and y coordinates range from 0 to 1. |
|
inline |
Gets the calibration points.
|
inline |
Sets the field of view of the camera.
|
inline |
Returns the camera height.
QVector3D cavapa_gui::SourceScene::getCameraLookDirection | ( | ) |
Gets the camera look direction.
QVector3D cavapa_gui::SourceScene::getCameraPosition | ( | ) |
Gets the camera position.
cavapa::camera cavapa_gui::SourceScene::getCameraSettings | ( | ) |
Gets the camera settings.
|
inline |
Returns the camera rotation around X axis.
|
inline |
Returns the camera rotation around Y axis.
|
inline |
Returns the camera rotation around Z axis.
|
inlineprotected |
Calculates the relative position of a point in the video.
widgetPoint | The point which position to calculate. |
|
protected |
Reacts to a mouse press event by highlighting the closest calibration point.
e | The QMouseEvent. |
|
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.
*e | The QMouseEvent. |
|
protected |
Resizes the GL viewport.
w | The new viewport width. |
h | The new viewport height. |
|
inline |
Sets if adding calibration points should be possible.
enabled | Specifies if adding calibration points should be possible. |
|
slot |
Sets the camera field of view.
value | The new field of view. |
|
slot |
Sets the camera height.
value | The new camera height. |
void cavapa_gui::SourceScene::setCameraSettings | ( | cavapa::camera | settings | ) |
Sets camera settings.
settings | The new camera settings. |
|
slot |
Sets the camera rotation around X axis.
value | The new camera X rotation. |
|
slot |
Sets the camera rotation around Y axis.
value | The new camera Y rotation. |
|
slot |
Sets the camera rotation around Z axis.
value | The new camera Z rotation. |
|
inlineslot |
Sets if the calibration points should be drawn.
enabled | Specifies whether the calibration points should be drawn or not. |
|
inlineslot |
Sets if the grid should be drawn.
enabled | Specifies whether the grid should be drawn or not. |
|
protected |
The timer event.
Handles updating the OpenGL widget.
*e | The QTimerEvent. |
void cavapa_gui::SourceScene::updateImage | ( | const cv::Mat & | image | ) |
Updates the background image.
Use this to update the video frames.
image | The new background image. |