515 developing core image filters for ios df · 2016. 7. 8. · developing core image filters for...
TRANSCRIPT
![Page 1: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/1.jpg)
© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
#WWDC14
Developing Core Image Filters for iOS
Media
Session 515 Alexandre Naaman Lead Customizer
!
Tony Chu General Specialist
![Page 2: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/2.jpg)
New to iOS 8Write your own kernels
Introduced on OS X 10.4, now on iOS • Main motivation—unable to write kernels as a combination of existing filters
• Use cases
- “Per pixel effects” (e.g., hot pixels, vignette)
- Distortions that cannot be represented as a matrix (Droste)
![Page 3: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/3.jpg)
Agenda
Concepts
![Page 4: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/4.jpg)
Agenda
Concepts
Examples of writing custom kernels
![Page 5: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/5.jpg)
Agenda
Concepts
Examples of writing custom kernels
Platform differences
![Page 6: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/6.jpg)
Key Concepts
![Page 7: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/7.jpg)
Key ConceptsFilters perform per pixel operations on an image
Original Result
SepiaFilter
![Page 8: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/8.jpg)
Key ConceptsFilters can be chained together for complex effects
ResultOriginal
SepiaFilter
Hue AdjustFilter
ContrastFilter
![Page 9: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/9.jpg)
Hue AdjustFilter
Key ConceptsIntermediate images are lightweight objects
ResultOriginal
ContrastFilter
SepiaFilter
![Page 10: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/10.jpg)
ResultOriginal
Key ConceptsEach filter has one or more kernel functions
ContrastFilter
SepiaFilter
kernel vec4 sepia (… kernel vec4 hue (… kernel vec4 contrast (…
Hue AdjustFilter
![Page 11: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/11.jpg)
Key ConceptsKernels concatenated into programs to minimize buffers
ResultOriginal
kernel vec4 sepia (…
kernel vec4 hue (…
kernel vec4 contrast (…
ContrastFilterSepiaFilter
Concat’dFilter
![Page 12: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/12.jpg)
Key ConceptsKernels concatenated into programs to minimize buffers
ResultOriginal
kernel vec4 sepia (…
kernel vec4 hue (…
kernel vec4 contrast (…
kernel vec4 sepia (…
kernel vec4 hue (…
kernel vec4 contrast (…
ContrastFilterSepiaFilter
Concat’dFilter
![Page 13: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/13.jpg)
Core Image Classes
![Page 14: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/14.jpg)
Core Image Classes
CIKernel • Represents a program written in Core Image’s kernel language
![Page 15: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/15.jpg)
Core Image Classes
CIKernel • Represents a program written in Core Image’s kernel language
CIFilter • Has mutable input parameters
• Uses one or more CIKernels to make a new image based on inputs
![Page 16: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/16.jpg)
Core Image Classes
CIKernel • Represents a program written in Core Image’s kernel language
CIFilter • Has mutable input parameters
• Uses one or more CIKernels to make a new image based on inputs
CIImage • An immutable object that represents the recipe for an image
• Non zero origin (lower left) and possibly infinite bounds
![Page 17: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/17.jpg)
Core Image Classes
CIKernel • Represents a program written in Core Image’s kernel language
CIFilter • Has mutable input parameters
• Uses one or more CIKernels to make a new image based on inputs
CIImage • An immutable object that represents the recipe for an image
• Non zero origin (lower left) and possibly infinite bounds
CIContext • A object through which Core Image draws results
![Page 18: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/18.jpg)
void *inputBuffer={ !
!
!
!
};
ConceptsStarting assumptions
![Page 19: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/19.jpg)
void *inputBuffer={ !
!
!
!
};
void *outputBuffer={ !
!
!
!
};
ConceptsStarting assumptions
![Page 20: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/20.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
void *outputBuffer={ !
!
!
!
};
ConceptsStarting assumptions
![Page 21: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/21.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
ConceptsStarting assumptions
![Page 22: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/22.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
![Page 23: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/23.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
![Page 24: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/24.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
CIKernel: processPixel
![Page 25: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/25.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
!!!
CIFilter subclass
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
CIKernel: processPixel
![Page 26: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/26.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
!!!
CIFilter subclass
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
CIImageCIKernel: processPixel
![Page 27: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/27.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
!!!
CIFilter subclass
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
CIImageCIKernel: processPixel
other input params
![Page 28: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/28.jpg)
void *inputBuffer={ !
!
!
!
};
for (j=0;j<height;j++){
}
for (i=0;i<width;i++){
}
void *outputBuffer={ !
!
!
!
};
!!!
CIFilter subclass
outputBuffer[i][j]= processPixel (inputBuffer[i][j]);
ConceptsStarting assumptions
CIImage
CIImageCIKernel: processPixel
other input params
![Page 29: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/29.jpg)
WorkflowUsing Core Image on iOS
![Page 30: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/30.jpg)
WorkflowUsing Core Image on iOS
Create input CIImages
![Page 31: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/31.jpg)
WorkflowUsing Core Image on iOS
Create input CIImages
Subclass CIFilter
![Page 32: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/32.jpg)
WorkflowUsing Core Image on iOS
Create input CIImages
Subclass CIFilter
Get output CIImage
![Page 33: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/33.jpg)
WorkflowUsing Core Image on iOS
Create input CIImages
Subclass CIFilter
Get output CIImage
Use CIContext to render output image (to CGImageRef, EAGL context, etc.)
![Page 34: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/34.jpg)
Create input CIImages
Subclass CIFilter • Create kernel
• Apply kernel to input image(s) and pass parameters from filter
WorkflowUsing Core Image on iOS
Create input CIImages
Subclass CIFilter
Get output CIImage
Use CIContext to render output image (to CGImageRef, EAGL context, etc.)
![Page 35: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/35.jpg)
115 Built-in CIFilters on iOSCIAccordianFoldTransition CIAdditionCompositing CIAffineClamp CIAffineTile CIAffineTransform CIAreaHistogram CIBarsSwipeTransition CIBlendWithMask CIBloom CIBumpDistortion CIBumpDistortionLinear CICheckerboardGenerator CICircleSplashDistortion CICircularScreen CICode128BarcodeGenerator CIColorBlendMode CIColorBurnBlendMode CIColorControls CIColorCube CIColorDodgeBlendMode CIColorInvert CIColorMap CIColorMatrix
CIColorMonochrome CIColorClamp CIColorCrossPolynomial CIColorPolynomial CIColorPosterize CIConstantColorGenerator CIConvolution3X3 CIConvolution5X5 CIConvolution9Horizontal CIConvolution9Vertical CICopyMachineTransition CICrop CIDarkenBlendMode CIDifferenceBlendMode CIDisintegrateWithMask CIDissolveTransition CIDivideBlendMode CIDotScreen CIEightfoldReflectedTile CIExclusionBlendMode CIExposureAdjust CIFalseColor CIFlashTransition
CIFourfoldReflectedTile CIFourfoldTranslatedTile CIGammaAdjust CIGaussianBlur CIGaussianGradient CIGlassDistortion CIGlideReflectedTile CIGloom CIHardLightBlendMode CIHatchedScreen CIHighlightShadowAdjust CIHistogramDisplayFilter CIHoleDistortion CIHueAdjust CIHueBlendMode CILanczosScaleTransform CILightenBlendMode CILightTunnel CILinearBurnBlendMode CILinearDodgeBlendMode CILinearGradient CILineScreen CILuminosityBlendMode
CIMaskToAlpha CIMaximumComponent CIMaximumCompositing CIMinimumComponent CIMinimumCompositing CIModTransition CIMultiplyBlendMode CIMultiplyCompositing CIOverlayBlendMode CIPerspectiveCorrection CIPerspectiveTile CIPerspectiveTransform CIPinchDistortion CIPinLightBlendMode CIPixellate CIRadialGradient CIRandomGenerator CISaturationBlendMode CIScreenBlendMode CISepiaTone CISharpenLuminance CISixfoldReflectedTile CISixfoldRotatedTile
CISoftLightBlendMode CISourceAtopCompositing CILinearToSRGBToneCurve CISRGBToneCurveToLinear CISourceInCompositing CISourceOutCompositing CISourceOverCompositing CIStarShineGenerator CIStraightenFilter CIStripesGenerator CISubtractBlendMode CISwipeTransition CITemperatureAndTint CIToneCurve CITriangleKaleidoscope CITwelvefoldReflectedTile CITwirlDistortion CIUnsharpMask CIVibrance CIVignette CIVortexDistortion CIWhitePointAdjust CIQRCodeGenerator
![Page 36: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/36.jpg)
115 Built-in CIFilters on iOS (78 Color)CIAccordianFoldTransition CIAdditionCompositing CIAffineClamp CIAffineTile CIAffineTransform CIAreaHistogram CIBarsSwipeTransition CIBlendWithMask CIBloom CIBumpDistortion CIBumpDistortionLinear CICheckerboardGenerator CICircleSplashDistortion CICircularScreen CICode128BarcodeGenerator CIColorBlendMode CIColorBurnBlendMode CIColorControls CIColorCube CIColorDodgeBlendMode CIColorInvert CIColorMap CIColorMatrix
CIColorMonochrome CIColorClamp CIColorCrossPolynomial CIColorPolynomial CIColorPosterize CIConstantColorGenerator CIConvolution3X3 CIConvolution5X5 CIConvolution9Horizontal CIConvolution9Vertical CICopyMachineTransition CICrop CIDarkenBlendMode CIDifferenceBlendMode CIDisintegrateWithMask CIDissolveTransition CIDivideBlendMode CIDotScreen CIEightfoldReflectedTile CIExclusionBlendMode CIExposureAdjust CIFalseColor CIFlashTransition
CIFourfoldReflectedTile CIFourfoldTranslatedTile CIGammaAdjust CIGaussianBlur CIGaussianGradient CIGlassDistortion CIGlideReflectedTile CIGloom CIHardLightBlendMode CIHatchedScreen CIHighlightShadowAdjust CIHistogramDisplayFilter CIHoleDistortion CIHueAdjust CIHueBlendMode CILanczosScaleTransform CILightenBlendMode CILightTunnel CILinearBurnBlendMode CILinearDodgeBlendMode CILinearGradient CILineScreen CILuminosityBlendMode
CIMaskToAlpha CIMaximumComponent CIMaximumCompositing CIMinimumComponent CIMinimumCompositing CIModTransition CIMultiplyBlendMode CIMultiplyCompositing CIOverlayBlendMode CIPerspectiveCorrection CIPerspectiveTile CIPerspectiveTransform CIPinchDistortion CIPinLightBlendMode CIPixellate CIRadialGradient CIRandomGenerator CISaturationBlendMode CIScreenBlendMode CISepiaTone CISharpenLuminance CISixfoldReflectedTile CISixfoldRotatedTile
CISoftLightBlendMode CISourceAtopCompositing CILinearToSRGBToneCurve CISRGBToneCurveToLinear CISourceInCompositing CISourceOutCompositing CISourceOverCompositing CIStarShineGenerator CIStraightenFilter CIStripesGenerator CISubtractBlendMode CISwipeTransition CITemperatureAndTint CIToneCurve CITriangleKaleidoscope CITwelvefoldReflectedTile CITwirlDistortion CIUnsharpMask CIVibrance CIVignette CIVortexDistortion CIWhitePointAdjust CIQRCodeGenerator
![Page 37: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/37.jpg)
115 Built-in CIFilters on iOS (27 Warps)CIAccordianFoldTransition CIAdditionCompositing CIAffineClamp CIAffineTile CIAffineTransform CIAreaHistogram CIBarsSwipeTransition CIBlendWithMask CIBloom CIBumpDistortion CIBumpDistortionLinear CICheckerboardGenerator CICircleSplashDistortion CICircularScreen CICode128BarcodeGenerator CIColorBlendMode CIColorBurnBlendMode CIColorControls CIColorCube CIColorDodgeBlendMode CIColorInvert CIColorMap CIColorMatrix
CIColorMonochrome CIColorClamp CIColorCrossPolynomial CIColorPolynomial CIColorPosterize CIConstantColorGenerator CIConvolution3X3 CIConvolution5X5 CIConvolution9Horizontal CIConvolution9Vertical CICopyMachineTransition CICrop CIDarkenBlendMode CIDifferenceBlendMode CIDisintegrateWithMask CIDissolveTransition CIDivideBlendMode CIDotScreen CIEightfoldReflectedTile CIExclusionBlendMode CIExposureAdjust CIFalseColor CIFlashTransition
CIFourfoldReflectedTile CIFourfoldTranslatedTile CIGammaAdjust CIGaussianBlur CIGaussianGradient CIGlassDistortion CIGlideReflectedTile CIGloom CIHardLightBlendMode CIHatchedScreen CIHighlightShadowAdjust CIHistogramDisplayFilter CIHoleDistortion CIHueAdjust CIHueBlendMode CILanczosScaleTransform CILightenBlendMode CILightTunnel CILinearBurnBlendMode CILinearDodgeBlendMode CILinearGradient CILineScreen CILuminosityBlendMode
CIMaskToAlpha CIMaximumComponent CIMaximumCompositing CIMinimumComponent CIMinimumCompositing CIModTransition CIMultiplyBlendMode CIMultiplyCompositing CIOverlayBlendMode CIPerspectiveCorrection CIPerspectiveTile CIPerspectiveTransform CIPinchDistortion CIPinLightBlendMode CIPixellate CIRadialGradient CIRandomGenerator CISaturationBlendMode CIScreenBlendMode CISepiaTone CISharpenLuminance CISixfoldReflectedTile CISixfoldRotatedTile
CISoftLightBlendMode CISourceAtopCompositing CILinearToSRGBToneCurve CISRGBToneCurveToLinear CISourceInCompositing CISourceOutCompositing CISourceOverCompositing CIStarShineGenerator CIStraightenFilter CIStripesGenerator CISubtractBlendMode CISwipeTransition CITemperatureAndTint CIToneCurve CITriangleKaleidoscope CITwelvefoldReflectedTile CITwirlDistortion CIUnsharpMask CIVibrance CIVignette CIVortexDistortion CIWhitePointAdjust CIQRCodeGenerator
![Page 38: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/38.jpg)
115 Built-in CIFilters on iOS (7 Convolution)CIAccordianFoldTransition CIAdditionCompositing CIAffineClamp CIAffineTile CIAffineTransform CIAreaHistogram CIBarsSwipeTransition CIBlendWithMask CIBloom CIBumpDistortion CIBumpDistortionLinear CICheckerboardGenerator CICircleSplashDistortion CICircularScreen CICode128BarcodeGenerator CIColorBlendMode CIColorBurnBlendMode CIColorControls CIColorCube CIColorDodgeBlendMode CIColorInvert CIColorMap CIColorMatrix
CIColorMonochrome CIColorClamp CIColorCrossPolynomial CIColorPolynomial CIColorPosterize CIConstantColorGenerator CIConvolution3X3 CIConvolution5X5 CIConvolution9Horizontal CIConvolution9Vertical CICopyMachineTransition CICrop CIDarkenBlendMode CIDifferenceBlendMode CIDisintegrateWithMask CIDissolveTransition CIDivideBlendMode CIDotScreen CIEightfoldReflectedTile CIExclusionBlendMode CIExposureAdjust CIFalseColor CIFlashTransition
CIFourfoldReflectedTile CIFourfoldTranslatedTile CIGammaAdjust CIGaussianBlur CIGaussianGradient CIGlassDistortion CIGlideReflectedTile CIGloom CIHardLightBlendMode CIHatchedScreen CIHighlightShadowAdjust CIHistogramDisplayFilter CIHoleDistortion CIHueAdjust CIHueBlendMode CILanczosScaleTransform CILightenBlendMode CILightTunnel CILinearBurnBlendMode CILinearDodgeBlendMode CILinearGradient CILineScreen CILuminosityBlendMode
CIMaskToAlpha CIMaximumComponent CIMaximumCompositing CIMinimumComponent CIMinimumCompositing CIModTransition CIMultiplyBlendMode CIMultiplyCompositing CIOverlayBlendMode CIPerspectiveCorrection CIPerspectiveTile CIPerspectiveTransform CIPinchDistortion CIPinLightBlendMode CIPixellate CIRadialGradient CIRandomGenerator CISaturationBlendMode CIScreenBlendMode CISepiaTone CISharpenLuminance CISixfoldReflectedTile CISixfoldRotatedTile
CISoftLightBlendMode CISourceAtopCompositing CILinearToSRGBToneCurve CISRGBToneCurveToLinear CISourceInCompositing CISourceOutCompositing CISourceOverCompositing CIStarShineGenerator CIStraightenFilter CIStripesGenerator CISubtractBlendMode CISwipeTransition CITemperatureAndTint CIToneCurve CITriangleKaleidoscope CITwelvefoldReflectedTile CITwirlDistortion CIUnsharpMask CIVibrance CIVignette CIVortexDistortion CIWhitePointAdjust CIQRCodeGenerator
![Page 39: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/39.jpg)
Anatomy of CIKernel
!OS X and iOS
CIKernel
![Page 40: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/40.jpg)
iOS Only
Anatomy of CIKernel
!OS X and iOS
CIKernel
![Page 41: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/41.jpg)
iOS Only
Anatomy of CIKernel
!
CIColorKernel CIWarpKernel
OS X and iOS
CIKernel
![Page 42: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/42.jpg)
Anatomy of CIKernel
@interface CIKernel + (CIKernel *) kernelWithString:(NSString *);- (CIImage *) applyWithExtent:(CGRect)extent roiCallback:(CIKernelROICallback)callback arguments:(NSArray *)arguments;@end
Performs no actual work
![Page 43: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/43.jpg)
Anatomy of CIKernel
@interface CIKernel + (CIKernel *) kernelWithString:(NSString *);- (CIImage *) applyWithExtent:(CGRect)extent roiCallback:(CIKernelROICallback)callback arguments:(NSArray *)arguments;@end
GLSL + extensions for imaging
Inputs and outputs are floats
Performs no actual work
![Page 44: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/44.jpg)
Color KernelsCIColorKernel
![Page 45: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/45.jpg)
Basic Principles of Color KernelsCIColorKernel
Input Image(s)
CIImage (RGBA8, ARGB8, RGBA Float, RGBA16, etc)
CIColorKernel(everything is read
as RGBA floats)
Output Image
CIImage (RGBA Float)
![Page 46: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/46.jpg)
Color Kernel Example
kernel vec4 doNothing ( __sample s ) { return s.rgba; }
![Page 47: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/47.jpg)
Color Kernel Example
kernel vec4 doNothing ( __sample s ) { return s.rgba; }
![Page 48: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/48.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
![Page 49: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/49.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
![Page 50: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/50.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
![Page 51: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/51.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
![Page 52: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/52.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
![Page 53: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/53.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
![Page 54: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/54.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
![Page 55: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/55.jpg)
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 doNothing ( __sample s ) { return s.rgba; }
kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
![Page 56: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/56.jpg)
kernel vec4 doNothing ( __sample s ) { return s.rgba; }
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
![Page 57: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/57.jpg)
kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
kernel vec4 doNothing ( __sample s ) { return s.rgba; }
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }
![Page 58: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/58.jpg)
kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }
kernel vec4 doNothing ( __sample s ) { return s.rgba; }
Color Kernel Example
kernel vec4 swapRedAndGreen ( __sample s ) { return s.grba; }
![Page 59: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/59.jpg)
Color Kernel ExampleSubclassing CIFilter
![Page 60: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/60.jpg)
Color Kernel ExampleSubclassing CIFilter
@interface SwapRedGreenFilter : CIFilter @property (retain, nonatomic) CIImage *inputImage;@property (copy, nonatomic) NSNumber *inputAmount;@end
![Page 61: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/61.jpg)
Color Kernel ExampleSubclassing CIFilter
@interface SwapRedGreenFilter : CIFilter @property (retain, nonatomic) CIImage *inputImage;@property (copy, nonatomic) NSNumber *inputAmount;@end
@implementation SwapRedGreenFilter-(CIKernel *)myKernel { … } // convenience+(NSDictionary *)customAttributes { … }-(CIImage *)outputImage { … }@end
![Page 62: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/62.jpg)
Color Kernel ExampleApplying the kernel inside of a CIFilter
- (CIKernel *) myKernel { static CIColorKernel *kernel = nil; static dispatch_once_t once; dispatch_once(&once, ^{ kernel = [CIColorKernel kernelWithString: @“kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }” ]; }); return kernel;} - (CIImage *)outputImage { CGRect dod = inputImage.extent ; return [ [self myKernel] applyWithExtent : dod arguments : @[inputImage, inputAmount]];}
![Page 63: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/63.jpg)
Color Kernel ExampleApplying the kernel inside of a CIFilter
- (CIKernel *) myKernel { static CIColorKernel *kernel = nil; static dispatch_once_t once; dispatch_once(&once, ^{ kernel = [CIColorKernel kernelWithString: @“kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }” ]; }); return kernel;} - (CIImage *)outputImage { CGRect dod = inputImage.extent ; return [ [self myKernel] applyWithExtent : dod arguments : @[inputImage, inputAmount]];}
![Page 64: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/64.jpg)
Color Kernel ExampleApplying the kernel inside of a CIFilter
- (CIKernel *) myKernel { static CIColorKernel *kernel = nil; static dispatch_once_t once; dispatch_once(&once, ^{ kernel = [CIColorKernel kernelWithString: @“kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }” ]; }); return kernel;} - (CIImage *)outputImage { CGRect dod = inputImage.extent ; return [ [self myKernel] applyWithExtent : dod arguments : @[inputImage, inputAmount]];}
![Page 65: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/65.jpg)
Color Kernel ExampleApplying the kernel inside of a CIFilter
- (CIKernel *) myKernel { static CIColorKernel *kernel = nil; static dispatch_once_t once; dispatch_once(&once, ^{ kernel = [CIColorKernel kernelWithString: @“kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }” ]; }); return kernel;} - (CIImage *)outputImage { CGRect dod = inputImage.extent ; return [ [self myKernel] applyWithExtent : dod arguments : @[inputImage, inputAmount]];}
![Page 66: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/66.jpg)
Color Kernel ExampleApplying the kernel inside of a CIFilter
- (CIKernel *) myKernel { static CIColorKernel *kernel = nil; static dispatch_once_t once; dispatch_once(&once, ^{ kernel = [CIColorKernel kernelWithString: @“kernel vec4 swapRedAndGreenAmount ( __sample s, float amount ) { return mix(s.rgba, s.grba, amount); }” ]; }); return kernel;} - (CIImage *)outputImage { CGRect dod = inputImage.extent ; return [ [self myKernel] applyWithExtent : dod arguments : @[inputImage, inputAmount]]; }
![Page 67: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/67.jpg)
Color Kernel Which Depends on PositionVignette effect
![Page 68: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/68.jpg)
Color Kernel Which Depends on PositionVignette effect
![Page 69: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/69.jpg)
Color Kernel Which Depends on PositionVignette effect
1.0
![Page 70: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/70.jpg)
Color Kernel Which Depends on PositionVignette effect
1.0
0.0
![Page 71: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/71.jpg)
Color Kernel Which Depends on PositionVignette effect
1.0
0.0
![Page 72: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/72.jpg)
Color Kernel Which Depends on PositionVignette effect
1.0
0.0
![Page 73: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/73.jpg)
Color Kernel Which Depends on PositionVignette effect
1.0
0.0
![Page 74: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/74.jpg)
Color Kernel Which Depends on PositionVignette effect
1.0
0.0
![Page 75: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/75.jpg)
Color Kernel Which Depends on PositionVignette effect
x = 1.0
0.0
![Page 76: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/76.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
{
}
Color Kernel Which Depends on PositionVignette kernel code
![Page 77: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/77.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
{
}
Color Kernel Which Depends on PositionVignette kernel code
![Page 78: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/78.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
{
}
Color Kernel Which Depends on PositionVignette kernel code
extent.originx
![Page 79: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/79.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
{
}
Color Kernel Which Depends on PositionVignette kernel code
extent.originx
![Page 80: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/80.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
extent.originx
{
}
![Page 81: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/81.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
extent.size/ 2.0
extent.originx
{
}
![Page 82: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/82.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
extent.size/ 2.0
centerOffset
extent.originx
{
}
![Page 83: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/83.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0
{
}
![Page 84: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/84.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
{
}
![Page 85: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/85.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
{
}
![Page 86: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/86.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
destCoord()
{
}
![Page 87: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/87.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
destCoord()
vecFromCenter
{
}
![Page 88: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/88.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
destCoord()
vecFromCenter
vec2 vecFromCenter = destCoord () - centerOffset;
{
}
![Page 89: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/89.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
destCoord()
vecFromCenter
vec2 vecFromCenter = destCoord () - centerOffset; float distance = length ( vecFromCenter ) ;
{
}
![Page 90: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/90.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
destCoord()
vecFromCenter
vec2 vecFromCenter = destCoord () - centerOffset; float distance = length ( vecFromCenter ) ; float darken = 1.0 - ( distance / radius ) ;
{
}
![Page 91: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/91.jpg)
kernel vec4 vignette ( __sample s , vec2 centerOffset , float radius ){ !
!
!
!
}
Color Kernel Which Depends on PositionVignette kernel code
centerOffset
centerOffset = extent.origin + extent.size/2.0radius = length ( extent.size )/2.0
destCoord()
vecFromCenter
return vec4 ( s.rgb * darken, s.a ) ;
vec2 vecFromCenter = destCoord () - centerOffset; float distance = length ( vecFromCenter ) ; float darken = 1.0 - ( distance / radius ) ;
{
}
![Page 92: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/92.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]];}
![Page 93: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/93.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]];}
![Page 94: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/94.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]];}
![Page 95: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/95.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]];}
![Page 96: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/96.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]];}
![Page 97: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/97.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]];}kernel vec4 vignette ( __sample s ,vec2 centerOffset ,float radius){ … }
![Page 98: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/98.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]]; } kernel vec4 vignette ( __sample s ,vec2 centerOffset ,float radius){ … }
![Page 99: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/99.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]]; } kernel vec4 vignette ( __sample s ,vec2 centerOffset ,float radius){ … }
![Page 100: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/100.jpg)
Color Kernel Which Depends on PositionVignette outputImage method
- (CIImage *)outputImage { CGRect dod = inputImage.extent; double radius = 0.5 * hypot ( dod.size.width, dod.size.height ); CIVector *centerOffset = [CIVector vectorWithX : dod.size.width * 0.5 + dod.origin.x Y : dod.size.height * 0.5 + dod.origin.y]; return [[self myKernel] applyWithExtent : dod arguments : @[inputImage, centerOffset, @(radius)]]; } kernel vec4 vignette ( __sample s ,vec2 centerOffset ,float radius){ … }
![Page 101: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/101.jpg)
Non zero pixelsDOD for Source over Compositing Kernel
CGRect dod = CGRectUnion ( inputImage.extent, inputBackgroundImage.extent )
kernel vec4 sourceOver( __sample src , __sample dest ) { return src + (1.0-src.a)*dest; }
![Page 102: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/102.jpg)
Non zero pixelsDOD for Source over Compositing Kernel
CGRect dod = CGRectUnion ( inputImage.extent, inputBackgroundImage.extent )
kernel vec4 sourceOver( __sample src , __sample dest ) { return src + (1.0-src.a)*dest; }
![Page 103: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/103.jpg)
Warp KernelsCIWarpKernel
![Page 104: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/104.jpg)
Basic Principles of Warp KernelsCIWarpKernel
Specify DOD and ROI block callback
Input Position(vec2) CIWarpKernel Output Position
(vec2)
![Page 105: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/105.jpg)
kernel vec2 doNothing () { return destCoord(); }
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y input image
![Page 106: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/106.jpg)
kernel vec2 doNothing () { return destCoord(); }
x
y
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y input image output image
![Page 107: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/107.jpg)
kernel vec2 doNothing () { return destCoord(); }
x
y
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
destCoord()
input image output image
![Page 108: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/108.jpg)
kernel vec2 doNothing () { return destCoord(); }
x
y
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
destCoord()
input image output image
![Page 109: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/109.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 110: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/110.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 111: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/111.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
destCoord()
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 112: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/112.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
destCoord()
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 113: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/113.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
destCoord()
x
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 114: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/114.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
imageWidth
destCoord()
x
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 115: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/115.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
imageWidth imageWidth-x
destCoord()
x
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 116: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/116.jpg)
Basic Principles of Warp KernelsCIWarpKernel—think backwards
x
y
x
y
imageWidth imageWidth-x
destCoord()
imageWidth-x x
kernel vec2 mirrorX ( float imageWidth ) { vec2 input = destCoord(); return vec2 ( imageWidth - input.x , input.y ); }
![Page 117: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/117.jpg)
Invoking MirrorX Kernel
CIWarpKernel *kernel = [CIWarpKernel kernelWithString:kernelSourceCode]; !
- (CIImage *) outputImage { CGFloat inputWidth = inputImage.extent.size.width; !
CIImage *result = [[self myKernel] applyWithExtent: inputImage.extent roiCallback: ^( int index, CGRect r ) { … } inputImage: inputImage arguments: @[@(inputWidth)]]; return result; }
![Page 118: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/118.jpg)
Invoking MirrorX Kernel
CIWarpKernel *kernel = [CIWarpKernel kernelWithString:kernelSourceCode]; !
- (CIImage *) outputImage { CGFloat inputWidth = inputImage.extent.size.width; !
CIImage *result = [[self myKernel] applyWithExtent: inputImage.extent roiCallback: ^( int index, CGRect r ) { … } inputImage: inputImage arguments: @[@(inputWidth)]]; return result; }
![Page 119: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/119.jpg)
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
5
![Page 120: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/120.jpg)
7
5
1
4
32
6
8 9
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
5
![Page 121: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/121.jpg)
5
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
5
![Page 122: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/122.jpg)
5
CGRectMake ( , , , );
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
5
![Page 123: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/123.jpg)
5
CGRectMake ( , , , );
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
x
y
x
y
5
![Page 124: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/124.jpg)
5
CGRectMake ( , , , );r.size.width
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
r.size.widthx
y
x
y
5
![Page 125: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/125.jpg)
5
CGRectMake ( , , , );r.size.width
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
r.size.height
r.size.width
r.size.height
x
y
x
y
5
![Page 126: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/126.jpg)
5
CGRectMake ( , , , );r.size.widthr.origin.y
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
r.size.height
r.size.width
r.origin.y
r.size.height
x
y
x
y
5
![Page 127: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/127.jpg)
5
CGRectMake ( , , , );r.size.widthr.origin.ynewOrigin
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
r.size.height
r.size.widthnewOrigin
r.origin.y
r.size.height
x
y
x
y
5
![Page 128: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/128.jpg)
5
CGRectMake ( , , , );r.size.widthr.origin.ynewOrigin
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
newOrigin =
r.size.height
r.size.widthnewOrigin
r.origin.y
r.size.height
x
y
x
y
5
![Page 129: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/129.jpg)
5
CGRectMake ( , , , );r.size.widthr.origin.ynewOrigin
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
newOrigin =
r.size.height
inputImage.extent.size.width
r.size.widthnewOrigin
r.origin.y
inputImage.extent.size.width
r.size.height
x
y
x
y
5
![Page 130: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/130.jpg)
5
CGRectMake ( , , , );r.size.widthr.origin.ynewOrigin
Basic Principles of Warp KernelsFor output rect, what part of input rect do we need—ROI
newOrigin =
r.size.height
- ( r.origin.x + r.size.width );inputImage.extent.size.width
r.origin.x r.size.widthnewOrigin
r.origin.y
inputImage.extent.size.width
r.size.height
x
y
x
y
5
![Page 131: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/131.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 132: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/132.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 133: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/133.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 134: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/134.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 135: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/135.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 136: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/136.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 137: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/137.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 138: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/138.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 139: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/139.jpg)
Invoking MirrorX Kernel
- (CIImage *) outputImage { if ( CGRectIsInfinite ( inputImage.extent ) ) return nil; !
CGPoint o = inputImage.extent.origin; CGFloat inputWidth = inputImage.extent.size.width;
CGAffineTransform to = CGAffineTransformMakeTranslation ( -o.x, -o.y ); !
CIImage *result = [inputImage imageByApplyingTransform:to]; !
result = [[self myKernel] applyWithExtent: … ]; // same as before CGAffineTransform from = CGAffineTransformMakeTranslation ( o.x, o.y );
return [result imageByApplyingTransform:from]; }
![Page 140: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/140.jpg)
More Complex Warp KernelAnamorphic stretch
![Page 141: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/141.jpg)
More Complex Warp KernelAnamorphic stretch
1024
![Page 142: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/142.jpg)
More Complex Warp KernelAnamorphic stretch
1024
768
![Page 143: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/143.jpg)
More Complex Warp KernelAnamorphic stretch
1024
768
1280
![Page 144: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/144.jpg)
More Complex Warp KernelAnamorphic stretch
1024
768
1280
![Page 145: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/145.jpg)
More Complex Warp KernelAnamorphic stretch
1024
768
1280
![Page 146: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/146.jpg)
sourceToDest() and destToSource()Invertible functions
![Page 147: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/147.jpg)
sourceToDest() and destToSource()Invertible functions
x
f(x)
![Page 148: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/148.jpg)
sourceToDest() and destToSource()Invertible functions
x
f(x)
width/2- width/2
![Page 149: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/149.jpg)
sourceToDest() and destToSource()Invertible functions
x
f(x)
width/2- width/2
scale = 1
![Page 150: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/150.jpg)
sourceToDest() and destToSource()Invertible functions
xi
f(xi)==xi
x
f(x)
width/2- width/2
scale = 1
![Page 151: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/151.jpg)
sourceToDest() and destToSource()Invertible functions
xi
f(xi)==xi
x
f(x)
width/2- width/2
scale = 1
![Page 152: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/152.jpg)
sourceToDest() and destToSource()Invertible functions
xi
f(xi)==xi
x
f(x)
width/2- width/2
scale = 1
![Page 153: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/153.jpg)
sourceToDest() and destToSource()Invertible functions
x
f(x)
width/2- width/2
scale = 1
DOD
![Page 154: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/154.jpg)
dest x
sourceToDest() and destToSource()Invertible functions
x
f(x)
width/2- width/2
scale = 1
DOD
src x
![Page 155: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/155.jpg)
dest x
sourceToDest() and destToSource()Invertible functions
src x
x
f(x)
dest x
width/2- width/2
scale = 1
DOD
Kernel and ROI
src x
![Page 156: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/156.jpg)
scale = desiredWidth/inputWidthk = inputWidth/(1.0 - (1.0/scale))
sourceToDest() and destToSource()Invertible functions
![Page 157: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/157.jpg)
scale = desiredWidth/inputWidthk = inputWidth/(1.0 - (1.0/scale))sourceToDest (1024) == 1280destToSource (1280) == 1024
sourceToDest() and destToSource()Invertible functions
![Page 158: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/158.jpg)
kernel vec2 strech (float center, float k) { vec2 p = destCoord(); !
!
!
!
return p; }
Kernel
![Page 159: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/159.jpg)
kernel vec2 strech (float center, float k) { vec2 p = destCoord(); !
!
!
!
return p; }
Kernel
![Page 160: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/160.jpg)
kernel vec2 strech (float center, float k) { vec2 p = destCoord(); !
!
!
!
return p; }
Kernel
p.x -= center;
![Page 161: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/161.jpg)
kernel vec2 strech (float center, float k) { vec2 p = destCoord(); !
!
!
!
return p; }
Kernel
p.x -= center;p.x = p.x / (1.0 + abs(p.x / k));p.x += center;
![Page 162: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/162.jpg)
r
ROI Pseudocode
![Page 163: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/163.jpg)
r
ROI Pseudocode
r’
![Page 164: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/164.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.x
![Page 165: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/165.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.x
![Page 166: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/166.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.xleftP’ = destToSource ( leftP )
![Page 167: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/167.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.x rightP = r.origin.x + r.size.widthleftP’ = destToSource ( leftP )
![Page 168: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/168.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.x rightP = r.origin.x + r.size.widthleftP’ = destToSource ( leftP )
![Page 169: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/169.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.x rightP = r.origin.x + r.size.widthleftP’ = destToSource ( leftP ) rightP’ = destToSource ( rightP )
![Page 170: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/170.jpg)
r
ROI Pseudocode
r’
leftP = r.origin.x rightP = r.origin.x + r.size.widthleftP’ = destToSource ( leftP ) rightP’ = destToSource ( rightP )
newWidth = rightP’ - leftP’ r’ = CGRectMake ( leftP’, r.origin.y, newWidth, r.size.height )
![Page 171: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/171.jpg)
double destToSource(double x, double center, double k) {
return x; } !
ROI—Region of InterestRe-use kernel equation
![Page 172: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/172.jpg)
double destToSource(double x, double center, double k) {
return x; } !
ROI—Region of InterestRe-use kernel equation
![Page 173: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/173.jpg)
double destToSource(double x, double center, double k) {
return x; } !
ROI—Region of Interest
x -= center; x = x / (1.0 + fabs(x / k)); x += center;
Re-use kernel equation
![Page 174: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/174.jpg)
double destToSource(double x, double center, double k) {
return x; } !
ROI—Region of Interest
x -= center; x = x / (1.0 + fabs(x / k)); x += center;
CGRect regionOf (CGRect r, float center, float k) { double leftP = destToSource (r.origin.x, center, k); double rightP = destToSource (r.origin.x + r.size.width, center, k); return CGRectMake (leftP, r.origin.y, rightP-leftP, r.size.height); }
Re-use kernel equation
![Page 175: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/175.jpg)
double sourceToDest (double x, double center, double k) {
return x; } !
DOD—Domain of Definition
x -= center; x = x / (1.0 - fabs(x / k)); x += center;
![Page 176: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/176.jpg)
double sourceToDest (double x, double center, double k) {
return x; } !
DOD—Domain of Definition
x -= center; x = x / (1.0 - fabs(x / k)); x += center;
CGRect dodForInputRect (CGRect r, double center, double k) { double leftP = sourceToDest (r.origin.x, center, k); double rightP = sourceToDest (r.origin.x + r.size.width, center, k); return CGRectMake (leftP, r.origin.y, rightP-leftP, r.size.height); }
![Page 177: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/177.jpg)
outputImage Method
- (CIImage *) outputImage { double inputWidth = inputImage.extent.size.width; !
double k = inputWidth / ( 1.0 - 1.0 / [inputScale floatValue] ); double center = inputImage.extent.origin.x + inputWidth / 2.0; CGRect dod = dodForInputRect (inputImage.extent, center, k); CIImage * result = [[self myKernel] applyWithExtent: dod roiCallback: ^(int index, CGRect rect) { return regionOf(rect, center, k); } inputImage: inputImage arguments: @[@(center), @(k)]]; return result; }
![Page 178: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/178.jpg)
outputImage Method
- (CIImage *) outputImage { double inputWidth = inputImage.extent.size.width; !
double k = inputWidth / ( 1.0 - 1.0 / [inputScale floatValue] ); double center = inputImage.extent.origin.x + inputWidth / 2.0; CGRect dod = dodForInputRect (inputImage.extent, center, k); CIImage * result = [[self myKernel] applyWithExtent: dod roiCallback: ^(int index, CGRect rect) { return regionOf(rect, center, k); } inputImage: inputImage arguments: @[@(center), @(k)]]; return result; }
![Page 179: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/179.jpg)
outputImage Method
- (CIImage *) outputImage { double inputWidth = inputImage.extent.size.width; !
double k = inputWidth / ( 1.0 - 1.0 / [inputScale floatValue] ); double center = inputImage.extent.origin.x + inputWidth / 2.0; CGRect dod = dodForInputRect (inputImage.extent, center, k); CIImage * result = [[self myKernel] applyWithExtent: dod roiCallback: ^(int index, CGRect rect) { return regionOf(rect, center, k); } inputImage: inputImage arguments: @[@(center), @(k)]]; return result; }
![Page 180: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/180.jpg)
outputImage Method
- (CIImage *) outputImage { double inputWidth = inputImage.extent.size.width; !
double k = inputWidth / ( 1.0 - 1.0 / [inputScale floatValue] ); double center = inputImage.extent.origin.x + inputWidth / 2.0; CGRect dod = dodForInputRect (inputImage.extent, center, k); CIImage * result = [[self myKernel] applyWithExtent: dod roiCallback: ^(int index, CGRect rect) { return regionOf(rect, center, k); } inputImage: inputImage arguments: @[@(center), @(k)]]; return result; }
![Page 181: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/181.jpg)
outputImage Method
- (CIImage *) outputImage { double inputWidth = inputImage.extent.size.width; !
double k = inputWidth / ( 1.0 - 1.0 / [inputScale floatValue] ); double center = inputImage.extent.origin.x + inputWidth / 2.0; CGRect dod = dodForInputRect (inputImage.extent, center, k); CIImage * result = [[self myKernel] applyWithExtent: dod roiCallback: ^(int index, CGRect rect) { return regionOf(rect, center, k); } inputImage: inputImage arguments: @[@(center), @(k)]]; return result; }
![Page 182: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/182.jpg)
customAttributes Method
+ (NSDictionary *)customAttributes { return @{ kCIAttributeFilterDisplayName : @“Anamorphic Stretch", kCIAttributeFilterCategories : @[kCICategoryDistortionEffect, kCICategoryVideo, kCICategoryInterlaced, kCICategoryNonSquarePixels, kCICategoryStillImage], @"inputScale" : @{ kCIAttributeSliderMin : @1.0, kCIAttributeSliderMax : @2.0, kCIAttributeDefault : @1.0, kCIAttributeIdentity : @1.0, kCIAttributeType : kCIAttributeTypeScalar } }; }
![Page 183: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/183.jpg)
customAttributes Method
+ (NSDictionary *)customAttributes { return @{ kCIAttributeFilterDisplayName : @“Anamorphic Stretch", kCIAttributeFilterCategories : @[kCICategoryDistortionEffect, kCICategoryVideo, kCICategoryInterlaced, kCICategoryNonSquarePixels, kCICategoryStillImage], @"inputScale" : @{ kCIAttributeSliderMin : @1.0, kCIAttributeSliderMax : @2.0, kCIAttributeDefault : @1.0, kCIAttributeIdentity : @1.0, kCIAttributeType : kCIAttributeTypeScalar } }; }
![Page 184: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/184.jpg)
customAttributes Method
+ (NSDictionary *)customAttributes { return @{ kCIAttributeFilterDisplayName : @“Anamorphic Stretch", kCIAttributeFilterCategories : @[kCICategoryDistortionEffect, kCICategoryVideo, kCICategoryInterlaced, kCICategoryNonSquarePixels, kCICategoryStillImage], @"inputScale" : @{ kCIAttributeSliderMin : @1.0, kCIAttributeSliderMax : @2.0, kCIAttributeDefault : @1.0, kCIAttributeIdentity : @1.0, kCIAttributeType : kCIAttributeTypeScalar } }; }
![Page 185: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/185.jpg)
customAttributes Method
+ (NSDictionary *)customAttributes { return @{ kCIAttributeFilterDisplayName : @“Anamorphic Stretch", kCIAttributeFilterCategories : @[kCICategoryDistortionEffect, kCICategoryVideo, kCICategoryInterlaced, kCICategoryNonSquarePixels, kCICategoryStillImage], @"inputScale" : @{ kCIAttributeSliderMin : @1.0, kCIAttributeSliderMax : @2.0, kCIAttributeDefault : @1.0, kCIAttributeIdentity : @1.0, kCIAttributeType : kCIAttributeTypeScalar } }; }
![Page 186: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/186.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 187: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/187.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 188: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/188.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 189: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/189.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 190: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/190.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 191: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/191.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 192: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/192.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 193: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/193.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 194: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/194.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 195: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/195.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 196: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/196.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 197: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/197.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 198: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/198.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 199: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/199.jpg)
CIKernel Wrap-Up
# Input Images Input Type Access Output
Image DOD ROI
ClColorKernel 0 .. n __sample vec4 vec4 YES NO
ClWarpKernel 1 destCoord() vec2 vec2 YES YES
ClKernel 0 .. n sampler sample(…) vec4 YES YES
![Page 200: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/200.jpg)
General KernelsCIKernel
Tony Chu
![Page 201: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/201.jpg)
Different Types of Kernels
Color Kernels (CIColorKernel)
Warp Kernels (CIWarpKernel)
General Kernels (CIKernel)
![Page 202: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/202.jpg)
MotivationCIKernel
When would you need to write a general kernel?
![Page 203: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/203.jpg)
MotivationCIKernel
When would you need to write a general kernel?• Kernel needs multiple samples of an image
![Page 204: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/204.jpg)
MotivationCIKernel
When would you need to write a general kernel?• Kernel needs multiple samples of an image
- e.g., any kind of blur or convolution filter
![Page 205: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/205.jpg)
MotivationCIKernel
When would you need to write a general kernel?• Kernel needs multiple samples of an image
- e.g., any kind of blur or convolution filter
• Kernel contains a dependent texture read
![Page 206: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/206.jpg)
MotivationCIKernel
When would you need to write a general kernel?• Kernel needs multiple samples of an image
- e.g., any kind of blur or convolution filter
• Kernel contains a dependent texture read
- e.g., sample from image A used to determine where to sample from image B
![Page 207: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/207.jpg)
Basic Principles of General KernelsCIKernel
Input Image(s)Input Image(s)Input Image(s) Output Image
Sampler CIKernel CIImage
![Page 208: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/208.jpg)
Basic Principles of General KernelsCIKernel
Input Image(s)Input Image(s)Input Image(s) Output Image
Sampler CIKernel CIImage
![Page 209: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/209.jpg)
Basic Principles of General Kernels
kernel vec4 do_nothing (sampler image) { vec2 dc = destCoord(); return sample (image, samplerTransform (image, dc)); }
!
!
![Page 210: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/210.jpg)
Basic Principles of General Kernels
kernel vec4 do_nothing (sampler image) { vec2 dc = destCoord(); return sample (image, samplerTransform (image, dc)); }
!
!
kernel vec4 do_nothing (sampler image) { return sample (image, samplerCoord (image)); }
![Page 211: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/211.jpg)
Basic Principles of General Kernels
kernel vec4 do_nothing (sampler image) { vec2 dc = destCoord(); return sample (image, samplerTransform (image, dc)); }
!
!
=kernel vec4 do_nothing (sampler image) { return sample (image, samplerCoord (image)); }
![Page 212: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/212.jpg)
Basic Principles of General Kernels
kernel vec4 do_nothing (sampler image) { vec2 dc = destCoord(); return sample (image, samplerTransform (image, dc)); }
!
!
=
Why use samplerTransform?
kernel vec4 do_nothing (sampler image) { return sample (image, samplerCoord (image)); }
![Page 213: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/213.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
Basic Principles of General KernelsDestination space vs. Sampler space
![Page 214: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/214.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
Basic Principles of General KernelsDestination space vs. Sampler space
x
y
400
06000
Destination space
![Page 215: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/215.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
x
y
400
06000
Destination space
![Page 216: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/216.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
x
y
400
06000
Destination space
(300, 200)
![Page 217: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/217.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
x
y
400
06000
Destination space
(300, 200) (0.5, 0.5)
![Page 218: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/218.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
(0.5, 2.5)
x
y
400
06000
Destination space
(300, 200) (0.5, 0.5)
![Page 219: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/219.jpg)
kernel vec4 do_something (sampler image) { vec2 sc = samplerCoord (image); vec2 offset = vec2(0.0, 2.0); return sample (image, sc + offset); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
(0.5, 2.5)
x
y
400
06000
Destination space
(300, 200) (0.5, 0.5)
![Page 220: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/220.jpg)
x
y
400
06000
Destination space
kernel vec4 do_something (sampler image) { vec2 dc = destCoord(); vec2 offset = vec2(0.0, 2.0); return sample (image, samplerTransform (image, dc + offset)); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
![Page 221: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/221.jpg)
x
y
400
06000
Destination space
kernel vec4 do_something (sampler image) { vec2 dc = destCoord(); vec2 offset = vec2(0.0, 2.0); return sample (image, samplerTransform (image, dc + offset)); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
(300, 200)
![Page 222: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/222.jpg)
x
y
400
06000
Destination space
kernel vec4 do_something (sampler image) { vec2 dc = destCoord(); vec2 offset = vec2(0.0, 2.0); return sample (image, samplerTransform (image, dc + offset)); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
(300, 200)
(300, 202)
![Page 223: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/223.jpg)
x
y
400
06000
Destination space
kernel vec4 do_something (sampler image) { vec2 dc = destCoord(); vec2 offset = vec2(0.0, 2.0); return sample (image, samplerTransform (image, dc + offset)); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
(0.5, 0.505)(300, 200)
(300, 202)
![Page 224: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/224.jpg)
x
y
400
06000
Destination space
kernel vec4 do_something (sampler image) { vec2 dc = destCoord(); vec2 offset = vec2(0.0, 2.0); return sample (image, samplerTransform (image, dc + offset)); }
x
y
0 1
Sampler space
1
0
Basic Principles of General KernelsDestination space vs. Sampler space
(0.5, 0.505)(300, 200)
(300, 202)
![Page 225: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/225.jpg)
ExamplesCIKernel
![Page 226: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/226.jpg)
Motion BlurKernel requires multiple samples
![Page 227: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/227.jpg)
Motion BlurKernel requires multiple samples
Compute the average of N samples along a bi-directional vector
![Page 228: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/228.jpg)
Motion BlurKernel requires multiple samples
Compute the average of N samples along a bi-directional vector
![Page 229: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/229.jpg)
Motion BlurKernel requires multiple samples
Compute the average of N samples along a bi-directional vector
![Page 230: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/230.jpg)
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction !
vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; !
for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } !
return s / float((NUM_SAMPLES * 2 + 1)); }
Motion BlurCIKernel
![Page 231: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/231.jpg)
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction !
vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; !
for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } !
return s / float((NUM_SAMPLES * 2 + 1)); }
Motion BlurCIKernel
![Page 232: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/232.jpg)
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction !
vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; !
for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } !
return s / float((NUM_SAMPLES * 2 + 1)); }
Motion BlurCIKernel
![Page 233: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/233.jpg)
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction !
vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; !
for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } !
return s / float((NUM_SAMPLES * 2 + 1)); }
Motion BlurCIKernel
![Page 234: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/234.jpg)
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction !
vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; !
for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } !
return s / float((NUM_SAMPLES * 2 + 1)); }
Motion BlurCIKernel
![Page 235: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/235.jpg)
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction !
vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; !
for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } !
return s / float((NUM_SAMPLES * 2 + 1)); }
Motion BlurCIKernel
![Page 236: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/236.jpg)
Motion BlurCIFilter subclass
- (CIKernel *)myKernel { static CIKernel *kernel = [CIKernel kernelWithString:source]; return kernel; } !
- (CIImage *)outputImage { float r = inputRadius.floatValue, a = inputAngle.floatValue; CIVector *velocity = [CIVector vectorWithX:r*cos(a) Y:r*sin(a)]; !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf(rect,velocity); } arguments: @[inputImage, velocity] ]; }
![Page 237: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/237.jpg)
Motion BlurCIFilter subclass
- (CIKernel *)myKernel { static CIKernel *kernel = [CIKernel kernelWithString:source]; return kernel; } !
- (CIImage *)outputImage { float r = inputRadius.floatValue, a = inputAngle.floatValue; CIVector *velocity = [CIVector vectorWithX:r*cos(a) Y:r*sin(a)]; !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf(rect,velocity); } arguments: @[inputImage, velocity] ]; }
![Page 238: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/238.jpg)
Motion BlurCIFilter subclass
- (CIKernel *)myKernel { static CIKernel *kernel = [CIKernel kernelWithString:source]; return kernel; } !
- (CIImage *)outputImage { float r = inputRadius.floatValue, a = inputAngle.floatValue; CIVector *velocity = [CIVector vectorWithX:r*cos(a) Y:r*sin(a)]; !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf(rect,velocity); } arguments: @[inputImage, velocity] ]; }
kernel vec4 motionBlur (sampler image, vec2 velocity) { const int NUM_SAMPLES = 10; // per direction vec4 s = vec4(0.0); vec2 dc = destCoord(), offset = -velocity; for (int i=0; i < (NUM_SAMPLES * 2 + 1); i++) { s += sample (image, samplerTransform (image, dc + offset)); offset += velocity / float(NUM_SAMPLES); } return s / float((NUM_SAMPLES * 2 + 1)); }
![Page 239: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/239.jpg)
Motion BlurCIFilter subclass
- (CIKernel *)myKernel { static CIKernel *kernel = [CIKernel kernelWithString:source]; return kernel; } !
- (CIImage *)outputImage { float r = inputRadius.floatValue, a = inputAngle.floatValue; CIVector *velocity = [CIVector vectorWithX:r*cos(a) Y:r*sin(a)]; !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf(rect,velocity); } arguments: @[inputImage, velocity] ]; }
![Page 240: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/240.jpg)
Motion BlurCIFilter subclass
- (CIKernel *)myKernel { static CIKernel *kernel = [CIKernel kernelWithString:source]; return kernel; } !
- (CIImage *)outputImage { float r = inputRadius.floatValue, a = inputAngle.floatValue; CIVector *velocity = [CIVector vectorWithX:r*cos(a) Y:r*sin(a)]; !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf(rect,velocity); } arguments: @[inputImage, velocity] ]; }
![Page 241: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/241.jpg)
Motion BlurCIFilter subclass
- (CIKernel *)myKernel { static CIKernel *kernel = [CIKernel kernelWithString:source]; return kernel; } !
- (CIImage *)outputImage { float r = inputRadius.floatValue, a = inputAngle.floatValue; CIVector *velocity = [CIVector vectorWithX:r*cos(a) Y:r*sin(a)]; !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf(rect,velocity); } arguments: @[inputImage, velocity] ]; }
![Page 242: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/242.jpg)
Motion BlurDOD
extent.size.width
ext
ent.
size
.hei
ght
extent.origin
![Page 243: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/243.jpg)
Motion BlurDOD
extent.size.width
ext
ent.
size
.hei
ght
extent.origin
![Page 244: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/244.jpg)
Motion BlurDOD
extent.size.width
ext
ent.
size
.hei
ght
extent.origin
![Page 245: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/245.jpg)
Motion BlurDOD
extent.size.width
ext
ent.
size
.hei
ght
extent.origin
![Page 246: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/246.jpg)
Motion BlurDOD
extent.size.width
ext
ent.
size
.hei
ght
extent.origin |velocity.X|
![Page 247: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/247.jpg)
Motion BlurDOD
extent.size.width
DOD = CGRectInset (inputImage.extent, -abs(velocity.X), -abs(velocity.Y));
ext
ent.
size
.hei
ght
extent.origin |velocity.X|
![Page 248: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/248.jpg)
Motion BlurROI
![Page 249: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/249.jpg)
Motion BlurROI
![Page 250: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/250.jpg)
Motion BlurROI
![Page 251: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/251.jpg)
Motion BlurROI
![Page 252: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/252.jpg)
Motion BlurROI
![Page 253: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/253.jpg)
Motion BlurROI
![Page 254: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/254.jpg)
Motion BlurROI
![Page 255: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/255.jpg)
Motion BlurROI
![Page 256: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/256.jpg)
Motion BlurROI
CGRect regionOf (CGRect rect, CIVector *velocity) { return CGRectInset (rect, -abs(velocity.X), -abs(velocity.Y)); }
![Page 257: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/257.jpg)
Motion Blur 2.0
![Page 258: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/258.jpg)
Motion Blur 2.0
![Page 259: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/259.jpg)
Motion Blur 2.0
![Page 260: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/260.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
![Page 261: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/261.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
![Page 262: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/262.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
![Page 263: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/263.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
CIKernel
![Page 264: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/264.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
CIKernel
![Page 265: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/265.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
CIKernel
![Page 266: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/266.jpg)
Motion Blur with Masked Vector FieldKernel contains dependent texture read
CIKernel
![Page 267: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/267.jpg)
Motion Blur with Masked Vector FieldCIKernel
![Page 268: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/268.jpg)
Motion Blur with Masked Vector FieldCIKernel
![Page 269: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/269.jpg)
Motion Blur with Masked Vector FieldCIKernel
!
!
!
!
kernel vec4 motionBlurWithMask (sampler image, sampler mask, float radius) { // read per-pixel directional vector from mask image first vec2 dir = sample (mask, samplerCoord(mask)).rg; dir = dir * 2.0 - 1.0; // de-normalize vector from [0,1] to [-1,+1] !
vec2 velocity = dir * radius; !
return _motionBlur (image, velocity); }
![Page 270: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/270.jpg)
Motion Blur with Masked Vector FieldCIKernel
!
!
!
!
kernel vec4 motionBlurWithMask (sampler image, sampler mask, float radius) { // read per-pixel directional vector from mask image first vec2 dir = sample (mask, samplerCoord(mask)).rg; dir = dir * 2.0 - 1.0; // de-normalize vector from [0,1] to [-1,+1] !
vec2 velocity = dir * radius; !
return _motionBlur (image, velocity); }
vec4 _motionBlur (sampler image, vec2 velocity) { // apply regular motion blur effect }
![Page 271: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/271.jpg)
Motion Blur with Masked Vector FieldCIKernel
!
!
!
!
kernel vec4 motionBlurWithMask (sampler image, sampler mask, float radius) { // read per-pixel directional vector from mask image first vec2 dir = sample (mask, samplerCoord(mask)).rg; dir = dir * 2.0 - 1.0; // de-normalize vector from [0,1] to [-1,+1] !
vec2 velocity = dir * radius; !
return _motionBlur (image, velocity); }
vec4 _motionBlur (sampler image, vec2 velocity) { // apply regular motion blur effect }
![Page 272: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/272.jpg)
Motion Blur with Masked Vector FieldCIKernel
!
!
!
!
kernel vec4 motionBlurWithMask (sampler image, sampler mask, float radius) { // read per-pixel directional vector from mask image first vec2 dir = sample (mask, samplerCoord(mask)).rg; dir = dir * 2.0 - 1.0; // de-normalize vector from [0,1] to [-1,+1] !
vec2 velocity = dir * radius; !
return _motionBlur (image, velocity); }
vec4 _motionBlur (sampler image, vec2 velocity) { // apply regular motion blur effect }
![Page 273: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/273.jpg)
Motion Blur with Masked Vector FieldCIKernel
!
!
!
!
kernel vec4 motionBlurWithMask (sampler image, sampler mask, float radius) { // read per-pixel directional vector from mask image first vec2 dir = sample (mask, samplerCoord(mask)).rg; dir = dir * 2.0 - 1.0; // de-normalize vector from [0,1] to [-1,+1] !
vec2 velocity = dir * radius; !
return _motionBlur (image, velocity); }
vec4 _motionBlur (sampler image, vec2 velocity) { // apply regular motion blur effect }
![Page 274: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/274.jpg)
- (CIImage *)outputImage { float r = inputRadius.floatValue; CGRect DOD = CGRectInset (inputImage.extent, -r, -r); !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf (index, rect, r); } arguments: @[inputImage, maskImage, inputRadius] ]; }
Motion Blur with Masked Vector FieldCIFilter subclass
![Page 275: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/275.jpg)
- (CIImage *)outputImage { float r = inputRadius.floatValue; CGRect DOD = CGRectInset (inputImage.extent, -r, -r); !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf (index, rect, r); } arguments: @[inputImage, maskImage, inputRadius] ]; }
Motion Blur with Masked Vector FieldCIFilter subclass
![Page 276: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/276.jpg)
- (CIImage *)outputImage { float r = inputRadius.floatValue; CGRect DOD = CGRectInset (inputImage.extent, -r, -r); !
return [[self myKernel] applyWithExtent:DOD roiCallback:^(int index, CGRect rect) { return regionOf (index, rect, r); } arguments: @[inputImage, maskImage, inputRadius] ]; }
Motion Blur with Masked Vector FieldCIFilter subclass
![Page 277: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/277.jpg)
CGRect regionOf (int index, CGRect rect, float radius) { if (index == 0) { return CGRectInset (rect, -radius, -radius); // ROI for input image } else if (index == 1) { return rect; // ROI for mask image } !
return CGRectNull; // should not reach here }
Motion Blur with Masked Vector FieldROI for multiple images
![Page 278: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/278.jpg)
CGRect regionOf (int index, CGRect rect, float radius) { if (index == 0) { return CGRectInset (rect, -radius, -radius); // ROI for input image } else if (index == 1) { return rect; // ROI for mask image } !
return CGRectNull; // should not reach here }
Motion Blur with Masked Vector FieldROI for multiple images
![Page 279: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/279.jpg)
CGRect regionOf (int index, CGRect rect, float radius) { if (index == 0) { return CGRectInset (rect, -radius, -radius); // ROI for input image } else if (index == 1) { return rect; // ROI for mask image } !
return CGRectNull; // should not reach here }
Motion Blur with Masked Vector FieldROI for multiple images
![Page 280: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/280.jpg)
Portability of General KernelsOS X and iOS
Desktop-class kernel type with the same language syntax and semantics as OS X
![Page 281: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/281.jpg)
Portability of General KernelsOS X and iOS
Desktop-class kernel type with the same language syntax and semantics as OS X
New built-in filters on iOS ported from OS X using general kernels
![Page 282: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/282.jpg)
Portability of General KernelsOS X and iOS
Desktop-class kernel type with the same language syntax and semantics as OS X
New built-in filters on iOS ported from OS X using general kernels
Glass Distortion
![Page 283: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/283.jpg)
Portability of General KernelsOS X and iOS
Desktop-class kernel type with the same language syntax and semantics as OS X
New built-in filters on iOS ported from OS X using general kernels
Histogram DisplayGlass Distortion
![Page 284: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/284.jpg)
Performance ConsiderationsMultiple render passes
Input Image(s)Input Image(s)Input Image(s) Output Image
Sampler CIKernel CIImage
![Page 285: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/285.jpg)
Performance ConsiderationsMultiple render passes
Input Image(s)Input Image(s)Input Image(s) Output Image
Sampler CIKernel CIImage
![Page 286: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/286.jpg)
!
!
!
!
!
!
Each input image to a CIKernel adds an extra render pass
Performance ConsiderationsMultiple render passes
Input Image(s)Input Image(s)Input Image(s) Output Image
Sampler CIKernel CIImage
![Page 287: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/287.jpg)
8-bit kCIFormatRGBA8
16-bit kCIFormatRGBAh
Null Working Space(Color Management Off )
Default Working Space (Linear Rec. 709) Needs Linear to sRGB Needs 2X Memory
Intermediate BufferskCIContextWorkingFormat
![Page 288: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/288.jpg)
8-bit kCIFormatRGBA8
16-bit kCIFormatRGBAh
Null Working Space(Color Management Off )
Default Working Space (Linear Rec. 709) Needs Linear to sRGB Needs 2X Memory
Intermediate BufferskCIContextWorkingFormat
![Page 289: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/289.jpg)
8-bit kCIFormatRGBA8
16-bit kCIFormatRGBAh
Null Working Space(Color Management Off )
Default Working Space (Linear Rec. 709) Needs Linear to sRGB Needs 2X Memory
Intermediate BufferskCIContextWorkingFormat
![Page 290: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/290.jpg)
8-bit kCIFormatRGBA8
16-bit kCIFormatRGBAh
Null Working Space(Color Management Off )
Default Working Space (Linear Rec. 709) Needs Linear to sRGB Needs 2X Memory
Intermediate BufferskCIContextWorkingFormat
![Page 291: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/291.jpg)
CIKernel?Square Kaleidoscope
![Page 292: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/292.jpg)
CIKernel?Square Kaleidoscope
![Page 293: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/293.jpg)
CIKernel?Square Kaleidoscope
!CIFilter
CIKernel?=
![Page 294: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/294.jpg)
CIKernel?Square Kaleidoscope
!CIFilter
CIKernel?=
![Page 295: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/295.jpg)
!CIFilter
Better solutionSquare Kaleidoscope
?=
![Page 296: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/296.jpg)
!CIFilter
Better solutionSquare Kaleidoscope
?=
![Page 297: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/297.jpg)
!CIFilter
Better solutionSquare Kaleidoscope
CIWarpKernel
?=
![Page 298: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/298.jpg)
!CIFilter
Better solutionSquare Kaleidoscope
CIWarpKernel
?=
![Page 299: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/299.jpg)
!CIFilter
Better solutionSquare Kaleidoscope
CIWarpKernel
+
CIColorKernel
?=
![Page 300: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/300.jpg)
!CIFilter
Better solutionSquare Kaleidoscope
CIWarpKernel
+
CIColorKernel
?=
![Page 301: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/301.jpg)
Square KaleidoscopeCIWarpKernel
kernel vec2 squareKaleidoscopeWarp (vec2 center, float size) { // offset by center and transform to unit square vec2 p = (destCoord() - center) / size; !
// calculate number of mirror reflections to get to this point float z = abs(floor(p.x)) + abs(floor(p.y)); !
// reflect this point into unit square space p = 1.0 - abs(mod(p, 2.0) - 1.0); !
// transform back to destination space return (p * size) + center; }
![Page 302: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/302.jpg)
Square KaleidoscopeCIColorKernel
kernel vec4 squareKaleidoscopeColor (__sample s, vec2 center, float size) { // offset by center and transform to unit square vec2 p = (destCoord() - center) / size; !
// calculate number of mirror reflections to get to this point float z = abs(floor(p.x)) + abs(floor(p.y)); !
// exponential decay float k = pow(0.8, z); !
// multiply color sample with decay return vec4(s.rgb * k, s.a); }
![Page 303: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/303.jpg)
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ];
Square KaleidoscopeCIWarpKernel and CIColorKernel
![Page 304: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/304.jpg)
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ];
Square KaleidoscopeCIWarpKernel and CIColorKernel
CIWarpKernel
![Page 305: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/305.jpg)
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ];
Square KaleidoscopeCIWarpKernel and CIColorKernel
CIWarpKernel
![Page 306: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/306.jpg)
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ];
Square KaleidoscopeCIWarpKernel and CIColorKernel
CIWarpKernel
coreRect;
![Page 307: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/307.jpg)
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ];
Square KaleidoscopeCIWarpKernel and CIColorKernel
CIWarpKernel
![Page 308: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/308.jpg)
Square KaleidoscopeCIWarpKernel and CIColorKernel
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ]; !
CIImage *outputImage = [colorKernel applyWithExtent:warpedImage.extent arguments: @[warpedImage, center, size] ];
CIWarpKernel
![Page 309: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/309.jpg)
Square KaleidoscopeCIWarpKernel and CIColorKernel
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ]; !
CIImage *outputImage = [colorKernel applyWithExtent:warpedImage.extent arguments: @[warpedImage, center, size] ];
CIWarpKernel CIColorKernel
![Page 310: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/310.jpg)
Square KaleidoscopeCIWarpKernel and CIColorKernel
!
!
!
!
!
!
!
!
!
CIImage *warpedImage = [warpKernel applyWithExtent:CGRectInfinite roiCallback:^(int index, CGRect rect) { return coreRect; } inputImage:inputImage arguments: @[center, size] ]; !
CIImage *outputImage = [colorKernel applyWithExtent:warpedImage.extent arguments: @[warpedImage, center, size] ];
CIWarpKernel CIColorKernel
![Page 311: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/311.jpg)
Recommendations
![Page 312: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/312.jpg)
Recommendations
Write a general kernel only when needed
![Page 313: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/313.jpg)
Recommendations
Write a general kernel only when needed
Write a general kernel initially for rapid prototyping, then try replacing with some combination of warp and color kernels
![Page 314: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/314.jpg)
Platform Differences
![Page 315: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/315.jpg)
Platform Differences
iOS OS X
Renderers GPU CPU and GPU
Control flow in language Yes No
Kernel classesCIKernelCIColorKernelCIWarpKernel
CIKernel
CISampler No Yes
DOD CGRect CIFilterShape
ROI Block Pointer Selector
[CIFilter setDefaults] Automatic Explicit
[CIFilter customAttributes] Class Method Instance Method
![Page 316: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/316.jpg)
What You’ve Learned Today
![Page 317: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/317.jpg)
What You’ve Learned Today
How to write Color, Warp, and general kernels
![Page 318: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/318.jpg)
What You’ve Learned Today
How to write Color, Warp, and general kernels
DOD and ROI
![Page 319: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/319.jpg)
What You’ve Learned Today
How to write Color, Warp, and general kernels
DOD and ROI• ROI function is critical for large image support to work correctly and optimally
![Page 320: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/320.jpg)
What You’ve Learned Today
How to write Color, Warp, and general kernels
DOD and ROI• ROI function is critical for large image support to work correctly and optimally
Platform differences
![Page 321: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/321.jpg)
More Information
Allan Schaffer Graphics and Game Technologies Evangelist [email protected]
Developer Technical Support http://developer.apple.com/contact
Apple Developer Forums http://devforums.apple.com
![Page 322: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/322.jpg)
Related Sessions
• Introducing the Photos Frameworks Nob Hill Thursday 10:15AM
• Advances in Core Image Pacific Heights Thursday 2:00PM
![Page 323: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/323.jpg)
Labs
• Core Image Lab Media Lab B Thursday 4:30PM
![Page 324: 515 Developing Core Image Filters for iOS DF · 2016. 7. 8. · Developing Core Image Filters for iOS Media Session 515 Alexandre Naaman Lead Customizer! Tony Chu General Specialist](https://reader031.vdocuments.net/reader031/viewer/2022013100/60f8a86250827474df19b4ff/html5/thumbnails/324.jpg)