diff --git a/mediapipe/MediaPipe.tulsiproj/Configs/MediaPipe.tulsigen b/mediapipe/MediaPipe.tulsiproj/Configs/MediaPipe.tulsigen
index 69b95f381..41eee5741 100644
--- a/mediapipe/MediaPipe.tulsiproj/Configs/MediaPipe.tulsigen
+++ b/mediapipe/MediaPipe.tulsiproj/Configs/MediaPipe.tulsigen
@@ -23,8 +23,7 @@
"mediapipe/objc/testing/app/BUILD"
],
"buildTargets" : [
- "//mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera:posetracking-lindera",
- "//mediapipe/swift/solutions/lindera:lindera"
+ "//mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera:posetracking-lindera"
],
"optionSet" : {
"BazelBuildOptionsDebug" : {
diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/BUILD.bazel b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/BUILD.bazel
index 6ba6af02e..592435d03 100644
--- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/BUILD.bazel
+++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/BUILD.bazel
@@ -12,7 +12,7 @@ MIN_IOS_VERSION = "14.0"
swift_library(
name = "lindera_app_lib",
srcs = glob(["**/*.swift"]),
- data =[
+ data = [
"Base.lproj/LaunchScreen.storyboard",
"Base.lproj/Main.storyboard",
],
@@ -62,7 +62,7 @@ ios_application(
"ipad",
],
infoplists = [
- "Info.plist",
+ "Infobazel.plist",
"//mediapipe/examples/ios/common:Info.plist",
],
linkopts = [
diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Base.lproj/Main.storyboard b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Base.lproj/Main.storyboard
index 2ca04eade..d65b7611f 100644
--- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Base.lproj/Main.storyboard
+++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Base.lproj/Main.storyboard
@@ -56,6 +56,38 @@
+
+
+
+
+
+
+
+
+
+
@@ -63,8 +95,10 @@
+
+
diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Infobazel.plist b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Infobazel.plist
new file mode 100644
index 000000000..108826e3b
--- /dev/null
+++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Infobazel.plist
@@ -0,0 +1,34 @@
+
+
+
+
+
+ UIApplicationSceneManifest
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSRequiresIPhoneOS
+
+ UIApplicationSupportsMultipleScenes
+
+ MainViewController
+ ViewController
+ UILaunchStoryboardName
+ LaunchScreen
+
+
+
diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift
index b9b449643..3cc30c86f 100644
--- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift
+++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift
@@ -7,9 +7,34 @@
import UIKit
import LinderaDetection
//import LinderaDetection
+import PhotosUI
+class ViewController: UIViewController, PHPickerViewControllerDelegate {
+
+ // Video Picker
+ func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
+
+ for result in results {
+ result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.movie.identifier){url,err in
+ if let url = url {
+ DispatchQueue.main.async {
+ [weak self] in
-class ViewController: UIViewController {
+ picker.dismiss(animated: true)
+ self?.inputSourceView.isHidden = true
+
+ }
+ let asset = AVAsset(url: url)
+ self.lindera.startVideo(asset: asset)
+
+ }
+ }
+ }
+
+//
+
+ }
+
//MARK: - UI Elements
@@ -17,11 +42,30 @@ class ViewController: UIViewController {
@IBOutlet var liveView : UIView!
@IBOutlet var showLandmarksButton: UIButton!
@IBOutlet var chooseModelButton: UIButton!
+ @IBOutlet var startCameraButton: UIButton!
@IBOutlet var titleview: UIView!
@IBOutlet var fpsLabel: UILabel!
-
+ @IBOutlet var inputSourceView: UIView!
//MARK: - UI Actions
+ @IBAction func startCamera(){
+ lindera.startCamera()
+ inputSourceView.isHidden = true
+
+
+
+ }
+
+ @IBAction func pickVideo(){
+ var configuration = PHPickerConfiguration(photoLibrary: .shared())
+ let filter = PHPickerFilter.any(of: [ .videos])
+ configuration.filter = filter
+ configuration.selectionLimit = 1
+ let picker = PHPickerViewController(configuration: configuration)
+ picker.delegate = self
+ present(picker, animated: true)
+
+ }
@IBAction func setModelComplexity(){
let alert = UIAlertController(
@@ -150,12 +194,16 @@ class ViewController: UIViewController {
// Otherwise they are hidden
self.liveView.bringSubviewToFront(titleview)
self.liveView.bringSubviewToFront(fpsLabel)
-
+ self.liveView.bringSubviewToFront(inputSourceView)
// Make the Landmarks and Model button text reflect the state in lindera object
updateLandmarksButtonText()
updateModelButtonText()
- lindera.startCamera()
+
+
+
+
+
}
diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/java/com/google/mediapipe/examples/posetracking_lindera/MainActivity.java b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/java/com/google/mediapipe/examples/posetracking_lindera/MainActivity.java
index cf183c471..1dd47440d 100644
--- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/java/com/google/mediapipe/examples/posetracking_lindera/MainActivity.java
+++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/java/com/google/mediapipe/examples/posetracking_lindera/MainActivity.java
@@ -33,9 +33,8 @@ import androidx.appcompat.app.AppCompatActivity;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.mediapipe.R;
-import com.google.mediapipe.solutions.lindera.BodyJoints;
import com.google.mediapipe.solutions.lindera.CameraRotation;
-import com.google.mediapipe.solutions.lindera.ComputerVisionPlugin;
+import com.google.mediapipe.solutions.lindera.InputSource;
import com.google.mediapipe.solutions.lindera.Lindera;
import org.json.JSONException;
@@ -80,11 +79,11 @@ public class MainActivity extends AppCompatActivity {
lindera = new Lindera(plugin);
+ lindera.setupVideoPicker(this);
List cameras = lindera.getAvailableCameras();
// FRONT or BACK
lindera.setCamera("BACK");
lindera.setCameraRotation(CameraRotation.AUTOMATIC);
-
lindera.fpsHelper.onFpsUpdate = new Consumer() {
@Override
public void accept(Double fps) {
@@ -99,36 +98,55 @@ public class MainActivity extends AppCompatActivity {
}
+ private void startDetectionPipeline(InputSource inputSource){
+ if (!isLinderaInitialized) {
+ modelLoadAsyncDialogue(()->{
+ if (inputSource==InputSource.VIDEO){
+ lindera.setInputSource(InputSource.VIDEO);
+ }
+ lindera.initialize(findViewById(R.id.preview_display_layout), MainActivity.this);
+ isLinderaInitialized = true;
+ findViewById(R.id.button_start_video).setVisibility(View.GONE);
+ findViewById(R.id.button_start_camera).setVisibility(View.GONE);
+ findViewById(R.id.button_set_model).setVisibility(View.VISIBLE);
+ findViewById(R.id.button_toggle_landmarks).setVisibility(View.VISIBLE);
+ findViewById(R.id.button_capture_logging).setVisibility(View.VISIBLE);
+
+ updateLandmarkButtonText();
+ updateModelComplexityButtonText();
+ if (inputSource==InputSource.VIDEO) {
+ lindera.pickVideo();
+ }
+
+ });
+
+
+ }
+ isDetectionStarted = !isDetectionStarted;
+ }
/**
* Sets up the UI components for the live demo with camera input.
*/
private void setupLiveDemoUiComponents() {
- Button startDetectionButton = findViewById(R.id.button_start_detection);
+ Button startCameraButton = findViewById(R.id.button_start_camera);
+ Button startVideoButton = findViewById(R.id.button_start_video);
Button toggleLandmarks = findViewById(R.id.button_toggle_landmarks);
Button modelComplexity = findViewById(R.id.button_set_model);
Button startCapture = findViewById(R.id.button_capture_logging);
FrameLayout frameLayout = findViewById(R.id.preview_display_layout);
- startDetectionButton.setOnClickListener(
+ startCameraButton.setOnClickListener(
v -> {
-// startCameraButton.setVisibility(View.GONE);
- if (!isLinderaInitialized) {
- modelLoadAsyncDialogue(()->{
- lindera.initialize(frameLayout, MainActivity.this);
- isLinderaInitialized = true;
- startDetectionButton.setVisibility(View.GONE);
- findViewById(R.id.button_set_model).setVisibility(View.VISIBLE);
- findViewById(R.id.button_toggle_landmarks).setVisibility(View.VISIBLE);
- findViewById(R.id.button_capture_logging).setVisibility(View.VISIBLE);
-
- updateLandmarkButtonText();
- updateModelComplexityButtonText();
- });
+ startDetectionPipeline(InputSource.CAMERA);
- }
- isDetectionStarted = !isDetectionStarted;
+
+ });
+ startVideoButton.setOnClickListener(
+ v -> {
+ startDetectionPipeline(InputSource.VIDEO);
+
});
diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/res/layout/activity_main.xml b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/res/layout/activity_main.xml
index 975690cb0..a2739ccc3 100644
--- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/res/layout/activity_main.xml
+++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/src/main/res/layout/activity_main.xml
@@ -15,11 +15,18 @@
android:orientation="horizontal">
+ android:text="Start Camera" />
+
+