20060410-Quick tip: Determining uniqueness of local maximum
来源:互联网 发布:glanceplus软件翻译 编辑:程序博客网 时间:2024/05/22 00:14
原文:http://blogs.mathworks.com/steve/2006/04/10/quick-tip-determining-uniqueness-of-neighborhood-maximum/
Let's review first the concept of a local maximum filter. This image operator replaces every pixel value with the maximum pixel value found in a neighborhood surrounding the pixel. For example:
a = magic(5)What should the output be for a local maximum filter using 3-by-3 neighborhoods?
neighborhood = a(2:4, 1:3)Local maximum filtering is the same as morphological dilation, so I usually useimdilate to compute the result for the entire image:
b = imdilate(a, ones(3,3))
I suggest using ordfilt2 twice. This function is for ''two-dimensional order-statistic filtering.'' This operation replaces every pixel value with the n-th sorted pixel value in its neighborhood. It uses an ascending sort order, so if n is the number of pixels in the neighborhood, the operation is exactly equivalent to the local maximum filter.
The specific procedure is:
- Call ordfilt2 to get the highest pixel values in each neighborhood.
- Call ordfilt2 again to get the second-highest pixel values in each neighborhood.
- Determine where the outputs of steps 1 and 2 are equal. Wherever they are equal, the local maximum is not unique.
Let's try an example. First, modify our original matrix a bit:
ap = a;ap(3,4) = 22Get the highest pixel values in each 3-by-3 neighborhood:
highest = ordfilt2(ap, 9, ones(3,3))Get the second-highest pixel values:
second_highest = ordfilt2(ap, 8, ones(3,3))Determine where the highest and second highest pixel values are equal:
non_unique_maxima_mask = (highest == second_highest)
- 20060410-Quick tip: Determining uniqueness of local maximum
- 1016. Uniqueness of MST (35)
- 1016. Uniqueness of MST (35)
- pat-top 1016. Uniqueness of MST (35)
- 1016. Uniqueness of MST (35)解题报告
- Local Cache的小TIP
- Local Cache的小TIP
- Local Cache的小TIP
- Determining the Size of a Class Object
- Determining the Size of a Class Object
- Determining the Size of a Class Object
- Determining the Size of a Class Object
- Again about determining size of Java object
- Tip of Makefile
- The Uniqueness of Software Engineering: The Dual Formalizations
- PAT (Top Level) Practise 1016 Uniqueness of MST (35)
- Eclipse Tip:Restore from Local History.
- Eclipse Tip:Restore from Local History. .
- ASP.NET 关于设置上传文件导致的问题
- c的基础 1. 无符号数和补码
- MP4文件格式详解
- Maven学习
- Linux Shell 脚本应用——使用for循环
- 20060410-Quick tip: Determining uniqueness of local maximum
- 管道通信相关资料 linux系统调用
- Hibernate复习(六)检索策略
- OC简介
- Git 基础
- 如何用自己电脑架设服务器!自助建站将不再是梦想
- 排序算法(三):堆排序
- POJ 1329 Circle Through Three Points
- Hadoop拓扑感知-个人学习