how to make mean filter ?

i want to make a mean filter of 3x3 and it takes any row column matrixes and perform mean filter
in my task i can not use bultin filter in matlab i have a code in octave
a = input('Please input the matrix like "[1, 2; 3, 4]":');
a1= paddones(a)
[m n]=size(a1);
c=zeros(size(a));
for i=2:(m-1)
for j =2:(n-1)
v=a1(i-1:i+1,j--1:j+1);
vrow= v(:)';
r= sum(v(:))/9 ;
c(i-1,j-1)=ceil(r) ;
end
end
when i am running this code in matlab ,its giving error in line no 2
a1=paddones(a)
and in line no 9
r= sum(v(:))/9 ;
tell me what changes i needed to remove error?

3 件のコメント

Walter Roberson
Walter Roberson 2021 年 8 月 21 日
paddones() is not a Mathworks function. It does not appear to be an Octave function either. The only place I can find reference to it is on kzhome.info
Muhammad
Muhammad 2021 年 8 月 21 日
i want to make the mean and median filter that takes matrix input from the user and perform fuction
sir tell me what modification do i need in this code
Walter Roberson
Walter Roberson 2021 年 8 月 21 日
編集済み: Walter Roberson 2021 年 8 月 21 日
mean filter can be done with conv(). median filter can be done with nlfilter()

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

回答 (0 件)

質問済み:

2021 年 8 月 21 日

編集済み:

2021 年 8 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by