DSPRelated.com
Forums

Is linear phase filtering all it takes to prevent phase distortion?

Started by Unknown November 8, 2006
Hello friends,

I'm experimenting the effect of phase distortion in digital image
filtering. I use two 1D filters in Matlab for simplicity.
The impulse response of one filter is:
h1 = [1 -2 4 -2 1];
And the other one is:
h2 = [1 -2 4 1 -2];

Then, by using
freqz(h1);
freqz(h2);
I can easily see that h1 is indeed linear in phase response, while h2
is not.

However, after I used
result1 = filter(h1, input_image);
and
result2 = filter(h2, input_image);
to filter the image vertically, I found that the phase distortion level
is even worse in result1 than that in result2.

I did get expected results (which mean that linear-phase FIR will not
result in phase distortion but nonlinear-phase FIR will) by using
different h1 and h2, but when I tried the above mentioned coefficients
for h1 and h2, I just couldn't get what should be got.

So I'm wondering linear-phase filtering might not be all it takes to
prevent phase distortion. Or where did I go wrong?

Thank you for reading this question. All sorts of comments are
welcome:-)

Regards,
Merlin


merlin.jiang1978@gmail.com wrote:

> However, after I used > result1 = filter(h1, input_image); > and > result2 = filter(h2, input_image); > to filter the image vertically, I found that the phase distortion level > is even worse in result1 than that in result2. >
Maybe you should explain what you mean by "I found that the phase distortion level" How are you measuring phase distortion? -jim
> I did get expected results (which mean that linear-phase FIR will not > result in phase distortion but nonlinear-phase FIR will) by using > different h1 and h2, but when I tried the above mentioned coefficients > for h1 and h2, I just couldn't get what should be got. > > So I'm wondering linear-phase filtering might not be all it takes to > prevent phase distortion. Or where did I go wrong? > > Thank you for reading this question. All sorts of comments are > welcome:-) > > Regards, > Merlin
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Hi Jim,

I measured by observing the edges in the images. In result1, a single
edge was split into two edges or so, but in result2 a single edge
looked as compact as before (with some halos of course). The phenomenon
in result1 could be observed when I applied another nonlinear-phase FIR
(different from h2), while the halos and looks of the edges in result2
were common in image enhancement. Therefore, I thought that phase
distortion was in result1 but not in result2.

I can mail you the resulted images if you like, since I can't post
images here. Thanks for your comment:-)

Best regards,
Merlin


MJ1978 wrote:
> > Hi Jim, > > I measured by observing the edges in the images. In result1, a single > edge was split into two edges or so, but in result2 a single edge > looked as compact as before (with some halos of course). The phenomenon > in result1 could be observed when I applied another nonlinear-phase FIR > (different from h2), while the halos and looks of the edges in result2 > were common in image enhancement. Therefore, I thought that phase > distortion was in result1 but not in result2. > > I can mail you the resulted images if you like, since I can't post > images here. Thanks for your comment:-)
Not sure what you mean by edge. But if the edge you are referring to were let's say a horizontal line on a uniform background and you were to 1D filter in the vertical direction, then the resulting filtered image would have a line that resembled (in cross section) the impulse response of your filter. If the impulse response were linear phase type and you implemented your filter in the standard way for an FIR filter the line would appear to be centered on the same pixel as before filtering. If the impulse response were non-linear then the line would appear to move off center (let's assume you can flip back and forth rapidly between the 2 images). Whether or nor the line appears to be double or not doesn't have much to do with the linear phase characteristics of the filter. -jim ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
I don't know what do you call "distortion", however any kind of the
lowpass filter will have a transition band of about 1/Fc duration. The
transition may have more or less ringing depending on how abrupt is the
frequency response. There is generally no connection between the
linearity of the phase in the filter and the amount of ringing.


Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

http://www.abvolt.com

merlin.jiang1978@gmail.com wrote:

