FastTrack 6.1.0
Tracks multiples objects dealing with occlusion and identities.
Loading...
Searching...
No Matches
videoreader.h
1/*
2This file is part of Fast Track.
3
4 FastTrack is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 FastTrack is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with FastTrack. If not, see <https://www.gnu.org/licenses/>.
16*/
17
18#ifndef VIDEOREADER_H
19#define VIDEOREADER_H
20
21#include <QDebug>
22#include <filesystem>
23#include <iostream>
24#include <mutex>
25#include <opencv2/imgproc.hpp>
26#include <opencv2/videoio.hpp>
27#include <opencv2/videoio/registry.hpp>
28#include <regex>
29#include <set>
30#include <stdexcept>
31
32using namespace cv;
33namespace fs = std::filesystem;
34using namespace std;
35
36class VideoReader : public VideoCapture {
37 bool m_isSequence;
38 int m_index;
39 string m_path;
40
41 public:
42 VideoReader() = default;
43 ~VideoReader() = default;
44 VideoReader(const string &path);
45 VideoReader(const VideoReader &) = delete;
46 VideoReader &operator=(const VideoReader &) = delete;
47 VideoReader &operator=(VideoReader &&T) = delete;
48 VideoReader(VideoReader &&T) = delete;
49
50 bool getNext(UMat &destination);
51 bool getNext(Mat &destination);
52 bool getImage(int index, UMat &destination);
53 bool getImage(int index, Mat &destination);
54 bool open(const String &path, int apiPreference = CAP_FFMPEG) override;
55 bool open(int apiPreference = CAP_FFMPEG);
56 unsigned int getImageCount() const;
57 bool isSequence();
58};
59
60#endif
bool open(const String &path, int apiPreference=CAP_FFMPEG) override
Open the VideoReader.
Definition videoreader.cpp:45
bool isSequence()
Is the file is an image sequence.
Definition videoreader.cpp:169
unsigned int getImageCount() const
Get the total number of images in the video.
Definition videoreader.cpp:161
bool getImage(int index, UMat &destination)
Get the image at selected index, always one channel.
Definition videoreader.cpp:118
bool getNext(UMat &destination)
Get the next image, always one channel.
Definition videoreader.cpp:87