├── .gitignore ├── README.md ├── SmileSwift.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── Ken_Tominaga.xcuserdatad │ └── xcschemes │ ├── SmileSwift.xcscheme │ └── xcschememanagement.plist ├── SmileSwift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.swift └── a0002_006614.png └── SmileSwiftTests ├── Info.plist └── SmileSwiftTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/073727ccd9b0ec0b39440fb7673034f04f5d1302/Swift.gitignore 2 | 3 | # Xcode 4 | # 5 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 6 | 7 | ## Build generated 8 | build/ 9 | DerivedData 10 | 11 | ## Various settings 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | 22 | ## Other 23 | *.xccheckout 24 | *.moved-aside 25 | *.xcuserstate 26 | *.xcscmblueprint 27 | 28 | ## Obj-C/Swift specific 29 | *.hmap 30 | *.ipa 31 | 32 | # CocoaPods 33 | # 34 | # We recommend against adding the Pods directory to your .gitignore. However 35 | # you should judge for yourself, the pros and cons are mentioned at: 36 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 37 | # 38 | # Pods/ 39 | 40 | # Carthage 41 | # 42 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 43 | # Carthage/Checkouts 44 | 45 | Carthage/Build 46 | 47 | 48 | ### https://raw.github.com/github/gitignore/073727ccd9b0ec0b39440fb7673034f04f5d1302/Global/OSX.gitignore 49 | 50 | .DS_Store 51 | .AppleDouble 52 | .LSOverride 53 | 54 | # Icon must end with two \r 55 | Icon 56 | 57 | # Thumbnails 58 | ._* 59 | 60 | # Files that might appear in the root of a volume 61 | .DocumentRevisions-V100 62 | .fseventsd 63 | .Spotlight-V100 64 | .TemporaryItems 65 | .Trashes 66 | .VolumeIcon.icns 67 | 68 | # Directories potentially created on remote AFP share 69 | .AppleDB 70 | .AppleDesktop 71 | Network Trash Folder 72 | Temporary Items 73 | .apdisk 74 | 75 | 76 | ### https://raw.github.com/github/gitignore/073727ccd9b0ec0b39440fb7673034f04f5d1302/Global/Xcode.gitignore 77 | 78 | # Xcode 79 | # 80 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 81 | 82 | ## Build generated 83 | build/ 84 | DerivedData 85 | 86 | ## Various settings 87 | *.pbxuser 88 | !default.pbxuser 89 | *.mode1v3 90 | !default.mode1v3 91 | *.mode2v3 92 | !default.mode2v3 93 | *.perspectivev3 94 | !default.perspectivev3 95 | xcuserdata 96 | 97 | ## Other 98 | *.xccheckout 99 | *.moved-aside 100 | *.xcuserstate 101 | 102 | 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SmileSwift 2 | This sample app detects smiles in a picture. 3 | 4 | # CIFaceFeature 5 | 6 | - bounds: CGRect { get } 7 | - hasLeftEyePosition: Bool { get } 8 | - leftEyePosition: CGPoint { get } 9 | - hasRightEyePosition: Bool { get } 10 | - rightEyePosition: CGPoint { get } 11 | - hasMouthPosition: Bool { get } 12 | - mouthPosition: CGPoint { get } 13 | 14 | - hasTrackingID: Bool { get } 15 | - trackingID: Int32 { get } 16 | - hasTrackingFrameCount: Bool { get } 17 | - trackingFrameCount: Int32 { get } 18 | 19 | - hasFaceAngle: Bool { get } 20 | - faceAngle: Float { get } 21 | 22 | - hasSmile: Bool { get } 23 | - leftEyeClosed: Bool { get } 24 | - rightEyeClosed: Bool { get } 25 | -------------------------------------------------------------------------------- /SmileSwift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4A1823471A0CB5CD00BDF95B /* a0002_006614.png in Resources */ = {isa = PBXBuildFile; fileRef = 4A1823461A0CB5CD00BDF95B /* a0002_006614.png */; }; 11 | 4AC91F4E1A0C812700E25EC2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC91F4D1A0C812700E25EC2 /* AppDelegate.swift */; }; 12 | 4AC91F501A0C812700E25EC2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC91F4F1A0C812700E25EC2 /* ViewController.swift */; }; 13 | 4AC91F531A0C812700E25EC2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4AC91F511A0C812700E25EC2 /* Main.storyboard */; }; 14 | 4AC91F551A0C812700E25EC2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4AC91F541A0C812700E25EC2 /* Images.xcassets */; }; 15 | 4AC91F581A0C812700E25EC2 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4AC91F561A0C812700E25EC2 /* LaunchScreen.xib */; }; 16 | 4AC91F641A0C812800E25EC2 /* SmileSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AC91F631A0C812800E25EC2 /* SmileSwiftTests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 4AC91F5E1A0C812700E25EC2 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 4AC91F401A0C812700E25EC2 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 4AC91F471A0C812700E25EC2; 25 | remoteInfo = SmileSwift; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 4A1823461A0CB5CD00BDF95B /* a0002_006614.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = a0002_006614.png; sourceTree = ""; }; 31 | 4AC91F481A0C812700E25EC2 /* SmileSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SmileSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | 4AC91F4C1A0C812700E25EC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 4AC91F4D1A0C812700E25EC2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34 | 4AC91F4F1A0C812700E25EC2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 35 | 4AC91F521A0C812700E25EC2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 36 | 4AC91F541A0C812700E25EC2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 37 | 4AC91F571A0C812700E25EC2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 38 | 4AC91F5D1A0C812700E25EC2 /* SmileSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SmileSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 4AC91F621A0C812700E25EC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 4AC91F631A0C812800E25EC2 /* SmileSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmileSwiftTests.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 4AC91F451A0C812700E25EC2 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 4AC91F5A1A0C812700E25EC2 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 4AC91F3F1A0C812700E25EC2 = { 62 | isa = PBXGroup; 63 | children = ( 64 | 4AC91F4A1A0C812700E25EC2 /* SmileSwift */, 65 | 4AC91F601A0C812700E25EC2 /* SmileSwiftTests */, 66 | 4AC91F491A0C812700E25EC2 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 4AC91F491A0C812700E25EC2 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 4AC91F481A0C812700E25EC2 /* SmileSwift.app */, 74 | 4AC91F5D1A0C812700E25EC2 /* SmileSwiftTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 4AC91F4A1A0C812700E25EC2 /* SmileSwift */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 4AC91F4D1A0C812700E25EC2 /* AppDelegate.swift */, 83 | 4AC91F4F1A0C812700E25EC2 /* ViewController.swift */, 84 | 4AC91F511A0C812700E25EC2 /* Main.storyboard */, 85 | 4A1823461A0CB5CD00BDF95B /* a0002_006614.png */, 86 | 4AC91F541A0C812700E25EC2 /* Images.xcassets */, 87 | 4AC91F561A0C812700E25EC2 /* LaunchScreen.xib */, 88 | 4AC91F4B1A0C812700E25EC2 /* Supporting Files */, 89 | ); 90 | path = SmileSwift; 91 | sourceTree = ""; 92 | }; 93 | 4AC91F4B1A0C812700E25EC2 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 4AC91F4C1A0C812700E25EC2 /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 4AC91F601A0C812700E25EC2 /* SmileSwiftTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 4AC91F631A0C812800E25EC2 /* SmileSwiftTests.swift */, 105 | 4AC91F611A0C812700E25EC2 /* Supporting Files */, 106 | ); 107 | path = SmileSwiftTests; 108 | sourceTree = ""; 109 | }; 110 | 4AC91F611A0C812700E25EC2 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 4AC91F621A0C812700E25EC2 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 4AC91F471A0C812700E25EC2 /* SmileSwift */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 4AC91F671A0C812800E25EC2 /* Build configuration list for PBXNativeTarget "SmileSwift" */; 124 | buildPhases = ( 125 | 4AC91F441A0C812700E25EC2 /* Sources */, 126 | 4AC91F451A0C812700E25EC2 /* Frameworks */, 127 | 4AC91F461A0C812700E25EC2 /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = SmileSwift; 134 | productName = SmileSwift; 135 | productReference = 4AC91F481A0C812700E25EC2 /* SmileSwift.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 4AC91F5C1A0C812700E25EC2 /* SmileSwiftTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 4AC91F6A1A0C812800E25EC2 /* Build configuration list for PBXNativeTarget "SmileSwiftTests" */; 141 | buildPhases = ( 142 | 4AC91F591A0C812700E25EC2 /* Sources */, 143 | 4AC91F5A1A0C812700E25EC2 /* Frameworks */, 144 | 4AC91F5B1A0C812700E25EC2 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 4AC91F5F1A0C812700E25EC2 /* PBXTargetDependency */, 150 | ); 151 | name = SmileSwiftTests; 152 | productName = SmileSwiftTests; 153 | productReference = 4AC91F5D1A0C812700E25EC2 /* SmileSwiftTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 4AC91F401A0C812700E25EC2 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastSwiftUpdateCheck = 0710; 163 | LastUpgradeCheck = 0800; 164 | ORGANIZATIONNAME = "Ken Tominaga"; 165 | TargetAttributes = { 166 | 4AC91F471A0C812700E25EC2 = { 167 | CreatedOnToolsVersion = 6.1; 168 | DevelopmentTeam = G4F57UX422; 169 | LastSwiftMigration = 0800; 170 | }; 171 | 4AC91F5C1A0C812700E25EC2 = { 172 | CreatedOnToolsVersion = 6.1; 173 | LastSwiftMigration = 0800; 174 | TestTargetID = 4AC91F471A0C812700E25EC2; 175 | }; 176 | }; 177 | }; 178 | buildConfigurationList = 4AC91F431A0C812700E25EC2 /* Build configuration list for PBXProject "SmileSwift" */; 179 | compatibilityVersion = "Xcode 3.2"; 180 | developmentRegion = English; 181 | hasScannedForEncodings = 0; 182 | knownRegions = ( 183 | en, 184 | Base, 185 | ); 186 | mainGroup = 4AC91F3F1A0C812700E25EC2; 187 | productRefGroup = 4AC91F491A0C812700E25EC2 /* Products */; 188 | projectDirPath = ""; 189 | projectRoot = ""; 190 | targets = ( 191 | 4AC91F471A0C812700E25EC2 /* SmileSwift */, 192 | 4AC91F5C1A0C812700E25EC2 /* SmileSwiftTests */, 193 | ); 194 | }; 195 | /* End PBXProject section */ 196 | 197 | /* Begin PBXResourcesBuildPhase section */ 198 | 4AC91F461A0C812700E25EC2 /* Resources */ = { 199 | isa = PBXResourcesBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | 4AC91F531A0C812700E25EC2 /* Main.storyboard in Resources */, 203 | 4AC91F581A0C812700E25EC2 /* LaunchScreen.xib in Resources */, 204 | 4A1823471A0CB5CD00BDF95B /* a0002_006614.png in Resources */, 205 | 4AC91F551A0C812700E25EC2 /* Images.xcassets in Resources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | 4AC91F5B1A0C812700E25EC2 /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXResourcesBuildPhase section */ 217 | 218 | /* Begin PBXSourcesBuildPhase section */ 219 | 4AC91F441A0C812700E25EC2 /* Sources */ = { 220 | isa = PBXSourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | 4AC91F501A0C812700E25EC2 /* ViewController.swift in Sources */, 224 | 4AC91F4E1A0C812700E25EC2 /* AppDelegate.swift in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 4AC91F591A0C812700E25EC2 /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 4AC91F641A0C812800E25EC2 /* SmileSwiftTests.swift in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXTargetDependency section */ 239 | 4AC91F5F1A0C812700E25EC2 /* PBXTargetDependency */ = { 240 | isa = PBXTargetDependency; 241 | target = 4AC91F471A0C812700E25EC2 /* SmileSwift */; 242 | targetProxy = 4AC91F5E1A0C812700E25EC2 /* PBXContainerItemProxy */; 243 | }; 244 | /* End PBXTargetDependency section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 4AC91F511A0C812700E25EC2 /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 4AC91F521A0C812700E25EC2 /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | 4AC91F561A0C812700E25EC2 /* LaunchScreen.xib */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 4AC91F571A0C812700E25EC2 /* Base */, 259 | ); 260 | name = LaunchScreen.xib; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 4AC91F651A0C812800E25EC2 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BOOL_CONVERSION = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INFINITE_RECURSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | ENABLE_TESTABILITY = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_DYNAMIC_NO_PIC = NO; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_OPTIMIZATION_LEVEL = 0; 293 | GCC_PREPROCESSOR_DEFINITIONS = ( 294 | "DEBUG=1", 295 | "$(inherited)", 296 | ); 297 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 305 | MTL_ENABLE_DEBUG_INFO = YES; 306 | ONLY_ACTIVE_ARCH = YES; 307 | SDKROOT = iphoneos; 308 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 309 | }; 310 | name = Debug; 311 | }; 312 | 4AC91F661A0C812800E25EC2 /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_CONSTANT_CONVERSION = YES; 322 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 323 | CLANG_WARN_EMPTY_BODY = YES; 324 | CLANG_WARN_ENUM_CONVERSION = YES; 325 | CLANG_WARN_INFINITE_RECURSION = YES; 326 | CLANG_WARN_INT_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 332 | COPY_PHASE_STRIP = YES; 333 | ENABLE_NS_ASSERTIONS = NO; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 344 | MTL_ENABLE_DEBUG_INFO = NO; 345 | SDKROOT = iphoneos; 346 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 347 | VALIDATE_PRODUCT = YES; 348 | }; 349 | name = Release; 350 | }; 351 | 4AC91F681A0C812800E25EC2 /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 355 | DEVELOPMENT_TEAM = G4F57UX422; 356 | INFOPLIST_FILE = SmileSwift/Info.plist; 357 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 358 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 359 | PRODUCT_BUNDLE_IDENTIFIER = "com.tommy.$(PRODUCT_NAME:rfc1034identifier)"; 360 | PRODUCT_NAME = "$(TARGET_NAME)"; 361 | SWIFT_VERSION = 3.0; 362 | }; 363 | name = Debug; 364 | }; 365 | 4AC91F691A0C812800E25EC2 /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | buildSettings = { 368 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 369 | DEVELOPMENT_TEAM = G4F57UX422; 370 | INFOPLIST_FILE = SmileSwift/Info.plist; 371 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 373 | PRODUCT_BUNDLE_IDENTIFIER = "com.tommy.$(PRODUCT_NAME:rfc1034identifier)"; 374 | PRODUCT_NAME = "$(TARGET_NAME)"; 375 | SWIFT_VERSION = 3.0; 376 | }; 377 | name = Release; 378 | }; 379 | 4AC91F6B1A0C812800E25EC2 /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | BUNDLE_LOADER = "$(TEST_HOST)"; 383 | FRAMEWORK_SEARCH_PATHS = ( 384 | "$(SDKROOT)/Developer/Library/Frameworks", 385 | "$(inherited)", 386 | ); 387 | GCC_PREPROCESSOR_DEFINITIONS = ( 388 | "DEBUG=1", 389 | "$(inherited)", 390 | ); 391 | INFOPLIST_FILE = SmileSwiftTests/Info.plist; 392 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 393 | PRODUCT_BUNDLE_IDENTIFIER = "com.tommy.$(PRODUCT_NAME:rfc1034identifier)"; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | SWIFT_VERSION = 3.0; 396 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SmileSwift.app/SmileSwift"; 397 | }; 398 | name = Debug; 399 | }; 400 | 4AC91F6C1A0C812800E25EC2 /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | BUNDLE_LOADER = "$(TEST_HOST)"; 404 | FRAMEWORK_SEARCH_PATHS = ( 405 | "$(SDKROOT)/Developer/Library/Frameworks", 406 | "$(inherited)", 407 | ); 408 | INFOPLIST_FILE = SmileSwiftTests/Info.plist; 409 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 410 | PRODUCT_BUNDLE_IDENTIFIER = "com.tommy.$(PRODUCT_NAME:rfc1034identifier)"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | SWIFT_VERSION = 3.0; 413 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SmileSwift.app/SmileSwift"; 414 | }; 415 | name = Release; 416 | }; 417 | /* End XCBuildConfiguration section */ 418 | 419 | /* Begin XCConfigurationList section */ 420 | 4AC91F431A0C812700E25EC2 /* Build configuration list for PBXProject "SmileSwift" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | 4AC91F651A0C812800E25EC2 /* Debug */, 424 | 4AC91F661A0C812800E25EC2 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | 4AC91F671A0C812800E25EC2 /* Build configuration list for PBXNativeTarget "SmileSwift" */ = { 430 | isa = XCConfigurationList; 431 | buildConfigurations = ( 432 | 4AC91F681A0C812800E25EC2 /* Debug */, 433 | 4AC91F691A0C812800E25EC2 /* Release */, 434 | ); 435 | defaultConfigurationIsVisible = 0; 436 | defaultConfigurationName = Release; 437 | }; 438 | 4AC91F6A1A0C812800E25EC2 /* Build configuration list for PBXNativeTarget "SmileSwiftTests" */ = { 439 | isa = XCConfigurationList; 440 | buildConfigurations = ( 441 | 4AC91F6B1A0C812800E25EC2 /* Debug */, 442 | 4AC91F6C1A0C812800E25EC2 /* Release */, 443 | ); 444 | defaultConfigurationIsVisible = 0; 445 | defaultConfigurationName = Release; 446 | }; 447 | /* End XCConfigurationList section */ 448 | }; 449 | rootObject = 4AC91F401A0C812700E25EC2 /* Project object */; 450 | } 451 | -------------------------------------------------------------------------------- /SmileSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SmileSwift.xcodeproj/xcuserdata/Ken_Tominaga.xcuserdatad/xcschemes/SmileSwift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /SmileSwift.xcodeproj/xcuserdata/Ken_Tominaga.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SmileSwift.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4AC91F471A0C812700E25EC2 16 | 17 | primary 18 | 19 | 20 | 4AC91F5C1A0C812700E25EC2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SmileSwift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SmileSwift 4 | // 5 | // Created by Ken Tominaga on 11/7/14. 6 | // Copyright (c) 2014 Ken Tominaga. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /SmileSwift/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SmileSwift/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /SmileSwift/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /SmileSwift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SmileSwift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SmileSwift 4 | // 5 | // Created by Ken Tominaga on 11/7/14. 6 | // Copyright (c) 2014 Ken Tominaga. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | final class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate { 12 | 13 | @IBOutlet private weak var outputTextView: UITextView! 14 | @IBOutlet private weak var sampleImageView: UIImageView! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | detectFaces() 20 | } 21 | 22 | override func didReceiveMemoryWarning() { 23 | super.didReceiveMemoryWarning() 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @IBAction func selectPhoto() { 28 | guard UIImagePickerController.isSourceTypeAvailable(.photoLibrary) else { 29 | return 30 | } 31 | 32 | let picker = UIImagePickerController() 33 | picker.sourceType = .photoLibrary 34 | picker.delegate = self 35 | present(picker, animated: true, completion: nil) 36 | } 37 | 38 | // MARK: - UIImagePickerControllerDelegate 39 | func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 40 | if let image = info[UIImagePickerControllerOriginalImage] as? UIImage { 41 | sampleImageView.image = image 42 | detectFaces() 43 | } 44 | 45 | picker.dismiss(animated: true, completion: nil) 46 | } 47 | 48 | // MARK: - 49 | private func detectFaces() { 50 | 51 | // create CGImage from image on storyboard. 52 | guard let image = sampleImageView.image, 53 | let cgImage = image.cgImage else { 54 | return 55 | } 56 | 57 | DispatchQueue.global(qos: .background).async { 58 | 59 | let ciImage = CIImage(cgImage: cgImage) 60 | 61 | // set CIDetectorTypeFace. 62 | let detector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh]) 63 | 64 | // set detector options 65 | let options = [ 66 | CIDetectorSmile: true, 67 | CIDetectorEyeBlink: true 68 | ] 69 | 70 | // get face features from image 71 | let features = detector?.features(in: ciImage, options: options) as! [CIFaceFeature] 72 | 73 | let featuresDescription = features 74 | .map { f in 75 | // you can configure CIFaceFeature descriptions here. There are many other properties you can get. 76 | return """ 77 | ********** 78 | bounds: \(f.bounds) 79 | hasSmile: \(f.hasSmile) 80 | hasfaceAngle: \(f.hasFaceAngle) -> \(f.faceAngle) 81 | leftEyeClosed: \(f.leftEyeClosed) 82 | rightEyeClosed: \(f.rightEyeClosed) 83 | ********** 84 | """ 85 | } 86 | .joined(separator: "\n") 87 | 88 | let outputText = "DETECTED FACES (\(features.count)):\n\n" + featuresDescription 89 | 90 | DispatchQueue.main.async { () -> Void in 91 | self.outputTextView.text = "\(outputText)" 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /SmileSwift/a0002_006614.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ken0nek/SmileSwift/ceca015d7a94f1ad74e0adf1a883e5959af9f0eb/SmileSwift/a0002_006614.png -------------------------------------------------------------------------------- /SmileSwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SmileSwiftTests/SmileSwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SmileSwiftTests.swift 3 | // SmileSwiftTests 4 | // 5 | // Created by Ken Tominaga on 11/7/14. 6 | // Copyright (c) 2014 Ken Tominaga. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class SmileSwiftTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------