Why the imfilter give different result with textbook?
1 次查看(过去 30 天)
显示 更早的评论
As the textbook say,this code ( gd=imfilter(f,w)) will give a result with blurry edge like follow
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166245/image.png)
But actually I will get a result :
w=ones(31);
gd=imfilter(f,w);
imshow(gd)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166246/image.png)
0 个评论
采纳的回答
Image Analyst
2017-7-23
Because you did not divide by 31^2 the image gets clipped to 256 instead of having much, much greater values. If you want to see it blurred, either convert to double (but the blurred image will be in a much brighter intensity range than the original), or divide your kernel by 31^2:
windowWidth = 31;
w = ones(windowWidth) / windowWidth ^ 2;
gd = imfilter(grayImage, w);
2 个评论
Walter Roberson
2017-7-23
Also notice that they used imshow(gd, []) but you used imshow(gd) without the []
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!