$30.00

## Description

### List of assignment due dates.

The assignment should be submitted via Blackboard.

### Task 1 (40 points)

Write a Matlab function `votes = oriented_hough(grayscale, thetas, rhos, thr1, thr2)`that takes in as argument a grayscale image A (not a filename), and returns the result of performing the Hough Transform for lines. The specific variant of the Hough Transform that you should implement is the one that takes edge orientations into account, as described in slides 61-70 of the Hough Transform slides.

The image that is passed in to your function is the first argument, `grayscale`. It is important to emphasize that `grayscale` is a grayscale image (single-channel image, values of type uint8 between 0 and 255) and NOT an edge image. To obtain an edge image, you should use the canny function that is posted on the course website. You must use `thr1` as the second argument when you call the `canny` function.

Argument `thetas` is a one-dimensional array of angles, given in degrees. This arguments specifies the discrete theta values that you should use in the voting. Similarly, argument `rhos` is a one-dimensional array of rho values that you should use in the voting.

The result `votes` is a matrix, whose rows is equal to the number of values in `rhos` and whose columns is equal to the number of values in `thetas`. In `votes(i,j)` your function should store the number of votes for the line with parameters `rho = rhos(i)` and `theta = thetas(j)`.

To compute the gradient orientation at each pixel location (i,j), you obviously need to compute the gradient vector (dy, dx) for that location. You should compute dy values by convolving `grayscale` with filter `dy_filter = [-1, 0, 1]'` and dx values by convolving `grayscale` with filter `dx_filter = [-1, 0, 1]`.

Argument `thr2` specifies the threshold that is used in the pseudocode on slide 65 of the Hough Transform slides, in the line:

If orientation_difference(o, θ) <= threshold:

### Task 2 (20 points)

Write a Matlab function `result = ssd_search(grayscale, template)` that measures the SSD differences between the template and each template-sized window of the grayscale image. Both `grayscale`and `template` are grayscale images, with values of type uint8.

Value `result(i,j)` should be the SSD score between the template and the template-sized subwindow of `grayscale` that is centered at location (i,j).

For boundary pixels (i,j), where a template-sized subwindow of grayscale cannot be extracted, result(i,j) should be set to -1.

### Task 3 (20 points)

Write a Matlab function `result = ssd_bn_search(grayscale, template)` that measures the SSD differences (normalized for brightness, but NOT for contrast) between the template and each template-sized window of the grayscale image. Both `grayscale` and `template` are grayscale images, with values of type uint8.

Value `result(i,j)` should be the SSD score between the template and the template-sized subwindow of `grayscale` that is centered at location (i,j), after both the template and the subwindow have been normalized for brightness (remember, do NOT normalize for contrast).

For boundary pixels (i,j), where a template-sized subwindow of grayscale cannot be extracted, result(i,j) should be set to -1.

### Task 4 (20 points)

Write a Matlab function `[scores, max_scales] = ssd_bn_multiscale(grayscale, template, scales)` that measures the SSD differences (normalized for brightness but NOT for contrast) between the template and each location of the image at multiple scales. Both `grayscale` and `template` are grayscale images, with values of type uint8. Argument `scales` is a one-dimensional array specifying the set of scales that should be considered.

Value `result(i,j)` should be the best SSD score for pixel (i,j) of `grayscale` across all scales. Value `max_scales(i,j)` should be the scale that gave that best SSD score for pixel (i,j).

Hint: function multiscale_correlation has many similarities with the function that you are asked to implement. The only difference is that `multiscale_correlation` computes scores based on normalized cross-correlation, whereas your scores are based on SSD differences after brightness normalization.

### How to submit

Submissions are only accepted via Blackboard. Submit a file called assignment3.zip, containing the following files:

- The Matlab source files implementing your solutions to the programming tasks.
- Any additional Matlab source files that are needed to run your code. If your code needs any code files available on the course website, please include those files with your submission.
- A README.txt file containing the name and UTA ID number of the student. No other information is needed for README.txt.

We try to automate the grading process as much as possible. Not complying precisely with the above instructions and naming conventions causes a significant waste of time during grading, and thus points will be taken off for failure to comply, and/or you may receive a request to resubmit.

**Please only include source code in your submissions. Do not include data files.**

**Code must run in Matlab version 2018b.**

**The submission should be a ZIP file. Any other file format will not be accepted.**