Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Streaming using C++ in OpenCV #23

Open
kcyeong92 opened this issue Oct 1, 2016 · 3 comments
Open

Video Streaming using C++ in OpenCV #23

kcyeong92 opened this issue Oct 1, 2016 · 3 comments

Comments

@kcyeong92
Copy link

Hi @drejkim

Thanks for sharing this project.

Can I write C++ code in openCV to view the video streaming instead of using web browser?

The C++ coding that i wrote as follow:

include <opencv/cv.h>

include <opencv2/highgui/highgui.hpp>

include <opencv2/imgproc/imgproc.hpp>

include

include <stdio.h>

using namespace std;
using namespace cv;
int main()
{
Mat frame;
namedWindow("video", 1);
VideoCapture cap("http://192.168.8.102:8080/video.mjpg");
if(!cap.isOpened())
{
cout<<"Camera not found"<<endl;
getchar();
return -1;
}
while ( cap.isOpened() )
{
cap >> frame;
if(frame.empty()) break;
imshow("video", frame);
if(waitKey(30) >= 0) break;
}
return 0;
}

When running the C++, it does not show me the video and show me "Camera not found".

However, in Intel Edison terminal, it shows:
"GET /video.mjpg 206 87.816 ms - 1248"
screenshot from 2016-10-01 18-26-32

Can you give me some advice and idea? Thank you.

@kcyeong92
Copy link
Author

what are "206", "87.816 ms" and "1248" represent in ""GET /video.mjpg 206 87.816 ms - 1248""?
Thanks.

@SteveRuben
Copy link

Yes of course, you can write a server which get input and transmit to your browser using opencv for javascript.
You can also build a simple web video player and build server which should transmit video frame to the web application. I am working on it know.

I also see that you have check my code, thank. If it doesn't work for you, check your inputs.
work

@alexjose70
Copy link

what are "206", "87.816 ms" and "1248" represent in ""GET /video.mjpg 206 87.816 ms - 1248""?
Thanks.

206 is the http status of what you ask.
In this case, video.mjpg did not exist. So, the browser is server is replying that because there is no such a source, it will be redirect to another address (Index.html) and giving a partial content.
the 1248 I think it is the amount of data it is partially showing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants