Attention! This forum will be made read-only by Dec-20. Please migrate to https://forum.opencv.org. Most of existing active users should've received invitation by e-mail.
Ask Your Question
0

D-Link IP Cam read Stream and Picture

asked 2013-07-21 09:59:45 -0500

thomasgull gravatar image

i have a IP-Cam D-Link DCS 932-L 1. i would like record the stram bur i have problem to conect to Cam. at first i have think the problem ist the cam was password-protectec, but now this fature is disabled. can any me give a example to connect to cam? when i type on Explorer:"http://192.168.0.20/video.cgi" have a download, iits possible that ist the stream from Cam. but u donk can it read on OpenCV the preview is black.

2.When i will amke a snaphot on"http://192.168.0.20/image/jpeg.cgi" the same problem the Picture is empty.

thanks for smal inputs

following Givens:

Win XP or Win 7 64bit Python 2.6.5 Open CV 2.3

Thomas

edit retag flag offensive close merge delete

Comments

Switch at least to OpenCV2.4.6! Many bugs have been fixed concerning the streaming of video. If it still doesn't work then, provide a code snippet on how you access the data.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-21 15:35:35 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2014-02-26 09:07:31 -0500

Ashish Ranjan gravatar image

You can use the following opencv c++ code for windows to get videostream from your IP WEBCAM app on android phone.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
    VideoCapture cap; //

    cap.open("http://192.168.226.101:8080/video?x.mjpeg");
    if (!cap.isOpened())  // if not success, exit program
    {
        cout << "Cannot open the video cam" << endl;
        return -1;
    }

   double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
   double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video

    cout << "Frame size : " << dWidth << " x " << dHeight << endl;

    namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo"
    namedWindow("MyNegativeVideo",CV_WINDOW_AUTOSIZE);

    while (1)
    {
        Mat frame;
        Mat contours;

        bool bSuccess = cap.read(frame); // read a new frame from video

         if (!bSuccess) //if not success, break loop
        {
             cout << "Cannot read a frame from video stream" << endl;
             break;
        }

        flip(frame, frame, 1);
        imshow("MyVideo", frame); //show the frame in "MyVideo" window

        Canny(frame, contours, 500, 1000, 5, true);
        imshow("MyNegativeVideo", contours);

        if (waitKey(30) == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
       {
            cout << "esc key is pressed by user" << endl;
            break;
       }
    }
    return 0;
}

Here, replace the ip address (192.168.226.101:8080) in

cap.open("http://192.168.226.101:8080/video?x.mjpeg");

with your ip address !! But make sure you have, ?x.mjpeg ,in the end (where x can be any string).

If this doesn't work then you should find out what your full ip address is? i.e. find out what is the string after the ip (In my case it was "/video" as shown in above address)

edit flag offensive delete link more
0

answered 2017-02-02 09:58:40 -0500

firas gravatar image

right click on you camera frame and select inspector to see the code and get the URL

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-07-21 09:59:45 -0500

Seen: 3,247 times

Last updated: Feb 26 '14