setup Meson project, get the server to read a video feed from a local camera

This commit is contained in:
Camryn Thomas 2025-03-25 16:26:35 -05:00
parent d4aa4eabb4
commit 54246257c9
Signed by: cptlobster
GPG Key ID: 33D607425C830B4C
4 changed files with 39 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
.venv
.idea
.idea
build

8
client.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}

13
meson.build Normal file
View File

@ -0,0 +1,13 @@
project('video-streaming-poc', 'cpp')
add_project_arguments('-Wall', '-Wextra', language : 'cpp')
opencv = dependency('opencv4', version : '>=4.0.0')
opencv_incl_dir = opencv.get_variable(cmake : 'OpenCV_INCLUDE_DIRECTORIES', pkgconfig : 'includedir')
include = include_directories(opencv_incl_dir)
common = []
client = common + ['client.cpp']
server = common + ['server.cpp']
client_exe = executable('client', client, dependencies : opencv, include_directories : include)
server_exe = executable('server', server, dependencies : opencv, include_directories : include)

16
server.cpp Normal file
View File

@ -0,0 +1,16 @@
#include <opencv2/highgui.hpp>
#include <opencv2/core/mat.hpp>
using namespace std;
int main() {
cv::VideoCapture cap = cv::VideoCapture(0);
bool running = true;
cv::Mat image = cv::Mat::zeros(480, 640, CV_8UC3);
while (running) {
cap.read(image);
imshow("image", image);
running = cv::waitKey(30) != 27;
}
return 0;
}