Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 在MATLAB中绘制或选择二值图像中的第n个像素_Image_Matlab_Image Processing_Plot - Fatal编程技术网

Image 在MATLAB中绘制或选择二值图像中的第n个像素

Image 在MATLAB中绘制或选择二值图像中的第n个像素,image,matlab,image-processing,plot,Image,Matlab,Image Processing,Plot,我有一个二值图像,我找到了它们的位置。我有x和y位置。我从变量表中绘图,例如绘图(1,94,'g+')。我选择了每60个像素。我想知道有没有可能用命令或代码自己选择每N个像素,而不是手动写入 谢谢只需使用索引1:n:end: % generate random binary image bw = rand(100) > 0.9; % locate all 1's [r,c] = find(bw); % choose every nth pixel n = 30; rr = r(1:n:en

我有一个二值图像,我找到了它们的位置。我有x和y位置。我从变量表中绘图,例如绘图(1,94,'g+')。我选择了每60个像素。我想知道有没有可能用命令或代码自己选择每N个像素,而不是手动写入


谢谢

只需使用索引
1:n:end

% generate random binary image
bw = rand(100) > 0.9;
% locate all 1's
[r,c] = find(bw);
% choose every nth pixel
n = 30;
rr = r(1:n:end);
cc = c(1:n:end);
% plot
imshow(bw,'InitialMagnification','fit');
hold on;
plot(cc,rr,'r*');

你的意思是“提取每个第k个元素”?我不确定它是否在提取。我只想画出它们并在结果中显示出来。我有一行二进制图像,我想在上面显示10个点。我是手工写的,但我正在搜索更实用的东西。非常感谢。[hy,hx]=find(bwi);imshow(bw);等等绘图(hx,hy,'ro')%每n个像素选择n=60;hx=x(1:n:end);hy=y(1:n:end);%阴谋等待;图(hx,hy,'g*');我尝试了我的代码,但它只描绘了一点。我想找出十点。可能吗?do
hx=hx(1:n:end);hy=hy(1:n:end)