We will now work on another night image taken in Berlin, Germany. We will try to isolate the light bulb soldier and perform blurring in the other areas of the image. The function we will use will be able to handle both grayscale and color images. Let's see the function:
function [output] = Bokeh(input, radius) % Function that performs blurring on the whole image except a user defined % ROI,using a disk kernel. The effect resembles the bokeh effect. % Inputs: % input - Input image % radius – User's choice of radius for the disk kernel % Output: % output - Output image (only user-defined ROI stays in focus) kernel = fspecial('disk',radius); % Create disk kernel disp('Select area to keep in focus!') % Display message to user mask = roipoly(input); % User selects area of interest output = []; % Start with an empty image for i = 1:size(input,3) % Covering the case of color...