Hands On - Part I

1. Register in Adessowiki platform

2. Create your own Adessowiki Page

This page should contain your name, institution and other personal information. You can use this homepage as template: HomePage Template.

3. Code execution

Articles written on Adessowiki can embed programming code that will be executed on the server when the page is rendered, incorporating the results as figures, texts and tables on the document.

The enclosed code, for example, reads an image, processes it and shows the resulting image.



 1 from ia636 import *
 3 # reads an image
 4 f = adread('lenina.pgm')
 6 # set parameters
 7 theta = pi/6             # set rotation parameter
 8 scale = [1,1]            # set scale parameter
 9 t = [0,0]               # set translation parameter
11 # create the transformation matrix
12 Ts   = [[scale[1],0,0],
13         [0,scale[0],0],
14         [0,   0    ,1]]              #Scale
16 Trot = [[cos(theta),-sin(theta),0],
17         [sin(theta),cos(theta) ,0],
18         [0         ,0          ,1]]  #Rotation
20 Tx   = [[1,0,t[1]],
21         [0,1,t[0]],
22         [0,0,1   ]]                  #Translation
24 # execute the affine transformation
25 g = iaffine(f,dot(Tx,dot(Ts,Trot)))
27 # image visualization
28 adshow(f,"Original image")
29 adshow(g,"Affine transformation Result")

Original image

Affine transformation Result

Task I: let´s get started

The code show is an example of using iaffine function. This function is implemented on ia636 toolbox, an open source library. This program executes affine transformations according to the input parameter:
  • Rotation: theta
  • Scale: scale
  • Translation: t.

Your task is to change the parameter in order to get different resulting images. First of all, create a link to the first hands-on on your page. Then, copy and paste the code shown below and execute:

  • A rotation;
  • A vertical translation;
  • A horizontal translation;
  • A scale procedure to zoom in;
  • A scale procedure to zoom out;
  • A cascade procedure comprising rotation, translation and scale operations;

Task II: getting hard (optional)

Original image

Affine transformation Result

The code executes a cascade operation on the input image. Unfortunally, the result image is not the expected one. We lost relevant information that will be necessary for other operation. Note that affine transformation results depends on the order in which the operations are been executed. Your task is to solve this problem by doing some modifications in the program code.

  • Change the order in which the operations are done
  • Change the parameters

Task III: For Jedi Masters (optional)

In this task, you are invited to explore the functions of ia636 toolbox. You should first use the code fragment of the samples shown before to:

  • generate a python code on AdessoWiki and
  • read a image file

Then, use your image processing knowledge and make an interesting demonstration. We suggest those interesting options: