Re: vImage scaling problems

Peter Ammon wrote:

This is doented at the bottom of

<http://developer.apple.com/hardware/ve/errata.html>

--

Pull out a splinter to reply.

Re: vImage scaling problems

> > On the other hand, the vImageAffineWarp family of functions is more [/ref]

Thanks a lot Peter, I did end up going with the vImageAffineWarp

functions - these seem to work reliably and being the most general

form do anything you might want to do in terms of scaling.

Basically the functions I *did* get to work were the convolution and

affine warp ones. The dedicated scale functions seemed to return bad

results (all zeros) or produce other problems. The 2D convolution is

*really* fast - I hope Apple fixes the problems because this is a

really useful framework (have filed bug report on Radar).

ER

Re: vImage scaling problems

Eric Raas <com> wrote:

[/ref]

>

> Thanks a lot Peter, I did end up going with the vImageAffineWarp

> functions - these seem to work reliably and being the most general

> form do anything you might want to do in terms of scaling.

>

> Basically the functions I *did* get to work were the convolution and

> affine warp ones.[/ref]

I don't suppose you happen the know the algorithm for Unsharp Mask, do

you? This is something I'd like my app to be able to do... m.

--

matt neuburg, phd = com, http://www.tidbits.com/matt/

AppleScript: The Definitive Guide

http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt

Read TidBITS! It's free and smart. http://www.tidbits.com

Re: vImage scaling problems

com (matt neuburg) wrote:

>

> I don't suppose you happen the know the algorithm for Unsharp Mask, do

> you? This is something I'd like my app to be able to do... m.[/ref]

<http://www.olympusmicro.com/primer/java/olympusmicd/digitalimaging/unsha

rpmask/>

Regards,

Tom_E

--

This address is valid in its unmodified form but expires soon.

Re: vImage scaling problems

>

This is the kind of thing made relatively easy by the vImage

framework. An unsharp mask filter is typically described using three

parameters: the width (or radius), the amount, and the threshold.

The basic steps are:

1) Generate a copy of the image smoothed using a Gaussian kernel. The

kernel matrix must be normalized so that the sum of all its values is

one. The width of the Gaussian you compute is determined by the Width

parameter. You can use the function vImageConvolve_PlanarF or one of

its siblings for ARGB or 8 bit to do the convolution. This runs fast

and saves you a lot of work.

2) Subtract the smoothed version from the original image - this

produces an image in which the sharp features are emphasized. You can

use the AltiVec vsub() function do subtract one buffer of floats from

another (assuming you're working with floats).

3) Set all pixels in the difference image with absolute value less

than your Threshold parameter to zero.

4) Multiply the thresholded difference image by your Amount parameter

and add to the original. The Amount parameter can be positive or

negative. If positive the mask will emphasize sharp features - if

negative it will de-emphasize them.

HTH ER

Re: vImage scaling problems

> 4) Multiply the thresholded difference image by your Amount parameter

Actually you should subtract the difference mask from the original

(Amount parameter is negative in above description) to enhance high

spatial-frequency detail. Sorry! ER