I am developing a C++ program with OpenCV library to capture a video from a camera (or webcam) and I would like to stream it on an internet page, this way anyone can access it. The code I am using is the following
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <termios.h>
#include <unistd.h>
#include <fstream>
#include <vector>
#include <seek/seek.h>
#include <thread>
#include <chrono>
#include <future>
#include <assert.h>
using namespace std;
using namespace cv;
/** @function main */
int main( int argc, char** argv )
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
namedWindow("edges",CV_NORMAL);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
imshow("edges", frame);
if(waitKey(30) >= 0) break;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
Do you know which is the command to stream the video and which is the HTML or PHP code to read it? I have used socket programming to send a video from a PC to another, but I don't know how to do it from a PC to a web page.
Thank you very much
Aucun commentaire:
Enregistrer un commentaire