EECS-841 Homework 1: Image Processing and Analysis - Prof. Brian Potetz, Assignments of Electrical and Electronics Engineering

Instructions and tasks for homework 1 of the eecs-841 course at the university of kansas. The homework focuses on image processing and analysis, including thresholding, edge detection, and the hough transform. Students are required to write matlab functions and process given images to extract useful information.

Typology: Assignments

Pre 2010

Uploaded on 03/19/2009

koofers-user-m4g
koofers-user-m4g 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Homework #1
EECS-841
Due: Friday, Sept 19 (midnight)
Total Points: 13
1. Thresholding and Edge Detection (5 points)
Although natural images are highly complex and cluttered, some applications of computer vision
allow the subject matter to be much more tightly controlled, resulting in simpler images. One
example is automated product inspection, where a factory's final products or components on an
assembly line may be moved across a light table to view them in silhouette. In these cases,
simply thresholding the image is often enough to locate object boundaries.
Better thresholding can be achieved by combining techniques from edge detection. One
approach is to use edge detection to choose the threshold values. In this problem, we will
explore that approach further.
a) (2 points) Write a Matlab function
function hist = hist2D(input_values)
that accepts a 2xN array (an array with two columns), and produces a 50x50 two-dimensional
histogram. Specifically, the program should
1) Compute the minimal and maximal values of each column of input_values
2) Normalize input_values so that the values of each column lie between 0 and 50. Let's call
this normalized array normed_input_values.
3) Construct the output histogram hist so that hist(i,j) (the ith column and jth row of
hist) contains an integer that is the number of rows r of normed_input_values such that
i-1 < normed_input_values(r,1) <= i
and
j-1 < normed_input_values(r,2) <= j
For example, if input_values was given by:
input_values = ![0, 0;
! 1, 1;
! 0.5, 0.5];
Then normed_input_values would be given by:
normed_input_values = ![ 0, 0;
! 50, 50;
! 25, 25];
and hist would be a 50x50 array, zero everywhere except
hist(50,50) = 1
hist(25,25) = 1
pf3
pf4

Partial preview of the text

Download EECS-841 Homework 1: Image Processing and Analysis - Prof. Brian Potetz and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

Homework # EECS- Due: Friday, Sept 19 (midnight) Total Points: 13

1. Thresholding and Edge Detection (5 points) Although natural images are highly complex and cluttered, some applications of computer vision allow the subject matter to be much more tightly controlled, resulting in simpler images. One example is automated product inspection, where a factory's final products or components on an assembly line may be moved across a light table to view them in silhouette. In these cases, simply thresholding the image is often enough to locate object boundaries. Better thresholding can be achieved by combining techniques from edge detection. One approach is to use edge detection to choose the threshold values. In this problem, we will explore that approach further. a) (2 points) Write a Matlab function function hist = hist2D(input_values) that accepts a 2xN array (an array with two columns), and produces a 50x50 two-dimensional histogram. Specifically, the program should

  1. Compute the minimal and maximal values of each column of input_values
  2. Normalize input_values so that the values of each column lie between 0 and 50. Let's call this normalized array normed_input_values.
  3. Construct the output histogram hist so that hist(i,j) (the ith column and jth row of hist ) contains an integer that is the number of rows r of normed_input_values such that i-1 < normed_input_values(r,1) <= i and j-1 < normed_input_values(r,2) <= j For example, if input_values was given by: input_values = [0, 0; 1, 1; 0.5, 0.5]; Then normed_input_values would be given by: normed_input_values = [ 0, 0; 50, 50; 25, 25]; and hist would be a 50x50 array, zero everywhere except hist(50,50) = 1 hist(25,25) = 1

Difficulty: Be sure to vectorize your code. Your function should not contain ANY for loops. Also, using any of MATLAB's built-in histogram functions (like histc ) is not allowed. Hint: Check out the useful MATLAB function sparse. Deliverables: the file hist2D.m b) (1 point) Write a Matlab function function im_GM = GradientMagnitude(im, sigma) that returns the magnitude of the gradient of im , where the gradient is defined by the derivative of a Gaussian of standard deviation sigma. The output image im_GM should be the same size as im - use zero-padded border handling to achieve this. Use of conv2 or filter2 is allowed, but use of for loops is not. The use of Matlabʼs built-in edge detection routines are not allowed. Deliverables: the file GradientMagnitude.m c) (2 points) Load the image 'Gears.png', which is available at www.ittc.ku.edu/~potetz/EECS_841/Homeworks/hw1/Gears.png Use the Matlab function hist to plot a (1D) histogram of the intensity values of the image. Save this graph as 'GearsHist1.png'. Now, use GradientMagnitude to compute it's gradient magnitude at sigma = 2. Then use hist2D to compute the histogram of gradient magnitude (y-axis) versus pixel intensity (x-axis). Normalize this histogram so that all values lie between 0 and 1, and save the image as 'GearsHist2.png'. Look at the shape of the histogram in 'GearsHist2.png'. What does this plot tell you about the image that is not obvious from 'GearsHist1.png'? How could you use such a plot to improve the thresholding of 'Gears.png'? Deliverables: the file GearsHist1.png the file GearsHist2.png Answers to the above questions.

2. Images in the Fourier Domain (2 points) Load in the image 'Tiger.png', which can be found at www.ittc.ku.edu/~potetz/EECS_841/Homeworks/hw1/Tiger.png Take it's (discrete) Fourier tranform. Without changing the phase component, change the magnitude so that |F(u,v)| is 1 everywhere. Take the inverse Fourier transform, and save the

like radon is not allowed. You can choose whether to exploit edge orientation information or not. You can choose how to discretize the parameter space. You may choose to vote for small patches rather than points in the accumulator array. c) To find "strong" lines in the image, scan through the accumulator array looking for parameter values that have high votes. Here again, a threshold should be used to distinguish strong lines from weak ones. You may choose whether or how to implement nonmaximal suppression. d) You now have a list of edges that span the entire image. For each line detected by the Hough transform, determine which parts of that line actually correspond to line segments in the image. Save your list of line segments in the output array edges. One approach is to walk each line, marking those locations where the image gradient magnitude passes above threshold and below. You may consider using hysteresis when walking each line. I will test your program on several novel images. You may test your program on whatever image you wish, although the images www.ittc.ku.edu/~potetz/EECS_841/Homeworks/hw1/hough_simple_1.png www.ittc.ku.edu/~potetz/EECS_841/Homeworks/hw1/hough_simple_2.png may be especially helpful. Deliverables: the file FindEdgeSegments.m