How does fspecial average filter deal with overlap causes by edges of an image?
이전 댓글 표시
I am applying an average filter using the fspecial command. I am wondering how the average filter works on images whose dimensions are not multiples of the user-specified hsize. For example if a 3x3 filter is chosen and applied to a 10x10 pixel image, how does this filter deal with the last row and column?
채택된 답변
추가 답변 (2개)
David
2013년 1월 15일
0 개 추천
fspecial will just define the 3x3 filter you're using and imfilter is the function that actually applies it to the image. imfilter deals with the last row and column in the same way whatever the size of the input image.
Don't think of your 10x10 image as being divided in to 3x3 subsets, because it isn't. The filter is applied to every pixel individually: pixel (1,1), then (1,2), then (1,3), and every other pixel. Think of the filter as being applied to overlapping subsets, each position shifted by one pixel.
If you have some curious artefacts at the edge, consider the boundary options (see help imfilter).
Image Analyst
2013년 1월 18일
0 개 추천
fspecial() is not a filter. It is a kernel maker, a filter maker. You then use this kernel (filter) in a function that does the actual filtering, such as imfilter(), or conv2(). There are explanations of the "boundary or edge effects" in the help for those functions. There are different ways you can choose to handle the output value when the filter window falls off the edge of the image.
카테고리
도움말 센터 및 File Exchange에서 Image Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!