Let's say you have an image rgbImg
, e.g., read in using imread
.
>> rgbImg = imread('pears.png');
>> figure, imshow(rgbImg), title('Original Image')
Use fspecial
to create a 2D filter:
>> h = fspecial('disk', 7);
>> figure, imshow(h, []), title('Filter')
Use imfilter
to apply the filter on the image:
>> filteredRgbImg = imfilter(rgbImg, h);
>> figure, imshow(filteredRgbImg), title('Filtered Image')