image filtering with median need basic help

조회 수: 7 (최근 30일)
Jhangir
Jhangir 2013년 11월 6일
편집: Image Analyst 2013년 11월 6일
Im trying to filter an image and remove surrounding noise, I need BASIC code which will help me do this. I have an image X, I separated X into three 2 dimensional arrays [R,G,B], Now i have the following
[nrows,mcols]=size(R);
for n=2:1:(nrows-1)
for m=2:1:(ncols-1)
I want to filter every value in each of the three matrices except for the ones in the corner, thus you will see my for statement starting 1 unit ahead and 1 unit behind on the other end. I want to filter each pixel like a tic tac toe. Each pixel is surrounded by 8 other pixels, I want to find the median of all the pixels including the middle one and then save the median and assign it to I dont know because my teacher never told us how to filter images. So yea...

답변 (2개)

Jhangir
Jhangir 2013년 11월 6일
help pls

Image Analyst
Image Analyst 2013년 11월 6일
편집: Image Analyst 2013년 11월 6일
% Call median filter function:
filteredImageR = medfilt2(redChannel, [7, 7]);
filteredImageG = medfilt2(greenChannel, [7, 7]);
filteredImageB = medfilt2(blueChannel, [7, 7]);
Also, see attached demo.

Community Treasure Hunt

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

Start Hunting!

Translated by