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 a0febb46a..15dcd337e 100644
--- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Base.lproj/Main.storyboard
+++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/Base.lproj/Main.storyboard
@@ -15,16 +15,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift
index d65734e39..b654b1122 100644
--- a/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift
+++ b/mediapipe/examples/ios/posetracking-lindera/PoseTrackingLindera/ViewController.swift
@@ -10,8 +10,51 @@ import LinderaDetection
class ViewController: UIViewController {
- @IBOutlet var liveView:UIView?;
+ @IBOutlet var liveView : UIView!
+ @IBOutlet var showLandmarksButton: UIButton!
+ @IBOutlet var chooseModelButton: UIButton!
+ @IBOutlet var titleview: UIView!
+ func updateLandmarksButtonText(){
+ if (lindera.areLandmarksShown()){
+ showLandmarksButton.setTitle("LANDMARKS (ON)", for: UIControl.State.normal)
+ }else{
+ showLandmarksButton.setTitle("LANDMARKS (OFF)", for: UIControl.State.normal)
+ }
+
+ }
+
+ func updateModelButtonText(){
+
+ }
+
+ @IBAction func showLandmarksButtonTouch(sender: UIButton){
+
+ lindera.showLandmarks(value: !lindera.areLandmarksShown());
+ updateLandmarksButtonText()
+
+// let alert = UIAlertController(
+// title: nil,
+// message: nil,
+// preferredStyle: .actionSheet
+// )
+//
+// alert.addAction(
+// .init(title: "Action 1", style: .default) { _ in
+// print("Action1")
+// }
+// )
+//
+// alert.addAction(
+// .init(title: "Action 2", style: .default) { _ in
+// print("Action 2")
+// }
+// )
+//
+// present(alert, animated: true)
+
+
+ }
let lindera = Lindera()
/// A simple LinderaDelegate implementation that prints nose coordinates if detected
@@ -31,18 +74,18 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
- // Do any additional setup after loading the view.
-
-
+// // Do any additional setup after loading the view.
+//
+//
self.lindera.delegate = linderaDelegate
-
+
// add lindera camera view to our app's UIView i.e. liveView
-
+
// Expand our cameraView frame to liveView frame
if let view = self.liveView{
view.addSubview(lindera.cameraView)
self.lindera.cameraView.frame = view.bounds
-
+
self.lindera.cameraView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
self.lindera.cameraView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
@@ -52,8 +95,12 @@ class ViewController: UIViewController {
])
}
-
+
lindera.startCamera()
+
+ self.liveView.bringSubviewToFront(titleview)
+ updateLandmarksButtonText()
+// self.liveView.bringSubviewToFront(chooseModelButton)
}
diff --git a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h
index ef1822c0e..fa50c96ce 100644
--- a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h
+++ b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.h
@@ -45,6 +45,8 @@
- (instancetype) initWithPoseTrackingOptions: (PoseTrackingOptions*) poseTrackingOptions;
- (void)startGraph;
- (void) startWithCamera: (MPPCameraInputSource*) cameraSource;
+- (void)showLandmarks: (BOOL) value;
+- (BOOL) areLandmarksShown;
@end
diff --git a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm
index 02e406326..39096f817 100644
--- a/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm
+++ b/mediapipe/objc/solutions/posetracking_gpu/PoseTracking.mm
@@ -144,8 +144,11 @@ static const char* kLandmarksOutputStream = "pose_landmarks";
self.graphOutputStream = "throttled_input_video";
}
- [self->mediapipeGraph addFrameOutputStream:self.graphOutputStream
+ [self->mediapipeGraph addFrameOutputStream:"output_video"
outputPacketType:MPPPacketTypePixelBuffer];
+ [self->mediapipeGraph addFrameOutputStream:"throttled_input_video"
+ outputPacketType:MPPPacketTypePixelBuffer];
+
self.poseTrackingResultsListener = ^(PoseTrackingResults*){};
@@ -166,7 +169,18 @@ static const char* kLandmarksOutputStream = "pose_landmarks";
return self;
}
+- (void)showLandmarks: (BOOL) value{
+ if (value){
+ self->poseTrackingGraphDelegate.graphOutputStream = "output_video";
+ }else{
+ self->poseTrackingGraphDelegate.graphOutputStream = "throttled_input_video";
+ }
+
+}
+- (BOOL) areLandmarksShown{
+ return self->poseTrackingGraphDelegate.graphOutputStream == "output_video";
+}
- (void)startGraph {
// Start running self.mediapipeGraph.
diff --git a/mediapipe/swift/solutions/lindera/Lindera.swift b/mediapipe/swift/solutions/lindera/Lindera.swift
index d89909be8..5719cf80e 100644
--- a/mediapipe/swift/solutions/lindera/Lindera.swift
+++ b/mediapipe/swift/solutions/lindera/Lindera.swift
@@ -18,7 +18,17 @@ public final class Lindera{
public var cameraView: UIView {
return self.linderaExerciseSession
}
+ public func showLandmarks(value:Bool){
+ self.poseTracking.showLandmarks(value)
+ }
+
+ public func areLandmarksShown() -> Bool{
+ return self.poseTracking.areLandmarksShown()
+ }
+// public func getModelComplexity() -> Int{
+// return self.poseTracking
+// }
// Initializes pipeline parameters and starts mediapipe graph
private lazy var linderaExerciseSession: UIView = {