I have a code ,of 7x7 natrix in that for each 3x3 i have found minimum value and if that minimum value is greater the centre pixel value ,the centre pixel value must be replaced by 5.have problem in replacing centre pixel value ,please help
for i=2:6 for j=2:6 K= A(i-1:i+1,j-1:j+1); T=K(2,2);finding centre pixel value
B=min(K(:)); if B>T
%%%please tell what must come here replacing centre pixel vaue by 5
%%%%I DID K(2,2)=5;
else %%%%%%%%%here also %%I DID K=K; end end end
BUT I GET 3x3 matrix only,how to get 7x7 matrix please assist
No products are associated with this question.
The minimum value in a 7x7 window will never be greater than the center value. Please explain what you are thinking.
By the way, you can call imerode() to get the local min values in a 7x7 sliding window.