0
votes

i went to applicate the bilateral filter in residuel image (residel image=image origianle-image with weavlet transform) the errer is

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;

the valuue in matrix become betwen [0,1] but the error still the same NB:the bilateral filter taht i use is B = bfilter2(A,W,SIGMA) performs 2-D bilateral filtering for the grayscale or color image A. A should be a double precision matrix of size NxMx1 or NxMx3 (i.e., grayscal or color images, respectively) with normalized values in the closed interval [0,1]. The half-size of the Gaussian bilateral filter window is defined by W. The standar deviations of the bilateral filter are given by SIGMA, where the spatial-domain standard deviation is given by SIGMA(1) and the intensity-domain standard deviation is given by SIGMA(2). NB:the size of my image is <256x256 double>

1

1 Answers

0
votes

It is difficult to know whats going on as you dont show much code, but if you go to bwfilter2 you can see the next piece of code:

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

That's where you get the error. I would suggest you test each of the conditions of the if (i.e ~isfloat(A) , min(A(:)) < 0 ,...) in your data, and see which ones becomes 1 and throws the error.