ubuntu10.04+matlab r2011a+opencv2.2 安装于配置

一、ubuntu10.04的安装

选用ubuntu10.04是因为该版本是LTS版本。安装的时候,语言最好选择英语。


二、opencv2.2 的安装

1)下载opencv2.2 源码,下载地址为:http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/

2)建立基本的编译环境

sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
3)解压opencv安装包,并切换到包目录下
tar -xvf OpenCV-2.2.0.tar.bz2
cd OpenCV-2.2.0/
4)进入目录后,就可以看到CMakeLists.txt。在终端中执行一下语句,安装cmake。
sudo apt-get install cmake
cmake .
注意cmake后的点,表示在当前目录寻找CMakeLists.txt。然后在编译
make
编译完成后,安装
sudo make install
5)将opencv库添加到开发环境,编辑一下文件
sudo gedit /etc/ld.so.conf.d/opencv.conf
然后将下面的语句添加到文件中(也许文件是空的),保存退出
/usr/local/lib

执行下面的语句,更新库

sudo ldconfig
现在需要编辑另外一个文件,打开文件
sudo gedit /etc/bash.bashrc
在文件后加入,下边的语句
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

重启或者是注销后,opencv就安装好了。之后在用随带的例子进行编译检测。


参考

1)http://www.samontab.com/web/2010/04/installing-opencv-2-1-in-ubuntu/

2)http://www.samontab.com/web/2011/06/installing-opencv-2-2-in-ubuntu-11-04/


三、MATLAB r2011a的安装

Parent page: Programming Applications

Introduction

MATLAB® is a high-level language and interactive environment that enables you to perform computationally intensive tasks faster than with traditional programming languages such as C, C++, and Fortran.

You can use MATLAB in a wide range of applications, including signal and image processing, communications, control design, test and measurement, financial modeling and analysis, and computational biology. Add-on toolboxes (collections of special-purpose MATLAB functions, available separately) extend the MATLAB environment to solve particular classes of problems in these application areas.

MATLAB provides a number of features for documenting and sharing your work. You can integrate your MATLAB code with other languages and applications, and distribute your MATLAB algorithms and applications.

MATLAB R2011a

Important Note Regarding Ubuntu 11.04

MATLAB R2011a was released on April 8, 2011. Please note that this is prior to the release of Ubuntu 11.04. Consequently Ubuntu 11.04 is not a supported operating system for MATLAB R2011a.

MATLAB R2011a users are strongly encouraged to install R2011a on Ubuntu 10.04 LTS or Ubuntu 10.10 for best results. Installation of MATLAB R2011a on unsupported Ubuntu releases are outside the scope of this documentation.

Installation Instructions

  • You will need superuser privileges. The assumption is that MATLAB install files are located at/media/MATHWORKS_R2011a in your filesystem.

0. Mount iso and cd to its direction.

1. Run the MATLAB installer with the following Terminal command:

sudo ./install

2. When prompted to 'Choose installation type' you should select custom. This will allow you to create symbolic links to MATLAB in /usr/local/bin.

Choose installation type

3. When prompted to 'Specify installation folder' it is recommended that you use the default folder/usr/local/MATLAB/R2011a.

Specify installation folder

4. When given the option to 'Create symbolick links to MATLAB scripts in:' it is recommended that you check the box and use the supplied path /usr/local/bin.

Create symbolick links to MATLAB scripts in:

Create A MATLAB Launcher

1. Get an icon:

sudo wget http://upload.wikimedia.org/wikipedia/commons/2/21/Matlab_Logo.png -O /usr/share/icons/matlab.png

2. Get the launcher file:

sudo wget 'https://help.ubuntu.com/community/MATLAB?action=AttachFile&do=get&target=matlab-r2011a.desktop' -O /usr/share/applications/matlab.desktop

注意:下载下来的matlab.desktop文件有问题,需要修改。可能需要修改成
#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Icon=/usr/share/icons/matlab.png
Name=MATLAB R2011a
Comment=Start MATLAB - The Language of Technical Computing
Exec=sh /usr/local/MATLAB/R2011a/bin/matlab -desktop
Categories=Development;
其中,Exec的配置要安装具体情况重新配置。


MEX functions

If you try to compile MEX functions you may see a message like the following:

Warning: You are using gcc version "4.4.4-14ubuntu5)".  The version
         currently supported with MEX is "4.3.4".
         For a list of currently supported compilers see:
         http://www.mathworks.com/support/compilers/current_release/

Note this is a warning - the MEX function will still compile.

The following instructions will setup gcc 4.3 and make it the default compiler for MATLAB:

1. Install The GNU Compiler Collection 4.3 and The GNU Standard C++ Library

sudo apt-get install gcc-4.3-multilib libstdc++6-4.3-dev

2. Make a MATLAB specific 'bin' directory for gcc symlink.

mkdir ~/.matlab/bin

3. Symlink gcc to gcc-4.3 via user MATLAB specific 'bin' directory.

ln -s /usr/bin/gcc-4.3 ~/.matlab/bin/gcc

4. Add MATLAB specific 'bin' directory to the front of your system $PATH within your local startup.m file.

printf "setenv('PATH',sprintf('/home/%%s/.matlab/bin:%%s',getenv('USER'),getenv('PATH')));\n" >> ~/Documents/MATLAB/startup.m

Steps 3 and 4 above may not work for at least one instance of a user trying to compile using MEX in MATLAB R2011a running on Ubuntu 10.10. An alternative is to do the following:

  • 3a. At the MATLAB Command Window prompt, type:

mex -setup

and choose option 2 which says:

 2: /usr/local/MATLAB/R2011a/bin/mexopts.sh : 
      Template Options file for building MEX-files via the system ANSI compiler

This will copy to your home directory a local copy of the file mexopts.sh.

  • 4a. Then edit this local file:

sudo gedit ~/.matlab/R2011a/mexopts.sh

and replace all instances of CC='gcc' to CC='gcc-4.3', CXX='g++' to CXX='g++-4.3', and FC='gfortran' to FC='gfortran-4.3'. Save and exit. The next time you run MEX in MATLAB to compile it will work properly.


共享库问题

运行matlab编译时,由于matlab强制调用自己的库文件,导致不能正常运行。并报类似于下边的错误:

/......./libstdc++.so.6: version `GLIBCXX_3.4.11' not found

具体解决方法:

1)备份matlab目录(默认安装目录:/usr/local/MATLAB/R2011a/sys/os/glnx86,本人电脑)的libstdc++.so.6文件。

sudo mv libstdc++.so.6 libstdc++.so.6_backup
2) 让MATLAB的libstdc++.so.6 软链接指向Linux的库文件
sudo ln -s /usr/lib/libstdc++.so.6 /usr/local/MATLAB/R2011a/sys/os/glnx86/libstdc++.so.6

参考

1) https://help.ubuntu.com/community/MATLAB


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值