To apply a binomial linear filter in Matlab using imfilter
, you can use the convolution technique. A binomial filter is a type of linear filter characterized by and derived from Pascal's triangle.
Here is an example code that applies a binomial filter with n=5 to an image using imfilter
:
main.m203 chars9 lines
In the code above, we first read an image using imread()
. Then, we define our kernel by specifying the binomial coefficients for n=5. We divide by 16 to normalize the kernel so that its sum equals to 1. Finally, we apply the filter on the original image using imfilter()
and store the result in filteredImg
.
Note that the imfilter()
function applies a linear filter by default, so we do not need to specify any extra parameters.
gistlibby LogSnag