如何使用OpenCV(C ++代码)访问IP摄像机?有没有办法访问OpenCv + vlc? (Windows 7的) [英] How to access an IP camera using OpenCV (C++ code) ? is there a way to access with OpenCv+vlc ? (windows 7)

查看:133
本文介绍了如何使用OpenCV(C ++代码)访问IP摄像机?有没有办法访问OpenCv + vlc? (Windows 7的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了很多方法,但有些程序给我一个灰色的空白屏幕而另一个只是退出代码检测相机无法访问但是找不到解决方案,即使程序在opencv中成功构建。



我在Opencv 2.4.3上使用Microsoft Visual Studio 2010



这些是我相机的规格。 />


- H.264 / MJPEG视频压缩

-G.722音频压缩

- 帧率30fps / NTSC ,25fps / PAL

- 分辨率:720P,D1,半D1,CIF,

- 1/3SONY CCD,CMOS

- 报警I / O支持动作检测,日期,时间,事件触发

- 自动日/夜

- 双向音频,广播系统

- RTSP,VLC(PS / TS)流媒体协议

- 比特率变量32Kbps-4000Kbps

- 使用密码保护的多级用户访问

- 免费管理软件支持1-100个频道

解决案例

如果相机安装正确,你可以尝试我在这里找到的解决方案:

http://answers.opencv.org/question/133/how-do-i-access-an-ip-camera/ [ ^ ]





  #include   <   stdio.h  >  
#include < opencv2 / opencv.hpp >
#include < iostream >

int main( int char **)
{
cv :: VideoCapture vcap;
cv :: Mat图像; // 这适用于D-Link CDS-932L
const std :: string videoStreamAddress = http://< username:password xmlns :username = #unknown > @< ip_address> /video.cgi?.mjpg ;

// 打开视频流并确保其已打开
if (!vcap.open(videoStreamAddress))
{
std :: cout<< 打开视频流或文件时出错<<的std :: ENDL;
返回 - 1 ;
}

for (;;)
{
if (!vcap.read(image))
{
std :: cout<< 无框架<<的std :: ENDL;
cv :: waitKey();
}

cv :: imshow( 输出窗口 , 图片);
if (cv :: waitKey( 1 )> = 0
break ;
}

}


 谢谢  所以    您的 回复 先生  am  执行  a  图像 处理 project     human  检测 使用  my   ip   camera   so   to  执行   需要  to   access   Ip   camera    使用  opencv < /跨度>。     used  几个 C ++ 代码 项目  to  执行    始终    a  问题    access    使用    IP  地址 as    示例  =   1 http:  //   888888:888888@192.168.1.19:8081 / cgi / mjpg / mjpg.cgi?.mjpg;  
2 rtsp: // cam_address:554 / live.sdp
3 http: // 888888:888888@192.168.1.19:3001 / video.cgi?resolution = 640x360& req_fps = 50& .mjpg

< span class =code-leadattribute> I
am 缺少 某事 < my camera


I have tried many ways but some programs give me a gray color empty screen and another just exit the code detecting camera can not be accessed but couldn't find a solution even though program are successfully build in opencv.

I am using Microsoft Visual Studio 2010 with Opencv 2.4.3

These are the specification of my camera.

- H.264/MJPEG video compression
-G.722 audio compression
- Frame rate 30fps /NTSC, 25fps/PAL
- Resolution: 720P, D1, Half D1, CIF,
- 1/3" SONY CCD, CMOS
- Alarm I/O support motion detection, date, time, event trigger
- Auto Day/Night
- Two-way audio, broadcast system
- RTSP, VLC(PS/TS) stream media protocol
- Bit rate variable 32Kbps-4000Kbps
- Multi-level user accessing with password protection
- Free management software support 1-100 channels

解决方案

If the camera is installed correctly you can try this solution which i found here:
http://answers.opencv.org/question/133/how-do-i-access-an-ip-camera/[^]


#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>

int main(int, char**) 
{    
   cv::VideoCapture vcap;    
   cv::Mat image;    // This works on a D-Link CDS-932L    
   const std::string videoStreamAddress = "http://<username:password xmlns:username="#unknown">@<ip_address>/video.cgi?.mjpg";    

//open the video stream and make sure it's opened    
if(!vcap.open(videoStreamAddress)) 
{        
   std::cout << "Error opening video stream or file" << std::endl;        
   return -1;    
}    

   for(;;) 
   {        
      if(!vcap.read(image)) 
      {            
         std::cout << "No frame" << std::endl;            
         cv::waitKey();        
      }        

      cv::imshow("Output Window", image);        
      if(cv::waitKey(1) >= 0) 
         break;    
   }   

}


Thank you so much for your reply sir, I am doing a Image processing project of human detection using my ip camera so to do that need to access Ip camera directly using opencv. I have used several C++ code projects to do that but always have a problem with access it using the IP adress, as an example = 1."http://888888:888888@192.168.1.19:8081/cgi/mjpg/mjpg.cgi?.mjpg";
2.rtsp://cam_address:554/live.sdp
3.http://888888:888888@192.168.1.19:3001/video.cgi?resolution=640x360&req_fps=50&.mjpg

I am missing something when im using it with my camera.


这篇关于如何使用OpenCV(C ++代码)访问IP摄像机?有没有办法访问OpenCv + vlc? (Windows 7的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