O'Reilly logo

Visual Media Processing Using MATLAB Beginner's Guide by George Siogkas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating the bokeh effect in an image

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!') ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required