Alley in Pisa, Italy

by Lars Kotthoff

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

I am trying to apply a Image sharpening 2D filter kernel(Laplacian) on a Image in my proprietary Image/Video processing pipeline(From Camera raw to final JPEG/MPEG). I plan to perform 2D convolution of this Laplacian kernel with the 2D image array to sharpen the image. My questions is :-

What is the most suitable colour space to apply this image sharpening filter to get best output image quality

a) Should I apply this filter on each component(R,G, & B) in the RGB space?

or

b)Should I apply this in the YUV space and only on Y component (or should it be also applied on U and V components)?

Any pointers will be useful.

thank you.

-AD.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

It depends on how your sharpening kernel works, if it just enhances the contrast either side of a boundary like an unsharp mask filter then you want to use the YUV (or LAB) space but apply the filter on the luminance channel only.

The reason for this is that increasing the contrast of a colour boundary can result in odd looking colour shifts, i.e. in a pale red to pale blue boundary you could end up with yellowy-red line on one side immediately next to a strong blue line. Here's a somewhat extreme example (but using a real image. Can you guess the landmark?)

unsharpened image


all colour channels sharpened


just luminance sharpened


Also you rarely see fine colour detail in images that's worthy of sharpening. Bayer interpolation / image compression both smooth colour detail. Also the eye isn't very sensitive to missing colour detail anyway (which is why compression removes it).

So in summary sharpening all channels will be three times the amount of work, can introduce colour artifacts and if not it may make little difference as there is generally much less colour detail than luminance detail.

share|improve this answer
    
When you mentioned about 'odd looking colour shifts', was it if one does filtering/sharpening in RGB space or UV space? –  goldenmean Feb 9 '11 at 17:11
    
@goldenmean: It makes little or no difference -- it happens either way. –  Jerry Coffin Feb 9 '11 at 18:21
    
It doesn't matter which space you use, but if you sharpen the luminance channel only you don't get colour artifacts. –  Matt Grum Feb 9 '11 at 18:33
1  
+1 Nice analysis of the difference between luminance-only sharpening and all-channel sharpening. I'm seeing artifacts in the luminance-only sharpening, too (consider the left edge of the building where a line of pixels has been darkened; this did not happen in the all-channel sharpened image). It looks like one could decide to sharpen either way, depending on the purpose of the sharpening and the nature of the image. –  whuber Feb 9 '11 at 19:05
    
If your purpose of sharpening is only to correct for actual softness in the image (such as lens softness, anti-aliasing filter, or bayer interpolation), then it's quite legitimate to sharpen the colour channels too (though probably by a different amount than luminance). Only if you over-sharpen like in the above samples would you notice any undesirable colour shift. If the over-sharpening "effect" (local contrast enhancement) is your goal, however, then depending on what you want, you may even want the colour shift (or then again you might not). So there's no hard and fast rule. –  thomasrutter Feb 10 '11 at 4:22

That's a thoughtful and intriguing question. However, because the transformation between RGB and YUV is linear and the Laplacian (or any kernel convolution) is also linear, it does not matter in principle which basis you use. In practice there can be tiny differences due to the discretization of the values (which are usually represented as small binary integers).

If you apply the filter only on the Y component you will get some sharpening, akin to a pan-sharpened satellite image. But why stop there? You might as well sharpen the U and V channels too, unless you are looking for this somewhat subtle special effect (of sharp luminance but relatively blurry chrominance). Search Google Images on "pan-sharpened" or "pan-enhanced" to see examples of what these can look like.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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