Last active
September 15, 2015 20:10
-
-
Save boustrophedon/db80461a5b7a3faee564 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // for standard I/O | |
#include <string> // for strings | |
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat) | |
#include <opencv2/highgui/highgui.hpp> // Video write | |
using namespace std; | |
using namespace cv; | |
int main() { | |
VideoCapture cap(0); | |
double w = cap.get(CV_CAP_PROP_FRAME_WIDTH); | |
double h = cap.get(CV_CAP_PROP_FRAME_HEIGHT); | |
cout << "frame size" << w << " " << h << endl; | |
namedWindow("Video", CV_WINDOW_AUTOSIZE); | |
while (1) { | |
Mat frame; | |
bool success = cap.read(frame); | |
if (!success) { | |
cout << "couldn't read video" << endl; | |
} | |
imshow("Video", frame); | |
if (waitKey(30) == 27) { | |
cout << "exit" << endl; | |
break; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=g++ | |
CFLAGS=-Wall -Werror | |
LDFLAGS=-lopencv_core -lopencv_highgui | |
all: main | |
OBJS = main.o | |
main: $(OBJS) | |
$(CC) -o $@ $(OBJS) $(LDFLAGS) | |
main.o: main.cpp | |
$(CC) -o $@ $(CFLAGS) -c $< | |
clean: | |
rm main $(OBJS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment