Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV code for network camera working for axis not canon

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);

}