MATLAB and Octave Functions
for Computer Vision and Image Processing


Peter Kovesi

 


Index to Code Sections


The complete set of these functions is available as a zip file MatlabFns.zip

MATLAB

To use these functions you will need MATLAB and the MATLAB Image Processing Toolbox.
You may also want to refer to the MATLAB documentation and the Image Processing Toolbox documentation

Octave

Alternatively you can use Octave which is a very good open source alternative to MATLAB. Almost all the functions on this page run under Octave. See my Notes on using Octave.

MATLAB/Octave compatibility of individual function is indicated as follows

  • Runs under MATLAB and Octave.
  • Only runs under MATLAB.
  • Not tested under Octave.

These days I work almost entirely in Julia. I am no longer developing any new code in MATLAB. Collections of functions that I have ported to Julia are indicated in the code sections below.




I receive many mail messages regarding this site. I will endeavor to respond to mail that directly concerns the use of individual functions. However, please note I do not have the time to provide an on-line vision problem solving service!

Please report any bugs and/or suggest enhancements to
pk@peterkovesi.com

Cheers,
Peter Kovesi


Perceptually Uniform Colour Maps

Many widely used colour maps have perceptual flat spots that can hide features as large as 10% of your total data range. They may also have points of locally high colour contrast leading to the perception of false features in your data when there are none. MATLAB's 'hot', 'jet', and 'hsv' colour maps suffer from these problems. Use the perceptually uniform colorcet maps instead! For an overview of this work and the theory behind it please visit colorcet.com.


Generation and correction of colour maps

If you want to experiment with the generation of your own perceptually uniform colour maps...

Rendering of images with colour maps

Ternary Images

Test images

Visualization of colour map paths and colour spaces

Functions for reading and writing colour maps in various formats

Colour blindness simulation and visualization.

Colour space conversions.

Additional supporting functions that are required.


Julia Code

Python Colour Maps

R Colour Maps

Reference:


Interactive Image Blending

These functions provide a set of interactive tools for visualizing multiple images. Some videos of their use can be seen here.

The functions above also require: normalise.m, histtruncate.m, circle.m, circularstruct.m and namenpath.m.

Demo package: Download BlendDemo.zip. This contains all the functions above and some sample data sets. Within the expanded folder in MATLAB run blenddemo.m. A series of windows will open, each demonstrating a different blending interface. Click in any of them and play!

Reference:


Phase Based Feature Detection and Phase Congruency


References:

    For those working in Julia the package ImagePhaseCongruency.jl implements most of the functions above.


Spatial Feature Detection

Reference:

    For those working in Julia the package ImageProjectiveGeometry.jl implements most of the functions above.


Segmentation


Integral Images

Reference:


Non-Maxima Suppression and Hysteresis Thresholding



Edge Linking and Line Segment Fitting


image

edges

labeled edges

fitted line segments


Test Grating for Edge Detection


Test image

Canny edge image

Phase congruency

Colour coded for feature type


Image Denoising

 

Reference:

    For those working in Julia the package ImagePhaseCongruency.jl implements this function.


Surface Normals to Surfaces


Surface Normals
     
Surface Reconstruction

Reference:


Scalogram Calculation



Anisotropic diffusion

 


Grey Scale Transformation and Enhancement


Frequency Domain Transformations

    For those working in Julia the package ImagePhaseCongruency.jl implements most of the functions above.


Functions Supporting Projective Geometry


image of beach

rectified beach

    For those working in Julia the package ImageProjectiveGeometry.jl implements most of the functions above.


Feature Matching


Model Fitting and Robust Estimation


Putative matches obtained
by matchbycorrelation.m
   
Inlying matches consistent
with fundamental matrix

References:

    For those working in Julia the package ImageProjectiveGeometry.jl implements most of the functions above.


Fingerprint Enhancement

   

Geoscientific and Geophysical Functions

   

Reference:


Interesting Synthetic and Test Images






ASCII Image Generation



Homogeneous Transforms

Quaternions

Angle-Axis Descriptors

    For those working in Julia the package ImageProjectiveGeometry.jl implements most of the functions above.


Image Display, Image Writing and Miscellaneous

Geometric shapes

String handling convenience functions