Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
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.
3. Image transformation (2 points)
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
masks in Fig. 10.14fg.
Eq. 1
𝑔𝑥 =𝜕𝑓
𝜕𝑥= (𝑧7 + 2𝑧8 + 𝑧9) − (𝑧1 + 2𝑧2 + 𝑧3)
𝑔𝑦 =𝜕𝑓
𝜕𝑦= (𝑧3 + 2𝑧6 + 𝑧9) − (𝑧1 + 2𝑧4 + 𝑧7)
(2 points) (b) Download Fig. 2 from the IPA Web site.
By combining smoothing (with a 3x3 mask from Task 1) and your function from (a), process Fig. 2.
and produce a binary image that isolates (segments) the large blood vessel in the center of the
image. This will require repeated trials of smoothing and choices of T. Looking at the histogram
(Task 2) of the gradient image before it is thresholded will help you select a value for T.
Showcase your findings with a script task4 which shows both the original and the segmented
image, as well as your chosen smoothing mask and threshold in one figure.
Fig.2. Kidney © Gonzales et. al.
5. Comparing edge detection algorithms (2 points) Use the image in Fig. 2. to compare the results of your own implementation in Task 2 and the
implementation of canny edge detection (use it from an image processing package, or write you own
canny edge detection algorithm). Write a script task5 and discuss the results and the effects of the
parameters used by the algorithms in detecting the blood vessels in the image.
6. Comparing image segmentation algorithms (6 points)
Write a script task 6 that takes at least 5 segmentation algorithms (you can choose to use those
mentioned in the lecture, or others) and compare the results of their segmentations. Show
segmentation result of each of the algorithm. Try to highlighting the border/countor between the
regions (e.g. by using a two-pixel black border)
Discuss the results, and the hyper parameters you have used (try different hyperparamets). Show
some examples of the segmentation by using couple of images. You do not have to implement the
algorithms by yourself.
For an image, apply all the algorithms you have chosen and find the borders between the regions.
Show a results as on overlay (the resulted borders of each algorithms on top of each other). If
algorithms agree on a border give it a higher value.
Result of the graph-based algorithm from Felzenswalb et al [1].
[1] P. F. Felzenswalb, D. P. Huttenlocher. Efficient graph-based image segmentation.
International Journal of Computer Vision 59 (2) (2004) 167–181.