When I try visualizing a high-pass filtered image, all I see is gray, similar to the middle subfigure in the attached figure from a related paper. The authors claim they normalize the image to have unit variance, so I tried plotting $(x - \mu) / \sigma$, which still resulted in a gray image. Here is my process for high-pass filtering:

  1. Shifted DFT
  2. Apply radial mask, zero out low frequencies
  3. Inverse shifted DFT
  4. Normalize image to $[0, 1]$

enter image description here

  • $\begingroup$ Show your starting image -- it would have to have significant high-frequency content. You might want to try something with known HF content (like the author's starting picture). Did the authors say how they dealt with negative values? By definition, $x - \mu$ is going to range around both sides of zero; for images you'd need to either take the absolute value or square that. $\endgroup$
    – TimWescott
    Oct 23, 2019 at 17:32
  • $\begingroup$ I'm working with private mammography data so I can't upload the image, but it has significant HF content. That's a good point about negative values, but I also tried $x / \sigma$ and this also gave me a gray image. All the authors said was "In order to even visualize these high frequency features, we had normalize pixel statistics to have unit variance." $\endgroup$
    – tmakino
    Oct 23, 2019 at 21:18
  • $\begingroup$ Wait. If it's high-pass filtered $\mu$ should be zero -- why didn't either of us catch that? Are you using the $\sigma$ from before the high-pass filtering, or after? (You need after). $\endgroup$
    – TimWescott
    Oct 23, 2019 at 22:09
  • $\begingroup$ I am using the $\sigma$ after the inverse DFT. $\endgroup$
    – tmakino
    Oct 24, 2019 at 1:03
  • $\begingroup$ If you want to check the free gimp wavelet decomposition plugin it is awesome, the results are more graded... One of the images here shows a photo with invisible detail on some wavelengths: google.com/…: $\endgroup$ Oct 24, 2019 at 16:56

2 Answers 2


First of all beware of the difference between image sharpening and highpass filtering. The former is actually a high frequency amplified image, while the latter removes the low frequency and completely eliminates the DC component.

So assuming that you indeed wanted to remove low frequency content by appling a highpass filter, then your output will be a ghost like image with black background that shows image edges.

Highpass filtering can produce out of range values, compared to the original valid range. This can be corrected with the following:

Assuming valid data range as [0,1], then the following assures that it will remain in [0,1] again:

x[m,n] = (x[m,n] - x_min)/(x_max-xmin) 

Assuming valid data range as [0,255], then the following assures that it will remain in [0,255] again:

x[m,n] = 255*(x[m,n] - x_min)/(x_max-xmin) 

More generally to map a data range from [a,b], into [c,d], the following mapping can be used:

x[m,n] = (d-c)*(x[m,n] - a)/(b-a) + c 

Note that a range correction may not always yield a best looking image. You might as well need to adjust distribution of intensities in nonlinear ways to pop out requested features...

  • 1
    $\begingroup$ D'oh, that's a much better method than using $\sigma$. $\endgroup$
    – TimWescott
    Oct 23, 2019 at 22:11
  • $\begingroup$ @TimWescott mean & variance (std) notation finds places in intuitive explanations; but here I preferred this other perspective... $\endgroup$
    – Fat32
    Oct 23, 2019 at 22:14
  • 1
    $\begingroup$ It makes perfect sense, unless you've got an image that has a few really small outliers (because one white dot, one black dot, and a bunch of gray is just boring). $\endgroup$
    – TimWescott
    Oct 23, 2019 at 22:38
  • $\begingroup$ @TimWescott yes sometimes those outliers become real headaches... $\endgroup$
    – Fat32
    Oct 23, 2019 at 22:49
  • $\begingroup$ I performed the first option you mentioned, which normalized the values to $[0 ,1]$. However, when I plot this, it appears to be all gray. $\endgroup$
    – tmakino
    Oct 24, 2019 at 1:04

Very often, image display is driven by the initial data range (with inheritance). If the data is of uint8 format (per channel), some software keep subsequent calculations in the same range, so value below $0$ and above $255$ (or $1$) are clipped. Conversion of initial data to float, or signed integer, can help. As well, take care of the scaling induced by the display function. In Matlab, image does $[0,255]$, and imagecs does a scaling to avoid down and up saturations. And flattens negative or too high data.

All the above processes are affine: centering + scaling. Leaving aside the management of negative or too-high values, diversity enhancement can help visualizations, like logarithms or power-law, like in homomorphic filtering.


Your Answer

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

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