Core Image generate histogram?

  • I am using some heavy Core Image filters along with Core Video in my
    Leopard application.  I was wondering if someone could point me in the
    right direction to generating a simple levels histogram from a
    CIImage.  I am hoping for something that is along the lines of the
    histogram used in iPhoto or iMovie's adjustment palette.  I'm not sure
    if I can go right from CIImage or if I'll need to go to NSImage or
    even OpenGL.  I've spent a while searching the lists and the
    documentation and haven't found any straight forward methods so if
    someone could just give me a shove in the right direction I'd
    appreciate it.
  • On 8 Jan 2008, at 11:01, Albert Martin wrote:

    > I am using some heavy Core Image filters along with Core Video in my
    > Leopard application.  I was wondering if someone could point me in
    > the right direction to generating a simple levels histogram from a
    > CIImage.  I am hoping for something that is along the lines of the
    > histogram used in iPhoto or iMovie's adjustment palette.  I'm not
    > sure if I can go right from CIImage or if I'll need to go to NSImage
    > or even OpenGL.  I've spent a while searching the lists and the
    > documentation and haven't found any straight forward methods so if
    > someone could just give me a shove in the right direction I'd
    > appreciate it.

    CoreImage images are usually only rendered on demand so I think that
    you will need for it to be rendered, perhaps to a CGBitmapContext.
    From there you should be able to use the histogram calculation
    function in the vImage library (vImageHistogramCalculation_ARGB8888)
    to compute the histogram for the pixel data.  The vImage library is
    highly optimised and knows how to choose the best code irrespective of
    the type of CPU the user has, using the vector processing parts of the
    CPU if available.

    Cheers,
      Nicko
previous month january 2008 next month
MTWTFSS
  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      
Go to today