1

I bought IP Camera which seems to have no brand on the box but it works fine when I check it through the browser. I wnat to use it to grab from it some frames. On the box it is said that it allowes me to grab data as mjpeg stream but in reality I can't do that. I did it before with other ip camera and all worked fine - til now.

This is my code - if it help you to solve or show me the way.

    #include <OpenCV/cv.h>
#include <OpenCV/highgui.h>

CvCapture *kamera = NULL;
CvMemStorage *pamiec = NULL;
CvSeq *zakreslenia = NULL;

    IplImage *klatka = 0;
        IplImage *szary = 0;

char *nazwa1 = "Orginalna klatka";
char *nazwa2 = "Po zmianach";
int main()

{
    kamera = cvCaptureFromFile("http://kni:blashyrkh@83.15.3.69:80/image.jpg");kamerki w systemie
    if(kamera!=NULL)
    {
    cvNamedWindow(nazwa1,CV_WINDOW_AUTOSIZE);
    cvNamedWindow(nazwa2,CV_WINDOW_AUTOSIZE);
    pamiec = cvCreateMemStorage(0);

    while((klatka=cvQueryFrame(kamera)) != NULL)    
    {
    szary = cvCreateImage(cvGetSize(klatka),8,1);
    cvCvtColor(klatka,szary,CV_BGR2GRAY);               
    cvSmooth(szary, szary, CV_GAUSSIAN_5x5,9,9,0,0);    
    cvCanny(szary,szary,0,20,3);                    
    zakreslenia = cvHoughCircles(szary,pamiec,CV_HOUGH_GRADIENT,2,szary->height/4,100,100,0,1000);

    cvShowImage(nazwa1,klatka);
    cvShowImage(nazwa2,szary);

    if(cvWaitKey(1)==(char)27)break;

    }

    cvReleaseImage(&szary);
    cvReleaseImage(&klatka);

    cvReleaseMemStorage(&pamiec);
    cvDestroyWindow(nazwa1);
    cvDestroyWindow(nazwa2);


    cvReleaseCapture(&kamera);
    cvWaitKey(0);
    }


  return 0;//bo jestem miły dla systemu i informuję go o braku błędów

}

I've got no idea what to do - shall I return that cam to store or write custom app to grab the frames somehow ?

I thought that it could work with image.jpg/cachebust=117434456&a on the end but it doesn't change anything

Camera is assigned to ip 83.15.3.69 with login kni and pass blashyrkh so you're allowed to check it.

Waiting for you response...

Marek Bar
  • 873
  • 3
  • 16
  • 31

1 Answers1

2

As I know, the possibility to use OpenCV with IP cameras is an undocumented (and unexpected) feature, and it works just because ffmpeg (its backend) supports ip rtp transfer.

The problem is that it works only with unencrypted streams (so if your camera doesn't have a password, it should work.) When you send a password, it is not correctly processed, and ffmpeg doesn't receive the expected path string.

You can test it trying to connect using VLC. And you can also use Wireshark to check the message transfer between camera and OpenCV. (filter with ip.addr==your_camera_ip)

Sam
  • 19,708
  • 4
  • 59
  • 82
  • Thanks Martin, I read it before but my mate posted me sych code which satisfies me, maybe someone will help it useful so I post. By the way when I was studying his code I saw that the url end should be jpeg instead jpg like that: Now it work fine. – Marek Bar Nov 17 '11 at 18:07