[英]save still image (jpeg) from h.264 stream
Is it possible to save a jpeg image from a h.264 stream. 是否可以从h.264流保存jpeg图像。 I got the stream from a Webcam and would like to programm a little helper which saves the image on a keypress.
我从网络摄像头获取数据流,并希望编写一个小助手以将图像保存在按键上。
Would be great to get your help. 会很高兴得到您的帮助。
OpenCV can do this. OpenCV可以做到这一点。 This is a good reference.
这是一个很好的参考。 Below is something I wrote up quick that worked for me:
以下是我快速撰写的对我有用的东西:
#include <cv.h>
#include <highgui.h>
using namespace cv;
int main(int argc, char ** argv){
VideoCapture capture(0);
namedWindow("video",1);
while(capture.isOpened()){
Mat frame;
capture >> frame;
imshow("video",frame);
if (waitKey(30) > 0){
imwrite("image.jpg",frame);
}
}
return 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.