What's a Core Image? An Image-Processing Framework on iOS and OS X

8
Core Image Steve Zhou & Heidi Hansen

description

Flatiron students Steven Zhou and Heidi Hansen explain how core images work on iOS and OS X to help developers process images efficiently without dealing with low level interactions with GPU or CPU. 

Transcript of What's a Core Image? An Image-Processing Framework on iOS and OS X

Page 1: What's a Core Image? An Image-Processing Framework on iOS and OS X

Core ImageSteve Zhou & Heidi Hansen

Page 2: What's a Core Image? An Image-Processing Framework on iOS and OS X

What is a Digital Image?

• It’s a collection of pixels and each pixel represents a specific color.

• Combining hundreds and thousands of pixels together forms a digital image.

• It’s a 2-dimensional arrays of pixels: X and Y or Rows and Columns.

• Usually digital image refers to raster image or bitmap image.

Page 3: What's a Core Image? An Image-Processing Framework on iOS and OS X

What is Core Image?

•It’s an image processing framework on both iOS and OS X. It was first introduced in iOS 5 and previously was only available on OS X.

•Its designed to do “real-time” image processing at pixel level for both still image and video.

•It operates on image data types from multiple sources. ex: Core Graphics,Core Video, Image I/O

•It allows developers to process images easily and efficiently without dealing with low level interactions with GPU or CPU.

•It provides more than 90 built-in image processing filters in iOS, Feature detection capability, and support for automatic image enhancement.

Page 4: What's a Core Image? An Image-Processing Framework on iOS and OS X

Key Core Image Classes• CIImage:

1. An object that represents an image. 2. You can create CIImage object with different inputs.

• CIFilter: 1. An object that represents an effect. 2. Has at least one input parameter. 3. Produces a CIImage object.

• CIContext: 1.An object that draws the result produced by CIFilter using either CPU or GPU rendering path.

Page 5: What's a Core Image? An Image-Processing Framework on iOS and OS X

Apply Filter To An Image

1. CIContext *context = [CIContext contextWithOptions:nil];

2. CIImage *beginImage =[[CIImage alloc] initWithImage:[UIImage imageNamed:@“waterfall.jpg”]];

3. CIFilter *filter = [CIFilter filterWithName:@“CIGammaAdjust"];" " [filter setValue:beginImage forKey:kCIInputImageKey];" " [filter setValue:@2.0 forKey:@"inputPower"];" "4. CIImage *resultImage = [filter outputImage];"!5. CGImageRef cgimage = [context createCGImage:resultImage fromRect:[resultImage extent]];

6. UIImage *newImage = [UIImage imageWithCGImage:cgimage];"

Page 6: What's a Core Image? An Image-Processing Framework on iOS and OS X

Chaining Multiple Filters1.CIImage *beginImage =[[CIImage alloc] initWithImage:[UIImage

imageNamed:@“waterfall.jpg”]];!

2.CIImage *firstOutPutImage=[CIFilter filterWithName:@"CISepiaTone" keysAndValues: kCIInputImageKey beginImage, @"inputIntensity", @0.8, nil].outputImage;!

3.CIImage *secondOutPutImage=[CIFilter filterWithName:@"CIHueAdjust" keysAndValues: kCIInputImageKey firstOutPutImage, @"inputIntensity", @0.8, nil].outputImage;!

4.CIImage *thirdOutPutImage=[CIFilter filterWithName:@"CIVibrance" keysAndValues: kCIInputImageKey secondOutPutImage, @"inputIntensity", @0.8, nil].outputImage;!!!!!!

begin Image

CISepiaTone CIHueAdjust CIVibrance

Page 7: What's a Core Image? An Image-Processing Framework on iOS and OS X

Core Image Built-In Filters • CIBoxBlur

• CIDiscBlur

• CIGaussianBlur

• CIMedianFilter

• CIMinimumComponent

• CIPhotoEffectChrome

• CIPhotoEffectFade

• CIPhotoEffectInstant

• CICircularScreen

• CICMYKHalftone

• CIDotScreen

• CIHatchedScreen

• CIAffineClamp

• CIAffineTile

• CIEightfoldReflectedTile

• CIFourfoldReflectedTile

• CIFourfoldRotatedTile

• CIOverlayBlendMode

• CISaturationBlendMode

• CIScreenBlendMode

• CISoftLightBlendMode

• CIColorMap

• CIColorMonochrome

• CIColorPosterize

• CIFalseColor

Page 8: What's a Core Image? An Image-Processing Framework on iOS and OS X

Steve Zhou & Heidi Hansen !

Thanks! Demo/Questions?