IPA 2017 Lab Exercise 1 (15 Points) Exercise due: 20th of October 2019 23:55 How to submit your report? Read carefully this document. Ask if you are unsure what to do, otherwise use common sense to solve the problems. The hand-in for this laboratory exercises is done by using Moodle before the deadline. (See http://vda.univie.ac.at/Teaching/IPA/19w/grading.html for more information.) You should hand in a ZIP file IPA_Lab1_YourLastname.zip containing: A written report of the lab as a PDF/Jupiter Notebook document YourLastname_Report.pdf, including your results and, most importantly, a discussion of the results. All the Python code necessary to run your solution (including your chosen images). o Feel free to define auxiliary functions where needed, but name your main files as specified in each task. o Please write (at least) your name and student ID as a comment at the beginning of each Python file and also on the PDF report. o Please write (a lot of) comments in your source code, it is necessary. You can discuss the results and solutions, but you have to submit your own work. Warning! Plagiarism will not be tolerated. Be careful: If the attached code does NOT run, we will reject your exercise completely. It is NOT necessary to include a copy of all the code in the PDF document, although key parts if you think are necessary to explain a point can be included. Please follow the instructions. 1. Spatial filtering (1 points) Write a function apply_filter which takes an image and a spatial mask as its input and returns the image with the spatial filtering applied. To showcase your function, write a script task1 which loads an image, applies a 3x3 filter of your choosing, and shows both the original and the filtered image in one figure. You can use one of the test images from here: http://www.io.csic.es/PagsPers/JPortilla/content/BLS- GSM/test_images/test_images.zip Please do not use predefined functions. You have to write your own code. 2. Histogram (1 point) Write a function image_hist which takes an image as its input and returns its histogram. To showcase your function, write a script task2 which loads an image, computes its histogram using your function, and shows both the original image and its histogram in one figure. Please do not use predefined functions. You have to write your own code.
4
Embed
IPA 2017 Lab Exercise 1 (15 Points) - univie.ac.atvda.univie.ac.at/Teaching/IPA/19w/Lab1/Lab1.pdfIPA 2017 Lab Exercise 1 (15 Points) Exercise due: 20th of October 2019 23:55 How to
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
IPA 2017 Lab Exercise 1 (15 Points) Exercise due: 20th of October 2019 23:55
How to submit your report? Read carefully this document. Ask if you are unsure what to do, otherwise use common sense to
solve the problems.
The hand-in for this laboratory exercises is done by using Moodle before the deadline.
(See http://vda.univie.ac.at/Teaching/IPA/19w/grading.html for more information.)
You should hand in a ZIP file IPA_Lab1_YourLastname.zip containing:
A written report of the lab as a PDF/Jupiter Notebook document
YourLastname_Report.pdf, including your results and, most importantly, a discussion
of the results.
All the Python code necessary to run your solution (including your chosen images).
o Feel free to define auxiliary functions where needed, but name your main files as
specified in each task.
o Please write (at least) your name and student ID as a comment at the beginning of
each Python file and also on the PDF report.
o Please write (a lot of) comments in your source code, it is necessary.
You can discuss the results and solutions, but you have to submit your own work.
Warning! Plagiarism will not be tolerated.
Be careful: If the attached code does NOT run, we will reject your exercise completely. It is NOT
necessary to include a copy of all the code in the PDF document, although key parts if you think are
necessary to explain a point can be included.
Please follow the instructions.
1. Spatial filtering (1 points) Write a function apply_filter which takes an image and a spatial mask as its input and returns
the image with the spatial filtering applied. To showcase your function, write a script task1 which
loads an image, applies a 3x3 filter of your choosing, and shows both the original and the filtered
image in one figure.
You can use one of the test images from here: http://www.io.csic.es/PagsPers/JPortilla/content/BLS-
GSM/test_images/test_images.zip
Please do not use predefined functions. You have to write your own code.
2. Histogram (1 point) Write a function image_hist which takes an image as its input and returns its histogram.
To showcase your function, write a script task2 which loads an image, computes its histogram
using your function, and shows both the original image and its histogram in one figure.
Please do not use predefined functions. You have to write your own code.
Take the βLena imageβ and break it into 16 x 16 non overlapping blocks. For each of the block
compute the histogram (your function from task 2) and visualize them in a 16 by 16 grid (it should fit
in a page). How would you compute the histograms if the image would have been in color? Are
histograms invariant to translation, rotation and scale? For each of the blocks compute the mean
value and show the image of the size 16 by 16 pixels produced (the low resolution image). What can
you say about the resulted image? Try to define a threshold that will segment the face of the woman.
Were you successful, if not why? Show some results. To showcase your function, write a script task3
4. Edge detection combined with smoothing and thresholding (3 points) (1 point) (a) Write a function sobel which takes an image and a threshold value and returns the
image with Sobel filtering applied.
The function should implement Eq. 1 (below or 10-24 and 10-25 from the book), and should be
outputting a binary image by comparing each gradient point against the specified threshold T.
You can reuse your function from Task 1 Spatial Filtering to compute the Sobel gradient using the