Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.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
MATLAB SPMD和nlfilter-更改窗口大小_Matlab_Parallel Processing_Convolution - Fatal编程技术网

MATLAB SPMD和nlfilter-更改窗口大小

MATLAB SPMD和nlfilter-更改窗口大小,matlab,parallel-processing,convolution,Matlab,Parallel Processing,Convolution,我正在使用John Burkardt的一个修改版本对一幅大灰度图像进行3x3方差计算。这样做的好处是,我可以使用PCT在本地机器上使用8个内核,但是我想更改窗口大小(目前为3x3),但我想尝试几种窗口大小。如何修改下面的代码以允许可变的窗口大小?(我将使用奇数方形窗口,例如3x3、5x5、7x7、9x9等) 函数y=parwinvar(x) %************************************************************************** %

我正在使用John Burkardt的一个修改版本对一幅大灰度图像进行3x3方差计算。这样做的好处是,我可以使用PCT在本地机器上使用8个内核,但是我想更改窗口大小(目前为3x3),但我想尝试几种窗口大小。如何修改下面的代码以允许可变的窗口大小?(我将使用奇数方形窗口,例如3x3、5x5、7x7、9x9等)

函数y=parwinvar(x) %************************************************************************** % % %%PARWINVAR使用MATLAB的SPMD命令进行并行窗口方差。 % %讨论: %计算加窗标准偏差(平方得到方差)。 %基于John Burkardt的对比2_SPMD。 % % %参数: % %输入,图像X,初始黑白图像。 %输出,图像Y,对比度增强的黑白图像。 % % % %打开matlabpool % matlabpool开放本地8 % %检查图像是否为灰度,如果不是,请将其隐藏 % 如果ndims(x)>2 x=RGB20灰色(x); 结束 % %因为图像是黑白的,所以它是一个2D数组。 %因此,它将按列分发。 % xd=分布(x); % %让每个工作人员增强其图片部分的对比度。 % %您将看到许多无意义的错误消息,因为NLFILTER %想放一个“侍者酒吧”让你等。但是工人们 %没有关联的显示。 % spmd xl=getLocalPart(xd); % %为了使用LABSENDRECEIVE,我们需要参考前面的 %接下来是labindex。 % if(labindex~=1) 先前=labindex-1; 其他的 先前=numlabs; 结束 if(labindex~=numlabs) next=labindex+1; 其他的 next=1; 结束 % %每个worker将其第一列发送给前一个worker, %并从下一工作者接收相应的数据。 % column=labSendReceive(上一个,下一个,xl(:,1)); if(labindex
提前感谢您的帮助。

您需要修改
labSendReceive
行以发送更多数据。特别是像这样的事情:

%
%  Each worker sends its first column to the previous worker,
%  and receives corresponding data from the next worker.
%
column = labSendReceive ( previous, next, xl(:,1) );
需要成为:

%
%  Each worker sends its first N columns to the previous worker,
%  and receives corresponding data from the next worker.
%
columns = labSendReceive ( previous, next, xl(:,1:N) );

其中
N
(blocksize-1)/2
。当发送右侧的“重影单元格”和剥离“额外列”时,将进行相应的更改。

谢谢!在我回来检查之前,我已经设法破解了它,但它是相同的修复。
%
%  Each worker sends its first N columns to the previous worker,
%  and receives corresponding data from the next worker.
%
columns = labSendReceive ( previous, next, xl(:,1:N) );