DetectorKit 0.0.4

DetectorKit 0.0.4

Steve Wight 维护。



  • Steve Wight

DetectorKit

使用 Swift 实现简单对象检测、封装和模糊

架构

uml diagram of DetectorKits object model

上述架构图顶部的浅灰色框是 DetectorKit 的公共接口。通过这些接口,您可以轻松访问检测、封装和模糊图像中的面部和文本的核心功能。

使用方法

检测

面部

// Detect all faces within an image
let faceDetector = FaceDetector(image)

// Then you can easily access the faces (as CIFeatures)
let faces = faceDetector.faces

// Access underlying CIDetector
let detector = faceDetector.detector

封装

面容

let faceFramer = FaceFramer(imageView)

// Change color and borderWidth 
// Note: borderWidth only works for box() and radial()
faceFramer.shapeColor = UIColor.red
faceFramer.borderWidth = 2.0

// Frame faces with a rectangle
faceFramer.box()

// or with a radial frame
faceFramer.radial()

// or with a pulsing circle
faceFramer.pulse()

// or with rotating boxes
faceFramer.boxRotate()

混淆

面容

let faceObscure = FaceObscure(image)

// pixelate all faces within an image
faceObscure.pixelate()

// or use a crystalize filter
faceObscure.crystalize()

Faces pixelated Faces crystalized

安装

使用DetectorKit最简单的方式是通过CocoaPods。

CocoaPods安装

要使用CocoaPods将DetectorKit集成到Xcode项目中,请在你的Podfile中指定它

platform :ios, '10.0'

target 'TargetName' do
  pod 'DetectorKit'
end

然后,运行以下命令

$ pod install

示例

有关实现上述使用的示例应用程序,请参阅Sherlock

授权

DetectorKit是在MIT授权下发布的。详情见LICENSE文件。