APRON Beginners

Hello! Thanks for showing an interest in using APRON (The Array Processing Environment). If your here, then I assume you are new to APRON and want to know what it is, what it does and if it can be of any use to you.

APRON is a software package that provides optimised array processing operations, such as those used in image processing, computer vision and neural networks. It is not a Software Development Kit (SDK), rather it is a graphical simulation environment that lets you interact with and analyse a running, perhaps real-time, simulation.

So what else is APRON not?

APRON is not an alternative to Matlab (or similar). APRON specifically deals with arrays of data called “registers”. It does this in a way similar to SIMD (Single Instruction, Multiple Data). This means that an operation is performed globally across every element of the array. You can mask regions of an array where you do/don’t want to perform operations. Register elements can also “communicate” with their nearest neighbours (although later we’ll see this can be extended).

APRON is not an alternative to OpenCV (or similar). Yes APRON is largely used for image processing and computer vision, but it is not an SDK. You cannot embed APRON code into your programs. The array operations provided are highly optimised, but are exposed in an assembly-like way. APRON can (and should) be used to control larger simulations, and has facilities for communicating with other software if needed.

So what is APRON actually used for?

APRON is fast, flexible and VERY easily extendable. If a particular function you need does not exist, create a plug-in! This is not as scary as it sounds, and the process is well documented. APRON is actually just a sequencer/controller for data moving between plug-ins. We have plug-ins for controlling robots, communicating over networks, using CUDA and GPUs, talking to custom VLSI chips, capturing data from cameras, all sorts!

APRON allows the user to create a script to control the flow of a simulation. The user can either “Run” the script, which is really quick, or they can step-through and debug the code. When a simulation is running, you can change parameters, stop it at any time, change some more stuff and continue running. The scripting language – “APRON Script” – is user friendly, and extendable. If you create a plug-in, access to that plug-ins capabilities are resolved through simple user-defined function names.

Why is APRON useful to me?

APRON is an excellent and easy way to get to grips with image processing. You literally work on the images displayed in the simulator. Each line of APRON Script equals one atomic function or process. Depending upon your configuration, an atomic function can be a simple “add two registers” or something really complex “use CUDA to FFT the image, then send the result to the robot”. The hierarchy is left up to you. Typicaly APRON users start with simple functions, and then start grouping them, encapsulating their functionality. This way you can create easily re-usable code across multiple projects. APRON also handles the visualisation and recording of data for you, so no more custom applications need to be built. The display in APRON is GPU powered, so no more DIBS, Brushes, Pens, buffers etc. It’s just there and ready.

Being highly visual allows the user to gain a real insight into what their algorithms are doing. Watching data move in real-time is far more intuitive than analysing traces and plots afterwords. Of course, sometimes this cannot be avoided, so APRON provides data recording functions as well.

So can I use APRON?

YES! APRON is versatile. In the labs at the moment, we have people using APRON to design custom processors, implement models of the visual cortex, exploring cellular processing architectures, creating games, modelling fluids, controlling robots, performing visual search tasks, creating presentational demo videos, learning image processing, modelling existing processors, prototyping vision sensors, exploring applications of focal-plane arrays…

How do I begin?

Firstly, download the package from this website. That version has some feature limitations, but is enough to get started with some large-scale simulations. If you want the latest unrestricted version, please contact the site directly. Secondly, you’ll need a text editor for creating APRON scripts. I recommend Crimson Editor, as we have syntax highlighting files and support for it. Once its all installed, open a demo in crimson editor. Most of these require a webcam, but there are a couple that don’t. In Crimson Editor hit CTRL+1 to compile, CTRL+2 to simulate. Click “RUN” at the top and watch, play, interact, analyse, hack, change to your heart’s content!

OK I’m interested. How do I learn APRON script?

The easiest way to learn is to look at the demos. Start with “SimpleCamera”. Then look in the docs folder for a list of the available functions at your disposal. Follow the tutorials that are posted on this website. More will be posted as time goes on. Set yourself a small challenge – can you implement Sobel’s Edge Detect on images captured from the webcam? Then try thresholding the edge-detected image. If you can do that then you’ve already mastered most of it.

Can you give me a really quick example of APRON?

Of course! The trick is to think in parallel. Programmers will be used to iterating through arrays of data sequentially, performing an operation. APRON will allow you to do this, but instead you should always think about operating upon the array resource as a whole object.

An example: Thresholding an image…

  • FOR x = 0 TO width STEP 1
    • FOR y = 0 TO height STEP 1
      • IF data[x][y] >= threshold THEN
        • data[x][y] = 1
      • ELSE
        • data[x][y] = 0
      • END IF
    • NEXT Y
  • NEXT X

But in APRON is


  • r[mask1] = mask.if(r[data], >=, threshold)
  • r[data] = 0
  • mask.on(r[mask1])
  • r[data] = 1

Leave a Reply