残差图像中的双边滤波器

bilateral filter in residuel image

我在残差图像中应用了双边滤波器(residel image=image origianle-image with weavlet transform) 错误是

Error using bfilter2 (line 35) Input image A must be a double precision matrix of size NxMx1 or NxMx3 on the closed interval [0,1].

i tried to normalizate my data with:

 f = rand(256,256)
normf = max(f) - min(f);               % this is a vector
normf = repmat(normf, [length(f) 1]);  % this makes it a matrix
                                       % of the same size as A
normalizedf = f./normf;

矩阵中的值变为[0,1]之间但错误仍然相同 NB:the 我使用的双边滤波器是 B = bfilter2(A,W,SIGMA) 对灰度或彩色图像 A 执行二维双边滤波。A 应该是大小为 NxMx1 或 NxMx3 的双精度矩阵(即,灰度或彩色图像)在闭区间 [0,1] 中具有归一化值。高斯双边滤波器的半尺寸 window 由 W 定义。双边滤波器的标准差由 SIGMA 给出,其中空间域标准差由 SIGMA(1) 和强度域给出标准差由 SIGMA(2) 给出。 NB:the 我的图片尺寸为 <256x256 双精度>

很难知道发生了什么,因为你没有显示太多代码,但是如果你去 bwfilter2 你可以看到下一段代码:

if ~isfloat(A) || ~sum([1,3] == size(A,3)) || ...
      min(A(:)) < 0 || max(A(:)) > 1
   error(['Input image A must be a double precision ',...
          'matrix of size NxMx1 or NxMx3 on the closed ',...
          'interval [0,1].']);      
end

这就是您遇到错误的地方。我建议您测试数据中 if 的每个条件(即 ~isfloat(A)min(A(:)) < 0 ,...),然后查看哪些条件变为 1 并抛出错误。