Error when capture RTSP IP Camera using OpenCV 2.10 and Visual Studio 2008 [closed]

asked 2015-07-27 09:41:10 -0600

dhaniarianda gravatar image

updated 2015-07-28 03:35:24 -0600

Hi ! I am newbie in openCV. I made a program to access IP Camera that support RTSP protocol using OpenCV 2.10 and Visual Studio 2008. I made this program using Win32 Application. When I debug my program, my frame could open once and I got some error.

The error said:

Compiler did not align stack variables. Libavcodec has been miscompiled and may be very slow or crash. This is not a bug in libavcodec, but in the compiler. You may try recompiling using gcc >= 4.2. Do not report crashes to FFmpeg developers.

An unhandled exception of type 'System.AccessViolationException' occurred in CobaKameraIPConsole.exe

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

This is my code :

#include "stdafx.h"
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"

IplImage *in_img;

using namespace System;

int main(array<System::String ^> ^args)
{

    CvCapture *URLKamera1 = cvCaptureFromFile("rtsp://192.168.1.125:554//user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream");

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

Closed for the following reason the question is answered, right answer was accepted by StevenPuttemans
close date 2015-08-05 00:41:33.101124

Comments

OpenCV 2.10 ? that's no more valid !

please, update to a more recent opencv version, and try again..

berak gravatar imageberak ( 2015-07-27 09:55:11 -0600 )edit

I have ever tried to use opencv 2.4.10 using VS 2008 but I always got some error, Missing MSVCP120.dll . How can I solve that problem ?

dhaniarianda gravatar imagedhaniarianda ( 2015-07-27 19:09:37 -0600 )edit

O man o man o man ... first of all, using OpenCV 2.anything with a C-API is not valid anymore. You should follow the official OpenCV installation guide for VS to have a hang on installing the latest version, which works just fine on VS2008. Take a look at the following links

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-28 03:37:24 -0600 )edit
1

MSVCP120.dll is the Microsoft Visual C++ Redistribuables for Visual Studio 2013. There should be some link errors ?

Eduardo gravatar imageEduardo ( 2015-07-28 03:40:03 -0600 )edit
1

Ok thank you all. I have upgraded my openCV to 2.4.11 and my Visual Studio to VS 2012 and it works :) God bless you all :)

dhaniarianda gravatar imagedhaniarianda ( 2015-08-04 22:12:01 -0600 )edit