How to apply a filter to an image?

96 ビュー (過去 30 日間)
Marco Pacifico
Marco Pacifico 2020 年 4 月 14 日
編集済み: Spectro 2020 年 4 月 14 日
So this is some hints that my professor gave us on our project, and I am stuck on the part where you are suppossed to apply the filter using imfilter.In part C there is the filter we used, that I made into an array, and I don't know how to apply said filter.

採用された回答

Spectro
Spectro 2020 年 4 月 14 日
編集済み: Spectro 2020 年 4 月 14 日
First you need to declare and read your picture:
img = imread('your_picture.bmp');
If you have already created matrices according to the assignment C - i. And ii. and that would be something like this:
I = [1/9 1/9 1/9;1/9 1/9 1/9;1/9 1/9 1/9];
II = [-1 -1 0;-1 0 1;0 1 1];
Finally, you want to use an imfilter() to filter image separately with created filters (matrices):
filtered_img1 = imfilter(img, I);
filtered_img2 = imfilter(img, II);
And if you want to show filtered images both at the same time:
subplot(121)
imshow(filtered_img1)
subplot(122)
imshow(filtered_img2)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by