ubuntu14.04+caffe+opencv

来源:互联网 发布:千锋 育知同创 编辑:程序博客网 时间:2024/05/09 12:59
opencv2.4.9安装:
1.进行系统更新
sudo apt-get update
sudo apt-get upgrade


2.安装依赖包
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev 
cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev 
libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev 
sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev
 default-jdk ant libvtk5-qt4-dev
make
sudo make install




3.下载opencv2.4.9:
cd ~ 
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip
cd opencv-2.4.9
4.生成makefile
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 WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON ..
5.
make
sudo make install


6.
   Now you have to configure OpenCV. First, open the opencv.conf file with the following code:
sudo gedit /etc/ld.so.conf.d/opencv.conf
  Add the following line at the end of the file(it may be an empty file, that is ok) and then save it:
/usr/local/lib
   Run the following code to configure the library:
sudo ldconfig
    Now you have to open another file:
sudo gedit /etc/bash.bashrc
   Add these two lines at the end of the file and save it:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
Finally, close the console and open a new one, restart the computer or logout and then login again. OpenCV will not work correctly until you do this.
Now you have OpenCV 2.4.9 installed in your computer with 3D visualization, Python, Java, TBB, OpenGL, video, and Qt support.
Check out the cool Qt interface which provides image viewing capabilities with zoom, as well as the ability to save the current image with just one click.


2.安装开发所需要的一些基本的包,


sudo apt-get install build-essential
sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage 
python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags
 Cython ipython 
如果不可行,则可以执行:


sudo apt-get update


3.安装BLAS
sudo apt-get install libatlas-base-dev
4.安装【dependencies】任意路径下可执行
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev
 libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
5.matalab2014a安装
http://blog.csdn.net/lanbing510/article/details/41698285点击打开链接
http://www.cnblogs.com/txg198955/p/5477258.html点击打开链接


6.编译caffe
cd ./caffe-master/
cp Makefile.config.example Makefile.config
接下来就是修改配置文件Makefile.config:
将# CPU_ONLY = 1前面的#去掉 并按“tab”键,(默认从tab处执行),因为这里没有安装GPU,需要使用CPU运行。
始编译过程:
主要过程为:
sudo make all -j8
sudo make test
sudo make runtest


7.编译python wrapper
make pycaffe
0 0
原创粉丝点击