-
Notifications
You must be signed in to change notification settings - Fork 0
/
frameReader.cpp
executable file
·75 lines (48 loc) · 1.43 KB
/
frameReader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// frameReader.cpp
// simpleStabilizer
//
// Created by Camille Ramseur on 7/25/16.
// Copyright © 2016 Camille Ramseur. All rights reserved.
//
#include <stdio.h>
#include <iostream>
//using namespace std;
#include "frameReader.h"
#include "Tracker.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/video/video.hpp>
#include <vector>
using namespace std;
//take input from user and integrate it into main
cv::VideoCapture FrameReader::getSource(){
return source;
}
//Frame reader class contructor that reads in the path of where the video
FrameReader::FrameReader(std::string path){ //constructor
source.open(path);
}
//returns the number of frames in the inputted video
int FrameReader:: getFrameCount(){
return 80; //the number of frames you want the program to read
return source.get(cv::CAP_PROP_FRAME_COUNT);
cv::Mat frame;
int count=0;
while(source.isOpened()){
source>>frame;
if(frame.empty()) break;
count++;
cout<<count; //using this for testing purposes
}
return count;
}
//Function allows you to choose what frame you want to evaluate
cv::Mat FrameReader::getFrame(int i){
source.set(cv::CAP_PROP_POS_FRAMES, i+1);
cv::Mat image;
source >> image;
return image;
}