-
Notifications
You must be signed in to change notification settings - Fork 319
Installation (Linux, Octave, OpenCV 3)
This page provides a guide on how to install mexopencv with Octave on Ubuntu. It covers Octave 4, OpenCV 3 and latest mexopencv.
We compile OpenCV with "contrib" modules, which provide non-free features such as SIFT and SURF, as well as other experimental algorithms not included in main distribution.
The instructions below are meant for Ubuntu. Other Debian-like distros will probably also have these packages or similarly named ones available. Adjust accordingly for other Linux distributions.
First we install Octave 4. For older Ubuntu releases, you should use this
PPA ppa:octave/stable
.
For Xenial (16.04), Bionic (18.04) or newer install the official Octave package simply as:
$ sudo apt-get install octave liboctave-dev
For Precise (12.04) or Trusty (14.04), install Octave from the above PPA (maintained by GNU Octave team):
$ sudo add-apt-repository ppa:octave/stable
$ sudo apt-get update
$ sudo apt-get install octave liboctave-dev
Refer to the same instructions from here for compiling OpenCV (step 1).
You can also consult OpenCV's installation tutorial for building from
source (as long as you use the 3.4.1 version, and not master
).
Download the latest version of mexopencv:
$ cd ~/cv
$ wget -O mexopencv-master.zip https://github.com/kyamagu/mexopencv/archive/master.zip
$ unzip mexopencv-master.zip && mv mexopencv-master mexopencv
Compile the MEX-files for Octave:
$ cd ~/cv/mexopencv
$ make WITH_OCTAVE=true WITH_CONTRIB=true all contrib
Once it's done, you can start using OpenCV functions in Octave:
>> cd('~/cv/mexopencv')
>> addpath('~/cv/mexopencv')
>> addpath('~/cv/mexopencv/opencv_contrib')
>> addpath('~/cv/mexopencv/+cv/private') % HACK
>> addpath('~/cv/mexopencv/opencv_contrib/+cv/private') % HACK
>> cv.getBuildInformation()
You might wanna put those addpath()
calls in your ~/.octaverc
config file
if you don't want to have to repeat them every time Octave is started.
To verify the installation, you can optionally run the full test suite:
$ make WITH_OCTAVE=true WITH_CONTRIB=true test
Help: Stack Overflow (MATLAB, OpenCV) | MATLAB Answers | OpenCV Answers
- Windows + MATLAB
- Windows + Octave
- Linux + MATLAB
- Linux + Octave
- macOS + MATLAB
- macOS + Octave
- Windows + MATLAB
- Linux + MATLAB
- macOS + MATLAB