pick of the week is Bilateral Filtering
by Douglas Lanman.
Bilateral filtering is an edge-preserving smoothing filter that can be used for a wide variety of image processing tasks such as de-noising and tone mapping, another fun application of a bilateral filter is to "cartoonize" an image. In his submission Douglas provides a helper function that shows how a bilateral filter can be used to turn an image into a cartoon version of itself.
Connect to a webcam
Lets start by reading in an input image from a webcam using the webcam object in MATLAB. You can view the live stream using the preview function.
camera = webcam;
Read input image from webcam
You then use the snapshot function to grab an input frame from the webcam.
inputImage = snapshot(camera);
Convert image into cartoon version of itself
Now lets "cartoonize" the image with a bilateral filter. Notice how edges in the image are preserved by the bilateral filter.
cartoonImage = cartoon(im2double(inputImage));
Other edge-preserving filters
If you are interested in using an edge-preserving filter I would recommend you try the new guided filter in the Image Processing Toolbox.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.