필터 지우기
필터 지우기

Image Processing Min/Max filter

조회 수: 142 (최근 30일)
Marco Rossi
Marco Rossi 2016년 4월 28일
댓글: Marco Rossi 2016년 5월 1일
Hi,
i'm trying to execute a min/max filtering of an image but i'm meeting some problems. The filter consist in calculating the upper and lower envelope. In particularly for the upper envelop (Ue) i substituted for every pixel the max value in a 3X3-pixel neighborhood, and for the lower envelop (Le) the min value. Finally i calculated the filtered image
Im = (Im - Le) ./ (Ue -Le);
but the result is not correct in my opinion. I think the problem is in the the conversion of the format image because i don't well understand the difference between the commands "im2double" and "double".
This is the code
Im = imread('image.bmp');
Im = im2double(Im);
[r c] = size(Im);
ImL = zeros(r,c);
ImU = zeros(r,c);
for i=2:r-1
for j=2:c-1
M = Im(i-1:i+1,j-1:j+1);
Min = min(M(:));
Max = max(M(:));
ImL(i,j) = Min;
ImU(i,j) = Max;
end
end
AirF = (Air-AirL)./(AirU-AirL);
AirF = im2uint8(AirF);
Thanks for help

답변 (1개)

Alex Taylor
Alex Taylor 2016년 4월 28일
If you have the image processing toolbox, imerode and imdilate are the min/max filters you are looking for and are much faster than rolling these yourself.
  댓글 수: 1
Marco Rossi
Marco Rossi 2016년 5월 1일
Thanks for the answer; i didn't know the commands you mentioned, but i'd prefer to implement by myself

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by