Professional Web Applications Themes

vImage scaling problems - Mac Programming

A few weeks ago Eric Raas posted about the vImage framework and that he was having problems with the scaling functions such as vImageScale_ARGB8888. I've been using the framework and while I get good results with the scaling function in the X direction, I get unusably buggy results in the Y direction. The Tableau example project seems to have similar troubles; it either crashes or gives me a blank image when I try to perform a scale. On the other hand, the vImageAffineWarp family of functions is more powerful than a scale and seems to work correctly. If you're having ...

  1. #1

    Default vImage scaling problems

    A few weeks ago Eric Raas posted about the vImage framework and that he
    was having problems with the scaling functions such as
    vImageScale_ARGB8888. I've been using the framework and while I get
    good results with the scaling function in the X direction, I get
    unusably buggy results in the Y direction.

    The Tableau example project seems to have similar troubles; it either
    crashes or gives me a blank image when I try to perform a scale.

    On the other hand, the vImageAffineWarp family of functions is more
    powerful than a scale and seems to work correctly. If you're having
    similar troubles, try using those instead.

    --
    Pull out a splinter to reply.
    Peter Guest

  2. #2

    Default 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.
    Peter Guest

  3. #3

    Default 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
    Eric Guest

  4. #4

    Default 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
    matt Guest

  5. #5

    Default 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.

    Thomas Guest

  6. #6

    Default 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
    Eric Guest

  7. #7

    Default 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
    Eric Guest

Similar Threads

  1. scaling swf
    By MYOC in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: April 28th, 10:50 AM
  2. scaling
    By Frozen_Tundra@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 1
    Last Post: October 3rd, 04:56 AM
  3. Scaling with 10.0.3 in OSX
    By Andrew_Harver@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 4
    Last Post: June 10th, 05:53 AM
  4. vImage framework - experiences?
    By Eric in forum Mac Programming
    Replies: 3
    Last Post: February 19th, 09:08 PM
  5. Scaling problems with SQL Server
    By Amol Kasbekar in forum Microsoft SQL / MS SQL Server
    Replies: 7
    Last Post: July 16th, 04:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139