% cambiarValores.m
function J=cambiarValores(I,x,y);
% cambiarValores substitutes values in I above x with y.

if isrgb(I)
   [m n c]=size(I);
   J=I;
   for i=1:m
      for j=1:n
	   for k=1:c
if I(i,j,k)>x
	         J(i,j,k)=y;
	   	end
	   end
      end
   end		
else
   [m n] = size(I);
   J=I;
   for i=1:m
      for j=1:n
	   if I(i,j)>x
	      J(i,j)=y;
	   end
	end
   end
end
