DSPRelated.com
Forums

Down-sample Spectrogram (Waterfall) by two different factors

Started by msousa 9 months ago1 replylatest reply 9 months ago150 views

Hi

I want to down-sample a Spectrogram (Waterfall) image, time on 'y' axis and frequency on 'x' axis. What I would like is to do is down-sample the image when it is resized, (likely by grabbing a corner and dragging it). This would preferably modify the original waterfall diagram by a time factor on the 'y' axis and by a frequency factor on the 'x' axis.  Aspect ratio does not to be maintained. Original image may not be square. So, for example, the image change produces and a time change of .5 and a frequency change of .7.  I'm thinking this would cause the column (frequency) axis resolution to change by 30% and the row (time) axis resolution to change by 50%.  I have done this with one change factor but not with two and it's not clear to me how to go about this.  I may also have my axis's mixed up in describing this.  I am doing this in C++, but I don't think that matters in this discussion.

Some additional info:

The image may be square or rectangle, won't know until received.

Also, maybe this can be addressed by down sampling one axis, say the 'x' axis. So if a spectrogram, I will be down sampling the frequencies (the time, 'y' axis, would remain the same). Is this possible? If so, any idea how can I go about this?   Thanks...


#Spectrogram #Downsample #ImageProcessing

[ - ]
Reply by G4ELIJuly 22, 2023

For purely image processing I used Direct2D on Windows, SetInterpolationMode = InterpolationModeHighQualityBicubic so the keywords here are "bicubic interpolation". Similar functions no doubt exist on OpenGL.

Also, I save all FFT output and recompute each row when the X axis scale changes which it can do when users get 'excited'. Two scenarios:

  1. Fewer FFT bins than DIPs - I use a simple cubic spline interpolation.
  2. More FFT bins than bins - I take the average of the bins after first converting from Log10 using Pow10, then back using Log10.

Scaling the FFT bins in Y could also be done in a similar fashion but I expect that image scaling would suffice.

FWIW the software is SDR Console, sdr-radio.com. The typical waterfall update rate is 40 lines/second and as much as 100 lines/second so this has to be fast and provide a good 'user experience'.

HTH