我的尝试导致根本没有输出。请帮帮我。
[row col] =size(i11);
for j=1:col
for i=1:row
darkestPixelValue = min(i11(i,j));
[i,j]=find(i11==darkestPixelValue);
plot (i,j);
end
end
答案 0 :(得分:4)
使用min
的第二个输出参数:
>> [mn row] = min( i11, [], 1 );
>> figure; imshow( i11 ); hold on; scatter( 1:size(i11,2), row, 40, 'xr' );
答案 1 :(得分:0)
一种不同的方法,用于从上方(@shai和@ user2805487)启发标记暗和亮像素:
[r c]=size(a);
pv=zeros(r,1);
dark=zeros(c,1);
for i=1:c
for j=1:r
pv(j)=a(j,i);
end
[ind dp] =min(pv);
dark(i)=ind;
[ind dp] =max(pv);
lyt(i)=ind;
end
figure; imshow(a); hold on; scatter(1:c, dark, 40, 'xr' );
figure; imshow(a); hold on; scatter(1:c, lyt, 40, 'xg' );