DSPRelated.com
Forums

"Good" FIRs with no negative parts

Started by Michel Rouzic November 25, 2007
I have images that I'm either trying to downsample or upsample,
preferably using time-domain convolution with a FIR kernel. The main
characteristic of these images is that they're overwhelmingly black,
that means, isolated bright features spread around a very dark
surface, quite similarly to the picture of a starry night sky.

Here's the problem, due to the overwhelming presence of black areas in
my pictures, it leaves FIRs with negative values (such as Lanczos/
windowed sinc FIRs) out of the equation (well it at least makes them
far-from-ideal choices), as most of the time the result would be
equivalent to setting the negative values of the FIR to 0 in the first
place. So what options do I have left? I've looked at the DFTs of
Blackman and Gaussian functions, and they would make pretty awful
FIRs, as they have a huge transition bandwidth, they have virtually no
"full" passband area (if that makes any sense), and the Gaussian
function has a relatively bad stop-band attenuation, plus an infinite
length.

To sum up things, I'm looking for a FIR function with, if possible, no
negative values (but let's not leave non-negative Lanczos FIRs out of
our considerations), and as narrow a transition bandwidth as possible.

Thanks in advance.
On Nov 25, 1:22 pm, Michel Rouzic <Michel0...@yahoo.fr> wrote:
> I have images that I'm either trying to downsample or upsample, > preferably using time-domain convolution with a FIR kernel. The main > characteristic of these images is that they're overwhelmingly black, > that means, isolated bright features spread around a very dark > surface, quite similarly to the picture of a starry night sky. > > Here's the problem, due to the overwhelming presence of black areas in > my pictures, it leaves FIRs with negative values (such as Lanczos/ > windowed sinc FIRs) out of the equation (well it at least makes them > far-from-ideal choices), as most of the time the result would be > equivalent to setting the negative values of the FIR to 0 in the first > place. So what options do I have left? I've looked at the DFTs of > Blackman and Gaussian functions, and they would make pretty awful > FIRs, as they have a huge transition bandwidth, they have virtually no > "full" passband area (if that makes any sense), and the Gaussian > function has a relatively bad stop-band attenuation, plus an infinite > length. > > To sum up things, I'm looking for a FIR function with, if possible, no > negative values (but let's not leave non-negative Lanczos FIRs out of > our considerations), and as narrow a transition bandwidth as possible. > > Thanks in advance.
My impression is that the problem with using any linear filter on astronomical image data is that the data does not resemble being bandlimited closely enough. The optical diffraction disc or focus spot isn't always calibrated to the CCD pixel spacing, and the data is clipped at zero. Any good linear filter will spatter this high frequency content far afield, as well as perhaps below the numeric floor where more information content will get clipped into additional high frequency noise and data lossage. On these types of images, I would be tempted to try some form of non-linear interpolation, adaptive to the local content, maybe selection from a set of splines based on neighboring median criteria or something... IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
On 25 Nov, 22:22, Michel Rouzic <Michel0...@yahoo.fr> wrote:
> I have images that I'm either trying to downsample or upsample, > preferably using time-domain convolution with a FIR kernel. The main > characteristic of these images is that they're overwhelmingly black, > that means, isolated bright features spread around a very dark > surface, quite similarly to the picture of a starry night sky.
If your images resemple astro images, you might want to ask this question in an astronomy newsgroup. There ought to be a few established and tested algorithms for dealing with images with these caharacteristics. Rune
On Nov 25, 4:22 pm, Michel Rouzic <Michel0...@yahoo.fr> wrote:

> Here's the problem, due to the overwhelming presence of black areas in > my pictures, it leaves FIRs with negative values (such as Lanczos/ > windowed sinc FIRs) out of the equation (well it at least makes them > far-from-ideal choices), as most of the time the result would be > equivalent to setting the negative values of the FIR to 0 in the first > place. So what options do I have left?
If you absolutely must stay with linear filters, then you're running into some of the basic time/frequency tradeoffs inherent in all filter design. With anything but a Gaussian shape, if the filter does not ring in one domain then it does ring in the other. In your case I would recommend something like window-based FIR filter design (can be found in any DSP book), except that you're convolving the window with a rectangular kernel in the time-domain (well, actually spatial- domain) instead of in the frequency-domain. The basic concept remains the same, though, by duality. You did not specify what kind of frequency-domain performance you desire, but you should be able to experiment with various windows and hopefully get something that meets your needs. If you're willing to look at nonlinear solutions, then Ron N already mentioned some possibilities for locally-optimized solutions. I wonder, though, since we're already discussing nonlinear solutions, if addition of a small global bias to your images might allow you to use filters with "negative values", so that all pixel values remain positive or zero after the convolution. Greg

Michel Rouzic wrote:
> I have images that I'm either trying to downsample or upsample, > preferably using time-domain convolution with a FIR kernel.
[...]
> To sum up things, I'm looking for a FIR function with, if possible, no > negative values (but let's not leave non-negative Lanczos FIRs out of > our considerations), and as narrow a transition bandwidth as possible.
That reminds me of the old problem of what conditions should satisfy the frequency response of a filter so the step response can be monotonic. I don't know if there is hard and fast answer to this question; I may be wrong however it seems like if you want a filter with the response better then gaussian, there will be ripple. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com

