iVS3D v2.0.9
Loading...
Searching...
No Matches
videoplayer.h
1#ifndef VIDEOPLAYER_H
2#define VIDEOPLAYER_H
3
4#include <QWidget>
5#include <QShortcut>
6#include <QKeySequence>
7#include <QGraphicsTextItem>
8#include <QGraphicsOpacityEffect>
9
10#include "opencv2/core.hpp"
11#include "opencv2/imgproc.hpp"
12#include "opencv2/imgcodecs.hpp"
13#include "ui_videoplayer.h"
14#include "cvmat_qmetadata.h"
15#include "visualization.h"
16
17#define OVERLAY_PADDING 13
18#define OVERLAY_MIN_WIDTH 50
19
20namespace Ui {
21class VideoPlayer;
22}
23
49class VideoPlayer : public QWidget
50{
51 Q_OBJECT
52
53public:
54
60 explicit VideoPlayer(QWidget *parent = nullptr, ColorTheme theme = DARK);
61
63
64 void showVisualization(const VIS::Visualization &vis);
65
66 void clearVisualization();
67
72 void showImage(const cv::Mat &image);
73
78 void setKeyframe(bool isKeyframe);
79
84 void setKeyframeCount(unsigned int keyframeCount);
85
90 void setEnabledBackBtns(bool enabled);
91
96 void setEnabledForwardBtns(bool enabled);
97
102 void setPlaying(bool playing);
103
108 void setStepsize(unsigned int stepsize);
109
114 void setKeyframesOnly(bool checked);
115
120 void addWidgetToLayout(QWidget *widget);
121
126 void removeWidgetFromLayout(QWidget *widget);
127
132 void setColorTheme(ColorTheme theme);
133
134 void setCropStatus(bool checked);
135 bool getCropStatus();
136
138 QString text;
139 bool isHeader = false;
140 Qt::TextElideMode elidMode = Qt::ElideRight;
141 };
142
143 void updateOverlayText(const QList<OverlayEntry> &content);
144
145 void updateRoi(const QRect& roi = QRect());
146 void clear();
147
148signals:
149
153 void sig_play();
154
159
164
169
174
179
184 void sig_toggleKeyframesOnly(bool checked);
185
190 void sig_changeStepsize(unsigned int stepsize);
191
196
201
202 void sig_useCropChanged(bool useCrop);
203
204protected:
205 void resizeEvent(QResizeEvent *e); // used to resize displayed image
206
207private slots:
208 void on_pushButton_firstPic_clicked();
209 void on_pushButton_prevPic_clicked();
210 void on_pushButton_playPause_clicked();
211 void on_pushButton_nextPic_clicked();
212 void on_pushButton_lastPic_clicked();
213 void on_checkBox_onlyKeyframes_stateChanged(int arg1);
214 void on_pushButton_setKeyframe_clicked();
215 void on_spinBox_stepsize_valueChanged(int arg1);
216 void on_pushButton_resetKeyframes_clicked();
217
218private:
219 Ui::VideoPlayer *ui;
220 ColorTheme m_colorTheme;
221 QShortcut *m_prevSC;
222 QShortcut *m_nextSC;
223
224 // This is the image item displayed in the graphics view
225 QGraphicsItem *m_imageItem;
226 QGraphicsRectItem *m_roiItem;
227 QGraphicsItemGroup *m_visItemGroup;
228
229 // Input Info Overlay
230 QList<OverlayEntry> m_overlayEntries;
231 QLabel *m_overlayLabel;
232 QGraphicsOpacityEffect *m_overlayOpacityEffect;
233
234 QImage qImageFromCvMat(const cv::Mat &input, bool bgr = true);
235 void alphaBlend(cv::Mat *foreground, cv::Mat *background, float alpha, cv::Mat &output);
236 void updateOverlay();
237 bool checkOverlap();
238 void displayDragNDropIcon();
239};
240
241#endif // VIDEOPLAYER_H
The VideoPlayer class provides a view to display images and holds buttons to interact with image sequ...
Definition videoplayer.h:50
void sig_deleteAllKeyframes()
[signal] sig_deleteAllKeyframes() is emitted on delete all button press.
void sig_showNextImage()
[signal] sig_showNextImage() is emitted on show next button press.
void sig_changeStepsize(unsigned int stepsize)
[signal] sig_changeStepsize(...) is emitted if stepsize changed.
void setColorTheme(ColorTheme theme)
setColorTheme updates text and icon colors according to a given theme
Definition videoplayer.cpp:254
void setEnabledBackBtns(bool enabled)
setEnabledBackBtns enables or disables the |<< and |< buttons.
Definition videoplayer.cpp:219
void showImage(const cv::Mat &image)
showImage displays the given image.
Definition videoplayer.cpp:176
void sig_toggleKeyframes()
[signal] sig_toggleKeyframes() is emitted on set keyframe / remove keyframe button press.
void setEnabledForwardBtns(bool enabled)
setEnabledForwardBtns enables or disables the >| and >>| buttons.
Definition videoplayer.cpp:225
void setKeyframeCount(unsigned int keyframeCount)
setKeyframeCount displays the given number under keyframe count.
Definition videoplayer.cpp:215
void setPlaying(bool playing)
setPlaying changes the play/pause button between > and ||.
Definition videoplayer.cpp:231
void sig_cropEdit()
[signal] sig_cropEdit() is emitted if the crop button is pressed.
void setKeyframesOnly(bool checked)
setKeyframesOnly checks the iterate keyframes only checkbox
Definition videoplayer.cpp:242
void sig_toggleKeyframesOnly(bool checked)
[signal] sig_toggleKeyframesOnly(...) is emitted if the keyframes only checkbox is checked/unchecked.
void setStepsize(unsigned int stepsize)
setStepsize changes the value of the stepsize box.
Definition videoplayer.cpp:238
void addWidgetToLayout(QWidget *widget)
addWidgetToLayout adds the given QWidget to the VideoPlayer between the displayed image and the inter...
Definition videoplayer.cpp:246
void sig_showFirstImage()
[signal] sig_showFirstImage() is emitted on show first button press.
void sig_play()
[signal] sig_play() is emitted on play / pause button press.
void setKeyframe(bool isKeyframe)
setKeyframe highlights the displayed image if isKeyframe is true.
Definition videoplayer.cpp:206
void removeWidgetFromLayout(QWidget *widget)
removeWidgetFromLayout removes the given QWidget from the VideoPlayer.
Definition videoplayer.cpp:250
void sig_showLastImage()
[signal] sig_showLastImage() is emitted on show last button press.
void sig_showPreviousImage()
[signal] sig_showPreviousImage() is emitted on show previous button press.
Preview visualization container returned by PLUG::IPreview plugins.
Definition visualization.h:217
Definition videoplayer.h:137