forked from homuler/MediaPipeUnityPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement DetectionResultAnnotationController (homuler#983)
* fix: hide Label when the text is empty * feat: implement DetectionResultAnnotationController
- Loading branch information
Showing
9 changed files
with
194 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...homuler.mediapipe/Runtime/Scripts/Unity/Annotation/DetectionResultAnnotationController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2023 homuler | ||
// | ||
// Use of this source code is governed by an MIT-style | ||
// license that can be found in the LICENSE file or at | ||
// https://opensource.org/licenses/MIT. | ||
|
||
using UnityEngine; | ||
|
||
using mptcc = Mediapipe.Tasks.Components.Containers; | ||
|
||
namespace Mediapipe.Unity | ||
{ | ||
public class DetectionResultAnnotationController : AnnotationController<DetectionListAnnotation> | ||
{ | ||
[SerializeField, Range(0, 1)] private float _threshold = 0.0f; | ||
|
||
private mptcc.DetectionResult _currentTarget; | ||
|
||
public void DrawNow(mptcc.DetectionResult target) | ||
{ | ||
_currentTarget = target; | ||
SyncNow(); | ||
} | ||
|
||
public void DrawLater(mptcc.DetectionResult target) => UpdateCurrentTarget(target, ref _currentTarget); | ||
|
||
protected override void SyncNow() | ||
{ | ||
isStale = false; | ||
annotation.Draw(_currentTarget, imageSize, _threshold); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...er.mediapipe/Runtime/Scripts/Unity/Annotation/DetectionResultAnnotationController.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters