Skip navigation.
 
mlRe: Core Image generate histogram?
FROM : Nicko van Someren
DATE : Wed Jan 09 20:33:10 2008

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

Related mailsAuthorDate
mlCore Image generate histogram? Albert Martin Jan 8, 12:01
mlRe: Core Image generate histogram? Nicko van Someren Jan 9, 20:33