Greg Berchin wrote:


> If you absolutely must stay with linear filters, then you're running > into some of the basic time/frequency tradeoffs inherent in all filter > design. With anything but a Gaussian shape, if the filter does not > ring in one domain then it does ring in the other.
However it is possible to have the steep response in the frequency domain without ringing in the time domain for the cost of the increased group delay in the filter. What I don't know is if there is a rule of thumb or some approximated formula about delay vs passband vs stopband if the time domain response is monotonic. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Nov 26, 10:48 am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:

> However it is possible to have the steep response in the frequency > domain without ringing in the time domain for the cost of the increased > group delay in the filter.
I'm not sure what you're driving at here, Vladimir. If one examines zero-phase even-symmetrical filters (avoiding the issue of group delay), then a Gaussian shape in the time(space)-domain corresponds to a Gaussian shape in the frequency(1/space)-domain. From there, if the shape in either domain is made more "rectangle-like", the shape in the other domain will become more "sinc-like". As far as I know, there is no way around this basic property of Fourier analysis. Am I missing a basic assumption behind your statement? Answering a comment in your earlier post, ("the old problem of what conditions should satisfy the frequency response of a filter so the step response can be monotonic"), I'm not certain what frequency-domain constraints will guarantee monotonic step response, but in the time-domain an impulse response that is everywhere nonnegative will do it. Greg

Greg Berchin wrote:

> On Nov 26, 10:48 am, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > wrote: > > >>However it is possible to have the steep response in the frequency >>domain without ringing in the time domain for the cost of the increased >>group delay in the filter. > > > I'm not sure what you're driving at here, Vladimir.
The question is what is the minimum delay in the LPF(Fpass, Fstop, Gstop) if the step response of this LPF has to be monotonous? There is obviously a limit for that; can we establish a rule of thumb? This applies to FIRs as well as IIRs. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Hi Michel,
Let me suggest that you are thinking about this problem in a fundamentally
wrong way.  You have image 1, and want to create image 2 that is a
different size.  Further, you want image 2 to be similar to image 1 &ldquo;in
some sense.&rdquo;   In other words, the two images cannot be identical, so
you need to define a criterion for measuring the &ldquo;correctness&rdquo; of
image 2.  The method you are trying (frequency band filtering with
decimation/interpolation) achieves this &ldquo;in the sense&rdquo; that the two
images have similar frequency spectra.  

Here&rsquo;s the catch.  The information you are dealing with is encoded in
the spatial domain, not the frequency domain.  That is, you are interested
in the spatial patterns, their edges, their positions, their amplitudes,
and so on. Accordingly, you want image 2 to be similar to image 1 in
&ldquo;some sense&rdquo; that is related to the spatial domain.  This is in
contrast to, for example, an audio signal that is primarily encoded in the
frequency domain. 

The problems you are seeing are a direct result of trying to manipulate
the data in the wrong domain. For instance, when you perform simple
filtering in the frequency domain, you create unpredictable artifacts in
the spatial domain.  Instead, ask yourself this, &ldquo;how should a pixel in
image 1 affect each pixel in image 2?&rdquo;  For instance, should an isolated
bright pixel in the original image be converted to a single bright pixel in
the new image?     

Hope this helps.
Regards,
Steve 
Steve.Smith1@SpectrumSDI.com
SteveSmith wrote:
> Hi Michel, > Let me suggest that you are thinking about this problem in a fundamentally > wrong way. You have image 1, and want to create image 2 that is a > different size. Further, you want image 2 to be similar to image 1 "in > some sense." In other words, the two images cannot be identical, so > you need to define a criterion for measuring the "correctness" of > image 2. The method you are trying (frequency band filtering with > decimation/interpolation) achieves this &ldquo;in the sense&rdquo; that the two > images have similar frequency spectra. > > Here&rsquo;s the catch. The information you are dealing with is encoded in > the spatial domain, not the frequency domain. That is, you are interested > in the spatial patterns, their edges, their positions, their amplitudes, > and so on. Accordingly, you want image 2 to be similar to image 1 in > &ldquo;some sense&rdquo; that is related to the spatial domain. This is in > contrast to, for example, an audio signal that is primarily encoded in the > frequency domain. > > The problems you are seeing are a direct result of trying to manipulate > the data in the wrong domain. For instance, when you perform simple > filtering in the frequency domain, you create unpredictable artifacts in > the spatial domain. Instead, ask yourself this, "how should a pixel in > image 1 affect each pixel in image 2?" For instance, should an isolated > bright pixel in the original image be converted to a single bright pixel in > the new image?
Steve, It's clear why you write the books. I was trying to formulate the words to get across just what you wrote above when I saw it. You got to the point directly and simply compared to what I was paring down. I would probably have gotten there eventually, but not as well as you did. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;