olambda tutorial

olambda is a single octave script designed for image manipulations. It uses iio to load and save images, and thus supports many image formats and can be piped from/to other programs. This tutorial shows the versatility of olambda through the following points:

Comparison with equivalent imscript programs are shown. Oftentimes the imscript programs provide shorter expressions for simple operations. However, olambda allows for more complex operations in a single call (e.g. take the modulus of the Fourier transform), whereas imscript programs would be combined with pipes. Furthermore, in the specific case of plambda, olambda is significantly faster (and sometimes more readable).

The idea of olambda is also to be usable by anyone who knows bits of MATLAB/Octave. The command line interface is straight forward and the user can directly use its knowledge of octave instead of learning how to use new tools.

1. Single image

olambda A.png "imsmooth(x,3)" -o A_gaussian_3.png
blur gaussian -s 3 A.png A_gaussian_3_imscript.png
olambda A.png "x .^ 2.2" | qauto - A_tonemap.png
plambda A.png "x 2.2 ^" | qauto - A_tonemap_imscript.png
olambda A.png "x + randn(size(x)) * 30" -o A_addnoise.png
plambda A.png "x randn randn randn join3 30 * +" -o A_addnoise_imscript.png
olambda barb.png "imresize(x, 0.5)" -o barb_downsa_resize.png
olambda barb.png "x(1:2:end,1:2:end,:)" -o barb_downsa.png
downsa f 2 barb.png barb_downsa_imscript.png
downsa v 4 barb.png | olambda - "imresize(x,4)" -o barb_upsa_resize.png
downsa v 4 barb.png | upsa 4 3 - barb_upsa_imscript.png
olambda barb.png "abs(fftshift(fft2(x)))" | qauto -p 1 - barb_fft.png
fft 1 barb.png | fftshift | plambda vnorm | qauto -p 1 - barb_fft_imscript.png

2. Multiple image operations

olambda {a,b}.jpg "abs(x - y)" -o ab_absdiff.png
plambda {a,b}.jpg "- fabs" -o ab_absdiff_imscript.png
olambda {a,b}.jpg "cat(3, x(:,:,1), y(:,:,2))" -o ab_channels.png
plambda {a,b}.jpg "x[0] y[1] join" -o ab_channels_imscript.png

(This document is a direct rip-off of the imscript tutorial. Credits go to Enric.)