Error when Capturing RTSP IP Camera

asked 2015-08-04 22:18:06 -0500

dhaniarianda gravatar image

updated 2015-08-05 02:31:13 -0500

thdrksdfthmn gravatar image

Hi all ! I am working to connect my IP Camera using openCV 2.4.11 and VS 2012. My IP Camera supports H.264 video compression. When I program it using openCV, it can be connected and I can capture image from it but when I try to mount my camera in parking area of my campus and I run my program again, I got some error. This error is like this. How to solve this problem ? Thank you.image description

This is my code :

#pragma once
#include "stdafx.h"
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <iostream>

using namespace SistemKameraWrapper;
using namespace cv;

IplImage *InputImage1;

void CameraWrapper::AksesKamera()
{
    CvCapture *Kamera1 = cvCaptureFromFile("rtsp://192.168.1.127:554//user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream");
    cvNamedWindow("input image 1", CV_WINDOW_FREERATIO);
    cvResizeWindow("input image 1", 400, 300);

    while(1)
    {
        InputImage1 = cvQueryFrame (Kamera1);
        cvShowImage("input image 1",InputImage1);
        int key = cvWaitKey(1);
        if ((key==27)|(key==13)) break; //key 27 escape, key 13 enter
    }
    cvReleaseCapture(&Kamera1);
    cvDestroyWindow("input image 1");
    return;
}
edit retag flag offensive close merge delete

Comments

You should use C++ API. If the problem persists, then the problem is because the image failed to load/arrive; but first start changing it to C++ (include .hpp, use cv::functionName, cv::Mat instad of IplImage pointer, etc).

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-08-05 02:33:37 -0500 )edit

I had tried the solution that you gave but the result was the same. What must I do to solve that problem ? Please help me

dhaniarianda gravatar imagedhaniarianda ( 2015-08-07 00:23:00 -0500 )edit

please update the code in the post to see better ;)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-08-07 02:25:41 -0500 )edit