diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2019-05-26 18:27:36 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2019-05-26 18:27:36 +0530 |
commit | 0eef4e52dee49a239f16aca5488fda20b34b2731 (patch) | |
tree | 935259bc54623c682c200b066528b27737706210 | |
parent | 5d4e27dc0776fd04d8a67dfd0f8cd9a51cbec4cc (diff) |
Added iOS App
42 files changed, 1194 insertions, 0 deletions
diff --git a/Logo.png b/Logo.png Binary files differnew file mode 100644 index 0000000..204009c --- /dev/null +++ b/Logo.png diff --git a/Logo.psd b/Logo.psd Binary files differnew file mode 100644 index 0000000..17dd7ca --- /dev/null +++ b/Logo.psd diff --git a/iOSApp/.DS_Store b/iOSApp/.DS_Store Binary files differnew file mode 100644 index 0000000..14765bb --- /dev/null +++ b/iOSApp/.DS_Store diff --git a/iOSApp/AutoSafe.xcodeproj/project.pbxproj b/iOSApp/AutoSafe.xcodeproj/project.pbxproj new file mode 100644 index 0000000..45de948 --- /dev/null +++ b/iOSApp/AutoSafe.xcodeproj/project.pbxproj @@ -0,0 +1,355 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 3E359493229A91790052C95A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E359492229A91790052C95A /* AppDelegate.swift */; }; + 3E359497229A91790052C95A /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E359496229A91790052C95A /* SecondViewController.swift */; }; + 3E35949A229A91790052C95A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E359498229A91790052C95A /* Main.storyboard */; }; + 3E35949C229A917A0052C95A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E35949B229A917A0052C95A /* Assets.xcassets */; }; + 3E35949F229A917A0052C95A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E35949D229A917A0052C95A /* LaunchScreen.storyboard */; }; + 3E3594A9229A964F0052C95A /* FatigueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3594A8229A964F0052C95A /* FatigueViewController.swift */; }; + 3E3594AB229A982A0052C95A /* FaceLandmarksDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3594AA229A982A0052C95A /* FaceLandmarksDetector.swift */; }; + 3E3594AD229A98670052C95A /* UIImage+Scale.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E3594AC229A98670052C95A /* UIImage+Scale.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 3E35948F229A91790052C95A /* AutoSafe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AutoSafe.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 3E359492229A91790052C95A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; + 3E359496229A91790052C95A /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = "<group>"; }; + 3E359499229A91790052C95A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; + 3E35949B229A917A0052C95A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + 3E35949E229A917A0052C95A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; + 3E3594A0229A917A0052C95A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 3E3594A8229A964F0052C95A /* FatigueViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FatigueViewController.swift; sourceTree = "<group>"; }; + 3E3594AA229A982A0052C95A /* FaceLandmarksDetector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaceLandmarksDetector.swift; sourceTree = "<group>"; }; + 3E3594AC229A98670052C95A /* UIImage+Scale.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Scale.swift"; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3E35948C229A91790052C95A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3E359486229A91790052C95A = { + isa = PBXGroup; + children = ( + 3E359491229A91790052C95A /* AutoSafe */, + 3E359490229A91790052C95A /* Products */, + ); + sourceTree = "<group>"; + }; + 3E359490229A91790052C95A /* Products */ = { + isa = PBXGroup; + children = ( + 3E35948F229A91790052C95A /* AutoSafe.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 3E359491229A91790052C95A /* AutoSafe */ = { + isa = PBXGroup; + children = ( + 3E3594A8229A964F0052C95A /* FatigueViewController.swift */, + 3E359492229A91790052C95A /* AppDelegate.swift */, + 3E359496229A91790052C95A /* SecondViewController.swift */, + 3E359498229A91790052C95A /* Main.storyboard */, + 3E35949B229A917A0052C95A /* Assets.xcassets */, + 3E35949D229A917A0052C95A /* LaunchScreen.storyboard */, + 3E3594A0229A917A0052C95A /* Info.plist */, + 3E3594AA229A982A0052C95A /* FaceLandmarksDetector.swift */, + 3E3594AC229A98670052C95A /* UIImage+Scale.swift */, + ); + path = AutoSafe; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3E35948E229A91790052C95A /* AutoSafe */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E3594A3229A917A0052C95A /* Build configuration list for PBXNativeTarget "AutoSafe" */; + buildPhases = ( + 3E35948B229A91790052C95A /* Sources */, + 3E35948C229A91790052C95A /* Frameworks */, + 3E35948D229A91790052C95A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = AutoSafe; + productName = AutoSafe; + productReference = 3E35948F229A91790052C95A /* AutoSafe.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3E359487229A91790052C95A /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1020; + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = "Navan Chauhan"; + TargetAttributes = { + 3E35948E229A91790052C95A = { + CreatedOnToolsVersion = 10.2.1; + }; + }; + }; + buildConfigurationList = 3E35948A229A91790052C95A /* Build configuration list for PBXProject "AutoSafe" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 3E359486229A91790052C95A; + productRefGroup = 3E359490229A91790052C95A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3E35948E229A91790052C95A /* AutoSafe */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3E35948D229A91790052C95A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E35949F229A917A0052C95A /* LaunchScreen.storyboard in Resources */, + 3E35949C229A917A0052C95A /* Assets.xcassets in Resources */, + 3E35949A229A91790052C95A /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3E35948B229A91790052C95A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3E359497229A91790052C95A /* SecondViewController.swift in Sources */, + 3E359493229A91790052C95A /* AppDelegate.swift in Sources */, + 3E3594A9229A964F0052C95A /* FatigueViewController.swift in Sources */, + 3E3594AB229A982A0052C95A /* FaceLandmarksDetector.swift in Sources */, + 3E3594AD229A98670052C95A /* UIImage+Scale.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 3E359498229A91790052C95A /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3E359499229A91790052C95A /* Base */, + ); + name = Main.storyboard; + sourceTree = "<group>"; + }; + 3E35949D229A917A0052C95A /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 3E35949E229A917A0052C95A /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 3E3594A1229A917A0052C95A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 3E3594A2229A917A0052C95A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 3E3594A4229A917A0052C95A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6BS49F3GLW; + INFOPLIST_FILE = AutoSafe/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.navanchauhan.autosafemobile; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3E3594A5229A917A0052C95A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 6BS49F3GLW; + INFOPLIST_FILE = AutoSafe/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.navanchauhan.autosafemobile; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3E35948A229A91790052C95A /* Build configuration list for PBXProject "AutoSafe" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3594A1229A917A0052C95A /* Debug */, + 3E3594A2229A917A0052C95A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3E3594A3229A917A0052C95A /* Build configuration list for PBXNativeTarget "AutoSafe" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E3594A4229A917A0052C95A /* Debug */, + 3E3594A5229A917A0052C95A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3E359487229A91790052C95A /* Project object */; +} diff --git a/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..54086ce --- /dev/null +++ b/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:AutoSafe.xcodeproj"> + </FileRef> +</Workspace> diff --git a/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist> diff --git a/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/xcuserdata/navanchauhan.xcuserdatad/UserInterfaceState.xcuserstate b/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/xcuserdata/navanchauhan.xcuserdatad/UserInterfaceState.xcuserstate Binary files differnew file mode 100644 index 0000000..ed57292 --- /dev/null +++ b/iOSApp/AutoSafe.xcodeproj/project.xcworkspace/xcuserdata/navanchauhan.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/iOSApp/AutoSafe.xcodeproj/xcuserdata/navanchauhan.xcuserdatad/xcschemes/xcschememanagement.plist b/iOSApp/AutoSafe.xcodeproj/xcuserdata/navanchauhan.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..1e4a5b8 --- /dev/null +++ b/iOSApp/AutoSafe.xcodeproj/xcuserdata/navanchauhan.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>SchemeUserState</key> + <dict> + <key>AutoSafe.xcscheme_^#shared#^_</key> + <dict> + <key>orderHint</key> + <integer>0</integer> + </dict> + </dict> +</dict> +</plist> diff --git a/iOSApp/AutoSafe/.DS_Store b/iOSApp/AutoSafe/.DS_Store Binary files differnew file mode 100644 index 0000000..4c76d10 --- /dev/null +++ b/iOSApp/AutoSafe/.DS_Store diff --git a/iOSApp/AutoSafe/AppDelegate.swift b/iOSApp/AutoSafe/AppDelegate.swift new file mode 100644 index 0000000..3b11ca5 --- /dev/null +++ b/iOSApp/AutoSafe/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// AutoSafe +// +// Created by Navan Chauhan on 26/05/19. +// Copyright © 2019 Navan Chauhan. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // 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. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // 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. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // 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. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Contents.json b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..8d8f4bb --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "ItunesArtwork@2x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png Binary files differnew file mode 100644 index 0000000..1023684 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png Binary files differnew file mode 100644 index 0000000..d8bfff4 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png Binary files differnew file mode 100644 index 0000000..1ab5526 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png Binary files differnew file mode 100644 index 0000000..7722deb --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png Binary files differnew file mode 100644 index 0000000..57af5b9 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png Binary files differnew file mode 100644 index 0000000..17b8445 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png Binary files differnew file mode 100644 index 0000000..d8bfff4 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png Binary files differnew file mode 100644 index 0000000..e492161 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png Binary files differnew file mode 100644 index 0000000..89280f5 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png Binary files differnew file mode 100644 index 0000000..89280f5 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png Binary files differnew file mode 100644 index 0000000..cf9857f --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png Binary files differnew file mode 100644 index 0000000..9017311 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png Binary files differnew file mode 100644 index 0000000..f01965c --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png Binary files differnew file mode 100644 index 0000000..31ae078 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png Binary files differnew file mode 100644 index 0000000..77224d2 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/Contents.json b/iOSApp/AutoSafe/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/iOSApp/AutoSafe/Assets.xcassets/first.imageset/Contents.json b/iOSApp/AutoSafe/Assets.xcassets/first.imageset/Contents.json new file mode 100644 index 0000000..33a7451 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/first.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "first.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/iOSApp/AutoSafe/Assets.xcassets/first.imageset/first.pdf b/iOSApp/AutoSafe/Assets.xcassets/first.imageset/first.pdf Binary files differnew file mode 100644 index 0000000..47d911d --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/first.imageset/first.pdf diff --git a/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/Contents.json b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/Contents.json new file mode 100644 index 0000000..43003d0 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "iTunesArtwork@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "iTunesArtwork@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "iTunesArtwork@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@1x.png b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@1x.png Binary files differnew file mode 100644 index 0000000..e780f81 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@1x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@2x.png b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@2x.png Binary files differnew file mode 100644 index 0000000..77224d2 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@2x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@3x.png b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@3x.png Binary files differnew file mode 100644 index 0000000..799d91a --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/iTunesArtwork.imageset/iTunesArtwork@3x.png diff --git a/iOSApp/AutoSafe/Assets.xcassets/second.imageset/Contents.json b/iOSApp/AutoSafe/Assets.xcassets/second.imageset/Contents.json new file mode 100644 index 0000000..03bd9c9 --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/second.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "second.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/iOSApp/AutoSafe/Assets.xcassets/second.imageset/second.pdf b/iOSApp/AutoSafe/Assets.xcassets/second.imageset/second.pdf Binary files differnew file mode 100644 index 0000000..401614e --- /dev/null +++ b/iOSApp/AutoSafe/Assets.xcassets/second.imageset/second.pdf diff --git a/iOSApp/AutoSafe/Base.lproj/LaunchScreen.storyboard b/iOSApp/AutoSafe/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..6b735c8 --- /dev/null +++ b/iOSApp/AutoSafe/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <device id="retina6_1" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="iTunesArtwork" translatesAutoresizingMaskIntoConstraints="NO" id="Z1u-mg-j5F"> + <rect key="frame" x="0.0" y="44" width="414" height="818"/> + </imageView> + </subviews> + <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <constraints> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="Z1u-mg-j5F" secondAttribute="bottom" id="KoE-ML-BPv"/> + <constraint firstItem="Z1u-mg-j5F" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="bfC-dt-R6U"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="Z1u-mg-j5F" secondAttribute="trailing" id="nQC-qq-3lK"/> + <constraint firstItem="Z1u-mg-j5F" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="vgx-Rh-3IH"/> + </constraints> + <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> + <resources> + <image name="iTunesArtwork" width="512" height="512"/> + </resources> +</document> diff --git a/iOSApp/AutoSafe/Base.lproj/Main.storyboard b/iOSApp/AutoSafe/Base.lproj/Main.storyboard new file mode 100644 index 0000000..5c5e033 --- /dev/null +++ b/iOSApp/AutoSafe/Base.lproj/Main.storyboard @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3"> + <device id="retina6_1" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Fatigue Detection--> + <scene sceneID="hNz-n2-bh7"> + <objects> + <viewController id="9pv-A4-QxB" customClass="FatigueViewController" customModule="AutoSafe" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="tsR-hK-woN"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lfK-Uu-nGE"> + <rect key="frame" x="0.0" y="20" width="414" height="793"/> + </imageView> + </subviews> + <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <constraints> + <constraint firstItem="lfK-Uu-nGE" firstAttribute="top" secondItem="tsR-hK-woN" secondAttribute="top" constant="20" symbolic="YES" id="G4A-m5-fMU"/> + <constraint firstItem="PQr-Ze-W5v" firstAttribute="trailing" secondItem="lfK-Uu-nGE" secondAttribute="trailing" id="YVI-sn-ADh"/> + <constraint firstItem="lfK-Uu-nGE" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" id="YsU-eu-XeY"/> + <constraint firstItem="PQr-Ze-W5v" firstAttribute="bottom" secondItem="lfK-Uu-nGE" secondAttribute="bottom" id="fGc-5J-gZz"/> + </constraints> + <viewLayoutGuide key="safeArea" id="PQr-Ze-W5v"/> + </view> + <tabBarItem key="tabBarItem" title="Fatigue Detection" image="first" id="acW-dT-cKf"/> + <connections> + <outlet property="imageView" destination="lfK-Uu-nGE" id="JwO-je-K5K"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="749.27536231884062" y="-320.08928571428572"/> + </scene> + <!--Overspeeding--> + <scene sceneID="wg7-f3-ORb"> + <objects> + <viewController id="8rJ-Kc-sve" customClass="SecondViewController" customModule="AutoSafe" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Second View" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="zEq-FU-wV5"> + <rect key="frame" x="106.5" y="426.5" width="201.5" height="43"/> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <fontDescription key="fontDescription" type="system" pointSize="36"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loaded by SecondViewController" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NDk-cv-Gan"> + <rect key="frame" x="99.5" y="477.5" width="215" height="17"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstItem="NDk-cv-Gan" firstAttribute="top" secondItem="zEq-FU-wV5" secondAttribute="bottom" constant="8" symbolic="YES" id="Day-4N-Vmt"/> + <constraint firstItem="NDk-cv-Gan" firstAttribute="centerX" secondItem="zEq-FU-wV5" secondAttribute="centerX" id="JgO-Fn-dHn"/> + <constraint firstAttribute="centerX" secondItem="zEq-FU-wV5" secondAttribute="centerX" id="qqM-NS-xev"/> + <constraint firstAttribute="centerY" secondItem="zEq-FU-wV5" secondAttribute="centerY" id="qzY-Ky-pLD"/> + </constraints> + <viewLayoutGuide key="safeArea" id="O1u-W8-tvY"/> + </view> + <tabBarItem key="tabBarItem" title="Overspeeding" image="second" id="cPa-gy-q4n"/> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="750" y="360"/> + </scene> + <!--Tab Bar Controller--> + <scene sceneID="yl2-sM-qoP"> + <objects> + <tabBarController id="49e-Tb-3d3" sceneMemberID="viewController"> + <tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA"> + <rect key="frame" x="0.0" y="975" width="768" height="49"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> + <color key="barTintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </tabBar> + <connections> + <segue destination="9pv-A4-QxB" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/> + <segue destination="8rJ-Kc-sve" kind="relationship" relationship="viewControllers" id="lzU-1b-eKA"/> + </connections> + </tabBarController> + <placeholder placeholderIdentifier="IBFirstResponder" id="HuB-VB-40B" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="0.0" y="0.0"/> + </scene> + </scenes> + <resources> + <image name="first" width="30" height="30"/> + <image name="second" width="30" height="30"/> + </resources> +</document> diff --git a/iOSApp/AutoSafe/FaceLandmarksDetector.swift b/iOSApp/AutoSafe/FaceLandmarksDetector.swift new file mode 100644 index 0000000..6aeac33 --- /dev/null +++ b/iOSApp/AutoSafe/FaceLandmarksDetector.swift @@ -0,0 +1,196 @@ +// +// FaceLandmarksDetector.swift +// AutoSafe +// +// Created by Navan Chauhan on 26/05/19. +// Copyright © 2019 Navan Chauhan. All rights reserved. +// + +import AVFoundation +import UIKit +import Vision + +class FaceLandmarksDetector { + var counter = 0 + open func highlightFaces(for source: UIImage, complete: @escaping (UIImage) -> Void) { + var resultImage = source + let detectFaceRequest = VNDetectFaceLandmarksRequest { (request, error) in + if error == nil { + if let results = request.results as? [VNFaceObservation] { + for faceObservation in results { + guard let landmarks = faceObservation.landmarks else { + continue + } + let boundingRect = faceObservation.boundingBox + + resultImage = self.drawOnImage(source: resultImage, boundingRect: boundingRect, faceLandmarks: landmarks) + } + } + } else { + print(error!.localizedDescription) + } + complete(resultImage) + } + + let vnImage = VNImageRequestHandler(cgImage: source.cgImage!, options: [:]) + try? vnImage.perform([detectFaceRequest]) + } + + private func drawOnImage(source: UIImage, boundingRect: CGRect, faceLandmarks: VNFaceLandmarks2D) -> UIImage { + UIGraphicsBeginImageContextWithOptions(source.size, false, 1) + let context = UIGraphicsGetCurrentContext()! + context.translateBy(x: 0.0, y: source.size.height) + context.scaleBy(x: 1.0, y: -1.0) + //context.setBlendMode(CGBlendMode.colorBurn) + context.setLineJoin(.round) + context.setLineCap(.round) + context.setShouldAntialias(true) + context.setAllowsAntialiasing(true) + + let rectWidth = source.size.width * boundingRect.size.width + let rectHeight = source.size.height * boundingRect.size.height + + //draw image + let rect = CGRect(x: 0, y:0, width: source.size.width, height: source.size.height) + context.draw(source.cgImage!, in: rect) + + + //draw bound rect + context.setStrokeColor(UIColor.green.cgColor) + context.addRect(CGRect(x: boundingRect.origin.x * source.size.width, y:boundingRect.origin.y * source.size.height, width: rectWidth, height: rectHeight)) + context.drawPath(using: CGPathDrawingMode.stroke) + + //draw overlay + context.setLineWidth(1.0) + + func drawFeature(_ feature: VNFaceLandmarkRegion2D, color: CGColor, close: Bool = false) { + context.setStrokeColor(color) + context.setFillColor(color) + for point in feature.normalizedPoints { + // Draw DEBUG numbers + let textFontAttributes = [ + NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16), + NSAttributedString.Key.foregroundColor: UIColor.white + ] + context.saveGState() + // rotate to draw numbers + context.translateBy(x: 0.0, y: source.size.height) + context.scaleBy(x: 1.0, y: -1.0) + let mp = CGPoint(x: boundingRect.origin.x * source.size.width + point.x * rectWidth, y: source.size.height - (boundingRect.origin.y * source.size.height + point.y * rectHeight)) + context.fillEllipse(in: CGRect(origin: CGPoint(x: mp.x-2.0, y: mp.y-2), size: CGSize(width: 4.0, height: 4.0))) + if let index = feature.normalizedPoints.firstIndex(of: point) { + NSString(format: "%d", index).draw(at: mp, withAttributes: textFontAttributes); + //print(mp, index); + } + context.restoreGState() + } + let mappedPoints = feature.normalizedPoints.map { CGPoint(x: boundingRect.origin.x * source.size.width + $0.x * rectWidth, y: boundingRect.origin.y * source.size.height + $0.y * rectHeight) } + context.addLines(between: mappedPoints) + if close, let first = mappedPoints.first, let lats = mappedPoints.last { + context.addLines(between: [lats, first]) + } + context.strokePath() + } + + + if let leftEye = faceLandmarks.leftEye { + drawFeature(leftEye, color: UIColor.cyan.cgColor, close: true) + /* + for point in leftEye.normalizedPoints { + let mp = CGPoint(x: boundingRect.origin.x * source.size.width + point.x * rectWidth, y: source.size.height - (boundingRect.origin.y * source.size.height + point.y * rectHeight)) + /* + if let index = leftEye.normalizedPoints.index(of: point) { + print(mp, index); + if(index==4){ + print("fuck me, this works!!!") + point4.append(mp[0]) + } */ + + } + + //for i in leftEye.normalizedPoints{ + // print("HEHE:") + // print(i) + //} + */ + //let p1.x = leftEye.normalizedPoints[0].x; + + + } + if let rightEye = faceLandmarks.rightEye { + drawFeature(rightEye, color: UIColor.cyan.cgColor, close: true) + + } + if let leftPupil = faceLandmarks.leftPupil { + drawFeature(leftPupil, color: UIColor.cyan.cgColor, close: true) + } + if let rightPupil = faceLandmarks.rightPupil { + drawFeature(rightPupil, color: UIColor.cyan.cgColor, close: true) + } + + + + if let leftEye = faceLandmarks.leftEye, let rightEye = faceLandmarks.rightEye { + print("WORKS?") + + let p1l = leftEye.normalizedPoints[1] + let p2l = leftEye.normalizedPoints[7] + + let p3l = leftEye.normalizedPoints[3] + let p4l = leftEye.normalizedPoints[5] + + let p5l = leftEye.normalizedPoints[0] + let p6l = leftEye.normalizedPoints[4] + + let Al = hypotf(Float(p1l.x - p2l.x), Float(p1l.y - p2l.y)); + let Bl = hypotf(Float(p3l.x - p4l.x), Float(p3l.y - p4l.y)); + let Cl = hypotf(Float(p5l.x - p6l.x), Float(p5l.y - p6l.y)); + + let leftEAR = (Al + Bl) / (2.0 * Cl) + + print("Left EAR", leftEAR); + + let p1r = rightEye.normalizedPoints[1] + let p2r = rightEye.normalizedPoints[7] + + let p3r = rightEye.normalizedPoints[3] + let p4r = rightEye.normalizedPoints[5] + + let p5r = rightEye.normalizedPoints[0] + let p6r = rightEye.normalizedPoints[4] + + let Ar = hypotf(Float(p1r.x - p2r.x), Float(p1r.y - p2r.y)); + let Br = hypotf(Float(p3r.x - p4r.x), Float(p3r.y - p4r.y)); + let Cr = hypotf(Float(p5r.x - p6r.x), Float(p5r.y - p6r.y)); + + let rightEAR = (Ar + Br) / (2.0 * Cr) + + print("Right EAR", rightEAR); + + let EAR = (Float(leftEAR) + Float(rightEAR)) / 2.0 + print("EAR:", EAR) + + let threshold = Float(0.25) + let noOfFrames = 2 + + if EAR < threshold { + counter += 1; + } + if EAR > threshold { + counter -= 1; + } + if counter > noOfFrames { + print("Wake up Sid!") + AudioServicesPlayAlertSound(SystemSoundID(1005)) + counter = 0 + + } + } + let coloredImg : UIImage = UIGraphicsGetImageFromCurrentImageContext()! + UIGraphicsEndImageContext() + return coloredImg + } +} + + + diff --git a/iOSApp/AutoSafe/FatigueViewController.swift b/iOSApp/AutoSafe/FatigueViewController.swift new file mode 100644 index 0000000..1e9f98f --- /dev/null +++ b/iOSApp/AutoSafe/FatigueViewController.swift @@ -0,0 +1,83 @@ +// +// FatigueDetection.swift +// AutoSafe +// +// Created by Navan Chauhan on 26/05/19. +// Copyright © 2019 Navan Chauhan. All rights reserved. +// + +import UIKit +import AVFoundation +import Vision + +class FatigueViewController: UIViewController { + + let faceDetector = FaceLandmarksDetector() + let captureSession = AVCaptureSession() + @IBOutlet weak var imageView: UIImageView! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view, typically from a nib. + configureDevice() + } + + private func getDevice() -> AVCaptureDevice? { + let discoverSession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera, .builtInTelephotoCamera, .builtInWideAngleCamera], mediaType: .video, position: .front) + return discoverSession.devices.first + } + + private func configureDevice() { + if let device = getDevice() { + do { + try device.lockForConfiguration() + if device.isFocusModeSupported(.continuousAutoFocus) { + device.focusMode = .continuousAutoFocus + } + device.unlockForConfiguration() + } catch { print("failed to lock config") } + + do { + let input = try AVCaptureDeviceInput(device: device) + captureSession.addInput(input) + } catch { print("failed to create AVCaptureDeviceInput") } + + captureSession.startRunning() + + let videoOutput = AVCaptureVideoDataOutput() + videoOutput.videoSettings = [String(kCVPixelBufferPixelFormatTypeKey): Int(kCVPixelFormatType_32BGRA)] + videoOutput.alwaysDiscardsLateVideoFrames = true + videoOutput.setSampleBufferDelegate(self, queue: DispatchQueue.global(qos: .utility)) + + if captureSession.canAddOutput(videoOutput) { + captureSession.addOutput(videoOutput) + } + } + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + +} + +extension FatigueViewController: AVCaptureVideoDataOutputSampleBufferDelegate { + + func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { + + // Scale image to process it faster + let maxSize = CGSize(width: 1024, height: 1024) + + if let image = UIImage(sampleBuffer: sampleBuffer)?.flipped()?.imageWithAspectFit(size: maxSize) { + faceDetector.highlightFaces(for: image) { (resultImage) in + DispatchQueue.main.async { + self.imageView?.image = resultImage + } + } + } + } +} + + diff --git a/iOSApp/AutoSafe/Info.plist b/iOSApp/AutoSafe/Info.plist new file mode 100644 index 0000000..cfce526 --- /dev/null +++ b/iOSApp/AutoSafe/Info.plist @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>NSCameraUsageDescription</key> + <string>For Fatigue Detection</string> + <key>UILaunchStoryboardName</key> + <string>LaunchScreen</string> + <key>UIMainStoryboardFile</key> + <string>Main</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>armv7</string> + </array> + <key>UIStatusBarTintParameters</key> + <dict> + <key>UINavigationBar</key> + <dict> + <key>Style</key> + <string>UIBarStyleDefault</string> + <key>Translucent</key> + <false/> + </dict> + </dict> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist> diff --git a/iOSApp/AutoSafe/SecondViewController.swift b/iOSApp/AutoSafe/SecondViewController.swift new file mode 100644 index 0000000..addbd61 --- /dev/null +++ b/iOSApp/AutoSafe/SecondViewController.swift @@ -0,0 +1,20 @@ +// +// SecondViewController.swift +// AutoSafe +// +// Created by Navan Chauhan on 26/05/19. +// Copyright © 2019 Navan Chauhan. All rights reserved. +// + +import UIKit + +class SecondViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. + } + + +} + diff --git a/iOSApp/AutoSafe/UIImage+Scale.swift b/iOSApp/AutoSafe/UIImage+Scale.swift new file mode 100644 index 0000000..118eac2 --- /dev/null +++ b/iOSApp/AutoSafe/UIImage+Scale.swift @@ -0,0 +1,86 @@ +// +// UIImage+Scale.swift +// AutoSafe +// +// Created by Navan Chauhan on 26/05/19. +// Copyright © 2019 Navan Chauhan. All rights reserved. +// + +import UIKit +import CoreMedia + +extension UIImage { + + convenience init?(sampleBuffer: CMSampleBuffer) { + + guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return nil } + CVPixelBufferLockBaseAddress(imageBuffer, CVPixelBufferLockFlags.readOnly) + + let baseAddress = CVPixelBufferGetBaseAddress(imageBuffer) + let bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer) + let width = CVPixelBufferGetWidth(imageBuffer) + let height = CVPixelBufferGetHeight(imageBuffer) + let colorSpace = CGColorSpaceCreateDeviceRGB() + + let bitmapInfo: UInt32 = CGBitmapInfo.byteOrder32Little.rawValue | CGImageAlphaInfo.premultipliedFirst.rawValue & CGBitmapInfo.alphaInfoMask.rawValue + guard let context = CGContext(data: baseAddress, width: width, height: height, bitsPerComponent: 8, bytesPerRow: bytesPerRow, space: colorSpace, bitmapInfo: bitmapInfo) else { return nil } + let quartzImage = context.makeImage() + CVPixelBufferUnlockBaseAddress(imageBuffer, CVPixelBufferLockFlags.readOnly) + + if let quartz = quartzImage { + self.init(cgImage: quartz, scale: 1.0, orientation: .right) + //self.init(cgImage: quartz) + } else { + return nil + } + } + + func hasAlpha() -> Bool { + if let cgImage = self.cgImage { + let alpha = cgImage.alphaInfo + return alpha == .first || alpha == .last || alpha == .premultipliedFirst || alpha == .premultipliedLast + } + return false + } + + func flipped() -> UIImage? { + UIGraphicsBeginImageContextWithOptions(self.size, !self.hasAlpha(), self.scale) + let context = UIGraphicsGetCurrentContext()! + context.translateBy(x: self.size.width, y: 0.0) + context.scaleBy(x: -1.0, y: 1.0) + let rect = CGRect(origin: .zero, size: self.size) + self.draw(in: rect) + let retVal = UIGraphicsGetImageFromCurrentImageContext() + UIGraphicsEndImageContext() + return retVal + } + + func imageWithAspectFit(size:CGSize) -> UIImage? { + let aspectFitSize = self.getAspectFitSize(destination: size) + let resizedImage = self.resize(size: aspectFitSize) + return resizedImage + } + + private func getAspectFitSize(destination dst:CGSize) -> CGSize { + var result = CGSize.zero + var scaleRatio = CGPoint() + + if (dst.width != 0) {scaleRatio.x = self.size.width / dst.width} + if (dst.height != 0) {scaleRatio.y = self.size.height / dst.height} + let scaleFactor = max(scaleRatio.x, scaleRatio.y) + + result.width = scaleRatio.x * dst.width / scaleFactor + result.height = scaleRatio.y * dst.height / scaleFactor + return result + } + + func resize(size:CGSize) -> UIImage? { + let imageRect = CGRect(origin: .zero, size: size); + + UIGraphicsBeginImageContextWithOptions(size, false, 1.0); + self.draw(in: imageRect) + let scaled = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return scaled + } +} |