我试图在 Ubuntu 13.04 中安装 OpenCV 以使用我的 IP 摄像头,但没有成功。我一步一步地按照本教程http://www.ozbotz.org/opencv-installation/但它对我不起作用。我也尝试过其他教程,但我有同样的问题,Opencv 尝试按小时连接相机而没有任何响应。我正在使用此代码来捕获视频:
cap=cv2.VideoCapture("http://192.168.180.60:82/videostream.cgi?user=admin&pwd=")
该链接在我的浏览器中有效,因此流媒体还活着。我已经在虚拟机中安装了 Opencv 6 次尝试不同的配置但没有成功,也许我在任何一步都犯了错误,但根据教程我是对的,我正在尝试这个:
sudo apt-get remove ffmpeg x264 libx264-dev
sudo apt-get update
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg
sudo apt-get install libgtk2.0-0 libgtk2.0-dev libjpeg8 libjpeg8-dev yasm
cd ~
mkdir src
cd src/
git clone git://git.videolan.org/x264.git
cd x264/
./configure --enable-shared --enable-pic
sudo make install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore_amrwb-dev libtheora-dev libvorbis-dev libx264-dev libxvidcore-dev
cd ~/src
wget http://ffmpeg.org/releases/ffmpeg-0.11.1.tar.bz2
tar xvf ffmpeg-0.11.1.tar.bz2
cd ffmpeg-0.11.1
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic
make
sudo make install
cd ~/src
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-0.9.5.tar.bz2
tar xvf v4l-utils-0.9.5.tar.bz2
cd v4l-utils-0.9.5
./configure --enable-shared
make
sudo make install
sudo apt-get install libdc1394-22-dev
sudo apt-get install libvideo-ivtv-perl
cd ~/src
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2
tar xvf OpenCV-2.4.2.tar.bz2
cd OpenCV-2.4.2/
mkdir build
cd build
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D OPENCV_BUILD_3RDPARTY_LIBS=ON -D WITH_FFMPEG=ON -D WITH_GTK=ON -D WITH_OPENEXR=ON -D WITH_OPENNI=ON -D WITH_PNG=ON -D WITH_TBB=ON -D WITH_XINE=ON -D WITH_GSTREAMER=ON .