0
$\begingroup$

I'm working on project where I'm using Independent Components Analysis (ICA) on NxN patches from images to separate components in an image signal. Each column of the resulting MxN^2 unmixing matrix is reshaped back to an NxN filter containing the independent components. For my project, this filter is then convolved with new images for feature extraction purposes.

My question is, how do I remove the DC offset of these NxN filters that result from ICA? In order words how can I ensure that (in MATLAB parlance) sum(sum(filter)) == 0 returns 1? Is it fair to just subtract the filter's sum from each component, or will that affect the filter's response?

If the filter sums to some non-zero value X, is it appropriate to just subtract X/number_of_coefficients from each filter coefficient?

$\endgroup$

1 Answer 1

1
$\begingroup$

Removing the mean (and not the sum) from a linear filter leads to a filter that removes DC.

For example:

N = 10;
h = [0.5 1 0.5];
conv(ones(N,1), h, 'valid')

leads to 2s.

N=10
h = [0.5 1 0.5]; h_high=h-mean(h);
conv(ones(N,1), h_high, 'valid')

leads to zeros.

Alternatively, you can use any high pass filter.

$\endgroup$
2
  • $\begingroup$ But what about in this answer here: dsp.stackexchange.com/questions/8501/…. It says that when you want to cancel out all of the DC effects, you want the kernel to sum to 0 $\endgroup$
    – marcman
    Aug 4, 2015 at 16:15
  • $\begingroup$ ...which is what happens if you subtract the mean... gotcha $\endgroup$
    – marcman
    Aug 4, 2015 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.