FastTrack 6.1.0
Tracks multiples objects dealing with occlusion and identities.
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 <filesystem>
22#include <iostream>
23#include <mutex>
24#include <opencv2/imgproc.hpp>
25#include <opencv2/videoio.hpp>
26#include <regex>
27#include <set>
28#include <stdexcept>
29
30using namespace cv;
31namespace fs = std::filesystem;
32using namespace std;
33
34class VideoReader : public VideoCapture {
35 bool m_isSequence;
36 int m_index;
37 string m_path;
38
39 public:
40 VideoReader() = default;
41 VideoReader(const string &path);
42 VideoReader(const VideoReader &);
43 VideoReader &operator=(const VideoReader &);
44 bool getNext(UMat &destination);
45 bool getNext(Mat &destination);
46 bool getImage(int index, UMat &destination);
47 bool getImage(int index, Mat &destination);
48 bool open(const String &path, int apiPreference = CAP_ANY) override;
49 unsigned int getImageCount() const;
50 bool isSequence();
51};
52
53#endif
This class is intended to abstract the opening of a video, it can load image sequence and video with ...
Definition: videoreader.h:34
bool isSequence()
Is the file is an image sequence.
Definition: videoreader.cpp:164
unsigned int getImageCount() const
Get the total number of images in the video.
Definition: videoreader.cpp:156
bool getImage(int index, UMat &destination)
Get the image at selected index, always one channel.
Definition: videoreader.cpp:113
bool getNext(UMat &destination)
Get the next image, always one channel.
Definition: videoreader.cpp:82