git-svn-id: http://moon:8086/svn/matlab/trunk@91 801c6759-fa7c-4059-a304-17956f83a07c
21 lines
420 B
Matlab
21 lines
420 B
Matlab
% Removes DC component from image patches
|
|
% Data given as a matrix where each patch is one column vectors
|
|
% That is, the patches are vectorized.
|
|
|
|
function [Y,meanX]=removeDC(X, dim);
|
|
|
|
% Subtract local mean gray-scale value from each patch in X to give output Y
|
|
if nargin == 1
|
|
dim = 1;
|
|
end
|
|
|
|
meanX = mean(X,dim);
|
|
|
|
if dim==1
|
|
Y = X-meanX(ones(size(X,1),1),:);
|
|
else
|
|
Y = X-meanX(:,ones(size(X,2),1));
|
|
end
|
|
|
|
return;
|