matlab找最大值_如何在MATLAB中找到图像中的局部最大值?

在MATLAB中,作者需要找到图像处理后的局部最大值,通过创建一个3D数组来比较每个像素与其邻居,然后查找第三维的最大值是否出现在第一层。他们询问是否存在更简洁的方法。提供的解决方案是使用形态学操作bw = pic > imdilate(pic, [1 1 1; 1 0 1; 1 1 1])。" 42778373,2983441,SpringMVC+Hibernate整合:Dao注入错误及解决方案,"['Java', 'Hibernate', 'Spring框架', 'SpringMVC', '异常处理']
摘要由CSDN通过智能技术生成

I have an image in MATLAB:

y = rgb2gray(imread('some_image_file.jpg'));

and I want to do some processing on it:

pic = some_processing(y);

and find the local maxima of the output. That is, all the points in y that are greater than all of their neighbors.

I can't seem to find a MATLAB function to do that nicely. The best I can come up with is:

[dim_y,dim_x]=size(pic);

enlarged_pic=[zeros(1,dim_x+2);

zeros(dim_y,1),pic,zeros(dim_y,1);

zeros(1,dim_x+2)];

% now build a 3D array

% each plane will be the enlarged picture

% moved up,down,left or right,

% to all the diagonals, or not at all

[en_dim_y,en_dim_x]=size(enlarged_pic);

three_d(:,:,1)=enlarged_pic;

three_d(:,:,2)=[enlarged_pic(2:end,:);zeros(1,en_dim_x)];

th

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值