Ask Your Question
0

OpenCV code for network camera working for axis not canon

asked 2013-02-11 08:20:17 -0600

sim gravatar image

Hi

I am using an open cv code to display video from network camera. For axis camera it's working. but for canon VB-c50i, its not showing anything. This is the url I am using http://username:[email protected]/-wvhttp-01-/GetOneShot?image_size=320x240&frame_count=no_limit. I am able to stream video if I use this url in internet browser but not with opencv

Code is working fine for axis camera. Can someone help. This is the code http://stackoverflow.com/questions/712998/opencv-with-network-cameras

int main(){

CvCapture *camera=cvCaptureFromFile("http://username:pass@cam_address/axis-cgi/mjpg/video.cgi?resolution=640x480&req_fps=30&.mjpg");
if (camera==NULL)
    printf("camera is null\n");
else
    printf("camera is not null");

cvNamedWindow("img");
while (cvWaitKey(10)!=atoi("q")){
    double t1=(double)cvGetTickCount();
    IplImage *img=cvQueryFrame(camera);
    double t2=(double)cvGetTickCount();
    printf("time: %gms  fps: %.2g\n",(t2-t1)/(cvGetTickFrequency()*1000.), 1000./((t2-t1)/(cvGetTickFrequency()*1000.)));
    cvShowImage("img",img);
}
cvReleaseCapture(&camera);

}

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-02-11 09:07:34 -0600

berak gravatar image

the url from your axis cam ended with '.mjpg',

the url from the canon one did not contain any hints about the content. look up the canon-manual, if you can add some parameter to specify the format.

maybe, even adding a 'dummy' there helps, like :

http://username:[email protected]/-wvhttp-01-/GetOneShot?image_size=320x240&frame_count=no_limit&type=.mjpg

edit flag offensive delete link more

Comments

Thanks a lot. Its working now.

sim gravatar imagesim ( 2013-02-11 23:57:12 -0600 )edit
0

answered 2015-04-15 18:41:46 -0600

This code works very well.

Thank you

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-11 08:20:17 -0600

Seen: 3,309 times

Last updated: Feb 11 '13