image filtering with median need basic help
2 次查看(过去 30 天)
显示 更早的评论
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...
0 个评论
回答(2 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!