Hi, People...
I am trying to include an IP Camera capability to a DVR, using OpenCV...
When I compile the examples from here (Laplace, etc), I can open the device (a RTSP/ONVIF Camera)...
But I can´t do this, in my "real" code (even if I copy/paste the example)... I can compile my source code, no errors, no warnings, just the device cannot be opened...
I am using Debian Linux 7.9 (x86, but I also tried in x64), with OpenCV 3.1.0 (compiled from source code - again, no errors)...
My code:
printf("Number of cameras registered in DB: %d\r\n", inQtde);
for(int inConta = 0; inConta < inQtde; inConta++ ) { //inConta > 0) {
inIndice = atoi ( PQgetvalue ( result, inConta, PQfnumber ( result, "onvif_no" ) ) ) - 1;
if(inIndice >= 0 && inIndice < 32) {
if ( PQgetisnull ( result, 0, PQfnumber ( result, "onvif_url" ) ) == 0 ) {
snprintf ( szBuffer, 100, "%s", PQgetvalue ( result, inConta, PQfnumber ( result, "onvif_url" ) ) );
szUrl = szBuffer;
printf("Preparing to create VideoCapture Object (%s) / Camera %d (%d)\r\n", szUrl.c_str(), inIndice+1, inConta);
pVideoDevices[inIndice] = new cv::VideoCapture(szUrl.c_str());
printf("Object created: %X\r\n", pVideoDevices[inIndice]);
szAddress[inIndice] = szUrl;
if(!(pVideoDevices[inIndice])->isOpened()) {
printf("Error opening IP Camera (%d - %s)\r\n", inIndice+1, szUrl.c_str());
}
}
}
}
And the result:
Number of cameras registered in DB: 1
Preparing to create VideoCapture Object (rtsp://192.168.0.169:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream) / Camera 32 (0)
Object created: AC4D248
Error opening IP Camera (32 - rtsp://192.168.0.169:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream)
Thanks in advance...
Fernando Menezes / Tercete