[英]Find black a pixel position in matlab
i want to find black pixel positions and save them. 我想找到黑色像素位置并保存。 i used this code.
我用了这段代码。
I= imread('bin_ecgm.png');
imshow(I);
[r c] =size(I);
for j=1:c
for i=1:r
if(I(i,j)==1)
[i j]
end
end
end
how to store black pixel positions 如何存储黑色像素位置
usually black pixels are I( ii, jj ) == 0
... you can do that without a loop 通常黑色像素为
I( ii, jj ) == 0
...
[ii jj] = find( I == 0 ); % or I == 1 if you insist...
PS, PS,
It is best not to use i
and j
as variable names in Matlab . 最好不要在Matlab中使用
i
和j
作为变量名 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.