[Solved] Computer Vision Lab Exercise 1

$25

File Name: Computer_Vision__Lab_Exercise_1.zip
File Size: 292.02 KB

SKU: [Solved] Computer Vision – Lab Exercise 1 Category: Tag:
5/5 - (1 vote)

Computer Vision Linear Filters: Gaussians and Derivatives

1 1D Gaussian Filter

In this first part, you will be implementing a 1D discrete Gaussian filter:

(1)

where is the variance of the Gaussian. The Matlab function should look like this:

  • function G = gaussian( sigma )
  • end

2 Convolving an image with a 2D Gaussian

You will write a function to convolve an image with a 2D Gaussian. One of the most important properties of Gaussian kernels is separability. Therefore, convolving an image with a 2D Gaussian is equivalent to convolving the image along the x-axis and the y-axis separately with a 1D Gaussian. The Matlab function should use the previous function and should look like this:

1 function imOut = gaussianConv(imagepath , sigma x , sigma y)2 3 end

Hint: use Matlab function conv2.

3 Comparing with Matlabs Gaussian Filter

Matlab already has a built-in function implementing 2D Gaussian kernels. The Matlab code for using it is:

  • G=fspecial(gaussian,n,sigma)
  • imOut=conv2(imIn,G,same)

In this part, you can compare your implementation of 2D Gaussian convolution, through two 1D operations, to Matlabs. You can read any image and check the difference between your output image and Matlabs.

4 Gaussian Derivative

The Gaussian first order derivative is given by:

Write a function to implement this first order derivative. Your function should look like this:

  • function Gd =gaussianDer(G , sigma)
  • end

5 Gradient Magnitude and Orientation

Write a function that returns two images with the magnitude and orientation of the gradient for each pixel of the input image. Your function should look like this:

  • function [magnitude , orientation] = gradmag(img , sigma)
  • end

5.1

Visualize your result using:

  • imshow(orientation , [-pi,pi])
  • colormap(hsv);
  • colorbar;

Visualize your result using Matlab quiver function.

5.2

Get results for varying sigma values.

  1. How do the magnitude images change as the sigma increases?
  2. How do the orientation images change as the sigma increases?

5.3

It is typical to place a threshold on the gradient magnitude so that the edge detection result is binary. Use different thresholds on the gradient magnitude and display your thresholded image for varying sigma values.

5.4

The Gaussian second order derivative is given by:

Write a function that give an output of the specified derivative of an input image (type : x, y, xx, yy, xy, yx). Your function should look like this:

1 function F=ImageDerivatives(img , sigma , type)
2
3 end

5.5

Create an impulse image (all zeros, with only one pixel in the center set to the maximum value) and convolve the impulse image with 0, 1st, and 2nd order gaussian derivatives, try some sigma values and visualize the result images. Describe what you see. Is there a relation between the order and the sigma?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Computer Vision Lab Exercise 1
$25