Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.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中三维阵列的一维数值梯度_Image_Matlab_Gradient - Fatal编程技术网

Image matlab中三维阵列的一维数值梯度

Image matlab中三维阵列的一维数值梯度,image,matlab,gradient,Image,Matlab,Gradient,我有一个大小为(nrows x cols x ndivs)的三维数组(图像),我希望计算沿三维的1-D数值梯度,间距为0.01,并获得梯度集(nrows x ncols) 我想到了一种方法,通过循环每个像素来实现这一点: grad_F = zeros(nrows,ncols,ndivs); for irow = 1:nrows for icol = 1:ncols grad_F(irow,icol,:) = gradient(F(irow,icol,:),0.01);

我有一个大小为(nrows x cols x ndivs)的三维数组(图像),我希望计算沿三维的1-D数值梯度,间距为0.01,并获得梯度集(nrows x ncols)

我想到了一种方法,通过循环每个像素来实现这一点:

grad_F = zeros(nrows,ncols,ndivs);

for irow = 1:nrows
    for icol = 1:ncols
        grad_F(irow,icol,:) = gradient(F(irow,icol,:),0.01);
    end
end

我想问一下,是否有一个梯度阵列操作可以在不循环每个像素的情况下执行上述操作?如果有这样一种方法,是更快还是需要同样的时间?

如果我理解正确,这应该是可行的

[~,~,FZ] = gradient(F,0.01)

FZ是你在第三维度的梯度。

如果我理解正确,这应该是可行的

[~,~,FZ] = gradient(F,0.01)

FZ是你的三维梯度。

啊,好的,谢谢!当我在matlab文档中看到它时,我以为这是指其他操作。啊,好的,谢谢!当我在matlab文档中看到它时,我认为这是指其他操作。