├── .gitignore ├── AVCaptureFaceTest ├── AVCaptureFaceTest.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── AVCaptureFaceTest │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── CoreImageTest ├── CoreImageTest.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── CoreImageTest │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── faceimg.imageset │ │ ├── 728da9773912b31b794ecb378b18367adab4e18a.jpg │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── OpenCVTest ├── OpenCVTest.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── OpenCVTest.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── OpenCVTest │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── faceimg1.imageset │ │ │ ├── 94cad1c8a786c91723e93522c43d70cf3ac757c6.jpg │ │ │ └── Contents.json │ │ └── faceimg2.imageset │ │ │ ├── 91529822720e0cf399099cc20146f21fbe09aa09.jpg │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.mm │ ├── haarcascade_frontalface_alt2.xml │ └── main.m ├── Podfile └── Podfile.lock ├── README.md └── VisionTest ├── VisionTest.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist └── VisionTest ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json ├── Contents.json └── faceimg3.imageset │ ├── 902397dda144ad34fe660eafdaa20cf431ad8539.jpg │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── Info.plist └── ViewController.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | Pods/ 38 | # 39 | # Add this line if you want to avoid checking in source code from the Xcode workspace 40 | #*.xcworkspace 41 | 42 | # Carthage 43 | # 44 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 45 | # Carthage/Checkouts 46 | 47 | Carthage/Build 48 | 49 | # fastlane 50 | # 51 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 52 | # screenshots whenever they are needed. 53 | # For more information about the recommended setup visit: 54 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 55 | 56 | fastlane/report.xml 57 | fastlane/Preview.html 58 | fastlane/screenshots/**/*.png 59 | fastlane/test_output 60 | 61 | # Code Injection 62 | # 63 | # After new code Injection tools there's a generated folder /iOSInjectionProject 64 | # https://github.com/johnno1962/injectionforxcode 65 | 66 | iOSInjectionProject/ 67 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6D694E8E21608142001CC3DE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E8D21608142001CC3DE /* AppDelegate.m */; }; 11 | 6D694E9121608142001CC3DE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E9021608142001CC3DE /* ViewController.m */; }; 12 | 6D694E9421608142001CC3DE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E9221608142001CC3DE /* Main.storyboard */; }; 13 | 6D694E962160814E001CC3DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E952160814E001CC3DE /* Assets.xcassets */; }; 14 | 6D694E992160814E001CC3DE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E972160814E001CC3DE /* LaunchScreen.storyboard */; }; 15 | 6D694E9C2160814E001CC3DE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E9B2160814E001CC3DE /* main.m */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 5895E7A1B20245AA80E8E493 /* libPods-AVCaptureFaceTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AVCaptureFaceTest.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 6D694E8921608142001CC3DE /* AVCaptureFaceTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AVCaptureFaceTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 6D694E8C21608142001CC3DE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 22 | 6D694E8D21608142001CC3DE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 23 | 6D694E8F21608142001CC3DE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 24 | 6D694E9021608142001CC3DE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 25 | 6D694E9321608142001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | 6D694E952160814E001CC3DE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | 6D694E982160814E001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | 6D694E9A2160814E001CC3DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 6D694E9B2160814E001CC3DE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 6D694E8621608142001CC3DE /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 1264C468E0FF171106956282 /* Frameworks */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 5895E7A1B20245AA80E8E493 /* libPods-AVCaptureFaceTest.a */, 47 | ); 48 | name = Frameworks; 49 | sourceTree = ""; 50 | }; 51 | 6D694E8021608142001CC3DE = { 52 | isa = PBXGroup; 53 | children = ( 54 | 6D694E8B21608142001CC3DE /* AVCaptureFaceTest */, 55 | 6D694E8A21608142001CC3DE /* Products */, 56 | 1264C468E0FF171106956282 /* Frameworks */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | 6D694E8A21608142001CC3DE /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 6D694E8921608142001CC3DE /* AVCaptureFaceTest.app */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | 6D694E8B21608142001CC3DE /* AVCaptureFaceTest */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 6D694E8C21608142001CC3DE /* AppDelegate.h */, 72 | 6D694E8D21608142001CC3DE /* AppDelegate.m */, 73 | 6D694E8F21608142001CC3DE /* ViewController.h */, 74 | 6D694E9021608142001CC3DE /* ViewController.m */, 75 | 6D694E9221608142001CC3DE /* Main.storyboard */, 76 | 6D694E952160814E001CC3DE /* Assets.xcassets */, 77 | 6D694E972160814E001CC3DE /* LaunchScreen.storyboard */, 78 | 6D694E9A2160814E001CC3DE /* Info.plist */, 79 | 6D694E9B2160814E001CC3DE /* main.m */, 80 | ); 81 | path = AVCaptureFaceTest; 82 | sourceTree = ""; 83 | }; 84 | /* End PBXGroup section */ 85 | 86 | /* Begin PBXNativeTarget section */ 87 | 6D694E8821608142001CC3DE /* AVCaptureFaceTest */ = { 88 | isa = PBXNativeTarget; 89 | buildConfigurationList = 6D694E9F2160814E001CC3DE /* Build configuration list for PBXNativeTarget "AVCaptureFaceTest" */; 90 | buildPhases = ( 91 | 6D694E8521608142001CC3DE /* Sources */, 92 | 6D694E8621608142001CC3DE /* Frameworks */, 93 | 6D694E8721608142001CC3DE /* Resources */, 94 | ); 95 | buildRules = ( 96 | ); 97 | dependencies = ( 98 | ); 99 | name = AVCaptureFaceTest; 100 | productName = AVCaptureFaceTest; 101 | productReference = 6D694E8921608142001CC3DE /* AVCaptureFaceTest.app */; 102 | productType = "com.apple.product-type.application"; 103 | }; 104 | /* End PBXNativeTarget section */ 105 | 106 | /* Begin PBXProject section */ 107 | 6D694E8121608142001CC3DE /* Project object */ = { 108 | isa = PBXProject; 109 | attributes = { 110 | LastUpgradeCheck = 1000; 111 | ORGANIZATIONNAME = GCI; 112 | TargetAttributes = { 113 | 6D694E8821608142001CC3DE = { 114 | CreatedOnToolsVersion = 10.0; 115 | }; 116 | }; 117 | }; 118 | buildConfigurationList = 6D694E8421608142001CC3DE /* Build configuration list for PBXProject "AVCaptureFaceTest" */; 119 | compatibilityVersion = "Xcode 9.3"; 120 | developmentRegion = en; 121 | hasScannedForEncodings = 0; 122 | knownRegions = ( 123 | en, 124 | Base, 125 | ); 126 | mainGroup = 6D694E8021608142001CC3DE; 127 | productRefGroup = 6D694E8A21608142001CC3DE /* Products */; 128 | projectDirPath = ""; 129 | projectRoot = ""; 130 | targets = ( 131 | 6D694E8821608142001CC3DE /* AVCaptureFaceTest */, 132 | ); 133 | }; 134 | /* End PBXProject section */ 135 | 136 | /* Begin PBXResourcesBuildPhase section */ 137 | 6D694E8721608142001CC3DE /* Resources */ = { 138 | isa = PBXResourcesBuildPhase; 139 | buildActionMask = 2147483647; 140 | files = ( 141 | 6D694E992160814E001CC3DE /* LaunchScreen.storyboard in Resources */, 142 | 6D694E962160814E001CC3DE /* Assets.xcassets in Resources */, 143 | 6D694E9421608142001CC3DE /* Main.storyboard in Resources */, 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXResourcesBuildPhase section */ 148 | 149 | /* Begin PBXSourcesBuildPhase section */ 150 | 6D694E8521608142001CC3DE /* Sources */ = { 151 | isa = PBXSourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 6D694E9121608142001CC3DE /* ViewController.m in Sources */, 155 | 6D694E9C2160814E001CC3DE /* main.m in Sources */, 156 | 6D694E8E21608142001CC3DE /* AppDelegate.m in Sources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXSourcesBuildPhase section */ 161 | 162 | /* Begin PBXVariantGroup section */ 163 | 6D694E9221608142001CC3DE /* Main.storyboard */ = { 164 | isa = PBXVariantGroup; 165 | children = ( 166 | 6D694E9321608142001CC3DE /* Base */, 167 | ); 168 | name = Main.storyboard; 169 | sourceTree = ""; 170 | }; 171 | 6D694E972160814E001CC3DE /* LaunchScreen.storyboard */ = { 172 | isa = PBXVariantGroup; 173 | children = ( 174 | 6D694E982160814E001CC3DE /* Base */, 175 | ); 176 | name = LaunchScreen.storyboard; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXVariantGroup section */ 180 | 181 | /* Begin XCBuildConfiguration section */ 182 | 6D694E9D2160814E001CC3DE /* Debug */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | ALWAYS_SEARCH_USER_PATHS = NO; 186 | CLANG_ANALYZER_NONNULL = YES; 187 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 189 | CLANG_CXX_LIBRARY = "libc++"; 190 | CLANG_ENABLE_MODULES = YES; 191 | CLANG_ENABLE_OBJC_ARC = YES; 192 | CLANG_ENABLE_OBJC_WEAK = YES; 193 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 194 | CLANG_WARN_BOOL_CONVERSION = YES; 195 | CLANG_WARN_COMMA = YES; 196 | CLANG_WARN_CONSTANT_CONVERSION = YES; 197 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 198 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 199 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 200 | CLANG_WARN_EMPTY_BODY = YES; 201 | CLANG_WARN_ENUM_CONVERSION = YES; 202 | CLANG_WARN_INFINITE_RECURSION = YES; 203 | CLANG_WARN_INT_CONVERSION = YES; 204 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 205 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 206 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 207 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 208 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 209 | CLANG_WARN_STRICT_PROTOTYPES = YES; 210 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 211 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 212 | CLANG_WARN_UNREACHABLE_CODE = YES; 213 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 214 | CODE_SIGN_IDENTITY = "iPhone Developer"; 215 | COPY_PHASE_STRIP = NO; 216 | DEBUG_INFORMATION_FORMAT = dwarf; 217 | ENABLE_STRICT_OBJC_MSGSEND = YES; 218 | ENABLE_TESTABILITY = YES; 219 | GCC_C_LANGUAGE_STANDARD = gnu11; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_NO_COMMON_BLOCKS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 234 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 235 | MTL_FAST_MATH = YES; 236 | ONLY_ACTIVE_ARCH = YES; 237 | SDKROOT = iphoneos; 238 | }; 239 | name = Debug; 240 | }; 241 | 6D694E9E2160814E001CC3DE /* Release */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_ENABLE_OBJC_WEAK = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INFINITE_RECURSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 265 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 268 | CLANG_WARN_STRICT_PROTOTYPES = YES; 269 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 270 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | CODE_SIGN_IDENTITY = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 276 | ENABLE_NS_ASSERTIONS = NO; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu11; 279 | GCC_NO_COMMON_BLOCKS = YES; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 287 | MTL_ENABLE_DEBUG_INFO = NO; 288 | MTL_FAST_MATH = YES; 289 | SDKROOT = iphoneos; 290 | VALIDATE_PRODUCT = YES; 291 | }; 292 | name = Release; 293 | }; 294 | 6D694EA02160814E001CC3DE /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CODE_SIGN_STYLE = Automatic; 299 | DEVELOPMENT_TEAM = HKZ94N2PPE; 300 | INFOPLIST_FILE = AVCaptureFaceTest/Info.plist; 301 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 302 | LD_RUNPATH_SEARCH_PATHS = ( 303 | "$(inherited)", 304 | "@executable_path/Frameworks", 305 | ); 306 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.AVCaptureFaceTest; 307 | PRODUCT_NAME = "$(TARGET_NAME)"; 308 | TARGETED_DEVICE_FAMILY = "1,2"; 309 | }; 310 | name = Debug; 311 | }; 312 | 6D694EA12160814E001CC3DE /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | CODE_SIGN_STYLE = Automatic; 317 | DEVELOPMENT_TEAM = HKZ94N2PPE; 318 | INFOPLIST_FILE = AVCaptureFaceTest/Info.plist; 319 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 320 | LD_RUNPATH_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "@executable_path/Frameworks", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.AVCaptureFaceTest; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | }; 328 | name = Release; 329 | }; 330 | /* End XCBuildConfiguration section */ 331 | 332 | /* Begin XCConfigurationList section */ 333 | 6D694E8421608142001CC3DE /* Build configuration list for PBXProject "AVCaptureFaceTest" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | 6D694E9D2160814E001CC3DE /* Debug */, 337 | 6D694E9E2160814E001CC3DE /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | 6D694E9F2160814E001CC3DE /* Build configuration list for PBXNativeTarget "AVCaptureFaceTest" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | 6D694EA02160814E001CC3DE /* Debug */, 346 | 6D694EA12160814E001CC3DE /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | /* End XCConfigurationList section */ 352 | }; 353 | rootObject = 6D694E8121608142001CC3DE /* Project object */; 354 | } 355 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AVCaptureFaceTest 4 | // 5 | // Created by jackyshan on 2018/9/30. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AVCaptureFaceTest 4 | // 5 | // Created by jackyshan on 2018/9/30. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/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 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | fdsfsdfsdf 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AVCaptureFaceTest 4 | // 5 | // Created by jackyshan on 2018/9/30. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // OpenCVTest 4 | // 5 | // Created by jackyshan on 2018/9/28. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic,strong) AVCaptureSession *session; 15 | @property (nonatomic,copy) NSMutableArray *facesViewArr; 16 | @property (nonatomic,strong) AVCaptureVideoPreviewLayer *previewLayer; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | _facesViewArr = [NSMutableArray arrayWithCapacity:0]; 26 | 27 | //1.获取输入设备(摄像头) 28 | NSArray *devices = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionBack].devices; 29 | AVCaptureDevice *deviceF = devices[0]; 30 | 31 | // NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; 32 | // AVCaptureDevice *deviceF; 33 | // for (AVCaptureDevice *device in devices ) 34 | // { 35 | // if ( device.position == AVCaptureDevicePositionFront ) 36 | // { 37 | // deviceF = device; 38 | // break; 39 | // } 40 | // } 41 | 42 | //2.根据输入设备创建输入对象 43 | AVCaptureDeviceInput*input = [[AVCaptureDeviceInput alloc] initWithDevice:deviceF error:nil]; 44 | 45 | //3.创建原数据的输出对象 46 | AVCaptureMetadataOutput *metaout = [[AVCaptureMetadataOutput alloc] init]; 47 | 48 | //4.设置代理监听输出对象输出的数据,在主线程中刷新 49 | [metaout setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; 50 | 51 | self.session = [[AVCaptureSession alloc] init]; 52 | 53 | //5.设置输出质量(高像素输出) 54 | if ([self.session canSetSessionPreset:AVCaptureSessionPreset640x480]) { 55 | [self.session setSessionPreset:AVCaptureSessionPreset640x480]; 56 | } 57 | 58 | //6.添加输入和输出到会话 59 | [self.session beginConfiguration]; 60 | if ([self.session canAddInput:input]) { 61 | [self.session addInput:input]; 62 | } 63 | if ([self.session canAddOutput:metaout]) { 64 | [self.session addOutput:metaout]; 65 | } 66 | [self.session commitConfiguration]; 67 | 68 | //7.告诉输出对象要输出什么样的数据,识别人脸, 最多可识别10张人脸 69 | [metaout setMetadataObjectTypes:@[AVMetadataObjectTypeFace]]; 70 | 71 | AVCaptureSession *session = (AVCaptureSession *)self.session; 72 | 73 | //8.创建预览图层 74 | _previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; 75 | _previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; 76 | _previewLayer.frame = self.view.bounds; 77 | [self.view.layer insertSublayer:_previewLayer atIndex:0]; 78 | 79 | //9.设置有效扫描区域(默认整个屏幕区域)(每个取值0~1, 以屏幕右上角为坐标原点) 80 | metaout.rectOfInterest = self.view.bounds; 81 | 82 | //前置摄像头一定要设置一下 要不然画面是镜像 83 | for (AVCaptureVideoDataOutput* output in session.outputs) { 84 | for (AVCaptureConnection * av in output.connections) { 85 | //判断是否是前置摄像头状态 86 | if (av.supportsVideoMirroring) { 87 | //镜像设置 88 | av.videoOrientation = AVCaptureVideoOrientationPortrait; 89 | // av.videoMirrored = YES; 90 | } 91 | } 92 | } 93 | 94 | //10. 开始扫描 95 | [self.session startRunning]; 96 | 97 | } 98 | 99 | - (void)captureOutput:(AVCaptureOutput *)output didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects fromConnection:(AVCaptureConnection *)connection 100 | { 101 | //当检测到了人脸会走这个回调 102 | 103 | //干掉旧画框 104 | for (UIView *faceView in self.facesViewArr) { 105 | [faceView removeFromSuperview]; 106 | } 107 | [self.facesViewArr removeAllObjects]; 108 | 109 | //转换 110 | for (AVMetadataFaceObject *faceobject in metadataObjects) { 111 | AVMetadataObject *face = [self.previewLayer transformedMetadataObjectForMetadataObject:faceobject]; 112 | CGRect r = face.bounds; 113 | //画框 114 | UIView *faceBox = [[UIView alloc] initWithFrame:r]; 115 | faceBox.layer.borderWidth = 3; 116 | faceBox.layer.borderColor = [UIColor redColor].CGColor; 117 | faceBox.backgroundColor = [UIColor clearColor]; 118 | [self.view addSubview:faceBox]; 119 | [self.facesViewArr addObject:faceBox]; 120 | } 121 | 122 | } 123 | 124 | @end 125 | -------------------------------------------------------------------------------- /AVCaptureFaceTest/AVCaptureFaceTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AVCaptureFaceTest 4 | // 5 | // Created by jackyshan on 2018/9/30. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6D694E1C215CB0FE001CC3DE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E1B215CB0FE001CC3DE /* AppDelegate.swift */; }; 11 | 6D694E1E215CB0FE001CC3DE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E1D215CB0FE001CC3DE /* ViewController.swift */; }; 12 | 6D694E21215CB0FE001CC3DE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E1F215CB0FE001CC3DE /* Main.storyboard */; }; 13 | 6D694E23215CB10F001CC3DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E22215CB10F001CC3DE /* Assets.xcassets */; }; 14 | 6D694E26215CB10F001CC3DE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E24215CB10F001CC3DE /* LaunchScreen.storyboard */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 6D694E18215CB0FE001CC3DE /* CoreImageTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoreImageTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 6D694E1B215CB0FE001CC3DE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20 | 6D694E1D215CB0FE001CC3DE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 21 | 6D694E20215CB0FE001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 22 | 6D694E22215CB10F001CC3DE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 6D694E25215CB10F001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 24 | 6D694E27215CB10F001CC3DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 6D694E15215CB0FE001CC3DE /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 6D694E0F215CB0FD001CC3DE = { 39 | isa = PBXGroup; 40 | children = ( 41 | 6D694E1A215CB0FE001CC3DE /* CoreImageTest */, 42 | 6D694E19215CB0FE001CC3DE /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | 6D694E19215CB0FE001CC3DE /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 6D694E18215CB0FE001CC3DE /* CoreImageTest.app */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 6D694E1A215CB0FE001CC3DE /* CoreImageTest */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 6D694E1B215CB0FE001CC3DE /* AppDelegate.swift */, 58 | 6D694E1D215CB0FE001CC3DE /* ViewController.swift */, 59 | 6D694E1F215CB0FE001CC3DE /* Main.storyboard */, 60 | 6D694E22215CB10F001CC3DE /* Assets.xcassets */, 61 | 6D694E24215CB10F001CC3DE /* LaunchScreen.storyboard */, 62 | 6D694E27215CB10F001CC3DE /* Info.plist */, 63 | ); 64 | path = CoreImageTest; 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | 6D694E17215CB0FE001CC3DE /* CoreImageTest */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = 6D694E2A215CB10F001CC3DE /* Build configuration list for PBXNativeTarget "CoreImageTest" */; 73 | buildPhases = ( 74 | 6D694E14215CB0FE001CC3DE /* Sources */, 75 | 6D694E15215CB0FE001CC3DE /* Frameworks */, 76 | 6D694E16215CB0FE001CC3DE /* Resources */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = CoreImageTest; 83 | productName = CoreImageTest; 84 | productReference = 6D694E18215CB0FE001CC3DE /* CoreImageTest.app */; 85 | productType = "com.apple.product-type.application"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | 6D694E10215CB0FD001CC3DE /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastSwiftUpdateCheck = 1000; 94 | LastUpgradeCheck = 1000; 95 | ORGANIZATIONNAME = GCI; 96 | TargetAttributes = { 97 | 6D694E17215CB0FE001CC3DE = { 98 | CreatedOnToolsVersion = 10.0; 99 | }; 100 | }; 101 | }; 102 | buildConfigurationList = 6D694E13215CB0FD001CC3DE /* Build configuration list for PBXProject "CoreImageTest" */; 103 | compatibilityVersion = "Xcode 9.3"; 104 | developmentRegion = en; 105 | hasScannedForEncodings = 0; 106 | knownRegions = ( 107 | en, 108 | Base, 109 | ); 110 | mainGroup = 6D694E0F215CB0FD001CC3DE; 111 | productRefGroup = 6D694E19215CB0FE001CC3DE /* Products */; 112 | projectDirPath = ""; 113 | projectRoot = ""; 114 | targets = ( 115 | 6D694E17215CB0FE001CC3DE /* CoreImageTest */, 116 | ); 117 | }; 118 | /* End PBXProject section */ 119 | 120 | /* Begin PBXResourcesBuildPhase section */ 121 | 6D694E16215CB0FE001CC3DE /* Resources */ = { 122 | isa = PBXResourcesBuildPhase; 123 | buildActionMask = 2147483647; 124 | files = ( 125 | 6D694E26215CB10F001CC3DE /* LaunchScreen.storyboard in Resources */, 126 | 6D694E23215CB10F001CC3DE /* Assets.xcassets in Resources */, 127 | 6D694E21215CB0FE001CC3DE /* Main.storyboard in Resources */, 128 | ); 129 | runOnlyForDeploymentPostprocessing = 0; 130 | }; 131 | /* End PBXResourcesBuildPhase section */ 132 | 133 | /* Begin PBXSourcesBuildPhase section */ 134 | 6D694E14215CB0FE001CC3DE /* Sources */ = { 135 | isa = PBXSourcesBuildPhase; 136 | buildActionMask = 2147483647; 137 | files = ( 138 | 6D694E1E215CB0FE001CC3DE /* ViewController.swift in Sources */, 139 | 6D694E1C215CB0FE001CC3DE /* AppDelegate.swift in Sources */, 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXSourcesBuildPhase section */ 144 | 145 | /* Begin PBXVariantGroup section */ 146 | 6D694E1F215CB0FE001CC3DE /* Main.storyboard */ = { 147 | isa = PBXVariantGroup; 148 | children = ( 149 | 6D694E20215CB0FE001CC3DE /* Base */, 150 | ); 151 | name = Main.storyboard; 152 | sourceTree = ""; 153 | }; 154 | 6D694E24215CB10F001CC3DE /* LaunchScreen.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | 6D694E25215CB10F001CC3DE /* Base */, 158 | ); 159 | name = LaunchScreen.storyboard; 160 | sourceTree = ""; 161 | }; 162 | /* End PBXVariantGroup section */ 163 | 164 | /* Begin XCBuildConfiguration section */ 165 | 6D694E28215CB10F001CC3DE /* Debug */ = { 166 | isa = XCBuildConfiguration; 167 | buildSettings = { 168 | ALWAYS_SEARCH_USER_PATHS = NO; 169 | CLANG_ANALYZER_NONNULL = YES; 170 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 171 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 172 | CLANG_CXX_LIBRARY = "libc++"; 173 | CLANG_ENABLE_MODULES = YES; 174 | CLANG_ENABLE_OBJC_ARC = YES; 175 | CLANG_ENABLE_OBJC_WEAK = YES; 176 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 177 | CLANG_WARN_BOOL_CONVERSION = YES; 178 | CLANG_WARN_COMMA = YES; 179 | CLANG_WARN_CONSTANT_CONVERSION = YES; 180 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 181 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 182 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 183 | CLANG_WARN_EMPTY_BODY = YES; 184 | CLANG_WARN_ENUM_CONVERSION = YES; 185 | CLANG_WARN_INFINITE_RECURSION = YES; 186 | CLANG_WARN_INT_CONVERSION = YES; 187 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 188 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 189 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 190 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 191 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 192 | CLANG_WARN_STRICT_PROTOTYPES = YES; 193 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 194 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 195 | CLANG_WARN_UNREACHABLE_CODE = YES; 196 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 197 | CODE_SIGN_IDENTITY = "iPhone Developer"; 198 | COPY_PHASE_STRIP = NO; 199 | DEBUG_INFORMATION_FORMAT = dwarf; 200 | ENABLE_STRICT_OBJC_MSGSEND = YES; 201 | ENABLE_TESTABILITY = YES; 202 | GCC_C_LANGUAGE_STANDARD = gnu11; 203 | GCC_DYNAMIC_NO_PIC = NO; 204 | GCC_NO_COMMON_BLOCKS = YES; 205 | GCC_OPTIMIZATION_LEVEL = 0; 206 | GCC_PREPROCESSOR_DEFINITIONS = ( 207 | "DEBUG=1", 208 | "$(inherited)", 209 | ); 210 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 211 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 212 | GCC_WARN_UNDECLARED_SELECTOR = YES; 213 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 214 | GCC_WARN_UNUSED_FUNCTION = YES; 215 | GCC_WARN_UNUSED_VARIABLE = YES; 216 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 217 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 218 | MTL_FAST_MATH = YES; 219 | ONLY_ACTIVE_ARCH = YES; 220 | SDKROOT = iphoneos; 221 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 222 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 223 | }; 224 | name = Debug; 225 | }; 226 | 6D694E29215CB10F001CC3DE /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | ALWAYS_SEARCH_USER_PATHS = NO; 230 | CLANG_ANALYZER_NONNULL = YES; 231 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 232 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 233 | CLANG_CXX_LIBRARY = "libc++"; 234 | CLANG_ENABLE_MODULES = YES; 235 | CLANG_ENABLE_OBJC_ARC = YES; 236 | CLANG_ENABLE_OBJC_WEAK = YES; 237 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_COMMA = YES; 240 | CLANG_WARN_CONSTANT_CONVERSION = YES; 241 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 243 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 244 | CLANG_WARN_EMPTY_BODY = YES; 245 | CLANG_WARN_ENUM_CONVERSION = YES; 246 | CLANG_WARN_INFINITE_RECURSION = YES; 247 | CLANG_WARN_INT_CONVERSION = YES; 248 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 249 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 250 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 251 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 252 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 253 | CLANG_WARN_STRICT_PROTOTYPES = YES; 254 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 255 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 256 | CLANG_WARN_UNREACHABLE_CODE = YES; 257 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 258 | CODE_SIGN_IDENTITY = "iPhone Developer"; 259 | COPY_PHASE_STRIP = NO; 260 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 261 | ENABLE_NS_ASSERTIONS = NO; 262 | ENABLE_STRICT_OBJC_MSGSEND = YES; 263 | GCC_C_LANGUAGE_STANDARD = gnu11; 264 | GCC_NO_COMMON_BLOCKS = YES; 265 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 267 | GCC_WARN_UNDECLARED_SELECTOR = YES; 268 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 269 | GCC_WARN_UNUSED_FUNCTION = YES; 270 | GCC_WARN_UNUSED_VARIABLE = YES; 271 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 272 | MTL_ENABLE_DEBUG_INFO = NO; 273 | MTL_FAST_MATH = YES; 274 | SDKROOT = iphoneos; 275 | SWIFT_COMPILATION_MODE = wholemodule; 276 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 277 | VALIDATE_PRODUCT = YES; 278 | }; 279 | name = Release; 280 | }; 281 | 6D694E2B215CB10F001CC3DE /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 285 | CODE_SIGN_STYLE = Automatic; 286 | DEVELOPMENT_TEAM = HKZ94N2PPE; 287 | INFOPLIST_FILE = CoreImageTest/Info.plist; 288 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 289 | LD_RUNPATH_SEARCH_PATHS = ( 290 | "$(inherited)", 291 | "@executable_path/Frameworks", 292 | ); 293 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.CoreImageTest; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | SWIFT_VERSION = 4.2; 296 | TARGETED_DEVICE_FAMILY = "1,2"; 297 | }; 298 | name = Debug; 299 | }; 300 | 6D694E2C215CB10F001CC3DE /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | CODE_SIGN_STYLE = Automatic; 305 | DEVELOPMENT_TEAM = HKZ94N2PPE; 306 | INFOPLIST_FILE = CoreImageTest/Info.plist; 307 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 308 | LD_RUNPATH_SEARCH_PATHS = ( 309 | "$(inherited)", 310 | "@executable_path/Frameworks", 311 | ); 312 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.CoreImageTest; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | SWIFT_VERSION = 4.2; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | 6D694E13215CB0FD001CC3DE /* Build configuration list for PBXProject "CoreImageTest" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | 6D694E28215CB10F001CC3DE /* Debug */, 326 | 6D694E29215CB10F001CC3DE /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | 6D694E2A215CB10F001CC3DE /* Build configuration list for PBXNativeTarget "CoreImageTest" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | 6D694E2B215CB10F001CC3DE /* Debug */, 335 | 6D694E2C215CB10F001CC3DE /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | }; 342 | rootObject = 6D694E10215CB0FD001CC3DE /* Project object */; 343 | } 344 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CoreImageTest 4 | // 5 | // Created by jackyshan on 2018/9/27. 6 | // Copyright © 2018年 GCI. 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: [UIApplication.LaunchOptionsKey: 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 invalidate graphics rendering callbacks. 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 active 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 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/Assets.xcassets/faceimg.imageset/728da9773912b31b794ecb378b18367adab4e18a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jackyshan/iOSFaceDetect/cca373df8dcbd9bb5d7e08f79a663f784902ac22/CoreImageTest/CoreImageTest/Assets.xcassets/faceimg.imageset/728da9773912b31b794ecb378b18367adab4e18a.jpg -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/Assets.xcassets/faceimg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "728da9773912b31b794ecb378b18367adab4e18a.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CoreImageTest/CoreImageTest/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CoreImageTest 4 | // 5 | // Created by jackyshan on 2018/9/27. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreImage 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | 18 | detect1() 19 | } 20 | 21 | @IBOutlet weak var personPic: UIImageView! 22 | 23 | func detect1() { 24 | 25 | guard let personciImage = CIImage(image: personPic.image!) else { return } 26 | let accuracy = [CIDetectorAccuracy: CIDetectorAccuracyHigh] 27 | let faceDetector = CIDetector(ofType: CIDetectorTypeFace, context: nil, options: accuracy) 28 | let faces = faceDetector?.features(in: personciImage) 29 | 30 | // 转换坐标系 31 | let ciImageSize = personciImage.extent.size 32 | var transform = CGAffineTransform(scaleX: 1, y: -1) 33 | transform = transform.translatedBy(x: 0, y: -ciImageSize.height) 34 | 35 | for face in faces as! [CIFaceFeature] { 36 | print("Found bounds are \(face.bounds)") 37 | // 应用变换转换坐标 38 | var faceViewBounds = face.bounds.applying(transform) 39 | // 在图像视图中计算矩形的实际位置和大小 40 | let viewSize = personPic.bounds.size 41 | let scale = min(viewSize.width / ciImageSize.width, viewSize.height / ciImageSize.height) 42 | let offsetX = (viewSize.width - ciImageSize.width * scale) / 2 43 | let offsetY = (viewSize.height - ciImageSize.height * scale) / 2 44 | 45 | faceViewBounds = faceViewBounds.applying(CGAffineTransform(scaleX: scale, y: scale)) 46 | faceViewBounds.origin.x += offsetX 47 | faceViewBounds.origin.y += offsetY 48 | 49 | let faceBox = UIView(frame: faceViewBounds) 50 | faceBox.layer.borderWidth = 3 51 | faceBox.layer.borderColor = UIColor.red.cgColor 52 | faceBox.backgroundColor = UIColor.clear 53 | personPic.addSubview(faceBox) 54 | 55 | if face.hasLeftEyePosition { 56 | print("Left eye bounds are \(face.leftEyePosition)") 57 | } 58 | 59 | if face.hasRightEyePosition { 60 | print("Right eye bounds are \(face.rightEyePosition)") 61 | } 62 | } 63 | } 64 | 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 52C4D8F3CD76A22130AF132E /* libPods-OpenCVTest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5894587A4C0EBC1A439FD033 /* libPods-OpenCVTest.a */; }; 11 | 6D384A2D2160B683003926F1 /* haarcascade_frontalface_alt2.xml in Resources */ = {isa = PBXBuildFile; fileRef = 6D384A2C2160B683003926F1 /* haarcascade_frontalface_alt2.xml */; }; 12 | 6D694E3B215DC042001CC3DE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E3A215DC042001CC3DE /* AppDelegate.m */; }; 13 | 6D694E3E215DC042001CC3DE /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E3D215DC042001CC3DE /* ViewController.mm */; }; 14 | 6D694E41215DC042001CC3DE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E3F215DC042001CC3DE /* Main.storyboard */; }; 15 | 6D694E43215DC052001CC3DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E42215DC052001CC3DE /* Assets.xcassets */; }; 16 | 6D694E46215DC052001CC3DE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E44215DC052001CC3DE /* LaunchScreen.storyboard */; }; 17 | 6D694E49215DC052001CC3DE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E48215DC052001CC3DE /* main.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 5894587A4C0EBC1A439FD033 /* libPods-OpenCVTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OpenCVTest.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 6D384A2C2160B683003926F1 /* haarcascade_frontalface_alt2.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = haarcascade_frontalface_alt2.xml; sourceTree = ""; }; 23 | 6D694E36215DC042001CC3DE /* OpenCVTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenCVTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 6D694E39215DC042001CC3DE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | 6D694E3A215DC042001CC3DE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | 6D694E3C215DC042001CC3DE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 27 | 6D694E3D215DC042001CC3DE /* ViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = ""; }; 28 | 6D694E40215DC042001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 29 | 6D694E42215DC052001CC3DE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 30 | 6D694E45215DC052001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 31 | 6D694E47215DC052001CC3DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 6D694E48215DC052001CC3DE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | C00B1EC951E604A06F863EB5 /* Pods-OpenCVTest.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenCVTest.release.xcconfig"; path = "Pods/Target Support Files/Pods-OpenCVTest/Pods-OpenCVTest.release.xcconfig"; sourceTree = ""; }; 34 | DEB63807078747FCF6ACC66F /* Pods-OpenCVTest.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenCVTest.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OpenCVTest/Pods-OpenCVTest.debug.xcconfig"; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 6D694E33215DC042001CC3DE /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 52C4D8F3CD76A22130AF132E /* libPods-OpenCVTest.a in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 6D694E2D215DC042001CC3DE = { 50 | isa = PBXGroup; 51 | children = ( 52 | 6D694E38215DC042001CC3DE /* OpenCVTest */, 53 | 6D694E37215DC042001CC3DE /* Products */, 54 | 725332104BEE736F0DCF1BFC /* Pods */, 55 | B25C1B0BC176CE62B560259C /* Frameworks */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | 6D694E37215DC042001CC3DE /* Products */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 6D694E36215DC042001CC3DE /* OpenCVTest.app */, 63 | ); 64 | name = Products; 65 | sourceTree = ""; 66 | }; 67 | 6D694E38215DC042001CC3DE /* OpenCVTest */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 6D694E39215DC042001CC3DE /* AppDelegate.h */, 71 | 6D694E3A215DC042001CC3DE /* AppDelegate.m */, 72 | 6D694E3C215DC042001CC3DE /* ViewController.h */, 73 | 6D694E3D215DC042001CC3DE /* ViewController.mm */, 74 | 6D694E3F215DC042001CC3DE /* Main.storyboard */, 75 | 6D694E42215DC052001CC3DE /* Assets.xcassets */, 76 | 6D694E44215DC052001CC3DE /* LaunchScreen.storyboard */, 77 | 6D694E47215DC052001CC3DE /* Info.plist */, 78 | 6D384A2C2160B683003926F1 /* haarcascade_frontalface_alt2.xml */, 79 | 6D694E48215DC052001CC3DE /* main.m */, 80 | ); 81 | path = OpenCVTest; 82 | sourceTree = ""; 83 | }; 84 | 725332104BEE736F0DCF1BFC /* Pods */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | DEB63807078747FCF6ACC66F /* Pods-OpenCVTest.debug.xcconfig */, 88 | C00B1EC951E604A06F863EB5 /* Pods-OpenCVTest.release.xcconfig */, 89 | ); 90 | name = Pods; 91 | sourceTree = ""; 92 | }; 93 | B25C1B0BC176CE62B560259C /* Frameworks */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 5894587A4C0EBC1A439FD033 /* libPods-OpenCVTest.a */, 97 | ); 98 | name = Frameworks; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 6D694E35215DC042001CC3DE /* OpenCVTest */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 6D694E4C215DC052001CC3DE /* Build configuration list for PBXNativeTarget "OpenCVTest" */; 107 | buildPhases = ( 108 | 05C0E5B364D6BA88E4145962 /* [CP] Check Pods Manifest.lock */, 109 | 6D694E32215DC042001CC3DE /* Sources */, 110 | 6D694E33215DC042001CC3DE /* Frameworks */, 111 | 6D694E34215DC042001CC3DE /* Resources */, 112 | ); 113 | buildRules = ( 114 | ); 115 | dependencies = ( 116 | ); 117 | name = OpenCVTest; 118 | productName = OpenCVTest; 119 | productReference = 6D694E36215DC042001CC3DE /* OpenCVTest.app */; 120 | productType = "com.apple.product-type.application"; 121 | }; 122 | /* End PBXNativeTarget section */ 123 | 124 | /* Begin PBXProject section */ 125 | 6D694E2E215DC042001CC3DE /* Project object */ = { 126 | isa = PBXProject; 127 | attributes = { 128 | LastUpgradeCheck = 1000; 129 | ORGANIZATIONNAME = GCI; 130 | TargetAttributes = { 131 | 6D694E35215DC042001CC3DE = { 132 | CreatedOnToolsVersion = 10.0; 133 | }; 134 | }; 135 | }; 136 | buildConfigurationList = 6D694E31215DC042001CC3DE /* Build configuration list for PBXProject "OpenCVTest" */; 137 | compatibilityVersion = "Xcode 9.3"; 138 | developmentRegion = en; 139 | hasScannedForEncodings = 0; 140 | knownRegions = ( 141 | en, 142 | Base, 143 | ); 144 | mainGroup = 6D694E2D215DC042001CC3DE; 145 | productRefGroup = 6D694E37215DC042001CC3DE /* Products */; 146 | projectDirPath = ""; 147 | projectRoot = ""; 148 | targets = ( 149 | 6D694E35215DC042001CC3DE /* OpenCVTest */, 150 | ); 151 | }; 152 | /* End PBXProject section */ 153 | 154 | /* Begin PBXResourcesBuildPhase section */ 155 | 6D694E34215DC042001CC3DE /* Resources */ = { 156 | isa = PBXResourcesBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | 6D694E46215DC052001CC3DE /* LaunchScreen.storyboard in Resources */, 160 | 6D694E43215DC052001CC3DE /* Assets.xcassets in Resources */, 161 | 6D384A2D2160B683003926F1 /* haarcascade_frontalface_alt2.xml in Resources */, 162 | 6D694E41215DC042001CC3DE /* Main.storyboard in Resources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXResourcesBuildPhase section */ 167 | 168 | /* Begin PBXShellScriptBuildPhase section */ 169 | 05C0E5B364D6BA88E4145962 /* [CP] Check Pods Manifest.lock */ = { 170 | isa = PBXShellScriptBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | ); 174 | inputPaths = ( 175 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 176 | "${PODS_ROOT}/Manifest.lock", 177 | ); 178 | name = "[CP] Check Pods Manifest.lock"; 179 | outputPaths = ( 180 | "$(DERIVED_FILE_DIR)/Pods-OpenCVTest-checkManifestLockResult.txt", 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 185 | showEnvVarsInLog = 0; 186 | }; 187 | /* End PBXShellScriptBuildPhase section */ 188 | 189 | /* Begin PBXSourcesBuildPhase section */ 190 | 6D694E32215DC042001CC3DE /* Sources */ = { 191 | isa = PBXSourcesBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | 6D694E3E215DC042001CC3DE /* ViewController.mm in Sources */, 195 | 6D694E49215DC052001CC3DE /* main.m in Sources */, 196 | 6D694E3B215DC042001CC3DE /* AppDelegate.m in Sources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXSourcesBuildPhase section */ 201 | 202 | /* Begin PBXVariantGroup section */ 203 | 6D694E3F215DC042001CC3DE /* Main.storyboard */ = { 204 | isa = PBXVariantGroup; 205 | children = ( 206 | 6D694E40215DC042001CC3DE /* Base */, 207 | ); 208 | name = Main.storyboard; 209 | sourceTree = ""; 210 | }; 211 | 6D694E44215DC052001CC3DE /* LaunchScreen.storyboard */ = { 212 | isa = PBXVariantGroup; 213 | children = ( 214 | 6D694E45215DC052001CC3DE /* Base */, 215 | ); 216 | name = LaunchScreen.storyboard; 217 | sourceTree = ""; 218 | }; 219 | /* End PBXVariantGroup section */ 220 | 221 | /* Begin XCBuildConfiguration section */ 222 | 6D694E4A215DC052001CC3DE /* Debug */ = { 223 | isa = XCBuildConfiguration; 224 | buildSettings = { 225 | ALWAYS_SEARCH_USER_PATHS = NO; 226 | CLANG_ANALYZER_NONNULL = YES; 227 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 228 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 229 | CLANG_CXX_LIBRARY = "libc++"; 230 | CLANG_ENABLE_MODULES = YES; 231 | CLANG_ENABLE_OBJC_ARC = YES; 232 | CLANG_ENABLE_OBJC_WEAK = YES; 233 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 234 | CLANG_WARN_BOOL_CONVERSION = YES; 235 | CLANG_WARN_COMMA = YES; 236 | CLANG_WARN_CONSTANT_CONVERSION = YES; 237 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 238 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 239 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 240 | CLANG_WARN_EMPTY_BODY = YES; 241 | CLANG_WARN_ENUM_CONVERSION = YES; 242 | CLANG_WARN_INFINITE_RECURSION = YES; 243 | CLANG_WARN_INT_CONVERSION = YES; 244 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 245 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 246 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 247 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 248 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 249 | CLANG_WARN_STRICT_PROTOTYPES = YES; 250 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 251 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 252 | CLANG_WARN_UNREACHABLE_CODE = YES; 253 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 254 | CODE_SIGN_IDENTITY = "iPhone Developer"; 255 | COPY_PHASE_STRIP = NO; 256 | DEBUG_INFORMATION_FORMAT = dwarf; 257 | ENABLE_STRICT_OBJC_MSGSEND = YES; 258 | ENABLE_TESTABILITY = YES; 259 | GCC_C_LANGUAGE_STANDARD = gnu11; 260 | GCC_DYNAMIC_NO_PIC = NO; 261 | GCC_NO_COMMON_BLOCKS = YES; 262 | GCC_OPTIMIZATION_LEVEL = 0; 263 | GCC_PREPROCESSOR_DEFINITIONS = ( 264 | "DEBUG=1", 265 | "$(inherited)", 266 | ); 267 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 268 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 269 | GCC_WARN_UNDECLARED_SELECTOR = YES; 270 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 271 | GCC_WARN_UNUSED_FUNCTION = YES; 272 | GCC_WARN_UNUSED_VARIABLE = YES; 273 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 274 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 275 | MTL_FAST_MATH = YES; 276 | ONLY_ACTIVE_ARCH = YES; 277 | SDKROOT = iphoneos; 278 | }; 279 | name = Debug; 280 | }; 281 | 6D694E4B215DC052001CC3DE /* Release */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = NO; 285 | CLANG_ANALYZER_NONNULL = YES; 286 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 287 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 288 | CLANG_CXX_LIBRARY = "libc++"; 289 | CLANG_ENABLE_MODULES = YES; 290 | CLANG_ENABLE_OBJC_ARC = YES; 291 | CLANG_ENABLE_OBJC_WEAK = YES; 292 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 293 | CLANG_WARN_BOOL_CONVERSION = YES; 294 | CLANG_WARN_COMMA = YES; 295 | CLANG_WARN_CONSTANT_CONVERSION = YES; 296 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 297 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 298 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 299 | CLANG_WARN_EMPTY_BODY = YES; 300 | CLANG_WARN_ENUM_CONVERSION = YES; 301 | CLANG_WARN_INFINITE_RECURSION = YES; 302 | CLANG_WARN_INT_CONVERSION = YES; 303 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 304 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 305 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 306 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 307 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 308 | CLANG_WARN_STRICT_PROTOTYPES = YES; 309 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 310 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 311 | CLANG_WARN_UNREACHABLE_CODE = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | CODE_SIGN_IDENTITY = "iPhone Developer"; 314 | COPY_PHASE_STRIP = NO; 315 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu11; 319 | GCC_NO_COMMON_BLOCKS = YES; 320 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 321 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 322 | GCC_WARN_UNDECLARED_SELECTOR = YES; 323 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 324 | GCC_WARN_UNUSED_FUNCTION = YES; 325 | GCC_WARN_UNUSED_VARIABLE = YES; 326 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 327 | MTL_ENABLE_DEBUG_INFO = NO; 328 | MTL_FAST_MATH = YES; 329 | SDKROOT = iphoneos; 330 | VALIDATE_PRODUCT = YES; 331 | }; 332 | name = Release; 333 | }; 334 | 6D694E4D215DC052001CC3DE /* Debug */ = { 335 | isa = XCBuildConfiguration; 336 | baseConfigurationReference = DEB63807078747FCF6ACC66F /* Pods-OpenCVTest.debug.xcconfig */; 337 | buildSettings = { 338 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 339 | CODE_SIGN_STYLE = Automatic; 340 | DEVELOPMENT_TEAM = HKZ94N2PPE; 341 | INFOPLIST_FILE = OpenCVTest/Info.plist; 342 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 343 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 344 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.OpenCVTest; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | TARGETED_DEVICE_FAMILY = "1,2"; 347 | }; 348 | name = Debug; 349 | }; 350 | 6D694E4E215DC052001CC3DE /* Release */ = { 351 | isa = XCBuildConfiguration; 352 | baseConfigurationReference = C00B1EC951E604A06F863EB5 /* Pods-OpenCVTest.release.xcconfig */; 353 | buildSettings = { 354 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 355 | CODE_SIGN_STYLE = Automatic; 356 | DEVELOPMENT_TEAM = HKZ94N2PPE; 357 | INFOPLIST_FILE = OpenCVTest/Info.plist; 358 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 359 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 360 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.OpenCVTest; 361 | PRODUCT_NAME = "$(TARGET_NAME)"; 362 | TARGETED_DEVICE_FAMILY = "1,2"; 363 | }; 364 | name = Release; 365 | }; 366 | /* End XCBuildConfiguration section */ 367 | 368 | /* Begin XCConfigurationList section */ 369 | 6D694E31215DC042001CC3DE /* Build configuration list for PBXProject "OpenCVTest" */ = { 370 | isa = XCConfigurationList; 371 | buildConfigurations = ( 372 | 6D694E4A215DC052001CC3DE /* Debug */, 373 | 6D694E4B215DC052001CC3DE /* Release */, 374 | ); 375 | defaultConfigurationIsVisible = 0; 376 | defaultConfigurationName = Release; 377 | }; 378 | 6D694E4C215DC052001CC3DE /* Build configuration list for PBXNativeTarget "OpenCVTest" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | 6D694E4D215DC052001CC3DE /* Debug */, 382 | 6D694E4E215DC052001CC3DE /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Release; 386 | }; 387 | /* End XCConfigurationList section */ 388 | }; 389 | rootObject = 6D694E2E215DC042001CC3DE /* Project object */; 390 | } 391 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // OpenCVTest 4 | // 5 | // Created by jackyshan on 2018/9/28. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // OpenCVTest 4 | // 5 | // Created by jackyshan on 2018/9/28. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Assets.xcassets/faceimg1.imageset/94cad1c8a786c91723e93522c43d70cf3ac757c6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jackyshan/iOSFaceDetect/cca373df8dcbd9bb5d7e08f79a663f784902ac22/OpenCVTest/OpenCVTest/Assets.xcassets/faceimg1.imageset/94cad1c8a786c91723e93522c43d70cf3ac757c6.jpg -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Assets.xcassets/faceimg1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "94cad1c8a786c91723e93522c43d70cf3ac757c6.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Assets.xcassets/faceimg2.imageset/91529822720e0cf399099cc20146f21fbe09aa09.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jackyshan/iOSFaceDetect/cca373df8dcbd9bb5d7e08f79a663f784902ac22/OpenCVTest/OpenCVTest/Assets.xcassets/faceimg2.imageset/91529822720e0cf399099cc20146f21fbe09aa09.jpg -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Assets.xcassets/faceimg2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "91529822720e0cf399099cc20146f21fbe09aa09.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | fsdfwdssfd 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // OpenCVTest 4 | // 5 | // Created by jackyshan on 2018/9/28. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/ViewController.mm: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // OpenCVTest 4 | // 5 | // Created by jackyshan on 2018/9/28. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #ifdef __cplusplus 10 | #import 11 | #endif 12 | 13 | #import "ViewController.h" 14 | #import 15 | 16 | using namespace cv; 17 | using namespace std; 18 | 19 | @interface ViewController () { 20 | CascadeClassifier _faceDetector; 21 | 22 | vector _faceRects; 23 | vector _faceImgs; 24 | } 25 | 26 | @property (weak, nonatomic) IBOutlet UIImageView *imageView; 27 | 28 | @end 29 | 30 | @implementation ViewController 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | 35 | //预设置face探测的参数 36 | [self preSetFace]; 37 | 38 | //image转mat 39 | cv::Mat mat; 40 | UIImageToMat(self.imageView.image, mat); 41 | 42 | //执行face 43 | [self processImage:mat]; 44 | } 45 | 46 | - (void)preSetFace { 47 | NSString *faceCascadePath = [[NSBundle mainBundle] pathForResource:@"haarcascade_frontalface_alt2" 48 | ofType:@"xml"]; 49 | 50 | const CFIndex CASCADE_NAME_LEN = 2048; 51 | char *CASCADE_NAME = (char *) malloc(CASCADE_NAME_LEN); 52 | CFStringGetFileSystemRepresentation( (CFStringRef)faceCascadePath, CASCADE_NAME, CASCADE_NAME_LEN); 53 | 54 | _faceDetector.load(CASCADE_NAME); 55 | 56 | free(CASCADE_NAME); 57 | } 58 | 59 | - (void)processImage:(cv::Mat&)inputImage { 60 | // Do some OpenCV stuff with the image 61 | cv::Mat frame_gray; 62 | 63 | //转换为灰度图像 64 | cv::cvtColor(inputImage, frame_gray, CV_BGR2GRAY); 65 | 66 | //图像均衡化 67 | cv::equalizeHist(frame_gray, frame_gray); 68 | 69 | //分类器识别 70 | _faceDetector.detectMultiScale(frame_gray, _faceRects,1.1,2,0,cv::Size(30,30)); 71 | 72 | vector faces; 73 | faces = _faceRects; 74 | 75 | // 在每个人脸上画一个红色四方形 76 | for(unsigned int i= 0;i < faces.size();i++) 77 | { 78 | const cv::Rect& face = faces[i]; 79 | cv::Point tl(face.x,face.y); 80 | cv::Point br = tl + cv::Point(face.width,face.height); 81 | // 四方形的画法 82 | cv::Scalar magenta = cv::Scalar(255, 0, 0, 255); 83 | cv::rectangle(inputImage, tl, br, magenta, 3, 8, 0); 84 | } 85 | UIImage *outputImage = MatToUIImage(inputImage); 86 | self.imageView.image = outputImage; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /OpenCVTest/OpenCVTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // OpenCVTest 4 | // 5 | // Created by jackyshan on 2018/9/28. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /OpenCVTest/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '11.1' 3 | 4 | target 'OpenCVTest' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for OpenCVTest 9 | 10 | pod "OpenCV", '~>3.4.2' 11 | 12 | end 13 | -------------------------------------------------------------------------------- /OpenCVTest/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OpenCV (3.4.2) 3 | 4 | DEPENDENCIES: 5 | - OpenCV (~> 3.4.2) 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - OpenCV 10 | 11 | SPEC CHECKSUMS: 12 | OpenCV: 452909747854c92e0f59670961ed5131f5286cb5 13 | 14 | PODFILE CHECKSUM: ad22d55380ecc420429b1cf02f283b227949d727 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### CoreImage 2 | 3 | 自从 iOS 5(大概在2011年左右)之后,iOS 开始支持人脸识别,只是用的人不多。人脸识别 API 让开发者不仅可以进行人脸检测,还能识别微笑、眨眼等表情。 4 | 5 | ### Vision 6 | 7 | Vision 是 Apple 在 WWDC 2017 推出的图像识别框架,它基于 Core ML,所以可以理解成 Apple 的工程师设计了一种算法模型,然后利用 Core ML 训练,最后整合成一个新的框架。 8 | 9 | ### OpenCV 10 | 11 | OpenCV 起始于 1999 年 Intel 的一个内部研究项目。从那时起,它的开发就一直很活跃。进化到现在,它已支持如 OpenCL 和 OpenGL 等现代技术,也支持如 iOS 和 Android 等平台。 12 | 13 | ### AVFoundation 14 | 15 | AVFoundation照片和视频捕捉功能是从框架搭建之初就是它的强项。 从iOS 4.0 我们就可以直接访问iOS的摄像头和摄像头生成的数据(照片、视频)。 -------------------------------------------------------------------------------- /VisionTest/VisionTest.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6D694E6F21605C99001CC3DE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E6E21605C99001CC3DE /* AppDelegate.swift */; }; 11 | 6D694E7121605C99001CC3DE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D694E7021605C99001CC3DE /* ViewController.swift */; }; 12 | 6D694E7421605C99001CC3DE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E7221605C99001CC3DE /* Main.storyboard */; }; 13 | 6D694E7621605CA5001CC3DE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E7521605CA5001CC3DE /* Assets.xcassets */; }; 14 | 6D694E7921605CA5001CC3DE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6D694E7721605CA5001CC3DE /* LaunchScreen.storyboard */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 6D694E6B21605C99001CC3DE /* VisionTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VisionTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | 6D694E6E21605C99001CC3DE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 20 | 6D694E7021605C99001CC3DE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 21 | 6D694E7321605C99001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 22 | 6D694E7521605CA5001CC3DE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 6D694E7821605CA5001CC3DE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 24 | 6D694E7A21605CA5001CC3DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | /* End PBXFileReference section */ 26 | 27 | /* Begin PBXFrameworksBuildPhase section */ 28 | 6D694E6821605C99001CC3DE /* Frameworks */ = { 29 | isa = PBXFrameworksBuildPhase; 30 | buildActionMask = 2147483647; 31 | files = ( 32 | ); 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXFrameworksBuildPhase section */ 36 | 37 | /* Begin PBXGroup section */ 38 | 6D694E6221605C99001CC3DE = { 39 | isa = PBXGroup; 40 | children = ( 41 | 6D694E6D21605C99001CC3DE /* VisionTest */, 42 | 6D694E6C21605C99001CC3DE /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | 6D694E6C21605C99001CC3DE /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 6D694E6B21605C99001CC3DE /* VisionTest.app */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 6D694E6D21605C99001CC3DE /* VisionTest */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 6D694E6E21605C99001CC3DE /* AppDelegate.swift */, 58 | 6D694E7021605C99001CC3DE /* ViewController.swift */, 59 | 6D694E7221605C99001CC3DE /* Main.storyboard */, 60 | 6D694E7521605CA5001CC3DE /* Assets.xcassets */, 61 | 6D694E7721605CA5001CC3DE /* LaunchScreen.storyboard */, 62 | 6D694E7A21605CA5001CC3DE /* Info.plist */, 63 | ); 64 | path = VisionTest; 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | 6D694E6A21605C99001CC3DE /* VisionTest */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = 6D694E7D21605CA5001CC3DE /* Build configuration list for PBXNativeTarget "VisionTest" */; 73 | buildPhases = ( 74 | 6D694E6721605C99001CC3DE /* Sources */, 75 | 6D694E6821605C99001CC3DE /* Frameworks */, 76 | 6D694E6921605C99001CC3DE /* Resources */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = VisionTest; 83 | productName = VisionTest; 84 | productReference = 6D694E6B21605C99001CC3DE /* VisionTest.app */; 85 | productType = "com.apple.product-type.application"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | 6D694E6321605C99001CC3DE /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastSwiftUpdateCheck = 1000; 94 | LastUpgradeCheck = 1000; 95 | ORGANIZATIONNAME = GCI; 96 | TargetAttributes = { 97 | 6D694E6A21605C99001CC3DE = { 98 | CreatedOnToolsVersion = 10.0; 99 | }; 100 | }; 101 | }; 102 | buildConfigurationList = 6D694E6621605C99001CC3DE /* Build configuration list for PBXProject "VisionTest" */; 103 | compatibilityVersion = "Xcode 9.3"; 104 | developmentRegion = en; 105 | hasScannedForEncodings = 0; 106 | knownRegions = ( 107 | en, 108 | Base, 109 | ); 110 | mainGroup = 6D694E6221605C99001CC3DE; 111 | productRefGroup = 6D694E6C21605C99001CC3DE /* Products */; 112 | projectDirPath = ""; 113 | projectRoot = ""; 114 | targets = ( 115 | 6D694E6A21605C99001CC3DE /* VisionTest */, 116 | ); 117 | }; 118 | /* End PBXProject section */ 119 | 120 | /* Begin PBXResourcesBuildPhase section */ 121 | 6D694E6921605C99001CC3DE /* Resources */ = { 122 | isa = PBXResourcesBuildPhase; 123 | buildActionMask = 2147483647; 124 | files = ( 125 | 6D694E7921605CA5001CC3DE /* LaunchScreen.storyboard in Resources */, 126 | 6D694E7621605CA5001CC3DE /* Assets.xcassets in Resources */, 127 | 6D694E7421605C99001CC3DE /* Main.storyboard in Resources */, 128 | ); 129 | runOnlyForDeploymentPostprocessing = 0; 130 | }; 131 | /* End PBXResourcesBuildPhase section */ 132 | 133 | /* Begin PBXSourcesBuildPhase section */ 134 | 6D694E6721605C99001CC3DE /* Sources */ = { 135 | isa = PBXSourcesBuildPhase; 136 | buildActionMask = 2147483647; 137 | files = ( 138 | 6D694E7121605C99001CC3DE /* ViewController.swift in Sources */, 139 | 6D694E6F21605C99001CC3DE /* AppDelegate.swift in Sources */, 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXSourcesBuildPhase section */ 144 | 145 | /* Begin PBXVariantGroup section */ 146 | 6D694E7221605C99001CC3DE /* Main.storyboard */ = { 147 | isa = PBXVariantGroup; 148 | children = ( 149 | 6D694E7321605C99001CC3DE /* Base */, 150 | ); 151 | name = Main.storyboard; 152 | sourceTree = ""; 153 | }; 154 | 6D694E7721605CA5001CC3DE /* LaunchScreen.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | 6D694E7821605CA5001CC3DE /* Base */, 158 | ); 159 | name = LaunchScreen.storyboard; 160 | sourceTree = ""; 161 | }; 162 | /* End PBXVariantGroup section */ 163 | 164 | /* Begin XCBuildConfiguration section */ 165 | 6D694E7B21605CA5001CC3DE /* Debug */ = { 166 | isa = XCBuildConfiguration; 167 | buildSettings = { 168 | ALWAYS_SEARCH_USER_PATHS = NO; 169 | CLANG_ANALYZER_NONNULL = YES; 170 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 171 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 172 | CLANG_CXX_LIBRARY = "libc++"; 173 | CLANG_ENABLE_MODULES = YES; 174 | CLANG_ENABLE_OBJC_ARC = YES; 175 | CLANG_ENABLE_OBJC_WEAK = YES; 176 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 177 | CLANG_WARN_BOOL_CONVERSION = YES; 178 | CLANG_WARN_COMMA = YES; 179 | CLANG_WARN_CONSTANT_CONVERSION = YES; 180 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 181 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 182 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 183 | CLANG_WARN_EMPTY_BODY = YES; 184 | CLANG_WARN_ENUM_CONVERSION = YES; 185 | CLANG_WARN_INFINITE_RECURSION = YES; 186 | CLANG_WARN_INT_CONVERSION = YES; 187 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 188 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 189 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 190 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 191 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 192 | CLANG_WARN_STRICT_PROTOTYPES = YES; 193 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 194 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 195 | CLANG_WARN_UNREACHABLE_CODE = YES; 196 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 197 | CODE_SIGN_IDENTITY = "iPhone Developer"; 198 | COPY_PHASE_STRIP = NO; 199 | DEBUG_INFORMATION_FORMAT = dwarf; 200 | ENABLE_STRICT_OBJC_MSGSEND = YES; 201 | ENABLE_TESTABILITY = YES; 202 | GCC_C_LANGUAGE_STANDARD = gnu11; 203 | GCC_DYNAMIC_NO_PIC = NO; 204 | GCC_NO_COMMON_BLOCKS = YES; 205 | GCC_OPTIMIZATION_LEVEL = 0; 206 | GCC_PREPROCESSOR_DEFINITIONS = ( 207 | "DEBUG=1", 208 | "$(inherited)", 209 | ); 210 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 211 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 212 | GCC_WARN_UNDECLARED_SELECTOR = YES; 213 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 214 | GCC_WARN_UNUSED_FUNCTION = YES; 215 | GCC_WARN_UNUSED_VARIABLE = YES; 216 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 217 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 218 | MTL_FAST_MATH = YES; 219 | ONLY_ACTIVE_ARCH = YES; 220 | SDKROOT = iphoneos; 221 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 222 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 223 | }; 224 | name = Debug; 225 | }; 226 | 6D694E7C21605CA5001CC3DE /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | ALWAYS_SEARCH_USER_PATHS = NO; 230 | CLANG_ANALYZER_NONNULL = YES; 231 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 232 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 233 | CLANG_CXX_LIBRARY = "libc++"; 234 | CLANG_ENABLE_MODULES = YES; 235 | CLANG_ENABLE_OBJC_ARC = YES; 236 | CLANG_ENABLE_OBJC_WEAK = YES; 237 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_COMMA = YES; 240 | CLANG_WARN_CONSTANT_CONVERSION = YES; 241 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 243 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 244 | CLANG_WARN_EMPTY_BODY = YES; 245 | CLANG_WARN_ENUM_CONVERSION = YES; 246 | CLANG_WARN_INFINITE_RECURSION = YES; 247 | CLANG_WARN_INT_CONVERSION = YES; 248 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 249 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 250 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 251 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 252 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 253 | CLANG_WARN_STRICT_PROTOTYPES = YES; 254 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 255 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 256 | CLANG_WARN_UNREACHABLE_CODE = YES; 257 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 258 | CODE_SIGN_IDENTITY = "iPhone Developer"; 259 | COPY_PHASE_STRIP = NO; 260 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 261 | ENABLE_NS_ASSERTIONS = NO; 262 | ENABLE_STRICT_OBJC_MSGSEND = YES; 263 | GCC_C_LANGUAGE_STANDARD = gnu11; 264 | GCC_NO_COMMON_BLOCKS = YES; 265 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 267 | GCC_WARN_UNDECLARED_SELECTOR = YES; 268 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 269 | GCC_WARN_UNUSED_FUNCTION = YES; 270 | GCC_WARN_UNUSED_VARIABLE = YES; 271 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 272 | MTL_ENABLE_DEBUG_INFO = NO; 273 | MTL_FAST_MATH = YES; 274 | SDKROOT = iphoneos; 275 | SWIFT_COMPILATION_MODE = wholemodule; 276 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 277 | VALIDATE_PRODUCT = YES; 278 | }; 279 | name = Release; 280 | }; 281 | 6D694E7E21605CA5001CC3DE /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 285 | CODE_SIGN_STYLE = Automatic; 286 | DEVELOPMENT_TEAM = HKZ94N2PPE; 287 | INFOPLIST_FILE = VisionTest/Info.plist; 288 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 289 | LD_RUNPATH_SEARCH_PATHS = ( 290 | "$(inherited)", 291 | "@executable_path/Frameworks", 292 | ); 293 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.VisionTest; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | SWIFT_VERSION = 4.2; 296 | TARGETED_DEVICE_FAMILY = "1,2"; 297 | }; 298 | name = Debug; 299 | }; 300 | 6D694E7F21605CA5001CC3DE /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | CODE_SIGN_STYLE = Automatic; 305 | DEVELOPMENT_TEAM = HKZ94N2PPE; 306 | INFOPLIST_FILE = VisionTest/Info.plist; 307 | IPHONEOS_DEPLOYMENT_TARGET = 11.1; 308 | LD_RUNPATH_SEARCH_PATHS = ( 309 | "$(inherited)", 310 | "@executable_path/Frameworks", 311 | ); 312 | PRODUCT_BUNDLE_IDENTIFIER = com.gzticc.xxt.VisionTest; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | SWIFT_VERSION = 4.2; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | 6D694E6621605C99001CC3DE /* Build configuration list for PBXProject "VisionTest" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | 6D694E7B21605CA5001CC3DE /* Debug */, 326 | 6D694E7C21605CA5001CC3DE /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | 6D694E7D21605CA5001CC3DE /* Build configuration list for PBXNativeTarget "VisionTest" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | 6D694E7E21605CA5001CC3DE /* Debug */, 335 | 6D694E7F21605CA5001CC3DE /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | }; 342 | rootObject = 6D694E6321605C99001CC3DE /* Project object */; 343 | } 344 | -------------------------------------------------------------------------------- /VisionTest/VisionTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VisionTest/VisionTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /VisionTest/VisionTest/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // VisionTest 4 | // 5 | // Created by jackyshan on 2018/9/30. 6 | // Copyright © 2018年 GCI. 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: [UIApplication.LaunchOptionsKey: 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 invalidate graphics rendering callbacks. 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 active 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 | -------------------------------------------------------------------------------- /VisionTest/VisionTest/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /VisionTest/VisionTest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /VisionTest/VisionTest/Assets.xcassets/faceimg3.imageset/902397dda144ad34fe660eafdaa20cf431ad8539.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jackyshan/iOSFaceDetect/cca373df8dcbd9bb5d7e08f79a663f784902ac22/VisionTest/VisionTest/Assets.xcassets/faceimg3.imageset/902397dda144ad34fe660eafdaa20cf431ad8539.jpg -------------------------------------------------------------------------------- /VisionTest/VisionTest/Assets.xcassets/faceimg3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "902397dda144ad34fe660eafdaa20cf431ad8539.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /VisionTest/VisionTest/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /VisionTest/VisionTest/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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /VisionTest/VisionTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /VisionTest/VisionTest/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // VisionTest 4 | // 5 | // Created by jackyshan on 2018/9/30. 6 | // Copyright © 2018年 GCI. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Vision 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var imageView: UIImageView! 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | // Do any additional setup after loading the view, typically from a nib. 19 | 20 | let handler = VNImageRequestHandler.init(cgImage: (imageView.image?.cgImage!)!, orientation: CGImagePropertyOrientation.up) 21 | let request = reqReq() 22 | 23 | DispatchQueue.global(qos: .userInteractive).async { 24 | do { 25 | try handler.perform([request]) 26 | } 27 | catch { 28 | print("e") 29 | } 30 | } 31 | 32 | } 33 | 34 | 35 | func reqReq() -> VNDetectFaceRectanglesRequest { 36 | let request = VNDetectFaceRectanglesRequest(completionHandler: { (request, error) in 37 | 38 | DispatchQueue.main.async { 39 | 40 | if let result = request.results { 41 | 42 | let transform = CGAffineTransform(scaleX: 1, y: -1).translatedBy(x: 0, y: -self.imageView!.frame.size.height) 43 | let translate = CGAffineTransform.identity.scaledBy(x: self.imageView!.frame.size.width, y: self.imageView!.frame.size.height) 44 | 45 | //遍历所有识别结果 46 | for item in result { 47 | 48 | //标注框 49 | let faceRect = UIView(frame: CGRect.zero) 50 | faceRect.layer.borderWidth = 3 51 | faceRect.layer.borderColor = UIColor.red.cgColor 52 | faceRect.backgroundColor = UIColor.clear 53 | 54 | self.imageView!.addSubview(faceRect) 55 | 56 | if let faceObservation = item as? VNFaceObservation { 57 | 58 | let finalRect = faceObservation.boundingBox.applying(translate).applying(transform) 59 | faceRect.frame = finalRect 60 | 61 | } 62 | 63 | } 64 | 65 | } 66 | } 67 | 68 | 69 | }) 70 | 71 | return request 72 | } 73 | 74 | } 75 | 76 | --------------------------------------------------------------------------------