在matlab中使用colfit进行唤醒

时间:2012-04-17 15:06:04

标签: matlab matlab-deployment

我想使用colfit计算输入图像的直方图和局部直方图均衡。但是当我运行代码时,我得到以下错误。 ???使用==>时出错通用电器 矩阵维度必须一致。

==>中的错误colfilt at 135 if all(block> = size(a)),%立即处理整个矩阵。

==>中的错误10岁的当地人 z = colfilt(f,[w w],'sliding',@ std);

请提供一些见解。

1 个答案:

答案 0 :(得分:1)

我没有看到它写在文档上(既不在help colfilt也不在docs colfilt),但我认为你只能使用colfiltnlfilter,与单通道图像。因此,如果您尝试在3通道图像上运行help colfilt上提供的示例代码,请说:

I = imread('peppers.png');  % 'peppers.png' is just a demo color image usually provided with matblab
figure, imshow(I)
I2 = uint8(colfilt(I,[5 5],'sliding',@mean));
figure, imshow(I2)

你得到了你发布的那种错误:

  

使用> =时出错   矩阵维度必须一致。

     

colfilt错误(第135行)      if all(block> = size(a)),%立即处理整个矩阵。

如果你吵了这个,只需要第一个频道(或任何其他频道组合),它就会起作用

% which is one of the example images usually provided with matlab
J = imread('peppers.png');
I = J(:,:,1);
figure, imshow(I)
I2 = uint8(colfilt(I,[5 5],'sliding',@mean));
figure, imshow(I2)

我希望这会有所帮助