video-streaming-poc/server.cpp

21 lines
592 B
C++

#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/core/mat.hpp>
using namespace std;
int main() {
// TODO: read image data from socket instead of VideoCapture
cv::VideoCapture cap = cv::VideoCapture(0);
bool running = true;
// TODO: handle multiple images
cv::Mat image = cv::Mat::zeros(480, 640, CV_8UC3);
// TODO: make this asynchronous. probably do that in tandem with setting up networking
while (running) {
cap.read(image);
imshow("image", image);
running = cv::waitKey(30) != 27;
}
return 0;
}