aboutsummaryrefslogtreecommitdiff
path: root/src/playback.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/playback.cc')
-rw-r--r--src/playback.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/playback.cc b/src/playback.cc
index 045abb6..8839528 100644
--- a/src/playback.cc
+++ b/src/playback.cc
@@ -13,14 +13,14 @@ namespace frontend {
std::size_t frameNum = 0;
};
- playback::playback(const std::filesystem::path& video) {
+ playback::playback(const std::filesystem::path& video, std::size_t frameCap) {
data = std::shared_ptr<playback_impl>(new playback_impl);
cv::VideoCapture cap(video);
if(!cap.isOpened()) {
throw std::runtime_error("Error loading video " + video.string());
}
data->fps = cap.get(cv::CAP_PROP_FPS);
- while(true) {
+ while(frameCap == 0 or data->images.size() < frameCap) {
cv::Mat frame;
cap >> frame;
if(frame.empty()) break;