lundi 29 juillet 2019

Access IP camera (rtsp) using OpenCV (C++) in Docker?

I am trying to build a docker image to get the video streams from the IP camera and take each frame for further processing using:

Ubuntu 18.04 OpenCV 4.1 C++ 11 Docker

I have tried to use the webcam on the laptop using the following docker command and it works:

docker run -i -t --device /dev/video0 <docker image> /bin/bash

C++ code:

    VideoCapture cap;  

    if(videoStreamUrl=="0")
    {
        std::cout <<"default camera applied"<< std::endl;
        cap.open(0);
    }
    else
    {
        std::cout <<"Video stream address: "<< videoStreamUrl << std::endl;
        cap.open(videoStreamUrl);
    }

    if (!cap.isOpened())
    {  
        std::cout << "Couldn't open camera : " << endl;  
        return -1;  
    }

but when I am trying to use the rtsp url of the IP camera in docker, it is not working:

to start the docker :

docker run -i -t <docker image> /bin/bash

in the cpp code shown above

let videoStreamUrl = rtsp://name:pwd@ and cap.isOpened() is always false in docker image (but works in my local linux system).

may I check is there anything missing ?

Thanks a lot !

Aucun commentaire:

Enregistrer un commentaire