简体   繁体   English

Matlab中的图像处理工具箱

[英]image processing toolbox in matlab

I've got a specific question and a related more general one... Why does imextendedmax() not give for example 9 in A(3,3) as a max? 我有一个特定的问题和一个相关的更笼统的问题...为什么imextendedmax()不能在A(3,3)中给出例如9的最大值? Generally... what is the best way for finding multiple maxes/peaks? 通常...找到多个最大值/峰值的最佳方法是什么? The nice thing about imextended max is it allows a threshold where presumably everything under that threshold is not counted whereas imregionalmax and findpeaks are more general, less effective. 关于extended max的好处是,它允许一个阈值,该阈值可能不计算该阈值下的所有内容,而imregionalmax和findpeaks更为通用,效果较差。

A=round(rand(5)*10) A =轮(rand(5)* 10)

A = A =

 1     5     4     8     3
 5     1     8     8     3
 9     3     9     1     2
 9     7     3     5     9
 6     3     5     6     8

B=imextendedmax(A,8) B =最大max(A,8)

B = B =

 1     1     1     1     1
 1     1     1     1     1
 1     1     1     1     1
 1     1     1     1     1
 1     1     1     1     1

From what I understand, imextendedmax(A,x) first suppresses all maxima that are x or less above their surroundings, and then it calls imregionalmax . 据我了解, imextendedmax(A,x)首先抑制所有大于其周围环境x或更小的最大值,然后调用imregionalmax

Thus, you want to call 因此,您想打电话

imextendedmax(A,1)

ans =

     0     0     0     1     0
     0     0     1     1     0
     1     0     1     0     0
     1     0     0     0     1
     0     0     0     0     1

If you want to find all areas that are x or more in an image, you can also just call (for x=8) 如果要查找图像中x或大于x的所有区域,也可以调用(对于x = 8)

x = 8;
A >= x
ans =

         0     0     0     1     0
         0     0     1     1     0
         1     0     1     0     0
         1     0     0     0     1
         0     0     0     0     1

Thus thresholding the image. 因此对图像进行阈值处理。

In the end it really comes down to what you want to do. 最后,它实际上取决于您想要做什么。 If you consider your image as having peaks and valleys, do you want to find the location of the peaks? 如果您认为图像具有峰谷,您是否想找到峰的位置? Then use imdilate for local maximum detection (see below). 然后使用imdilate进行局部最大值检测(请参见下文)。 Do you want to know which parts of the peaks and valleys would stay dry if you fill everything to a level x with water? 您是否想知道如果将所有东西都注满水到x的水平,峰谷的哪些部分会保持干燥? Then use A>x etc. 然后使用A>x等。


EDIT 编辑

Apologies about findpeaks . 关于findpeaks道歉。 I assumed that you mentioned it because it worked for 2D and I didn't check. 我以为您提到了它,因为它适用于2D,但我没有检查。 For local maximum detection, a very nice way is to use imdilate like this 对于局部最大值检测,一种非常好的方法是使用像这样的imdilate

locMaxMask = A > imdilate(A,[1,1,1;1,0,1;1,1,1]);

The call to imdilate replaces every pixel with the maximum of its surroundings. 对imdilate的调用会用周围的最大像素替换每个像素。 Thus, the comparison will yield all pixels that have a higher value than the 8 surrounding pixels. 因此,比较将产生具有比周围的8个像素更高的值的所有像素。

About the noise: There has been a similar question to yours, so I link you to the answer I gave there. 关于噪音:您有一个类似的问题,所以我将您链接到我在那给出的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM