简体   繁体   English

索尼Ip相机opencv Java

[英]Sony Ip camera opencv Java

I am trying to take images from an IP cam (sony snc p1) for motion detection using opencv java. 我试图从IP cam(sony snc p1)中获取图像,以便使用opencv java进行运动检测。 The stream is in mjpeg format and I am using opencv's VideoCapture to try to retrieve an image. 流是mjpeg格式,我使用opencv的VideoCapture来尝试检索图像。 I can grab an image from a video file using videocapture but when I try to open the camera doesn't work. 我可以使用视频捕捉从视频文件中获取图像,但是当我尝试打开相机时无效。 I can view the stream on vlc but that ip address doesn't work on opencv. 我可以在vlc上查看流,但是该地址在opencv上不起作用。 This is the code that I use: 这是我使用的代码:

while (true){
  VideoCapture camera1=newVideoCapture("http://192.168.0.101/mjpeg");                    
  if (!camera1.isOpened())                  
   System.out.println("Cannot open file");
}

What version are you using? 你用的是什么版本? In openCV 2.4 this is a known bug. 在openCV 2.4中,这是一个已知的错误。 (fixed in later versions) (在以后的版本中修复)

You can olso try adding a dummy param, at the end, something like camera1.open("http://192.168.0.101/?dummy=video.mjpg"); 你可以尝试添加一个虚拟参数,最后是像camera1.open("http://192.168.0.101/?dummy=video.mjpg"); because opencv VideoCapture expects an extension at the end of the file name. 因为opencv VideoCapture需要在文件名末尾加一个扩展名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM