フィルターのクリア

How can I make a Loop (!) over the image using a 5×5 pixel window

2 ビュー (過去 30 日間)
Nadeen Bahnam
Nadeen Bahnam 2019 年 11 月 14 日
コメント済み: Nadeen Bahnam 2019 年 11 月 20 日
Loop (!) over the image using a 5×5 pixel window. For each such window, compute the average pixel value and store the result in a new image. Treat borders in some controlled way and make sure the result has the same size in pixels as the original image. You will need at least two nested for-loops, to scan rows and columns in your image.
  4 件のコメント
Nadeen Bahnam
Nadeen Bahnam 2019 年 11 月 14 日
Is there some other way to solve this if loops are not be used ?
Walter Roberson
Walter Roberson 2019 年 11 月 14 日
nlfilt(), blockproc(), conv2()

サインインしてコメントする。

採用された回答

Mahesh Taparia
Mahesh Taparia 2019 年 11 月 20 日
Hi Nadeen,
It seems you want to do average filtering of an image with the kernal size of 5x5. It can be done using imfilter command. Consider the code below:
window_size = 5;
filter_type=fspecial('average', window_size);
filtered_image = imfilter(I,filter_type, 'replicate'); %%% I = image
For more details refer to the documentation page of imfilter using the link given below:

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by