Exercises

  Abgaben
  • bitte zu zweit bearbeiten
  • als iPython notebook Datei
    • an lw2013@iupr.com
    • Namen und E-Mailadresse in die ipynb Datei
    • und Namen oder Gruppennamen in Dateinnamen
  • Abgabefrist wird mit der Aufgabe bekanntgegeben (normaler Weise 7 Tage)
  • Neu onlne gestellte Aufgaben und Updates werden auf der Ankündigungen-Seite bekanntgegeben.

Hinweise zu den Übungsaufgaben:

  • Die Übungsaufgaben sind sehr wichtig, um die Vorlesungsinhalte zu verstehen. Sie können Bildverarbeitung und Mustererkennung nicht nur theoretisch lernen, Sie müssen mit Bildern und Daten arbeiten.
  • Übungsaufgaben benötigen nur Inhalte, die in der Vorlesung behandelt worden sind. Die Worksheets enthalten oft schon viel Code, der bei der Lösung der Übungsaufgaben hilft.
  • Alle Übungen sollten nur Bibliotheken und Funktionen benötigen, die in der Vorlesung behandelt worden sind (plus die Standardbibliotheken sys, os, glob, und re). Wenn Sie meinen, dass ein Problem ohne andere Bibliotheken nicht lösbar ist, sprechen Sie mit Ihrem Übungsleiter.
  • Die Übungsaufgaben sollten einige Stunden zur Lösung brauchen. Wenn Sie meinen, dass Sie zu viel Zeit benötigen, sprechen Sie mit Ihrem Übungsleiter.
  • Zum Starten von iPython Notebook
    1. gehen ('cd') Sie zum Ordner in dem Ihre ipython notebook Dateien liegen und
    2. tippen Sie folgenden Befehl in die Konsole ein:  ipython notebook --pylab=inline
      • --pylab ist equivalent zu from pylab import *. 1
      • inline sorgt dafür, dass Bilder im notebook und nicht als neues Fenster angezeigt werden
1 ­Soge­nannte 'Sternchen'-Importe sind eigentlich verpöhnt, da sie die Herrkunft der Funktionen verschleiern. Bei Pylab wird eine Aussnahme gemacht, wenn man in interactiven Umgebungen arbeitet (iPython, Python interpreter), da sie die in diesem Fall Sachen vereinfachen. Mehr dazu auch im entsprechenden Kapitel im Tutorial: Importing objects from modules und Matplotlib Coding Styles

iPython Notebook mit Passwort sichern: (NEU)

Wenn Sie iPython Notebook auf den SCI-Computern nutzen, raten wir dringend dazu ihre iPython Notebook Sitzung mit einem Passwort zu sichern. Andernfalls koennen sonst andere auf Ihre Notebooks zugreifen.  Ein Password laesst sich in drei Schritten setzen. Weitere Informationen gibt es in der iPython Dokumentation
  1. Falls nicht vorhanden mit ipython profile create folgende Ipython Konfigurationsdatei erzeugen: ~/.ipython/profile_default/ipython_notebook_config.py
  2. In Python einen Hash generieren mit: from IPython.lib import passwd; passwd()
  3. In Zeile 85 von ipython_notebook_config.py den vorher generierten Passworthash bei c.NotebookApp.password = u'' einfeugen und die Raute loeschen.

Lecture 1

  1. Implement heapsort in an iPython notebook. Write some test cases and show both the input and output for those test cases in the notebook.
  2. Write a Python script that loads every image in the current directory, converts it from color to grayscale, and then saves it back to disk. An image called "image.png" should be saved as "image-gray.png".
Beispiellösungen
Lecture 2
iPython Notebook aus dem Seminar: Tutorial1 

(1) Assume you have two monitors with emission matrices 
    
That is, given an RGB value c, the output spectrum received by the eye from the monitor (in our 400-dimensional representation) is 
    
Assume that the eye sensitivity matrix (as defined in the lecture), that is, a matrix that maps a 400-dimensional spectrum into cone activations, is given by
    
