iVS3D v2.0.0
Loading...
Searching...
No Matches
modelinputpictures.h
1#ifndef MODELINPUTPICTURES_H
2#define MODELINPUTPICTURES_H
3
4#include "reader.h"
5#include "readerfactory.h"
6#include "ISerializable.h"
7#include "stringcontainer.h"
8#include "concurrentreader.h"
9#include "metadatamanager.h"
10#include "algorithmmanager.h"
11#include "readerparams.h"
12
13#include <QObject>
14#include <QPoint>
15#include <opencv2/core.hpp>
16#include <opencv2/videoio.hpp>
17#include <opencv2/imgcodecs.hpp>
18#include <opencv2/core/utils/filesystem.hpp>
19#include <QByteArray>
20#include <QVector>
21#include <QVariant>
22#include <QJsonObject>
23#include <QVector>
24#include <QStringList>
25
26
40class ModelInputPictures: public QObject, public ISerializable
41{
42Q_OBJECT
43
44
45
46public:
58 class Memento {
59 friend class ModelInputPictures;
60
61 public:
66 QDateTime getSnapshotDate();
67 private:
68 Memento(std::vector<uint> state);
69 std::vector<uint> getState();
70
71 std::vector<uint> m_state;
72 QDateTime m_dateTime;
73 };
74
80 explicit ModelInputPictures(QString inputPath);
84 explicit ModelInputPictures();
85
92 void addKeyframe(unsigned int index);
99 bool isKeyframe(unsigned int index);
105 void updateMIP(const std::vector<unsigned int> &keyframes);
111 void removeKeyframe(unsigned int index);
118 const cv::Mat* getPic(unsigned int index, Reader::PictureProcessingFlags flags = Reader::APPLY_NONE);
126 unsigned int getKeyframeCount(bool inBound);
132 unsigned int getPicCount();
140 std::vector<unsigned int> getAllKeyframes(bool inBound);
141
146 std::shared_ptr<ReaderParams> getReaderParams();
154 unsigned int getNextKeyframe(unsigned int index, unsigned int stepsize);
162 unsigned int getPreviousKeyframe(unsigned int index, unsigned int stepsize);
168 QString getPath();
174 Reader *getReader();
181 // ISerializable interface
187 QVariant toText() override;
193 void fromText(QVariant data) override;
199 QPoint getBoundaries();
205 void setBoundaries(QPoint boundaries);
211 int loadMetaData(QStringList paths);
216 int loadMetaDataImages();
217 Memento *save();
218 void restore(Memento *m);
219
220 void setAltitude(double altitude);
221 double getAltitude();
222
223
224
225signals:
231
232
233private:
234 Reader* m_reader = nullptr;
235 std::vector<unsigned int> m_keyframes;
236 QString m_inputPath;
237 cv::Mat m_currentMat;
238 QPoint m_boundaries;
239 MetaDataManager* m_metaDataManager = nullptr;
240 std::shared_ptr<ReaderParams> m_readerParams;
241 double m_altitude;
242
243 std::vector<unsigned int> splitString(QString string);
244};
245
246#endif // MODELINPUTPICTURES_H
The ConcurrentReader class is a wrapper for a Reader object. The ConcurrentReader can be moved to a s...
Definition concurrentreader.h:28
The ISerializable class ensures that inherit classes can be transformed to and from text.
Definition ISerializable.h:20
Definition metadatamanager.h:25
The Memento class is used to store and restore the keyframe list of mip for undo and redo.
Definition modelinputpictures.h:58
QDateTime getSnapshotDate()
getSnapshotDate returns the QDateTime object with the exact creation time and date of the memento
Definition modelinputpictures.cpp:402
The ModelInputPictures class is responsible for saving all the Data regarding the input....
Definition modelinputpictures.h:41
Reader * getReader()
Returns the current Reader as a DelayedCopyReader.
Definition modelinputpictures.cpp:174
int loadMetaData(QStringList paths)
loadMetaData Loads the given meta data for the imported Video
Definition modelinputpictures.cpp:307
QPoint getBoundaries()
Returns the current boundaries.
Definition modelinputpictures.cpp:296
void fromText(QVariant data) override
Reades its members from the given QVariant.
Definition modelinputpictures.cpp:238
void updateMIP(const std::vector< unsigned int > &keyframes)
Updates the indices of all keyframes.
Definition modelinputpictures.cpp:60
void setBoundaries(QPoint boundaries)
Set the current boundaries.
Definition modelinputpictures.cpp:301
ConcurrentReader * createConcurrentReader()
createConcurrentReader creates an object from the class ConcurrentReader which can be used to access ...
Definition modelinputpictures.cpp:179
unsigned int getKeyframeCount(bool inBound)
Returns the number of keyframes.
Definition modelinputpictures.cpp:130
void sig_mipChanged()
Signal, which is emitted, when the keyframe vector changes.
int loadMetaDataImages()
loadMetaDataImages Tries to extract meta data from the imported images
Definition modelinputpictures.cpp:316
const cv::Mat * getPic(unsigned int index, Reader::PictureProcessingFlags flags=Reader::APPLY_NONE)
Returns the frame with the given index.
Definition modelinputpictures.cpp:124
unsigned int getNextKeyframe(unsigned int index, unsigned int stepsize)
Returns the stepsize-next keyframe to a given index.
Definition modelinputpictures.cpp:141
unsigned int getPreviousKeyframe(unsigned int index, unsigned int stepsize)
Returns the stepsize-next keyframe to a given index.
Definition modelinputpictures.cpp:155
ModelInputPictures()
ModelInputPictures Constructor, which creates an empty class. toText can be used on this instance.
Definition modelinputpictures.cpp:45
void addKeyframe(unsigned int index)
Sets the frame with index as a keyframe.
Definition modelinputpictures.cpp:102
bool isKeyframe(unsigned int index)
Checks if the indexed frame is a keyframe.
Definition modelinputpictures.cpp:55
unsigned int getPicCount()
Returns the number of frames.
Definition modelinputpictures.cpp:134
void removeKeyframe(unsigned int index)
Removes the keyframe with the given index.
Definition modelinputpictures.cpp:113
QString getPath()
Returns the input Path.
Definition modelinputpictures.cpp:169
std::shared_ptr< ReaderParams > getReaderParams()
getReaderParams returns the parameters (working resolution, crop, etc.) used by the readers.
Definition modelinputpictures.cpp:384
std::vector< unsigned int > getAllKeyframes(bool inBound)
Returns the index vector containing the keyframes.
Definition modelinputpictures.cpp:353
QVariant toText() override
Saves this class to a QVariant.
Definition modelinputpictures.cpp:185
The Reader interface defines functions which are used for reading and parsing the import.
Definition reader.h:23