Quantcast
Channel: その後のその後
Viewing all articles
Browse latest Browse all 314

API Diffsから見るiOS 13の新機能 - Core Image #WWDC19

$
0
0

iOS 13の新API発掘シリーズその3です。今回はCore Image。

髪・肌・歯のマスク

iOS 12の"Portrait Matte"は全身セグメンテーション用のマスクだったわけですが、それの「髪・肌・歯」版が取れるようになったようです。

developer.apple.com

static let auxiliarySemanticSegmentationHairMatte: CIImageOption
static let auxiliarySemanticSegmentationSkinMatte: CIImageOption
static let auxiliarySemanticSegmentationTeethMatte: CIImageOption

関連: "Portrait Matte"とは?

shu223.hatenablog.com

デプスブラー

CIContextにデプスブラーフィルタを生成するメソッドが追加。disparityImage(視差画像)、portraitEffectsMatte(全身セグメンテーション用マスク画像)、hairSemanticSegmentation(髪のセグメンテーション画像)を渡せて、出力としてCIFilterオブジェクトが返ってきます。

developer.apple.com

func depthBlurEffectFilter(for image: CIImage, 
            disparityImage: CIImage, 
      portraitEffectsMatte: CIImage?, 
  hairSemanticSegmentation: CIImage?, 
               orientation: CGImagePropertyOrientation, 
                   options: [AnyHashable : Any]? = nil) -> CIFilter?

allowLowPower

また、CIContextOptionに以下の型プロパティが追加されていました。

static let allowLowPower: CIContextOption

ドキュメントには解説がありませんが、ヘッダになにか書いてあるかも知れません。パフォーマンスかなにかを犠牲にして消費電力を抑えるオプションでしょうか?

CIFilterの各フィルタの初期化メソッド

今までは次のように文字列でフィルタ名を指定して初期化しないといけなかったのですが、

letfilter= CIFilter(name:"CISepiaTone")!

iOS 13ではドーンと(たぶん)全フィルタの初期化メソッドが追加されました。

一覧は長いので本記事の末尾に載せますが、たとえば上に示したsepia toneフィルタは次のメソッドで初期化できます。

class func sepiaTone() -> CIFilter & CISepiaTone

CIImageのAVSemanticSegmentationMatteからの初期化メソッド

AVSemanticSegmentationMatteはまだ紹介してませんが、名前からしてPortraitMatteの汎用版(Portrait Matteは人間の全身専用マスクだが、もうちょっと汎用的に領域分割するマスク)で、そこからCIImageを生成するメソッドが追加されています。

init?(semanticSegmentationMatte:AVSemanticSegmentationMatte)
init?(semanticSegmentationMatte:AVSemanticSegmentationMatte, options:[CIImageOption : Any]?)

パパッと既存の(≠オリジナルの)画像処理を適用するにはやっぱりCore Imageが簡単なので、これは必須ですね。

CGImageSourceを渡すイニシャライザも追加されています(今までなかったんだっけ。。?)

init(cgImageSource:CGImageSource, index:Int, options:[CIImageOption : Any]?)

AVSemanticSegmentationMatteオブジェクトにはプロパティからアクセスできる(持っていれば)ようです。

varsemanticSegmentationMatte:AVSemanticSegmentationMatte?

一色のCIImageを生成する?

ドキュメントには解説がなかったのですが、CIImageに以下のような型プロパティが追加されています。一色塗りのCIImageオブジェクトを生成するのでしょうか?

classvar black:CIImageclassvar blue:CIImageclassvar clear:CIImageclassvar cyan:CIImageclassvar gray:CIImageclassvar green:CIImageclassvar magenta:CIImageclassvar red:CIImageclassvar white:CIImageclassvar yellow:CIImage

CIFilterに追加された初期化メソッド一覧

上で解説した、CIFilterを生成するメソッド一覧です。しれっと新たに追加されたフィルタもあるかもしれません。

