IP camera

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

IP camera

Somnath Mukherjee
    Hi
        I am try to connect wityh my IP camera with the below url
URL :- http://admin:pwd@ip:80/web/tmpfs/auto.jpg

I am getting only a single frame after the opencv videocapture class
throwing an exception and exiting , not able to read the fframe
continiuosly, but in my my browser its working fine.

below is the code


VideoCapture cap1(URL);
  if(!cap1.isOpened())
  {
  cout<<"Camera Error"<<endl;
  exit(-1);
  }
  namedWindow("CameraAdjustment");
  while(true)
  {
  Mat frame;
 bool check= cap1.read(frame);
  if(frame.empty())
          {
  cout<<"Frame not Available"<<endl;
                  exit(-1);
          }

      imshow("CameraAdjustment",frame);
  if(cv::waitKey(30)==27) break;
  frame.release();
  }
  destroyWindow("CameraAdjustment");
  cap1.release();



Can any one can help me in this aspect please




   Thanks & Regards
  Somnath Mukherjee
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: IP camera

Fábián Kristóf - Szabolcs
Hi,


The problem is that you call exit(-1) on the first empty frame. I think your camera works on smaller frame rate, so calling cv::waitKey(30) will result in an empty frame the second time you're reading your camera. You have to remove the exit(-1) line and also maybe increase the delay (parameter of cv::waitKey) a bit.


Regards,


Fabian


________________________________
Feladó: [hidden email] <[hidden email]>, meghatalmazó: Somnath Mukherjee [hidden email] [OpenCV] <[hidden email]>
Elküldve: 2017. október 29. 15:27
Címzett: [hidden email]
Tárgy: [OpenCV] IP camera



    Hi
        I am try to connect wityh my IP camera with the below url
URL :- http://admin:pwd@ip:80/web/tmpfs/auto.jpg

I am getting only a single frame after the opencv videocapture class throwing an exception and exiting , not able to read the fframe continiuosly, but in my my browser its working fine.

below is the code


VideoCapture cap1(URL);
  if(!cap1.isOpened())
  {
  cout<<"Camera Error"<<endl;
  exit(-1);
  }
  namedWindow("CameraAdjustment");
  while(true)
  {
  Mat frame;
 bool check= cap1.read(frame);
  if(frame.empty())
          {
  cout<<"Frame not Available"<<endl;
                  exit(-1);
          }

      imshow("CameraAdjustment",frame);
  if(cv::waitKey(30)==27) break;
  frame.release();
  }
  destroyWindow("CameraAdjustment");
  cap1.release();



Can any one can help me in this aspect please




   Thanks & Regards
  Somnath Mukherjee
[hidden email]<mailto:[hidden email]>


Reply | Threaded
Open this post in threaded view
|

Re: IP camera

pevia Usnick
Thanks for letting me know!
Reply | Threaded
Open this post in threaded view
|

Re: IP camera

Somnath Mukherjee
HI Fabian,
                 Great and thanks , for your assistance, however
"CV_CAP_PROP_BUFFERSIZE"  is not working in opencv , I am using 2.4.11 ,
now its is very difficult to play the streaming video its almost a
unpredictable lag .. need to buffer first few frame and then need to play




   Thanks & Regards
  Somnath Mukherjee
[hidden email]

On Wed, Nov 1, 2017 at 9:41 PM, pevia Usnick [hidden email] [OpenCV] <
[hidden email]> wrote:

>
>
> Thanks for letting me know!
>
>