diff --git a/.aswb/.bazelproject b/.aswb/.bazelproject new file mode 100644 index 000000000..6b0f88386 --- /dev/null +++ b/.aswb/.bazelproject @@ -0,0 +1,25 @@ +directories: + # Add the directories you want added as source here + # By default, we've added your entire workspace ('.') + . + +# Automatically includes all relevant targets under the 'directories' above +derive_targets_from_directories: true + +targets: + # If source code isn't resolving, add additional targets that compile it here + +additional_languages: + # Uncomment any additional languages you want supported + # c + # dart + # kotlin + # python + + +# Please uncomment an android-SDK platform. Available SDKs are: +# android_sdk_platform: android-28 +# android_sdk_platform: android-29 +android_sdk_platform: android-30 +# android_sdk_platform: android-31 +# android_sdk_platform: android-32 \ No newline at end of file diff --git a/.bazelrc b/.bazelrc index c2d8236b8..22fe5a191 100644 --- a/.bazelrc +++ b/.bazelrc @@ -69,6 +69,12 @@ build:android_arm64 --cpu=arm64-v8a build:android_arm64 --fat_apk_cpu=arm64-v8a # iOS configs. + +build:ios --apple_bitcode=embedded +build:ios --copt=-fembed-bitcode +build:ios --cxxopt=-std=c++17 # enables c++ 17 + + build:ios --apple_platform_type=ios build:ios --copt=-fno-aligned-allocation diff --git a/.gitignore b/.gitignore index 4be57c71d..a58a436de 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,4 @@ lint/tmp/ # App Specific cases app/release/output.json .idea/codeStyles/ +Pods/ diff --git a/WORKSPACE b/WORKSPACE index d7a833877..19d988f0a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -528,11 +528,11 @@ load("@build_bazel_rules_android//android:rules.bzl", "android_ndk_repository", android_sdk_repository( name = "androidsdk", build_tools_version = "30.0.3", -# path = "/Users/tj/Library/Android/sdk", # Path to Android SDK, optional if $ANDROID_HOME is set + # path = "/Users/tj/Library/Android/sdk", # Path to Android SDK, optional if $ANDROID_HOME is set ) android_ndk_repository( name = "androidndk", # Required. Name *must* be "androidndk". api_level = 21, -# path = "/Users/tj/Library/Android/sdk/ndk/21.4.7075529", # Optional. Can be omitted if `ANDROID_NDK_HOME` environment variable is set. + # path = "/Users/tj/Library/Android/sdk/ndk/21.4.7075529", # Optional. Can be omitted if `ANDROID_NDK_HOME` environment variable is set. ) diff --git a/mediapipe/calculators/core/BUILD b/mediapipe/calculators/core/BUILD index b28a3573a..47a74998a 100644 --- a/mediapipe/calculators/core/BUILD +++ b/mediapipe/calculators/core/BUILD @@ -728,7 +728,7 @@ cc_library( cc_library( name = "flow_limiter_calculator", - srcs = ["flow_limiter_calculator.cc"], + srcs = ["flow_limiter_calculator.h"], visibility = ["//visibility:public"], deps = [ ":flow_limiter_calculator_cc_proto", @@ -1217,7 +1217,7 @@ cc_test( cc_library( name = "constant_side_packet_calculator", - srcs = ["constant_side_packet_calculator.cc"], + srcs = ["constant_side_packet_calculator.h"], visibility = ["//visibility:public"], deps = [ ":constant_side_packet_calculator_cc_proto", diff --git a/mediapipe/calculators/core/constant_side_packet_calculator.cc b/mediapipe/calculators/core/constant_side_packet_calculator.h similarity index 100% rename from mediapipe/calculators/core/constant_side_packet_calculator.cc rename to mediapipe/calculators/core/constant_side_packet_calculator.h diff --git a/mediapipe/calculators/core/flow_limiter_calculator.cc b/mediapipe/calculators/core/flow_limiter_calculator.h similarity index 100% rename from mediapipe/calculators/core/flow_limiter_calculator.cc rename to mediapipe/calculators/core/flow_limiter_calculator.h diff --git a/mediapipe/examples/ios/posetracking-lindera/Podfile b/mediapipe/examples/ios/posetracking-lindera/Podfile new file mode 100644 index 000000000..d2309ed77 --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/Podfile @@ -0,0 +1,13 @@ +# Uncomment the next line to define a global platform for your project +# platform :ios, '9.0' +source 'https://github.com/copper-labs/CocoaSpecs.git' + +target 'PoseTrackingLindera' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + pod 'LinderaDetection' #, :path => 'LinderaDetection' + + # Pods for PoseTrackingLindera + +end diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.pbxproj b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.pbxproj new file mode 100644 index 000000000..51652e86d --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.pbxproj @@ -0,0 +1,457 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 1C59D14FDC8E0245032992F2 /* Pods_PoseTrackingLindera.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B06906B638FEBA7FF2874FB /* Pods_PoseTrackingLindera.framework */; }; + 32ADBDDB2907D1E200F78CE0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32ADBDDA2907D1E200F78CE0 /* AppDelegate.swift */; }; + 32ADBDDF2907D1E200F78CE0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32ADBDDE2907D1E200F78CE0 /* ViewController.swift */; }; + 32ADBDE22907D1E200F78CE0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32ADBDE02907D1E200F78CE0 /* Main.storyboard */; }; + 32ADBDE42907D1E400F78CE0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32ADBDE32907D1E400F78CE0 /* Assets.xcassets */; }; + 32ADBDE72907D1E400F78CE0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32ADBDE52907D1E400F78CE0 /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 32ADBDD72907D1E200F78CE0 /* PoseTrackingLindera.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PoseTrackingLindera.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 32ADBDDA2907D1E200F78CE0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 32ADBDDE2907D1E200F78CE0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 32ADBDE12907D1E200F78CE0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 32ADBDE32907D1E400F78CE0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 32ADBDE62907D1E400F78CE0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 32ADBDE82907D1E400F78CE0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 32DE689E2916386C00CF67DE /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; + 9B06906B638FEBA7FF2874FB /* Pods_PoseTrackingLindera.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PoseTrackingLindera.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D0145F51AF9833F7B3332A77 /* Pods-PoseTrackingLindera.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PoseTrackingLindera.debug.xcconfig"; path = "Target Support Files/Pods-PoseTrackingLindera/Pods-PoseTrackingLindera.debug.xcconfig"; sourceTree = ""; }; + E651467537CC922E8D432264 /* Pods-PoseTrackingLindera.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PoseTrackingLindera.release.xcconfig"; path = "Target Support Files/Pods-PoseTrackingLindera/Pods-PoseTrackingLindera.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 32ADBDD42907D1E200F78CE0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1C59D14FDC8E0245032992F2 /* Pods_PoseTrackingLindera.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 32ADBDCE2907D1E200F78CE0 = { + isa = PBXGroup; + children = ( + 32ADBDD92907D1E200F78CE0 /* PoseTrackingLindera */, + 32ADBDD82907D1E200F78CE0 /* Products */, + 669AA0EB532C755115F04FF2 /* Pods */, + 88E6C68AD588A768E9656194 /* Frameworks */, + ); + sourceTree = ""; + }; + 32ADBDD82907D1E200F78CE0 /* Products */ = { + isa = PBXGroup; + children = ( + 32ADBDD72907D1E200F78CE0 /* PoseTrackingLindera.app */, + ); + name = Products; + sourceTree = ""; + }; + 32ADBDD92907D1E200F78CE0 /* PoseTrackingLindera */ = { + isa = PBXGroup; + children = ( + 32ADBDDA2907D1E200F78CE0 /* AppDelegate.swift */, + 32ADBDDE2907D1E200F78CE0 /* ViewController.swift */, + 32ADBDE02907D1E200F78CE0 /* Main.storyboard */, + 32ADBDE32907D1E400F78CE0 /* Assets.xcassets */, + 32ADBDE52907D1E400F78CE0 /* LaunchScreen.storyboard */, + 32ADBDE82907D1E400F78CE0 /* Info.plist */, + ); + path = PoseTrackingLindera; + sourceTree = ""; + }; + 669AA0EB532C755115F04FF2 /* Pods */ = { + isa = PBXGroup; + children = ( + D0145F51AF9833F7B3332A77 /* Pods-PoseTrackingLindera.debug.xcconfig */, + E651467537CC922E8D432264 /* Pods-PoseTrackingLindera.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 88E6C68AD588A768E9656194 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 32DE689E2916386C00CF67DE /* AssetsLibrary.framework */, + 9B06906B638FEBA7FF2874FB /* Pods_PoseTrackingLindera.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 32ADBDD62907D1E200F78CE0 /* PoseTrackingLindera */ = { + isa = PBXNativeTarget; + buildConfigurationList = 32ADBDEB2907D1E400F78CE0 /* Build configuration list for PBXNativeTarget "PoseTrackingLindera" */; + buildPhases = ( + 7F961E62B43D9BC2161D6057 /* [CP] Check Pods Manifest.lock */, + 32ADBDD32907D1E200F78CE0 /* Sources */, + 32ADBDD42907D1E200F78CE0 /* Frameworks */, + 32ADBDD52907D1E200F78CE0 /* Resources */, + F2C34C6162DE10BC2A8141AC /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PoseTrackingLindera; + productName = PoseTrackingLindera; + productReference = 32ADBDD72907D1E200F78CE0 /* PoseTrackingLindera.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 32ADBDCF2907D1E200F78CE0 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1330; + LastUpgradeCheck = 1330; + TargetAttributes = { + 32ADBDD62907D1E200F78CE0 = { + CreatedOnToolsVersion = 13.3.1; + }; + }; + }; + buildConfigurationList = 32ADBDD22907D1E200F78CE0 /* Build configuration list for PBXProject "PoseTrackingLindera" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 32ADBDCE2907D1E200F78CE0; + productRefGroup = 32ADBDD82907D1E200F78CE0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 32ADBDD62907D1E200F78CE0 /* PoseTrackingLindera */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 32ADBDD52907D1E200F78CE0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 32ADBDE72907D1E400F78CE0 /* LaunchScreen.storyboard in Resources */, + 32ADBDE42907D1E400F78CE0 /* Assets.xcassets in Resources */, + 32ADBDE22907D1E200F78CE0 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 7F961E62B43D9BC2161D6057 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-PoseTrackingLindera-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + 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"; + showEnvVarsInLog = 0; + }; + F2C34C6162DE10BC2A8141AC /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-PoseTrackingLindera/Pods-PoseTrackingLindera-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-PoseTrackingLindera/Pods-PoseTrackingLindera-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PoseTrackingLindera/Pods-PoseTrackingLindera-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 32ADBDD32907D1E200F78CE0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 32ADBDDF2907D1E200F78CE0 /* ViewController.swift in Sources */, + 32ADBDDB2907D1E200F78CE0 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 32ADBDE02907D1E200F78CE0 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 32ADBDE12907D1E200F78CE0 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 32ADBDE52907D1E400F78CE0 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 32ADBDE62907D1E400F78CE0 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 32ADBDE92907D1E400F78CE0 /* 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++17"; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + 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; + 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 = 15.4; + 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; + }; + 32ADBDEA2907D1E400F78CE0 /* 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++17"; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + 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; + 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 = 15.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 32ADBDEC2907D1E400F78CE0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0145F51AF9833F7B3332A77 /* Pods-PoseTrackingLindera.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = JML2TT8X5V; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + "FRAMEWORK_SEARCH_PATHS[arch=*]" = ( + "$(inherited)", + "\"${PODS_CONFIGURATION_BUILD_DIR}/LinderaDetection\"", + "\"${PODS_ROOT}/../LinderaDetection/frameworks\"", + ); + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = PoseTrackingLindera/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-l\"stdc++\"", + "-framework", + "\"LinderaDetection\"", + "-framework", + "\"MPPoseTracking\"", + "-Wl", + ); + PRODUCT_BUNDLE_IDENTIFIER = ai.example.PoseTrackingLindera; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 32ADBDED2907D1E400F78CE0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E651467537CC922E8D432264 /* Pods-PoseTrackingLindera.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = JML2TT8X5V; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = PoseTrackingLindera/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "$(inherited)", + "-ObjC", + "-l\"stdc++\"", + "-framework", + "\"LinderaDetection\"", + "-framework", + "\"MPPoseTracking\"", + "-Wl", + ); + PRODUCT_BUNDLE_IDENTIFIER = ai.example.PoseTrackingLindera; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 32ADBDD22907D1E200F78CE0 /* Build configuration list for PBXProject "PoseTrackingLindera" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 32ADBDE92907D1E400F78CE0 /* Debug */, + 32ADBDEA2907D1E400F78CE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 32ADBDEB2907D1E400F78CE0 /* Build configuration list for PBXNativeTarget "PoseTrackingLindera" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 32ADBDEC2907D1E400F78CE0 /* Debug */, + 32ADBDED2907D1E400F78CE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 32ADBDCF2907D1E200F78CE0 /* Project object */; +} diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/xcuserdata/tj.xcuserdatad/UserInterfaceState.xcuserstate b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/xcuserdata/tj.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 000000000..a0760071d Binary files /dev/null and b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/project.xcworkspace/xcuserdata/tj.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/xcuserdata/tj.xcuserdatad/xcschemes/xcschememanagement.plist b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/xcuserdata/tj.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 000000000..e77c5a9fa --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcodeproj/xcuserdata/tj.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + PoseTrackingLindera.xcscheme_^#shared#^_ + + orderHint + 2 + + + + diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/contents.xcworkspacedata b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1417ce4b0 --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/xcuserdata/tj.xcuserdatad/UserInterfaceState.xcuserstate b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/xcuserdata/tj.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 000000000..30d055d46 Binary files /dev/null and b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera.xcworkspace/xcuserdata/tj.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Info.plist b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Info.plist index 426e53640..50a35699c 100644 --- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Info.plist +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Info.plist @@ -2,10 +2,10 @@ + NSCameraUsageDescription + Processing Camera Feed UIApplicationSceneManifest - NSCameraUsageDescription - This app uses the camera to demonstrate live video processing. CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift index 13ec1ee48..b9b449643 100644 --- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift +++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift @@ -6,6 +6,7 @@ // import UIKit import LinderaDetection +//import LinderaDetection class ViewController: UIViewController { diff --git a/mediapipe/framework/calculator_registry.h b/mediapipe/framework/calculator_registry.h index dafc95aaf..5447aa759 100644 --- a/mediapipe/framework/calculator_registry.h +++ b/mediapipe/framework/calculator_registry.h @@ -23,6 +23,9 @@ #define REGISTER_CALCULATOR(name) \ REGISTER_FACTORY_FUNCTION_QUALIFIED( \ mediapipe::CalculatorBaseRegistry, calculator_registration, name, \ - absl::make_unique>) + absl::make_unique>); \ + void register_##name(){typeid(name);}; #endif // MEDIAPIPE_FRAMEWORK_CALCULATOR_REGISTRY_H_ + + diff --git a/mediapipe/framework/deps/registration.h b/mediapipe/framework/deps/registration.h index b39a1e293..03d1d123e 100644 --- a/mediapipe/framework/deps/registration.h +++ b/mediapipe/framework/deps/registration.h @@ -383,7 +383,7 @@ class GlobalFactoryRegistry { #define REGISTER_FACTORY_FUNCTION_QUALIFIED(RegistryType, var_name, name, ...) \ static auto* REGISTRY_STATIC_VAR(var_name, __LINE__) = \ - new mediapipe::RegistrationToken( \ + new ::mediapipe::RegistrationToken( \ RegistryType::Register(#name, __VA_ARGS__)) } // namespace mediapipe diff --git a/mediapipe/framework/subgraph.h b/mediapipe/framework/subgraph.h index b3e7d958b..332a85eaf 100644 --- a/mediapipe/framework/subgraph.h +++ b/mediapipe/framework/subgraph.h @@ -130,7 +130,7 @@ class Subgraph { using SubgraphRegistry = GlobalFactoryRegistry>; #define REGISTER_MEDIAPIPE_GRAPH(name) \ - REGISTER_FACTORY_FUNCTION_QUALIFIED(mediapipe::SubgraphRegistry, \ + REGISTER_FACTORY_FUNCTION_QUALIFIED(::mediapipe::SubgraphRegistry, \ subgraph_registration, name, \ absl::make_unique) diff --git a/mediapipe/framework/tool/mediapipe_graph.bzl b/mediapipe/framework/tool/mediapipe_graph.bzl index 45d98b1eb..b357e9e85 100644 --- a/mediapipe/framework/tool/mediapipe_graph.bzl +++ b/mediapipe/framework/tool/mediapipe_graph.bzl @@ -134,7 +134,7 @@ def mediapipe_simple_subgraph( expand_template( name = name + "_linked_cc", template = clean_dep("//mediapipe/framework/tool:simple_subgraph_template.cc"), - out = name + "_linked.cc", + out = name + "_linked.h", substitutions = { "{{SUBGRAPH_CLASS_NAME}}": register_as, "{{SUBGRAPH_INC_FILE_PATH}}": native.package_name() + "/" + graph_base_name + ".inc", @@ -145,7 +145,7 @@ def mediapipe_simple_subgraph( native.cc_library( name = name, srcs = [ - name + "_linked.cc", + name + "_linked.h", graph_base_name + ".inc", ], deps = [ @@ -161,7 +161,7 @@ def mediapipe_simple_subgraph( cc_library_with_tflite( name = name, srcs = [ - name + "_linked.cc", + name + "_linked.h", graph_base_name + ".inc", ], tflite_deps = tflite_deps, diff --git a/mediapipe/framework/tool/simple_subgraph_template.cc b/mediapipe/framework/tool/simple_subgraph_template.cc index 57cd36cd3..0f2e70f34 100644 --- a/mediapipe/framework/tool/simple_subgraph_template.cc +++ b/mediapipe/framework/tool/simple_subgraph_template.cc @@ -25,11 +25,11 @@ static const char binary_graph[] = #include "{{SUBGRAPH_INC_FILE_PATH}}" ; // NOLINT(whitespace/semicolon) -class {{SUBGRAPH_CLASS_NAME}} : public Subgraph { +class {{SUBGRAPH_CLASS_NAME}} : public ::mediapipe::Subgraph { public: - absl::StatusOr GetConfig( + absl::StatusOr<::mediapipe::CalculatorGraphConfig> GetConfig( const SubgraphOptions& /*options*/) { - CalculatorGraphConfig config; + ::mediapipe::CalculatorGraphConfig config; // Note: this is a binary protobuf serialization, and may include NUL // bytes. The trailing NUL added to the string literal should be excluded. if (config.ParseFromArray(binary_graph, sizeof(binary_graph) - 1)) { diff --git a/mediapipe/objc/BUILD b/mediapipe/objc/BUILD index 48c9b181a..f2df3b7e3 100644 --- a/mediapipe/objc/BUILD +++ b/mediapipe/objc/BUILD @@ -286,3 +286,14 @@ exports_files( "//mediapipe:__subpackages__", ], ) + +exports_files( + [ + "MPPCameraInputSource.h", + "MPPLayerRenderer.h", + "MPPPlayerInputSource.h", + "MPPInputSource.h", + "MPPGLViewRenderer.h", + ], + visibility = ["//visibility:public"], +) diff --git a/mediapipe/objc/solutions/posetracking_gpu/BUILD b/mediapipe/objc/solutions/posetracking_gpu/BUILD index d25e498d6..251c59767 100644 --- a/mediapipe/objc/solutions/posetracking_gpu/BUILD +++ b/mediapipe/objc/solutions/posetracking_gpu/BUILD @@ -1,36 +1,217 @@ +load( + "@build_bazel_rules_apple//apple:ios.bzl", + "ios_application", + "ios_dynamic_framework", + "ios_framework", + "ios_static_framework", + "ios_unit_test", +) +load( + "@build_bazel_rules_apple//apple:apple.bzl", + "apple_static_xcframework", +) +load( + "//mediapipe/examples/ios:bundle_id.bzl", + "BUNDLE_ID_PREFIX", + "example_provisioning", +) + +MPP_HEADERS = [ + "PoseTracking.h", + "PoseTrackingOptions.h", + "PoseTrackingResults.h", +] + +MP_IOS_HEADERS_NAMES = [ + "MPPCameraInputSource.h", + "MPPLayerRenderer.h", + "MPPPlayerInputSource.h", + "MPPInputSource.h", + "MPPGLViewRenderer.h", +] + +MP_IOS_HEADERS = ["//mediapipe/objc:" + header for header in MP_IOS_HEADERS_NAMES] + +#[genrule( +# name = "gen_" + header_name, +# srcs = [header_rule], +# outs = [header_name], +# cmd = """ +# OUTPUT_DIR=mediapipe/objc/solutions/posetracking_gpu +# mkdir -p $$OUTPUT_DIR +# OUTPUT_PATH=$$OUTPUT_DIR/{} +# cp $(location {}) $$OUTPUT_PATH +# sed -i -e "s#mediapipe/objc/##g" $$OUTPUT_PATH +# cp $$OUTPUT_PATH $@ +# """.format(header_name, header_rule), +# local = False, +#) for (header_name, header_rule) in zip(MP_IOS_HEADERS_NAMES, MP_IOS_HEADERS)] +# +#MP_GEN_IOS_HEADERS = ["gen_" + header for header in MP_IOS_HEADERS_NAMES] +# +#filegroup( +# name = "gen_mp_ios_headers", +# srcs = MP_GEN_IOS_HEADERS, +#) + +#-c opt --config=ios_fat --cxxopt=--std=c++17 --copt=-fembed-bitcode --linkopt="-s" +MP_GEN_IOS_HEADERS = MP_IOS_HEADERS + +ios_static_framework( + name = "MPPoseTracking", + hdrs = MPP_HEADERS + MP_GEN_IOS_HEADERS, + bundle_name = "MPPoseTracking", + linkopts = [ + # "--no-whole-archive", + # "-all_load", + # "-Wl", + "-force_load", + ], + minimum_os_version = "12.0", + visibility = ["//visibility:public"], + deps = [ + "//mediapipe/objc/solutions/posetracking_gpu:posetracking_gpu_solution", + + # "//third_party:opencv", + # "@ios_opencv//:OpencvFramework", + ], +) + +apple_static_xcframework( + name = "MPPoseTrackingXC", + bundle_name = "MPPoseTracking", + minimum_os_versions = {"ios": "12.0"}, + public_hdrs = MPP_HEADERS + MP_GEN_IOS_HEADERS, + deps = [ + "//mediapipe/objc/solutions/posetracking_gpu:posetracking_gpu_solution", + + # "//third_party:opencv", + # "@ios_opencv//:OpencvFramework", + ], +) + +ios_framework( + name = "MPPoseTrackingDynamic", + hdrs = MPP_HEADERS + MP_GEN_IOS_HEADERS + ["MPPoseTracking.h"], + bundle_id = BUNDLE_ID_PREFIX + ".MPPPoseTracking", + bundle_name = "MPPoseTracking", + families = [ + "iphone", + "ipad", + ], + infoplists = ["Info.plist"], + linkopts = [ + # "--no-whole-archive", + # "-all_load", + # "-Wl", + # "-force_load", + ], + minimum_os_version = "10.0", + resources = ["modulemap/module.modulemap"], + visibility = ["//visibility:public"], + deps = [ + "//mediapipe/objc/solutions/posetracking_gpu:posetracking_gpu_solution", + # "//mediapipe/calculators/core:flow_limiter_calculator", + + # "//third_party:opencv", + "@ios_opencv//:OpencvFramework", + ], +) + +genrule( + name = "PatchedMPPosetrackingDynamic", + srcs = [":MPPoseTrackingDynamic"], + outs = [ + "MPPoseTracking.framework", + "MPPoseTracking.framework.dSYM", + ], + cmd = """ + bash $(location patch_ios_framework.sh) "$(SRCS)" "$(OUTS)" + """, + output_to_bindir = 1, + tools = ["patch_ios_framework.sh"], +) + +# Custom Bazel Rule that patches headers of framework to flatten header imports +genrule( + name = "MPPoseTrackingHeaderPatched", + srcs = [":MPPoseTracking"], + outs = ["MPPoseTrackingHeaderPatched.zip"], + cmd = """ + unzip $(location MPPoseTracking) + sed -i -e "s#mediapipe/objc/##g" $$(find MPPoseTracking.framework -name "*.h") + rm -f MPPoseTracking.framework/Headers/*.h-e + zip -r MPPoseTrackingHeaderPatched.zip MPPoseTracking.framework + cp MPPoseTrackingHeaderPatched.zip $@ + """, + visibility = ["//visibility:public"], +) + objc_library( name = "posetracking_gpu_solution", - srcs = glob([ - "*.h", - "*.mm", - ]), - module_name = "MPPoseTracking", - hdrs = [ - "PoseTracking.h", - "PoseTrackingOptions.h", - "PoseTrackingResults.h" - ], + srcs = [ + "PoseTrackingOptions.mm", + "PoseTrackingResults.mm", + "PoseTracking.mm", + ] + select({ + "//mediapipe:ios_i386": [], + "//mediapipe:ios_x86_64": [], + "//conditions:default": [], + }), + hdrs = MPP_HEADERS + MP_GEN_IOS_HEADERS, copts = [ "-Wno-shorten-64-to-32", + # "-all_load", ], - data = [ + data = [ "//mediapipe/graphs/pose_tracking:pose_tracking_gpu.binarypb", "//mediapipe/modules/pose_detection:pose_detection.tflite", - "//mediapipe/modules/pose_landmark:pose_landmark_heavy.tflite", "//mediapipe/modules/pose_landmark:pose_landmark_full.tflite", - "//mediapipe/modules/pose_landmark:pose_landmark_lite.tflite", ] , - sdk_frameworks = ["Accelerate"], + "//mediapipe/modules/pose_landmark:pose_landmark_heavy.tflite", + "//mediapipe/modules/pose_landmark:pose_landmark_lite.tflite", + ], + linkopts = [ + # "--no-whole-archive", + # "-all_load", + # "-force_load", + # "-Wl", + ], + module_name = "MPPoseTracking", + sdk_frameworks = [ + "Accelerate", + "AVFoundation", + "CoreGraphics", + "CoreMedia", + "UIKit", + ], visibility = ["//visibility:public"], deps = [ "//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_input_sources_ios", "//mediapipe/objc:mediapipe_layer_renderer", + "//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps", + "//mediapipe/framework/formats:landmark_cc_proto", + "calculator_registry", ] + select({ "//mediapipe:ios_i386": [], "//mediapipe:ios_x86_64": [], "//conditions:default": [ - "//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps", - "//mediapipe/framework/formats:landmark_cc_proto", ], }), + alwayslink = True, +) + +cc_library( + name = "calculator_registry", + srcs = [ + "registry/calculator_registry.cpp", + "registry/calculator_registry.h", + ], + deps = ["//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps"], + alwayslink = True, +) + +exports_files( + MPP_HEADERS, + visibility = ["//visibility:public"], ) diff --git a/mediapipe/objc/solutions/posetracking_gpu/Info.plist b/mediapipe/objc/solutions/posetracking_gpu/Info.plist new file mode 100644 index 000000000..0866eed17 --- /dev/null +++ b/mediapipe/objc/solutions/posetracking_gpu/Info.plist @@ -0,0 +1,27 @@ + + + + + NSCameraUsageDescription + This app uses the camera to demonstrate live video processing. + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + + + diff --git a/mediapipe/objc/solutions/posetracking_gpu/MPPoseTracking.h b/mediapipe/objc/solutions/posetracking_gpu/MPPoseTracking.h new file mode 100644 index 000000000..f2fa3334a --- /dev/null +++ b/mediapipe/objc/solutions/posetracking_gpu/MPPoseTracking.h @@ -0,0 +1,3 @@ +#import "PoseTracking.h" +#import "PoseTrackingOptions.h" +#import "PoseTrackingResults.h" \ No newline at end of file diff --git a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h index 65f1b392c..40c9aa7d7 100644 --- a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h +++ b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h @@ -10,6 +10,7 @@ #import "mediapipe/objc/MPPPlayerInputSource.h" #import "PoseTrackingOptions.h" #import "PoseTrackingResults.h" + @interface PoseTracking : NSObject // The MediaPipe graph currently in use. Initialized in viewDidLoad, started in diff --git a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm index 4ea760cd6..43ef37afb 100644 --- a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm +++ b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm @@ -3,6 +3,23 @@ #import "mediapipe/objc/MPPGraph.h" #import "mediapipe/objc/MPPTimestampConverter.h" #include "mediapipe/framework/packet.h" +#include "registry/calculator_registry.h" + +//#include "mediapipe/calculators/core/flow_limiter_calculator.h" +//#include "mediapipe/calculators/core/constant_side_packet_calculator.h" +//#include "mediapipe/modules/pose_landmark/pose_landmark_gpu_linked.h" +//#include "mediapipe/graphs/pose_tracking/subgraphs/pose_renderer_gpu_linked.h" +//#include "mediapipe/modules/pose_detection/pose_detection_gpu_linked.h" + +void registerCalculators(){ +// typeid(::mediapipe::FlowLimiterCalculator); +// typeid(::mediapipe::ConstantSidePacketCalculator); +// typeid(::mediapipe::PoseLandmarkGpu); +// typeid(::mediapipe::PoseRendererGpu); +// typeid(::mediapipe::PoseDetectionGpu); + + +} static const char* kVideoQueueLabel = "com.google.mediapipe.example.videoQueue"; static const char* kLandmarksOutputStream = "pose_landmarks"; @@ -37,7 +54,7 @@ static const char* kLandmarksOutputStream = "pose_landmarks"; -(id) initWithMediapipeGraph: (MPPGraph*) graph graphOutputStream: (const char*) graphOutputStream renderer: (MPPLayerRenderer*) renderer { - + self.mediapipeGraph = graph; self.graphOutputStream =graphOutputStream; self.renderer = renderer; @@ -127,6 +144,9 @@ static const char* kLandmarksOutputStream = "pose_landmarks"; } - (instancetype) initWithPoseTrackingOptions: (PoseTrackingOptions*) poseTrackingOptions{ + + registerCalculators(); + MPPCalculator(); self.renderer = [[MPPLayerRenderer alloc] init]; self.renderer.frameScaleMode = MPPFrameScaleModeFillAndCrop; diff --git a/mediapipe/objc/solutions/posetracking_gpu/modulemap/module.modulemap b/mediapipe/objc/solutions/posetracking_gpu/modulemap/module.modulemap new file mode 100644 index 000000000..276eba983 --- /dev/null +++ b/mediapipe/objc/solutions/posetracking_gpu/modulemap/module.modulemap @@ -0,0 +1,5 @@ +framework module MPPoseTracking { + umbrella header "MPPoseTracking.h" + export * + module * { export * } +} \ No newline at end of file diff --git a/mediapipe/objc/solutions/posetracking_gpu/patch_ios_framework.sh b/mediapipe/objc/solutions/posetracking_gpu/patch_ios_framework.sh new file mode 100644 index 000000000..5374d617b --- /dev/null +++ b/mediapipe/objc/solutions/posetracking_gpu/patch_ios_framework.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Copyright (c) 2022 Baracoda. All rights reserved +# +# Copying this file via any medium without the prior written consent of Baracoda is strictly +# prohibited +# +# Proprietary and confidential + +set -eu +set -o pipefail + +for outputPath in $2 +do + fileName=$(basename "$outputPath" .framework) + outputPath=$(dirname $outputPath) + + for inputPath in $1 + do + if [[ $inputPath == *"$fileName"*.zip ]]; then + fullPath=$(dirname "$inputPath") + + frameworkPath="$fullPath"/"$fileName".framework + + rm -rf "$fullPath"/"$fileName".framework + unzip "$inputPath" -d "$fullPath" + + if [ -d "$frameworkPath".dSYM ]; then + cp -R "$frameworkPath".dSYM "$outputPath"/"$fileName".framework.dSYM + fi + + if [ -f "$frameworkPath"/module.modulemap ]; then + mkdir "$frameworkPath"/Modules + mv "$frameworkPath"/module.modulemap "$frameworkPath"/Modules + fi + + cp -R "$frameworkPath" "$outputPath"/"$fileName".framework + fi + done; +done; \ No newline at end of file diff --git a/mediapipe/objc/solutions/posetracking_gpu/registry/calculator_registry.cpp b/mediapipe/objc/solutions/posetracking_gpu/registry/calculator_registry.cpp new file mode 100644 index 000000000..328d5e676 --- /dev/null +++ b/mediapipe/objc/solutions/posetracking_gpu/registry/calculator_registry.cpp @@ -0,0 +1,68 @@ +// +// Created by Mautisim Munir on 05/11/2022. +// + +#include "calculator_registry.h" +#include "mediapipe/calculators/core/flow_limiter_calculator.h" +#include "mediapipe/calculators/core/constant_side_packet_calculator.h" + +// We need namespaces for subgraphs because of the static variables inside the files +namespace PLG { + +#include "mediapipe/modules/pose_landmark/pose_landmark_gpu_linked.h" + +} + +namespace PDROI{ +#include "mediapipe/modules/pose_landmark/pose_detection_to_roi_linked.h" + +} + +namespace PRG { + +#include "mediapipe/graphs/pose_tracking/subgraphs/pose_renderer_gpu_linked.h" + +} +namespace PDG { +#include "mediapipe/modules/pose_detection/pose_detection_gpu_linked.h" +} + +namespace PLROIG{ +#include "mediapipe/modules/pose_landmark/pose_landmark_by_roi_gpu_linked.h" + +} +namespace PLF{ +#include "mediapipe/modules/pose_landmark/pose_landmark_filtering_linked.h" +} +namespace PLTOROI{ +#include "mediapipe/modules/pose_landmark/pose_landmarks_to_roi_linked.h" +} +namespace PSF{ +#include "mediapipe/modules/pose_landmark/pose_segmentation_filtering_linked.h" +} +namespace PLML{ +#include "mediapipe/modules/pose_landmark/pose_landmark_model_loader_linked.h" +} +namespace PLSIP{ +#include "mediapipe/modules/pose_landmark/pose_landmarks_and_segmentation_inverse_projection_linked.h" +} +namespace TPLS{ +#include "mediapipe/modules/pose_landmark/tensors_to_pose_landmarks_and_segmentation_linked.h" +} + +MPPCalculator::MPPCalculator() { + typeid(TPLS::mediapipe::TensorsToPoseLandmarksAndSegmentation); + typeid(::mediapipe::FlowLimiterCalculator); + typeid(::mediapipe::ConstantSidePacketCalculator); + typeid(PLG::mediapipe::PoseLandmarkGpu); + typeid(PRG::mediapipe::PoseRendererGpu); + typeid(PDG::mediapipe::PoseDetectionGpu); + typeid(PDROI::mediapipe::PoseDetectionToRoi); + typeid(PLROIG::mediapipe::PoseLandmarkByRoiGpu); + typeid(PLF::mediapipe::PoseLandmarkFiltering); + typeid(PLTOROI::mediapipe::PoseLandmarksToRoi); + typeid(PSF::mediapipe::PoseSegmentationFiltering); + typeid(PLML::mediapipe::PoseLandmarkModelLoader); + typeid(PLSIP::mediapipe::PoseLandmarksAndSegmentationInverseProjection); + +} diff --git a/mediapipe/objc/solutions/posetracking_gpu/registry/calculator_registry.h b/mediapipe/objc/solutions/posetracking_gpu/registry/calculator_registry.h new file mode 100644 index 000000000..c139e75da --- /dev/null +++ b/mediapipe/objc/solutions/posetracking_gpu/registry/calculator_registry.h @@ -0,0 +1,13 @@ +// +// Created by Mautisim Munir on 05/11/2022. +// + +#ifndef MEDIAPIPE_CALCULATOR_REGISTRY_H +#define MEDIAPIPE_CALCULATOR_REGISTRY_H + +class MPPCalculator{ +public: + MPPCalculator(); +}; + +#endif //MEDIAPIPE_CALCULATOR_REGISTRY_H diff --git a/mediapipe/swift/solutions/lindera/BUILD b/mediapipe/swift/solutions/lindera/BUILD index 42c4f0851..962d19f29 100644 --- a/mediapipe/swift/solutions/lindera/BUILD +++ b/mediapipe/swift/solutions/lindera/BUILD @@ -1,8 +1,62 @@ load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework", "ios_static_framework", "ios_unit_test") + +POSETRACKING_DEPS = [ + "//mediapipe/objc/solutions/posetracking_gpu:posetracking_gpu_solution", + "//mediapipe/objc:mediapipe_framework_ios", + "//mediapipe/objc:mediapipe_input_sources_ios", + "//mediapipe/objc:mediapipe_layer_renderer", +] + select({ + "//mediapipe:ios_i386": [], + "//mediapipe:ios_x86_64": [], + "//conditions:default": [ + "//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps", + "//mediapipe/framework/formats:landmark_cc_proto", + ], +}) + +genrule( + name = "podgen", + srcs = [ + "//mediapipe/objc/solutions/posetracking_gpu:MPPoseTrackingHeaderPatched", + "LinderaDetection.podspec", + "@ios_opencv//:OpencvFrameworkContents", + ] + glob(["*.swift"]), + outs = ["LinderaDetection.zip"], + cmd = """ + + mkdir mediapipe/swift/solutions/lindera/frameworks + cp -r external/ios_opencv/opencv2.framework mediapipe/swift/solutions/lindera/frameworks + unzip $(location //mediapipe/objc/solutions/posetracking_gpu:MPPoseTrackingHeaderPatched) -d mediapipe/swift/solutions/lindera/frameworks + cd mediapipe/swift/solutions/lindera/ + + zip -r LinderaDetection.zip frameworks LinderaDetection.podspec *.swift + cd ../../../../ + cp mediapipe/swift/solutions/lindera/LinderaDetection.zip $@ + """, +) + +# bazel build //mediapipe/swift/solutions/lindera:lindera-framework -c opt --config=ios_fat --cxxopt=--std=c++17 --copt=-fembed-bitcode --linkopt="-s" +ios_static_framework( + name = "lindera-framework", + # avoid_deps = POSETRACKING_DEPS, + bundle_name = "LinderaDetection", + minimum_os_version = "12.0", + visibility = ["//visibility:public"], + deps = [ + ":lindera", + # "//third_party:opencv", + # "@ios_opencv//:OpencvFramework", + ] + POSETRACKING_DEPS, +) swift_library( name = "lindera", - srcs = ["Lindera.swift","Asensei3D.swift","utils.swift"], + srcs = [ + "Asensei3D.swift", + "Lindera.swift", + "utils.swift", + ], linkopts = [ "-lc++", "-std=c++17", @@ -10,17 +64,5 @@ swift_library( ], module_name = "LinderaDetection", visibility = ["//visibility:public"], - deps = [ - "//mediapipe/objc/solutions/posetracking_gpu:posetracking_gpu_solution", - "//mediapipe/objc:mediapipe_framework_ios", - "//mediapipe/objc:mediapipe_input_sources_ios", - "//mediapipe/objc:mediapipe_layer_renderer", - ] + select({ - "//mediapipe:ios_i386": [], - "//mediapipe:ios_x86_64": [], - "//conditions:default": [ - "//mediapipe/graphs/pose_tracking:pose_tracking_gpu_deps", - "//mediapipe/framework/formats:landmark_cc_proto", - ], - }), + deps = POSETRACKING_DEPS, ) diff --git a/mediapipe/swift/solutions/lindera/Lindera.swift b/mediapipe/swift/solutions/lindera/Lindera.swift index 2943c2416..3a380c923 100644 --- a/mediapipe/swift/solutions/lindera/Lindera.swift +++ b/mediapipe/swift/solutions/lindera/Lindera.swift @@ -1,31 +1,32 @@ // This is the copperlabs posetracking api built in objective c -import MPPoseTracking import UIKit +#if arch(arm64) +import MPPoseTracking /// A helper class to run the Pose Tracking API /// TFLite models are also loaded when you initialize this class public final class Lindera{ - - + + //MARK: - Public Class API - - + + // A delegate to handle results public weak var delegate: LinderaDelegate? - + /// This function sets up your callback function to happen whenver there is an fps update public func setFpsDelegate(fpsDelegate: @escaping (_ fps:Double)->Void){ fpsHelper.onFpsUpdate = fpsDelegate; } - + // Get the camera UI View that may contain landmarks drawing public var cameraView: UIView { return self.linderaExerciseSession } - - + + // Show Landmarks - works instantaneously! public func showLandmarks(value:Bool){ self.poseTracking.showLandmarks(value) @@ -38,50 +39,50 @@ public final class Lindera{ public func getModelComplexity() -> Int { return Int(self.poseTracking.poseTrackingOptions.modelComplexity); } - + // Set the model complexity and restart detection to load new models public func setModelComplexityNow(complexity:Int){ let poseTrackingOptions = poseTracking.poseTrackingOptions - + poseTrackingOptions?.modelComplexity = Int32(complexity) - + poseTracking = PoseTracking(poseTrackingOptions: poseTrackingOptions) startPoseTracking() startCamera() - + } - + public required init(){ - + startPoseTracking() } - - + + public func startCamera(_ completion: ((Result) -> Void)? = nil) { // set our rendering layer frame according to cameraView boundry self.poseTracking.renderer.layer.frame = cameraView.layer.bounds // attach render CALayer on cameraView to render output to self.cameraView.layer.addSublayer(self.poseTracking.renderer.layer) - + self.cameraSource.requestCameraAccess( - completionHandler: {(granted:Bool)->Void in - if (granted){ - self.poseTracking.videoQueue.async(execute:{ [weak self] in - - self?.cameraSource.start() - - } ) - completion?(.success(Void())) - }else{ - - completion?(.failure(preconditionFailure("Camera Access Not Granted"))) - - } - }) - - - - + completionHandler: {(granted:Bool)->Void in + if (granted){ + self.poseTracking.videoQueue.async(execute:{ [weak self] in + + self?.cameraSource.start() + + } ) + completion?(.success(Void())) + }else{ + + completion?(.failure(preconditionFailure("Camera Access Not Granted"))) + + } + }) + + + + } /// Choose front or back camera. Must restart camera after use if already started public func selectCamera(_ position: AVCaptureDevice.Position, _ completion: ((Result) -> Void)? = nil) { @@ -89,23 +90,23 @@ public final class Lindera{ self?.cameraSource.cameraPosition = position completion?(.success(Void())) } - + } - - + + // MARK: - Private Class Functions - + // Set your custom view heree private lazy var linderaExerciseSession: UIView = { - + // this will be the main camera view; Change it to custom view class to get desired results let liveView = UIView() - + return liveView - + }() - - + + private func startPoseTracking(){ // set camera preferences self.cameraSource.sessionPreset = AVCaptureSession.Preset.high.rawValue @@ -116,43 +117,43 @@ public final class Lindera{ } // call LinderaDelegate on pose tracking results self.poseTracking.poseTrackingResultsListener = {[weak self] results in - - + + guard let self = self, let results = results else { return } - + self.delegate?.lindera(self, didDetect: .init(pose: Asensei3DPose.init(results), timestamp: CMTimeGetSeconds(self.poseTracking.timeStamp))) } self.poseTracking.graphOutputStreamListener = {[weak self] in self?.fpsHelper.logTime() } - + self.poseTracking.startGraph() // attach camera's output with poseTracking object and its videoQueue self.cameraSource.setDelegate(self.poseTracking, queue: self.poseTracking.videoQueue) } - - + + func stopCamera(){ if (self.cameraSource.isRunning){ self.poseTracking.videoQueue.async { [weak self] in self?.cameraSource.stop() } - + } } - + /// switches camera from front to back and vice versa func switchCamera(_ completion: ((Result) -> Void)? = nil) { self.poseTracking.videoQueue.async { [weak self] in if let self = self { - + self.stopCamera() self.startCamera(completion) - + switch(self.cameraSource.cameraPosition){ - + case .unspecified: completion?(.failure(preconditionFailure("Unkown Camera Position"))) case .back: @@ -161,34 +162,34 @@ public final class Lindera{ self.selectCamera(AVCaptureDevice.Position.back,completion) @unknown default: completion?(.failure(preconditionFailure("Unkown Camera Position"))) - + } - - + + } - + } } - - + + // MARK: - Private Class Objects // initalize the PoseTracking api and load models var poseTracking:PoseTracking = PoseTracking(poseTrackingOptions: PoseTrackingOptions(showLandmarks: true,modelComplexity: 1)) - + // Needed to get fps of model let fpsHelper = FPSHelper(smoothingFactor: 0.95) - + // attach Mediapipe camera helper to our class let cameraSource = MPPCameraInputSource() - - - + + + } public protocol LinderaDelegate: AnyObject { - + func lindera(_ lindera: Lindera, didDetect event: Asensei3DPose.Event) } @@ -199,61 +200,61 @@ func landmarkToBodyJointDetails(landmark: PoseLandmark) -> Asensei3DPose.BodyJoi } // MARK: - Helpers extension Asensei3DPose { - + init(_ pose: PoseTrackingResults) { - + self.nose = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_NOSE]) - + self.leftEyeInner = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_EYE_INNER]) self.leftEye = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_EYE]) self.leftEyeOuter = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_EYE_OUTER]) - + self.rightEyeInner = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_EYE_OUTER]) self.rightEye = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_EYE]) self.rightEyeOuter = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_EYE_OUTER]) - + self.leftEar = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_EAR]) self.rightEar = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_EAR]) - + self.mouthLeft = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_MOUTH_LEFT]) self.mouthRight = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_MOUTH_RIGHT]) - + self.leftShoulder = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_SHOULDER]) self.rightShoulder = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_SHOULDER]) - + self.leftElbow = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_ELBOW]) self.rightElbow = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_ELBOW]) - + self.leftWrist = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_WRIST]) self.rightWrist = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_WRIST]) - + self.leftPinky = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_PINKY]) self.rightPinky = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_PINKY]) - + self.leftIndex = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_INDEX]) self.rightIndex = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_INDEX]) - + self.leftThumb = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_THUMB]) self.rightThumb = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_THUMB]) - + self.leftHip = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_HIP]) self.rightHip = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_HIP]) - + self.leftKnee = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_KNEE]) self.rightKnee = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_KNEE]) - + self.rightAnkle = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_ANKLE]) self.leftAnkle = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_ANKLE]) - - + + self.rightHeel = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_HEEL]) self.leftHeel = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_HEEL]) - + self.rightFoot = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_RIGHT_FOOT]) self.leftFoot = landmarkToBodyJointDetails(landmark: pose.landmarks[POSE_LEFT_FOOT]) - - - + + + } } @@ -265,3 +266,6 @@ extension Asensei3DPose { // self.z = vector.y // } //} +#else +final public class Lindera{} +#endif diff --git a/mediapipe/swift/solutions/lindera/LinderaDetection.podspec b/mediapipe/swift/solutions/lindera/LinderaDetection.podspec new file mode 100644 index 000000000..d0f2961de --- /dev/null +++ b/mediapipe/swift/solutions/lindera/LinderaDetection.podspec @@ -0,0 +1,154 @@ +# +# Be sure to run `pod spec lint EdgeEngine.podspec' to ensure this is a +# valid spec and to remove all comments including this before submitting the spec. +# +# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html +# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ +# + +Pod::Spec.new do |spec| + + # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # These will help people to find your library, and whilst it + # can feel like a chore to fill in it's definitely to your advantage. The + # summary should be tweet-length, and the description more in depth. + # + + spec.name = "LinderaDetection" + spec.version = "0.0.2" + spec.summary = "LinderaDetection is a simple yet powerful interface to run AI Fitness Solutions" + + # This description is used to generate tags and improve search results. + # * Think: What does it do? Why did you write it? What is the focus? + # * Try to keep it short, snappy and to the point. + # * Write the description between the DESC delimiters below. + # * Finally, don't worry about the indent, CocoaPods strips it! + spec.description = "LinderaDetection is a simple yet powerful interface to run AI Fitness Solutions. It is powered by Mediapipe." + + spec.homepage = "https://github.com/udamaster/mediapipe" + # spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" + + + # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Licensing your code is important. See https://choosealicense.com for more info. + # CocoaPods will detect a license file if there is a named LICENSE* + # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. + # + + spec.license = { :type => 'MIT', :text => <<-LICENSE + Copyright 2012 + Permission is granted to... + LICENSE + } + + + # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Specify the authors of the library, with email addresses. Email addresses + # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also + # accepts just a name if you'd rather not provide an email address. + # + # Specify a social_media_url where others can refer to, for example a twitter + # profile URL. + # + + spec.author = "Copper Labs" + + + # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # If this Pod runs only on iOS or OS X, then specify the platform and + # the deployment target. You can optionally include the target after the platform. + # + spec.swift_versions = ["4.0"] + # spec.platform = :ios + spec.platform = :ios, "12.0" + + # When using multiple platforms + # spec.ios.deployment_target = "5.0" + # spec.osx.deployment_target = "10.7" + # spec.watchos.deployment_target = "2.0" + # spec.tvos.deployment_target = "9.0" + + + # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Specify the location from where the source should be retrieved. + # Supports git, hg, bzr, svn and HTTP. + + spec.source = { :http => 'https://github.com/copper-labs/iOSFramework/releases/download/0.1.0/LinderaDetection.zip' } + + # for quickly testing locally + # spec.source = { :http => 'http://127.0.0.1:8000/LinderaDetection.zip' } + + + # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # CocoaPods is smart about how it includes source code. For source files + # giving a folder will include any swift, h, m, mm, c & cpp files. + # For header files it will include any header in the folder. + # Not including the public_header_files will make all headers public. + # + + spec.source_files = "*.swift" + # spec.exclude_files = "Classes/Exclude" + + # spec.public_header_files = "" + + + # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # A list of resources included with the Pod. These are copied into the + # target bundle with a build phase script. Anything else will be cleaned. + # You can preserve files from being cleaned, please don't preserve + # non-essential files like tests, examples and documentation. + # + + # spec.resource = "icon.png" + spec.resources = ["frameworks/*/*.tflite","frameworks/*/*.binarypb"] + + # spec.preserve_paths = "FilesToSave", "MoreFilesToSave" + + + # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # Link your library with frameworks, or libraries. Libraries do not include + # the lib prefix of their name. + # + + # spec.framework = "SomeFramework" + # spec.frameworks = "SomeFramework", "AnotherFramework" + + # spec.library = "iconv" + # spec.libraries = "iconv", "xml2" + + + # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # + # + # If your library depends on compiler flags you can set them in the xcconfig hash + # where they will only apply to your library. If you depend on other Podspecs + # you can include multiple dependencies to ensure it works. + + # spec.requires_arc = true + + # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } + # spec.dependency "OpenCV", "3.2" + spec.static_framework = true + # spec.preserve_paths = "frameworks/**/*" + spec.ios.vendored_frameworks = 'frameworks/*.framework' + spec.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' , + 'OTHER_LDFLAGS' => '$(inherited) -force_load $(PODS_ROOT)/LinderaDetection/frameworks/MPPoseTracking.framework/MPPoseTracking' } + spec.user_target_xcconfig = { + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' , + 'OTHER_LDFLAGS' => '$(inherited) -force_load $(PODS_ROOT)/LinderaDetection/frameworks/MPPoseTracking.framework/MPPoseTracking' } + spec.libraries = 'stdc++' + + + # spec.xcconfig = { + # 'FRAMEWORK_SEARCH_PATH[sdk=iphoneos*]' => '$(inherited) "$(PODS_ROOT)/frameworks"', + # 'OTHERCFLAGS[sdk=iphoneos*]' => '$(inherited) -iframework "$(PODS_ROOT)/frameworks"', + # 'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -framework frameworks' + # } +end diff --git a/mediapipe/swift/solutions/lindera/README.md b/mediapipe/swift/solutions/lindera/README.md new file mode 100644 index 000000000..7cfe9b747 --- /dev/null +++ b/mediapipe/swift/solutions/lindera/README.md @@ -0,0 +1,13 @@ +## CocoaPods + +### Building Pod zipfile +```shell +bazel build -c opt --config=ios_fat --cxxopt=--std=c++17 --copt=-fembed-bitcode //mediapipe/swift/solutions/lindera:podgen +``` + +### Pushing Pods + +here clspecs is the name of pod specs repository +```shell +pod repo push clspecs LinderaDetection.podspec --skip-import-validation +``` diff --git a/third_party/opencv_ios.BUILD b/third_party/opencv_ios.BUILD index c9f112075..6a20a2f45 100644 --- a/third_party/opencv_ios.BUILD +++ b/third_party/opencv_ios.BUILD @@ -10,6 +10,12 @@ load( "apple_static_framework_import", ) +filegroup( + name = "OpencvFrameworkContents", + srcs = glob(["opencv2.framework/**"]), + visibility = ["//visibility:public"], +) + apple_static_framework_import( name = "OpencvFramework", framework_imports = glob(["opencv2.framework/**"]),