필터 지우기
필터 지우기

Image enhancement MATLAB code.

조회 수: 231 (최근 30일)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 2월 12일
댓글: Image Analyst 2017년 2월 12일
% Adjust image intensity values or colormap.
f = imadjust(uint8(scratched_image), stretchlim(scratched_image), [0 1]);
% convert to grayscale
img_gray = rgb2gray(f);
% Create morphological structuring element
se = strel('disk',12);
% Top-hat filtering.
th_fhiltered = imtophat(img_gray,se);
figure, imshow(th_fhiltered);
% Adjust image intensity values or colormap.
contrast_adjusted = imadjust(th_fhiltered);
figure, imshow(contrast_adjusted);
% 2-D median filtering
K = medfilt2(img_gray);
% Contrast-limited Adaptive Histogram Equalization
J = adapthisteq(K,'cliplimit',0.5);
% Create predefined 2-D filters
H = fspecial('average', [8 3]);
% N-D filtering of multidimensional images.
f_avg = imfilter(J,H,'replicate');
contrast_adj_image = contrast_adjusted-0.3*f_avg;
I have a few questions,
  1. what is the end result of this routine?
  2. why is top-hat filtering used with 'disk'?
  3. what are the last two lines doing?
  4. Why 'replicate' is used?

채택된 답변

Image Analyst
Image Analyst 2017년 2월 12일
  1. It's an edge detection algorithm.
  2. The disk is used so that the background estimation is radially symmetric.
  3. The imfilter line blurs the image. The subtraction from the background corrected image is what causes the edge detection.
  4. 'replicate' is used to avoid intensity change near the outer edges of the image (top, left, bottom, and right sides).
  댓글 수: 2
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 2월 12일
This is the input image:
The following is the output image:
Could you please tell me which edge is being detected here?
Image Analyst
Image Analyst 2017년 2월 12일
Well it's not a pure edge detector because you're only subtracting part of the image, 0.3 of it. So it's more of like an edge enhancement routine. The rest of the image is what it will look like from adapthisteq - a local background flattening. Try it without the filtering at the end and it will look similar but a little blurrier around the edges.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by