Using imtophat in MATLAB

爱⌒轻易说出口 提交于 2019-12-11 07:24:18

问题


I'm trying to do top hat filtering in MATLAB. The imtophat function looks promising, but I have no idea how to use it. I don't have a lot of work with MATLAB before. I am trying to look find basically small spots several pixels wide that are local maxima in my 2 dimensional array.


回答1:


I think you have more problem undertanding how to use STREL, than IMTOPHAT. The later can be described as simple threshold but per structural element, not the whole image.

Here is another good examples of using STREL and IMTOPHAT: http://www.mathworks.com/matlabcentral/fx_files/2573/1/content/html/R14_MicroarrayImage_CaseStudy.html

This series of posts on Steve Eddins blog might be useful for you: http://blogs.mathworks.com/steve/category/dilation-algorithms/




回答2:


tophat is basically an "opening" procedure followed by a subtraction of the result from the original image. the best and most helpful explanation of opening I've found here:
http://homepages.inf.ed.ac.uk/rbf/HIPR2/morops.htm

"The effect of opening can be quite easily visualized. Imagine taking the structuring element and sliding it around inside each foreground region, without changing its orientation. All pixels which can be covered by the structuring element with the structuring element being entirely within the foreground region will be preserved. However, all foreground pixels which cannot be reached by the structuring element without parts of it moving out of the foreground region will be eroded away."




回答3:


The documentation on imtophat has an example .. did you try it? The following images are from the MATLAB documentation.

Code

I = imread('rice.png');
imshow(I)
se = strel('disk',12);
J = imtophat(I,se);
figure, imshow(J,[])

Original

(image source: mathworks.com)

Top Hat with a disk structuring element

(image source: mathworks.com)



来源:https://stackoverflow.com/questions/2777264/using-imtophat-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!