Code covered by the BSD License  

Highlights from
Guided Filter

4.3 | 3 ratings Rate this file 65 Downloads (last 30 days) File Size: 2.54 KB File ID: #33143 Version: 1.0

Guided Filter


Rachel (view profile)


An 2D edge-preserving filter derived from a local linear model. Related to bilateral filter.

| Watch this File

File Information

This is a novel type of explicit image filter - guided filter. Derived from a local linear model, the guided filter
generates the filtering output by considering the content of a guidance
image, which can be the input image itself or another different image.

The guided filter can perform as an edge-preserving smoothing operator
like the popular bilateral filter, but has better behavior near the edges. It also has a theoretical connection with the matting Laplacian matrix, so is a more generic concept than a smoothing operator and can better utilize the structures in the guidance image. Moreover, the
guided filter has a fast and on-approximate linear-time algorithm, whose
computational complexity is independent of the filtering kernel size. The guided filter is both effective and efficient in a great variety of computer vision and computer graphics applications including
noise reduction, detail smoothing/enhancement, HDR compression, image matting/feathering, haze removal, and joint upsampling.

There are two files: 'guided_filter.m' contains the guided filter function; 'guided.m' is an example script demonstrating the use of the filter.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
18 Jun 2015 Stefan Karlsson

Stefan Karlsson (view profile)

Its always nice to see useful implementations. As pointed out, this function is already implemented in the imageprocessing toolbox, but for 2014 versions and onward.

A question: how does this code perform when compared to the one found here?:

16 May 2015 Aasd

Aasd (view profile)

good job ,this code doing smooth well

17 Mar 2015 Rachel

Rachel (view profile)

@Royi: this code is simply using the input image (noisy image) as the guidance image, which the original authors used in their example (Fig. 1 in their original paper). If you compare the results from this code and the new MATLAB 2014a function 'imguidedfilter', you'll notice the results look almost identical. I suggest you have another look at the original paper before posting.

Comment only
16 Mar 2015 Royi Avital

Pay attention that you make it a linear combination of the Input Image while the article states that the output is a linear combination of the Guidance Image. Hence the code is wrong.

Comment only
01 Jul 2014 Spandan Tiwari

Guided filter is offered in the Image Processing Toolbox, as function imguidedfilter, since R2014a.

Comment only
24 Oct 2011 jun

jun (view profile)

Another codes from Kaiming He,author of the paper 'Guided Filter', are here:

Comment only
24 Oct 2011 jun

jun (view profile)

The code doing smooth well @ epsilon in range[0.05,0.1]. And what about HDR compression?

Contact us