2016-11-21 72 views
1

我想运行一些神经网络和机器学习算法,如使用来自robotic camera (PTZ)的输入的面部跟踪来控制相机的运动并访问扬声器。Foscam的IP摄像头R2有API吗?

我打算购买Foscam的R2,但我没有使用IP摄像机的经验。我试图联系Foscam,但他们提供了非常有限的信息,并提请我申请SDK。有谁知道,如果我能在没有智能手机应用程序的情况下控制相机,而是通过某种编程界面?

关于德国亚马逊的产品信息,它被写入NVR兼容ONVIF和FTP服务器(连接到路由器,NAS的硬盘驱动器)。据我所知,ONVIF指定了一个标准,我在Youtube上发现了一些C#ONVIF教程,但我仍不确定这是否意味着肯定有一个R2的API,可以让我做所有我需要的事情。

有没有人有足够的经验来帮助我?另外,我可以直接将相机连接到树莓派,并避免在网络上使用它并直接访问该功能?

+0

嗨,它工作? – Delta

回答

4

寻找一个SDK/API自己,我发现这个链接: http://foscam-uk.com/download/SDK/

它包括HTTP GET PDF文档的命令到foscam的几乎所有功能。

+0

是的,我也发现了这一点,我申请了Foscam SDK并获得了许可,但到目前为止我还没有设法实际做过什么。 – TheMindWithin

0

看一看这个API文档:http://www.camarasip.es/descarga/IP_Camera_CGI_(SDK).pdf

尝试一下在你的选择,例如的浏览器与:

http://XXX.XXX.XXX.XXX:XX/cgi-bin/CGIProxy.fcgi?usr=YOURUSER&pwd=YOURPASS&cmd=snapPicture2 

这将返回在您的浏览器中的相机JPG快照。也可以使用PTZ控制,例如,

http://XXX.XXX.XXX.XXX:XX/cgi-bin/CGIProxy.fcgi?usr=YOURUSER&pwd=YOURPASS&cmd=ptzMoveUp 

如果成功的话,你应该看到的相机移动,你应该得到的回应是这样的:

<CGI_Result> 
    <result>0</result> 
</CGI_Result> 

下一步,这种直接HTTP接口的R2显然也内置了ONVIF支持。有一个node.js模块(https://github.com/futomi/node-onvif),我已经可以使用它来连接以获取一些相机信息,并且我已经能够使用它来进行一些PTZ控制,但是如果它仍然认为不会退出。

到目前为止,我最大的障碍是我找不到任何东西,只能将RTSP视频流集成到网页中。以前的Foscam相机,例如8910W具有这种能力。

这里是ONVIF的代码,对我来说,到目前为止的工作:

onvif.startDiscovery(function(info) { 
 
     // Show the device name and the URL of the end point 
 
     console.log('\n********* Retrieved Discovery Info ***********'); 
 
     console.log(JSON.stringify(info, null, ' ')); 
 

 
     // Create an OnvifDevice object 
 
     var device = new onvif.OnvifDevice({ 
 
     xaddr: info.xaddrs[0], 
 
     user: 'YOURUSER', 
 
     pass: 'YOURPASS' 
 
     }); 
 

 
     // Initialize the OnvifDevice object 
 
     device.init(function(error) { 
 
      if (error) { 
 
      console.log('[ERROR] ' + error.message); 
 
      } else { 
 
      // Get the detailed device information 
 
      var device_info = device.getInformation(); 
 
      // Show the result 
 
      console.log('\n********* Retrieved Discovery Info ***********'); 
 
      console.log(JSON.stringify(device_info, null, ' ')); 
 
      var url = device.getUdpStreamUrl(); 
 
      console.log('UDP Stream URL: ' + url); 
 

 
      var profile_list = device.getProfileList(); 
 
      for (var i = 0; i < profile_list.length; i++) { 
 
       console.log('\n********* Retrieved Profile ***********'); 
 
       console.log(profile_list[i]); 
 
       console.log('\nPTZ:'); 
 
       console.log(profile_list[i].ptz); 
 
      } 
 

 
      // The OnvifServicePtz object 
 
      var ptz = device.services.ptz; 
 

 
      if (ptz) { 
 
       console.log('Current Token: ' + device.getCurrentProfile()['token']); 
 

 
       var params = { 
 
       'ProfileToken': device.getCurrentProfile()['token'], 
 
       'Position': { 
 
        x: .5, 
 
        y: 0, 
 
        z: 0 
 
       }, 
 
       'Timeout': 1 
 
       }; 
 

 
       ptz.absoluteMove(params, function(error, result) { 
 
       { 
 
        if (error) { 
 
        console.log('[ERROR] ' + error.message); 
 
        } else { 
 
        console.log(JSON.stringify(result.data, null, ' ')); 
 
        } 
 
       }); 
 
       } else { 
 
       console.log('[ERROR] Your ONVIF network camera does not support the PTZ service.'); 
 
       } 
 
      } 
 
      }); 
 

 
     });

0

我找到了一个稍微更近API doc

您可能还会从python foscam library收集一些信息。对于直接连接 - 如果你的raspi没有使用以太网端口,你可以得到一个交叉电缆并直接插入,并在该电缆上设置一个小静态网络;这将解决您在两个盒子之间可能遇到的任何带宽问题。