Write a Python function that, given E1, E2, and M as parameters, maps RGB values approximately from one monitor to the other. Make sure to output only legal RGB values. Hand in your solution in the form of a notebook.

(2a) Consider this function:

def check_grayworld(image,epsilon=0.01):
    assert amin(image)>=0 and amax(image)<=1
    if amin(image)>epsilon: return False
    if amax(image)<1.0-epsilon: return False
    m = mean(mean(image,axis=0),axis=0)
    m /= amax(m)
    return amax(abs(m-1.0))<epsilon

Write a function grayworld_normalize(image) such that it transforms the input image in such a way that check_gray is true and that the resulting normalized image looks "reasonable" most of the time. Hand in your solution in the form of a notebook.

(2b) Consider this function:

def check_highlight(image,epsilon=0.01):
    assert amin(image)>=0 and amax(image)<=1
    if amin(image)>epsilon: return False
    if amax(image)<1-epsilon: return False
    if amax(sum(image,axis=2))< 3-epsilon:  return False
    return True 1

1 now with return

Write a function highlight_normalize(image) such that it transforms the input image in such a way that check_highlight is true and that the resulting normalized image looks "reasonable" most of the time. Hand in your solution in the form of a notebook.

Abgabefrist: Donnerstag, der 2. Mai um 23:59

Lectures 3+4

 - see lecture notebook on gradient-filters for guidance and code examples
 - show that your code is working correctly by printing out variables and showing images in a sensible way
 - execute 'Run all' before sending in the notebook, to make sure everything works and the results are saved in the notebook
Abgabefrist: Sonntag, der 26. Mai um 23:59

Lectures 5+6

 - This worksheet comes in the form of a 'cloze' (Germ: Lückentext) 
 - The gaps you have to fill with your code are marked with: # YOUR CODE HERE; OUTPUT SHOULD LOOK LIKE THE IMAGE BELOW
 - Your code should result in an image / graph, that looks like the provided example.
 - Each task should not need more than a handful of lines. If you take too long to finish it, document what you did and send it in your work.
 - And as usual:
     - show that your code is working correctly by printing out variables and showing images in a sensible way
     - execute 'Run all' before sending in the notebook, to make sure everything works and the results are saved in the notebook
Abgabefrist: Sonntag, der 16. Juni um 23:59
Beispielloesung

Lectures 7+8

Folien: Wiederholung Morphologische Operatoren


Lecture 11 NEU

Genau Aufgabenstellung und Hinweise stehen in dem Notebook
Abgabefrist: Sonntag, der 14. Juli um 23:59

ċ
Ex1.ipynb
(4k)
Ludwig Schmidt-Hackenberg,
Apr 26, 2013, 2:35 AM
ċ
Ex2.ipynb
(523k)
Ludwig Schmidt-Hackenberg,
May 16, 2013, 9:17 AM
ċ
Frequency Modulation and Encoding.ipynb
(614k)
Ludwig Schmidt-Hackenberg,
Jun 20, 2013, 10:01 AM
ċ
HW - Improve OCR MNIST with morphological filters.ipynb
(172k)
Ludwig Schmidt-Hackenberg,
Jul 4, 2013, 9:58 AM
Ċ
Ludwig Schmidt-Hackenberg,
Jun 13, 2013, 8:55 AM
ċ
Tutorial 1.ipynb
(824k)
Ludwig Schmidt-Hackenberg,
Apr 25, 2013, 12:07 PM
ċ
hw-edge-detection-loesung.ipynb
(4455k)
Ludwig Schmidt-Hackenberg,
May 28, 2013, 10:55 AM
ċ
hw-edge-detection.ipynb
(215k)
Ludwig Schmidt-Hackenberg,
May 7, 2013, 10:57 AM
ċ
hw-frequency-modulation.ipynb
(607k)
Ludwig Schmidt-Hackenberg,
Jun 6, 2013, 4:17 AM
Comments