how to use image filters for spectrograms? Using MATLAB, I can import an audio signal and use some FFT function to get the spectrogram into the workspace. My question from here, is how to then process this spectrogram with image filtering techniques that usually import some image. For example, here is the code that filters an image:

J = imread('example.jpg');
K = somefilter(J);


my question is the imread part; as you can see the image is imported to J and then this J is used for the processing function below. However, can I simply input my spectrogram data from the workspace directly into the filter argument? or is there some other step that needs to happen before? 

Also, most image filtering matlab codes mention sometime the input is grayscale image or RGB, color, etc. My question is: how is a spectrogram in Matlab classified as? does it matter for the filter? do I need to convert the spectrogram then?
A spectrogram of a monochannel (real) audio file would generally be a complex 2D matrix, hence a sort of complex image.  So you can use 2D filters directly on the complex matrix in the workspace. However, filtering complex data can be complicated, due to the non-linear coupling between the phase and the magnitude: if you want to preserve the Hermitian properties, which is useful when you want to invert the spectrogram into a real (filtered) signal. So traditional algorithms like  enhancement, shrinkage, adaptive filtering, masking are possible.

Thus, no need to go through an intermediate binary format like:


  J = imread('example.jpg');


that will quantize or compress values and somehow loose the complex aspect. 

Note that processing complex values requires some care. In many situations, people only want to analyze the magnitude of the spectrogram, which then become a mere positive real-valued 2D matrix. Then, all sorts of 2D processing are available. In that case, you should take care of preserving the positivity. Most linear filters with non-negative coefficients will do the job. Non-linear processing tools based on histograms, on ranking, may require a simplification of the floating-point values.