Re: How to sharpen image?
Re: How to sharpen image?
- Subject: Re: How to sharpen image?
- From: Nicko van Someren <email@hidden>
- Date: Thu, 20 May 2004 00:45:34 +0100
On 19 May 2004, at 12:45, leszek wrote:
my interpolated images looks blurry. Is there some snippets (of code)
showing sharpen function? Maybe using vImage? Or another direction?
Can anyone help with this?
Yes, you can use vImage to sharpen pictures, and the documentation[1]
even suggests a filter kernel for sharpening. You will also need to
look at the details of the NSBitmapImageRep in order to work out how to
extract the pixel data in a suitable byte array. If your image uses
"planar" rather than "interleaved" values then you can simply use the
vImage function that act on monochrome pixels and apply it to each
colour plane separately.
Having said all that, if the blurry images are ones that you have
scaled yourself then you might want to consider different strategies
for the scaling in the first place. I believe that the default method
of image scaling under Quartz is essentially to average the colours of
the source pixels that land under the destination pixel with a
weighting proportional to the coverage area. This sort of sampling is
supported by most modern graphics chips but it necessarily leads to
blurring. You will get a sharper image (though one prone to nasty
alias artefacts) by point sampling whichever source pixel lies under
the centre of the destination pixel. You can also get a sharper image
with fewer artefacts by using a 2D cubic (or higher order)
interpolation. Photoshop by default uses a bi-cubic interpolation and
generally gives good results. Details of how to do this can be had
from a signal processing expert near you :-) or you can invest in a
copy of "Computer Graphics: Principles and Practice"[3] by Foley, van
Dam and numerous other authors that they've roped in over the 23 years
since the first edition.
Cheers,
Nicko
[1]
file:///Developer/Documentation/Performance/Conceptual/vImage/Chapter4/
chapter_4_section_5.html
[2]
file:///Developer/Documentation/Cocoa/Reference/ApplicationKit/
ObjC_classic/Classes/NSBitmapImageRep.html
[3] Addison-Wesley, 2nd (1995) edition ISBN: 0201848406
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.