【发布时间】:2014-12-15 14:41:22
【问题描述】:
我想在图像 img_gauss 的每一列中找到这 2 个局部最大值之间的局部最大值和最小值。然后将它们的最小值设置为 1(白色)。任何人都知道如何以简单的方式做到这一点?
下面是我的代码。但是我遇到了一些麻烦,我尝试在每次迭代(对于每一列)中进行定位(locs),然后将它们放入数组 peaks_column 中,以便按列定位峰,但是会出现此错误:
下标分配维度不匹配。 cropping_image_long 中的错误(第 136 行) peaks_column(1:size(Intens_graph,1),x)=pks(:,1);
pks= [];
locs_column=zeros(20,size(img_gauss,2));
locs= [];
pks_column=zeros(20,size(img_gauss,2));
for x = 1:size(img_gauss,2) % 2 = colunas x(colunas)
% make a row wise intensity distribution graphic for each column
Intens_graph(:,x)=img_gauss(size(img_gauss,1):-1:1,x);
[pks,locs] = findpeaks(Intens_graph(:,x));%find the local maximum
peaks_column(1:size(Intens_graph,1),x)=pks(:,1); %associate to each column
locs_column(1:size(Intens_graph,1),x)=locs(:,1);
BW = imregionalmin(Intens_graph);
end
【问题讨论】:
-
请您发布一些示例数据。