opencv是否可以读取视频流?

问题描述:

对于流:

是否存在可以捕获流以进行操作的类?

is there a class that can capture the stream for manipulation?

我发现的所有内容都是有关如何制作客户端服务器或从与计算机连接的cam中读取内容的教程.

all i found was tutorials about how to make client server, or read from computer connected cam.

更新: 看起来很有希望. 尝试再次打开失败,因此我跟随了asx说:

Update: it looks promising. trying to open this again failed , so i followed the asx which said:

<asx version="3.0">
    <!-- GMEmbed -->
    <title>CastUP: Ayalon</title>
    <entryref href="http://switch3.castup.net/cunet/gm.asp?format=wm&s=4A59334AD43141A7BFD73D7CE6B71560&ci=15369&ak=35143679&ClipMediaID=21329&authi=&autht=&dr=" />
</asx>

因此尝试了,但它也没有打开(在cap.isOpen == false上也是如此.

so tried this which also didn't open(on cap.isOpen == false), too.

有什么建议吗?

来源:

Mat frame;
VideoCapture Ayalon("http://switch3.castup.net/cunet/gm.asp?format=wm&s=4A59334AD43141A7BFD73D7CE6B71560&ci=15369&ak=35143679&ClipMediaID=21329&authi=&autht=&dr=");
int delay = 1000/Ayalon.get(CV_CAP_PROP_FPS);// (1 second / fps) = delay between frames
bool stop(false);               
if (!Ayalon.isOpened()) 
    return 1;                   
namedWindow("ayalon Stream");
while (!stop) {
    if (!Ayalon.read(frame))
        break;
    imshow("ayalon Stream",frame);
    if (waitKey(delay) >0 )
        stop = true;
}   
Ayalon.release();
waitKey(7000);
return 1;

是的,很好的功能是该代码与从相机读取的代码完全相同-请参见

Yes and the nice feature is that the code is exactly the same as reading from a camera - see Reading and Writing Images and Video