Python for MATLAB Users:
Promoting Open Source Computer Vision Research
Thursday, June 21, 2012


Organizers
Matt Leotta   Kitware, Inc., USA
Amitha Perera Kitware, Inc., USA
Eran Swears  Kitware, Inc., USA
Patrick Reynolds Kitware, Inc., USA
Yong Zhao Google Research
Varun Ganapathi Google Research

Materials

Source code for slides can be downloaded here.

Course materials (slides, code examples, virtual appliance) can be downloaded here.

Course Description

This tutorial is a hands-on introduction to using Python for rapid prototyping and computer vision research.  Python is presented from a MATLAB user’s point of view, showing how to directly map the familiar MATLAB syntax and workflow to a very similar syntax and workflow in Python.  The goal of the tutorial is to provide a free and open source alternative to MATLAB to promote open science and to better prepare students for careers outside of academia.

The target audience is students, professors, researchers, and software developers who are interested in using Python for computer vision research.  In particular, there is an orientation toward developers who primarily use MATLAB for computer vision applications.  While the focus is on replicating a MATLAB-like work flow using open source software, attendees are not strictly required to have MATLAB experience.  Attendees are required to have some prior programming experience as well as basic familiarity with linear algebra and common computer vision algorithms.

This is a full day tutorial divided into a morning and an afternoon session.  The morning session provides an introduction to Python and focuses on migrating from MATLAB to Python for general scientific computing.  The afternoon session focuses more on application of Python to computer vision problems, using third party computer vision libraries, and other advanced topics.

Attendees who would like to participate should bring a laptop.  Participating attendees will receive USB stick containing a virtual appliance (VirtualBox) with the full scientific Python environment pre-configured, and will execute programming exercises ranging from the introductory level to the intermediate level.  Attendees wishing to participate are strongly encouraged to attend both morning and afternoon sessions.


Motivation

MATLAB has long been the language of choice for rapid development in much of the computer vision community. It has a simple, easy to learn syntax. Its matrix-centric data structures are well suited to representing and manipulating images. MATLAB comes with a large number of built-in algorithms for numerical computing, image processing, and signal processing. Its IDE allows for interactive experimentation, introspection, and plotting. Academic licensing at most universities makes MATLAB effectively free for use in research and as a platform for teaching computer vision. It is a powerful tool and its popularity in the field is well deserved.

Unfortunately, MATLAB is not a free and open source solution. Outside of academic institutions, MATLAB is often prohibitively expensive. Many private research institutions avoid MATLAB development and maintain a limited number of MATLAB licenses for running 3rd party code. This means that students who are taught computer vision through MATLAB are often unprepared for jobs outside of academia. Furthermore, MATLAB licensing inhibits open scientific collaboration. Research code written in MATLAB can be shared, but the cost of MATLAB licensing limits the number of researcher who can run that code.

Open source alternatives to MATLAB have had a large upswing is recent years. Tools such as Octave and SciLab aim to provide an open source analog to MATLAB, but have relatively small user communities. On the other hand, Python is a powerful open source, interpreted language that has enjoyed broad adaption in a large variety of application areas. Python itself is not a MATLAB replacement, but additional modules have been developed for Scientific computing (NumPy/SciPy), plotting (matplotlib, guiqwt), and IDE (Spyder). These libraries are designed to make Python as capable as MATLAB for computer vision research. The plethora of other libraries available for Python make it more capable than MATLAB in many ways.

The aim of this tutorial is to teach MATLAB users how to migrate their familiar interactive, matrix-based, work flow to Python. We hope these ideas will trickle back into academia and reduce the dependency of computer vision research on proprietary software. This will both promote open science and better prepare students for jobs outside of academia.


Syllabus and Schedule
Morning Session
  1. Virtual Appliance Setup (for hands on participants)
  2. Overview of Python and other open source MATLAB alternatives
  3. Introduction to the Python language
  4. Python for Scientific Computing
    1. NumPy
    2. SciPy
    3. Matplotlib
  5. Using the Spyder Python IDE
Afternoon Session
  1. Python for Computer Vision
    1. Basic image I/O
    2. Basic image processing using NumPy/SciPy
    3. discussion of 3rd party libraries for vision, machine learning, etc.
    4. working with SimpleITK
    5. working with OpenCV
  2. Parallel Processing with Python
    1. Distributing over multiple processes
    2. Using OpenCL for heterogeneous computing
  3. Interfacing Python with other languages
    1. Calling legacy MATLAB code from Python
    2. Wrapping C/C++ code for Python



 8:30 am Overview, Virtual Machine Setup
 9:00 am Intro to Python
 10:00 am - 10:30 am Coffee Break

 10:30 am

Python Scripting 

 11:15 am

Scientific Python - Numpy, Matplotlib, SciPy 

 12:30 am - 1:30pm Lunch

 1:30 pm

Using OpenCV 

 2:15 pm

Using Simple ITK 

 3:00 pm - 3:30 pm    Coffee Break

 3:30 pm

Parallel Processing / GPU Processing 

 4:15 pm

Interfacing Python with C / C++ 

 4:45 pm

Interfacing Python with MATLAB 

 5:00 pm

Wrap-up Raffle