> Hello friends, > > I'm experimenting the effect of phase distortion in digital image > filtering. I use two 1D filters in Matlab for simplicity. > The impulse response of one filter is: > h1 = [1 -2 4 -2 1]; > And the other one is: > h2 = [1 -2 4 1 -2]; > > Then, by using > freqz(h1); > freqz(h2); > I can easily see that h1 is indeed linear in phase response, while h2 > is not. > > However, after I used > result1 = filter(h1, input_image); > and > result2 = filter(h2, input_image); > to filter the image vertically, I found that the phase distortion level > is even worse in result1 than that in result2. > > I did get expected results (which mean that linear-phase FIR will not > result in phase distortion but nonlinear-phase FIR will) by using > different h1 and h2, but when I tried the above mentioned coefficients > for h1 and h2, I just couldn't get what should be got. > > So I'm wondering linear-phase filtering might not be all it takes to > prevent phase distortion. Or where did I go wrong? > > Thank you for reading this question. All sorts of comments are > welcome:-) > > Regards, > Merlin >
MJ1978 wrote:

> Hi Jim, > > I measured by observing the edges in the images. In result1, a single > edge was split into two edges or so, but in result2 a single edge > looked as compact as before (with some halos of course). The phenomenon > in result1 could be observed when I applied another nonlinear-phase FIR > (different from h2), while the halos and looks of the edges in result2 > were common in image enhancement. Therefore, I thought that phase > distortion was in result1 but not in result2. > > I can mail you the resulted images if you like, since I can't post > images here. Thanks for your comment:-) > > Best regards, > Merlin >
That's not phase distortion, that's just ringing. If it rings as much to the left of the edge as it does to the right it's not phase distortion. There _are_ other bad things that can happen to an image than just phase distortion. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Hello Jim, Tim, and Vladimir,

Yes it should be ringing, which some people call "halos." I seldom use
an impulse response like [1 -2 4 -2 1], but I often use something like
[-1 2 -1] instead. I just failed to recognize that they were the same
issue.

Thanks for all your kind comments:-)

Best regards,
Merlin


> I don't know what do you call "distortion", however any kind of the > lowpass filter will have a transition band of about 1/Fc duration. The > transition may have more or less ringing depending on how abrupt is the > frequency response. There is generally no connection between the > linearity of the phase in the filter and the amount of ringing. > >
Is that really true? The amount of ringing is a function of the steepness of the transition band? and the symetry of the ringing (pre and post ringing) is a function of the linearity of the phase response? So there is no way to build filter with a given transition bandwidth and a given low level of ringing? The best you can do is make the ringing symetrical by making the phase response linear...... I guess that is what the Gibbs phenomenon is about... Mark
Mark wrote:
> > I don't know what do you call "distortion", however any kind of the > > lowpass filter will have a transition band of about 1/Fc duration. The > > transition may have more or less ringing depending on how abrupt is the > > frequency response. There is generally no connection between the > > linearity of the phase in the filter and the amount of ringing. > > > > > > Is that really true? > > The amount of ringing is a function of the steepness of the transition > band? > > and > > the symetry of the ringing (pre and post ringing) is a function of the > linearity of the phase response? > > So there is no way to build filter with a given transition bandwidth > and a given low level of ringing?
Sharp linear filters can ring. I think another edge-enhancement technique is to use a non-linear algorithm to attempt to sharpen certain types of edges without ringing. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M

Ron N. wrote:

>>>I don't know what do you call "distortion", however any kind of the >>>lowpass filter will have a transition band of about 1/Fc duration. The >>>transition may have more or less ringing depending on how abrupt is the >>>frequency response. There is generally no connection between the >>>linearity of the phase in the filter and the amount of ringing. >>> >>Is that really true? >> >>The amount of ringing is a function of the steepness of the transition >>band?
It is a bit more complicated. There is relation between the delay in the filter, the steepness of the response and the amount of ringing.
>> >>and >>the symetry of the ringing (pre and post ringing) is a function of the >>linearity of the phase response?
Not quite. The linearity of the phase response is a very different story.
>> >>So there is no way to build filter with a given transition bandwidth >>and a given low level of ringing?
There is a way to do that. Moreover, you can design a filter without any overshoot for any finite transition band. It can be linear or nonlinear phase whatever you like. However you will have to trade off the delay in the filter for the other parameters.
> Sharp linear filters can ring. I think another edge-enhancement > technique is to use a non-linear algorithm to attempt to sharpen > certain types of edges without ringing.
Any filter is the algorithm which observes the unknown input signal for some duration. Based on this observation of the input, the filter decides what has to be at the output. In order to to the filtering, you have to collect some information from the input. You can't create the information, thus, you can't trick the nature. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com