iVS3D v2.0.0
Loading...
Searching...
No Matches
videoplayercontroller.h
1#ifndef VIDEOPLAYERCONTROLLER_H
2#define VIDEOPLAYERCONTROLLER_H
3
4#include <QObject> // used for signals and slots
5#include <QTimer> // used for periodic timer events to update displayed image
6#include <set>
7
8#include "plugin/algorithmmanager.h" //used to emit signal that index has changed
9
10#include "DataManager.h" // used to access image data for displaying and manipulation
11
12#include "view/videoplayer.h" // used to display images
13#include "view/timeline.h" // used to visualize keyframe distribution
14
15#include "controller/ModelInputIterator.h" // used to iterate over given image data
16#include "controller/algorithmcontroller.h" // used to display transformed images
17
18#include "controller/imageiterator.h"
19#include "controller/modelinputiteratorfactory.h"
20#include "view/reallydeletedialog.h"
21
22#include "cvmat_qmetadata.h"
23
24#define ERROR_MSG_APPROX_COUNT 5
25#define BOUDNARY_STATIONARY_DURATION 1000 // in ms
26
42class VideoPlayerController : public QObject
43{
44 Q_OBJECT // used to enable signals and slots for this class
45 QThread workerThread;
46
47public:
58 explicit VideoPlayerController(QObject *parent = nullptr, VideoPlayer *player = nullptr, Timeline *timeline = nullptr, DataManager *dataManager = nullptr, AlgorithmController *algoController = nullptr);
59
64
69 unsigned int getImageIndexOnScreen();
70
71public slots:
75 void slot_play();
76
81
85 void slot_showLastImage();
86
92
97 void slot_showNextImage();
98
102 void slot_toggleKeyframe();
103
108 void slot_toggleKeyframesOnly(bool checked);
109
114 void slot_changeStepSize(unsigned int stepsize);
115
120 void slot_changeIndex(unsigned int index);
121
125 void slot_mipChanged();
126
131
136
140 void slot_stopPlay();
141
145 void slot_updateBoundaries(QPoint boundaries);
146
151
157 void slot_imageProcessed(cv::Mat *preview, int id);
158
162 void slot_redraw();
163
169 void slot_receiveImage(uint idx, const cv::Mat &img);
170
176 void slot_displayImage(uint idx, const cv::Mat &img);
177
182 void slot_selectedITransformChanged(uint id);
183
188 void slot_transformEnabledChanged(bool enabled);
189
190
191signals:
192
197 void sig_hasStatusMessage(QString message);
198
204 void sig_imageToProcess(cv::Mat *image, int id);
205
210 void sig_read(uint idx);
211
217 void sig_sendToITransform(uint idx, const cv::Mat &img, const Resolution &resolution, const ROI &roi);
218
224 void sig_toggleKeyframe(uint idx, bool isNowKeyframe);
225
230
235
236private slots:
237 void slot_timerNextImage();
238 void slot_boundaryStopped();
239
240private:
241 VideoPlayer *m_videoPlayer;
242 Timeline *m_timeline;
243 DataManager *m_dataManager;
244 QTimer *m_frametimer;
245 QTimer *m_boundaryMoveTimer;
246 unsigned int m_imageIndex;
247 unsigned int m_imageIndexOnScreen;
248 unsigned int m_stepsize;
249 bool m_keyframesOnly;
250 bool m_playing;
251 ModelInputIterator *m_iterator;
252 AlgorithmController *m_algoController;
253 ITransformRequestDequeue *m_transform;
254
255 const int m_frametime = 33; //ms between frames
256
257 std::set<int> m_foundCorruptedFrames = {};
258
259 void showImage();
260
261};
262
263#endif // VIDEOPLAYERCONTROLLER_H
The AlgorithmController class is responsible for controlling the user input regarding algorithm selec...
Definition algorithmcontroller.h:40
The DataManager class is a Facade for the data holding classes in the model. It delegates most of it'...
Definition DataManager.h:29
The ITransformRequestDequeue class is a proxy for an ITransform. It is used to run ITransform::transf...
Definition itransformrequestdequeue.h:30
The ModelInputIterator class handles iteration over given ModelInputPictures. Handles boundarys and a...
Definition ModelInputIterator.h:18
The ROI class manages a region of interest represented as a rectangle in the [0,1]x[0,...
Definition roi.h:21
The Resolution class encapsulates an image resolution (width and height). It provides functionality f...
Definition resolution.h:17
The Timeline class is the class wich coordinates and manages all timeline events and elements.
Definition timeline.h:30
The VideoPlayerController class manages visualization of image data and manual changes to keyframes.
Definition videoplayercontroller.h:43
void slot_imageProcessed(cv::Mat *preview, int id)
[slot] slot_imageProcessed(...) is invoked when image has been processed and provides additional imag...
Definition videoplayercontroller.cpp:299
void slot_updateBoundaries(QPoint boundaries)
[slot] slot_updateBoundaries() updates the mip so that the boundaries are up to date
Definition videoplayercontroller.cpp:267
void slot_mipChanged()
[slot] slot_mipChanged() is called when image data changed. VideoPlayer and Timeline are updated.
Definition videoplayercontroller.cpp:217
~VideoPlayerController()
disconnects signals, deletes timer and VideoPlayerController instance.
Definition videoplayercontroller.cpp:76
void sig_deleteAllKeyframes()
[signal] sig_deleteAllKeyframes is emitted when frames are reseted to be keyframes
void slot_play()
[slot] slot_play() toggles automatic iteration over image sequence.
Definition videoplayercontroller.cpp:108
void sig_deleteKeyframes()
[signal] sig_deleteKeyframes is emitted when all keyframes are deleted
void sig_read(uint idx)
[signal] sig_read sends an image request to the worker thread to read the image.
void slot_selectedITransformChanged(uint id)
[slot] slot_selectedITransformChanged connects new plugin to videoplayer
Definition videoplayercontroller.cpp:367
void sig_imageToProcess(cv::Mat *image, int id)
[signal] sig_imageToProcess(...) is emitted when VideoPlayer is about to display a new image.
void slot_displayImage(uint idx, const cv::Mat &img)
[slot] slot_displayImage diplays img if transformation is enabled
Definition videoplayercontroller.cpp:355
void sig_hasStatusMessage(QString message)
[signal] sig_hasStatusMessage(...) is emitted when VideoPlayerController has a status message to disp...
void slot_showLastImage()
[slot] slot_showLastImage() displays last image.
Definition videoplayercontroller.cpp:126
void slot_deleteAllKeyframes()
[slot] slot_deleteAllKeyframes() deletes all keyframes.
Definition videoplayercontroller.cpp:238
void sig_toggleKeyframe(uint idx, bool isNowKeyframe)
[signal] sig_toggleKeyframe notifies about a manual keyframe change by clicking Add keyframe/Remove k...
void slot_stopPlay()
[slot] slot_stopPlay() stops running videoPlayer.
Definition videoplayercontroller.cpp:261
void slot_redraw()
[slot] slot_redraw() draws selected image again.
Definition videoplayercontroller.cpp:309
void slot_changeIndex(unsigned int index)
[slot] slot_changeIndex(...) displays the image from DataManager referenced by given index.
Definition videoplayercontroller.cpp:210
void slot_deleteKeyframes()
[slot] slot_deleteKeyframes() deletes all selected keyframes.
Definition videoplayercontroller.cpp:226
void slot_showNextImage()
[slot] slot_showNextImage() displays image going one or more steps forward from current image.
Definition videoplayercontroller.cpp:142
void slot_transformEnabledChanged(bool enabled)
slot_transformEnabledChanged reads data with new changed enabled parameter
Definition videoplayercontroller.cpp:381
void slot_resetBoundaries()
[slot] slot_resetBoundaries() updates the mip so that the boundaries are back to default
Definition videoplayercontroller.cpp:294
void sig_sendToITransform(uint idx, const cv::Mat &img, const Resolution &resolution, const ROI &roi)
[signal] sig_sendToITransform sends the image for processing to the connected ITransforms.
void slot_changeStepSize(unsigned int stepsize)
[slot] slot_changeStepSize(...) changes stepsize for iterating the images.
Definition videoplayercontroller.cpp:205
void slot_receiveImage(uint idx, const cv::Mat &img)
[slot] slot_receiveImage draws given image with and applies a transformable plugin if neccessary
Definition videoplayercontroller.cpp:314
void slot_toggleKeyframesOnly(bool checked)
[slot] slot_toggleKeyframesOnly(...) switches between displaying all images or keyframes only.
Definition videoplayercontroller.cpp:176
unsigned int getImageIndexOnScreen()
getImageIndexOnScreen getter for m_imageIndexOnScreen (only used in tests for now)
Definition videoplayercontroller.cpp:103
void slot_showFirstImage()
[slot] slot_showFirstImage() displays first image.
Definition videoplayercontroller.cpp:118
void slot_showPreviousImage()
[slot] slot_showPreviousImage() displays image going one or more steps backward from current image.
Definition videoplayercontroller.cpp:134
void slot_toggleKeyframe()
[slot] slot_toggleKeyframe() toggles keyframe-state for currently displayed image.
Definition videoplayercontroller.cpp:150
The VideoPlayer class provides a view to display images and holds buttons to interact with image sequ...
Definition videoplayer.h:49