Just like we did in previous chapters, we will write a custom function that incorporates a combination of MATLAB functions to make our lives easier. This time, our function will perform image blurring, hence will be called BlurImage.m
:
function [output] = BlurImage(input,kernel_choice,kernel_size,method) % Function for image blurring % Inputs: % input - Input image % kernel_choice – User's choice of filter % (1: disk % 2: average % 3: gaussian) % kernel_size – User's choice of kernel size % ([radius] for disk, % [rows, columns] for average, % [rows, columns, standard deviation] for Gaussian) % method – User's choice of filtering method % (1: correlation % 2: convolution) % Output: % output - Output image (after bluring) switch kernel_choice case 1 kernel = fspecial('disk',kernel_size); case 2 kernel = fspecial('average',kernel_size...