今天的帖子显示了如何使用
ISMEMBER
to conveniently locate all of the highest pixel values in an image. For example, in the following Hough transform image, what are the 20 highest values, and
所有具有这些值的像素在哪里
?
我从图像处理工具箱作者梅根·曼库索(Megan Mancuso)编写的一些示例代码中得到了这个想法。梅根说她有使用的想法
ISMEMBER
这样来
艾哈迈德的答案
在MATLAB答案上。
这是上面的霍夫变换图像来自的地方。
a = imread("gantrycrane.png");
bw = edge(rgb2gray(a),“ Canny”);
imshow(H,[],XData=T,YData=R)
Now let's sort to figure out the highest 20 values of
H
。
sorted_h_values = stort(h(:),,,“下降”);
最高_h_values = sorted_h_values(1:20)
293 250 209 205 182 177 173 172 171 168
最后,我会用
ISMEMBER
to compute a binary image showing all the elements of H that have one of those 20 highest values. (And I'll use
xlim
and
Ylim
放大,以便我们可以清楚地看到其中的一些元素。)
mask_20_highest_values = iSmember(h,gish_h_values);
imshow(mask_20_highest_values,xdata = t,ydata = r)
任何元素逻辑功能,例如
ISMEMBER
,可以以这种方式使用二进制图像。因此,将其添加到您的Matlab技巧袋中!
Comments
要发表评论,请单击here登录您的数学帐户或创建一个新帐户。