Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
在matrice matlab中生成nan的条带_Matlab_Image Processing_Matlab Figure - Fatal编程技术网

在matrice matlab中生成nan的条带

在matrice matlab中生成nan的条带,matlab,image-processing,matlab-figure,Matlab,Image Processing,Matlab Figure,我有一个图像大小(m x n x 4)我想在上面画一条0或NaN。我希望这些条带是4像素宽,它们之间有大约30像素的空间。也就是说,当我在RGB中显示图像时,我有NaN条带。有人能帮我解决这个问题吗 我将您的问题解释为“如何在图像上重复绘制具有给定宽度和指定偏移量的黑线” 您不能直接解决它们吗,比如var(x:y,xx:yy,xxx:yy)=nan? img = imread('peppers.png'); height = size(img,1); strip_width = 4; strip

我有一个图像大小
(m x n x 4)
我想在上面画一条
0
NaN
。我希望这些条带是4像素宽,它们之间有大约30像素的空间。也就是说,当我在
RGB
中显示图像时,我有
NaN
条带。有人能帮我解决这个问题吗

我将您的问题解释为“如何在图像上重复绘制具有给定宽度和指定偏移量的黑线”


您不能直接解决它们吗,比如
var(x:y,xx:yy,xxx:yy)=nan
img = imread('peppers.png');
height = size(img,1);
strip_width = 4;
strip_offset = 30;

line_start_idx = 0:(strip_width+strip_offset):height;
line_idx = ndgrid(line_start_idx,1:strip_width)';
line_idx = line_idx(:);
line_add = repmat(1:strip_width,1,length(line_start_idx))';
line_idx = line_idx + line_add;

img(line_idx,:,:) = 0;
imshow(img)