classfunc accordionFoldTransition() ->CIFilter& CIAccordionFoldTransition
classfunc additionCompositing() ->CIFilter& CICompositeOperation
classfunc affineClamp() ->CIFilter& CIAffineClamp
classfunc affineTile() ->CIFilter& CIAffineTile
classfunc attributedTextImageGenerator() ->CIFilter& CIAttributedTextImageGenerator
classfunc aztecCodeGenerator() ->CIFilter& CIAztecCodeGenerator
classfunc barcodeGenerator() ->CIFilter& CIBarcodeGenerator
classfunc barsSwipeTransition() ->CIFilter& CIBarsSwipeTransition
classfunc bicubicScaleTransform() ->CIFilter& CIBicubicScaleTransform
classfunc blendWithAlphaMask() ->CIFilter& CIBlendWithMask
classfunc blendWithBlueMask() ->CIFilter& CIBlendWithMask
classfunc blendWithMask() ->CIFilter& CIBlendWithMask
classfunc blendWithRedMask() ->CIFilter& CIBlendWithMask
classfunc bloom() ->CIFilter& CIBloom
classfunc bokehBlur() ->CIFilter& CIBokehBlur
classfunc boxBlur() ->CIFilter& CIBoxBlur
classfunc checkerboardGenerator() ->CIFilter& CICheckerboardGenerator
classfunc circularScreen() ->CIFilter& CICircularScreen
classfunc cmykHalftone() ->CIFilter& CICMYKHalftone
classfunc code128BarcodeGenerator() ->CIFilter& CICode128BarcodeGenerator
classfunc colorBlendMode() ->CIFilter& CICompositeOperation
classfunc colorBurnBlendMode() ->CIFilter& CICompositeOperation
classfunc colorClamp() ->CIFilter& CIColorClamp
classfunc colorControls() ->CIFilter& CIColorControls
classfunc colorCrossPolynomial() ->CIFilter& CIColorCrossPolynomial
classfunc colorCube() ->CIFilter& CIColorCube
classfunc colorCubeWithColorSpace() ->CIFilter& CIColorCubeWithColorSpace
classfunc colorCubesMixedWithMask() ->CIFilter& CIColorCubesMixedWithMask
classfunc colorCurves() ->CIFilter& CIColorCurves
classfunc colorDodgeBlendMode() ->CIFilter& CICompositeOperation
classfunc colorInvert() ->CIFilter& CIColorInvert
classfunc colorMap() ->CIFilter& CIColorMap
classfunc colorMatrix() ->CIFilter& CIColorMatrix
classfunc colorMonochrome() ->CIFilter& CIColorMonochrome
classfunc colorPolynomial() ->CIFilter& CIColorPolynomial
classfunc colorPosterize() ->CIFilter& CIColorPosterize
classfunc comicEffect() ->CIFilter& CIComicEffect
classfunc convolution3X3() ->CIFilter& CIConvolution
classfunc convolution5X5() ->CIFilter& CIConvolution
classfunc convolution7X7() ->CIFilter& CIConvolution
classfunc convolution9Horizontal() ->CIFilter& CIConvolution
classfunc convolution9Vertical() ->CIFilter& CIConvolution
classfunc copyMachineTransition() ->CIFilter& CICopyMachineTransition
classfunc coreMLModel() ->CIFilter& CICoreMLModel
classfunc crystallize() ->CIFilter& CICrystallize
classfunc darkenBlendMode() ->CIFilter& CICompositeOperation
classfunc depthOfField() ->CIFilter& CIDepthOfField
classfunc depthToDisparity() ->CIFilter& CIDepthToDisparity
classfunc differenceBlendMode() ->CIFilter& CICompositeOperation
classfunc discBlur() ->CIFilter& CIDiscBlur
classfunc disintegrateWithMaskTransition() ->CIFilter& CIDisintegrateWithMaskTransition
classfunc disparityToDepth() ->CIFilter& CIDisparityToDepth
classfunc dissolveTransition() ->CIFilter& CIDissolveTransition
classfunc dither() ->CIFilter& CIDither
classfunc divideBlendMode() ->CIFilter& CICompositeOperation
classfunc documentEnhancer() ->CIFilter& CIDocumentEnhancer
classfunc dotScreen() ->CIFilter& CIDotScreen
classfunc edgePreserveUpsample() ->CIFilter& CIEdgePreserveUpsample
classfunc edgeWork() ->CIFilter& CIEdgeWork
classfunc edges() ->CIFilter& CIEdges
classfunc eightfoldReflectedTile() ->CIFilter& CIEightfoldReflectedTile
classfunc exclusionBlendMode() ->CIFilter& CICompositeOperation
classfunc exposureAdjust() ->CIFilter& CIExposureAdjust
classfunc falseColor() ->CIFilter& CIFalseColor
classfunc flashTransition() ->CIFilter& CIFlashTransition
classfunc fourfoldReflectedTile() ->CIFilter& CIFourfoldReflectedTile
classfunc fourfoldRotatedTile() ->CIFilter& CIFourfoldRotatedTile
classfunc fourfoldTranslatedTile() ->CIFilter& CIFourfoldTranslatedTile
classfunc gammaAdjust() ->CIFilter& CIGammaAdjust
classfunc gaussianBlur() ->CIFilter& CIGaussianBlur
classfunc gaussianGradient() ->CIFilter& CIGaussianGradient
classfunc glideReflectedTile() ->CIFilter& CIGlideReflectedTile
classfunc gloom() ->CIFilter& CIGloom
classfunc hardLightBlendMode() ->CIFilter& CICompositeOperation
classfunc hatchedScreen() ->CIFilter& CIHatchedScreen
classfunc heightFieldFromMask() ->CIFilter& CIHeightFieldFromMask
classfunc hexagonalPixellate() ->CIFilter& CIHexagonalPixellate
classfunc highlightShadowAdjust() ->CIFilter& CIHighlightShadowAdjust
classfunc hueAdjust() ->CIFilter& CIHueAdjust
classfunc hueBlendMode() ->CIFilter& CICompositeOperation
classfunc hueSaturationValueGradient() ->CIFilter& CIHueSaturationValueGradient
classfunc kaleidoscope() ->CIFilter& CIKaleidoscope
classfunc labDeltaE() ->CIFilter& CILabDeltaE
classfunc lanczosScaleTransform() ->CIFilter& CILanczosScaleTransform
classfunc lenticularHaloGenerator() ->CIFilter& CILenticularHaloGenerator
classfunc lightenBlendMode() ->CIFilter& CICompositeOperation
classfunc lineOverlay() ->CIFilter& CILineOverlay
classfunc lineScreen() ->CIFilter& CILineScreen
classfunc linearBurnBlendMode() ->CIFilter& CICompositeOperation
classfunc linearDodgeBlendMode() ->CIFilter& CICompositeOperation
classfunc linearGradient() ->CIFilter& CILinearGradient
classfunc linearToSRGBToneCurve() ->CIFilter& CILinearToSRGBToneCurve
classfunc luminosityBlendMode() ->CIFilter& CICompositeOperation
classfunc maskToAlpha() ->CIFilter& CIMaskToAlpha
classfunc maskedVariableBlur() ->CIFilter& CIMaskedVariableBlur
classfunc maximumComponent() ->CIFilter& CIMaximumComponent
classfunc maximumCompositing() ->CIFilter& CICompositeOperation
classfunc median() ->CIFilter& CIMedian
classfunc meshGenerator() ->CIFilter& CIMeshGenerator
classfunc minimumComponent() ->CIFilter& CIMinimumComponent
classfunc minimumCompositing() ->CIFilter& CICompositeOperation
classfunc mix() ->CIFilter& CIMix
classfunc modTransition() ->CIFilter& CIModTransition
classfunc morphologyGradient() ->CIFilter& CIMorphologyGradient
classfunc morphologyMaximum() ->CIFilter& CIMorphologyMaximum
classfunc morphologyMinimum() ->CIFilter& CIMorphologyMinimum
classfunc morphologyRectangleMaximum() ->CIFilter& CIMorphologyRectangleMaximum
classfunc morphologyRectangleMinimum() ->CIFilter& CIMorphologyRectangleMinimum
classfunc motionBlur() ->CIFilter& CIMotionBlur
classfunc multiplyBlendMode() ->CIFilter& CICompositeOperation
classfunc multiplyCompositing() ->CIFilter& CICompositeOperation
classfunc noiseReduction() ->CIFilter& CINoiseReduction
classfunc opTile() ->CIFilter& CIOpTile
classfunc overlayBlendMode() ->CIFilter& CICompositeOperation
classfunc pageCurlTransition() ->CIFilter& CIPageCurlTransition
classfunc pageCurlWithShadowTransition() ->CIFilter& CIPageCurlWithShadowTransition
classfunc paletteCentroid() ->CIFilter& CIPaletteCentroid
classfunc palettize() ->CIFilter& CIPalettize
classfunc parallelogramTile() ->CIFilter& CIParallelogramTile
classfunc pdf417BarcodeGenerator() ->CIFilter& CIPDF417BarcodeGenerator
classfunc perspectiveCorrection() ->CIFilter& CIPerspectiveCorrection
classfunc perspectiveTile() ->CIFilter& CIPerspectiveTile
classfunc perspectiveTransform() ->CIFilter& CIPerspectiveTransform
classfunc perspectiveTransformWithExtent() ->CIFilter& CIPerspectiveTransformWithExtent
classfunc photoEffectChrome() ->CIFilter& CIPhotoEffect
classfunc photoEffectFade() ->CIFilter& CIPhotoEffect
classfunc photoEffectInstant() ->CIFilter& CIPhotoEffect
classfunc photoEffectMono() ->CIFilter& CIPhotoEffect
classfunc photoEffectNoir() ->CIFilter& CIPhotoEffect
classfunc photoEffectProcess() ->CIFilter& CIPhotoEffect
classfunc photoEffectTonal() ->CIFilter& CIPhotoEffect
classfunc photoEffectTransfer() ->CIFilter& CIPhotoEffect
classfunc pinLightBlendMode() ->CIFilter& CICompositeOperation
classfunc pixellate() ->CIFilter& CIPixellate
classfunc pointillize() ->CIFilter& CIPointillize
classfunc qrCodeGenerator() ->CIFilter& CIQRCodeGenerator
classfunc radialGradient() ->CIFilter& CIRadialGradient
classfunc randomGenerator() ->CIFilter& CIRandomGenerator
classfunc rippleTransition() ->CIFilter& CIRippleTransition
classfunc sRGBToneCurveToLinear() ->CIFilter& CISRGBToneCurveToLinear
classfunc saliencyMap() ->CIFilter& CISaliencyMap
classfunc saturationBlendMode() ->CIFilter& CICompositeOperation
classfunc screenBlendMode() ->CIFilter& CICompositeOperation
classfunc sepiaTone() ->CIFilter& CISepiaTone
classfunc shadedMaterial() ->CIFilter& CIShadedMaterial
classfunc sharpenLuminance() ->CIFilter& CISharpenLuminance
classfunc sixfoldReflectedTile() ->CIFilter& CISixfoldReflectedTile
classfunc sixfoldRotatedTile() ->CIFilter& CISixfoldRotatedTile
classfunc smoothLinearGradient() ->CIFilter& CISmoothLinearGradient
classfunc softLightBlendMode() ->CIFilter& CICompositeOperation
classfunc sourceAtopCompositing() ->CIFilter& CICompositeOperation
classfunc sourceInCompositing() ->CIFilter& CICompositeOperation
classfunc sourceOutCompositing() ->CIFilter& CICompositeOperation
classfunc sourceOverCompositing() ->CIFilter& CICompositeOperation
classfunc spotColor() ->CIFilter& CISpotColor
classfunc spotLight() ->CIFilter& CISpotLight
classfunc starShineGenerator() ->CIFilter& CIStarShineGenerator
classfunc straighten() ->CIFilter& CIStraighten
classfunc stripesGenerator() ->CIFilter& CIStripesGenerator
classfunc subtractBlendMode() ->CIFilter& CICompositeOperation
classfunc sunbeamsGenerator() ->CIFilter& CISunbeamsGenerator
classfunc supportedRawCameraModels() ->[String]!classfunc swipeTransition() ->CIFilter& CISwipeTransition
classfunc temperatureAndTint() ->CIFilter& CITemperatureAndTint
classfunc textImageGenerator() ->CIFilter& CITextImageGenerator
classfunc thermal() ->CIFilter& CIThermal
classfunc toneCurve() ->CIFilter& CIToneCurve
classfunc triangleKaleidoscope() ->CIFilter& CITriangleKaleidoscope
classfunc triangleTile() ->CIFilter& CITriangleTile
classfunc twelvefoldReflectedTile() ->CIFilter& CITwelvefoldReflectedTile
classfunc unsharpMask() ->CIFilter& CIUnsharpMask
classfunc vibrance() ->CIFilter& CIVibrance
classfunc vignette() ->CIFilter& CIVignette
classfunc vignetteEffect() ->CIFilter& CIVignetteEffect
classfunc whitePointAdjust() ->CIFilter& CIWhitePointAdjust
classfunc xRay() ->CIFilter& CIXRay
classfunc zoomBlur() ->CIFilter& CIZoomBlur

Viewing all articles
Browse latest Browse all 314

Trending Articles