From 5f68762012cadfca5c0c06084c3bd618dc235694 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Tue, 10 Sep 2024 14:04:51 +0900 Subject: [PATCH 1/5] [MediaVision] Add new inference APIs --- .../Interop/Interop.Libraries.cs | 7 +- .../Interop/Interop.MediaVision.Inference.cs | 140 ++++++++++++ .../MediaVision/InferenceFaceDetector.cs | 204 ++++++++++++++++++ .../InferenceFaceDetectorResult.cs | 67 ++++++ .../InferenceFacialLandmarkDetector.cs | 204 ++++++++++++++++++ .../InferenceFacialLandmarkDetectorResult.cs | 67 ++++++ .../MediaVision/InferenceImageClassifier.cs | 204 ++++++++++++++++++ .../InferenceImageClassifierResult.cs | 67 ++++++ .../MediaVision/InferenceObjectDetector.cs | 204 ++++++++++++++++++ .../InferenceObjectDetectorResult.cs | 67 ++++++ .../InferencePoseLandmarkDetector.cs | 204 ++++++++++++++++++ .../InferencePoseLandmarkDetectorResult.cs | 67 ++++++ 12 files changed, 1501 insertions(+), 1 deletion(-) create mode 100644 src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs create mode 100644 src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs create mode 100644 src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs create mode 100644 src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs create mode 100644 src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs index 3a22309b08f..647eac18612 100644 --- a/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs @@ -20,12 +20,17 @@ internal static partial class Libraries { public const string MediaVisionCommon = "libmv_common.so"; public const string MediaVisionFace = "libmv_face.so"; - public const string MediaVisionInference = "libmv_inference.so"; public const string MediaVisionImage = "libmv_image.so"; public const string MediaVisionSurveillance = "libmv_surveillance.so"; public const string MediaVisionBarcodeDetector = "libmv_barcode_detector.so"; public const string MediaVisionBarcodeGenerator = "libmv_barcode_generator.so"; public const string MediaVisionRoiTracker = "libmv_roi_tracker.so"; public const string MediaVisionFaceRecognition = "libmv_face_recognition.so"; // It's based on machine learning + public const string MediaVisionInference = "libmv_inference.so"; + public const string MediaVisionInferenceImageClassification = "libmv_image_classification.so"; // Inference image classification + public const string MediaVisionInferenceObjectDetection = "libmv_object_detection.so"; + public const string MediaVisionInferenceFaceDetection = MediaVisionInferenceObjectDetection; // Inference object detection and face detection + public const string MediaVisionInferenceFacialLandmarkDetection = "libmv_landmark_detection.so"; + public const string MediaVisionInferencePoseLandmarkDetection = "libmv_landmark_detection.so"; // Inference facial landmark detection and pose landmark detection } } diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs index 2e5d9879231..15d5c7eeea3 100644 --- a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs @@ -112,5 +112,145 @@ internal static extern MediaVisionError DetectFacialLandmark(IntPtr source, IntP internal static extern MediaVisionError DetectPoseLandmark(IntPtr source, IntPtr inference, IntPtr roi, PoseLandmarkDetectedCallback callback, IntPtr userData = default(IntPtr)); // Deprecated in API 12 } + + internal static partial class InferenceImageClassification + { + // Newly added inferernce APIs + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_destroy")] + internal static extern MediaVisionError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_configure")] + internal static extern MediaVisionError Configure(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_prepare")] + internal static extern MediaVisionError Prepare(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_inference")] + internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_inference_async")] + internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_get_result_count")] + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + + [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_get_label")] + internal static extern MediaVisionError GetLabel(IntPtr handle, uint index, out IntPtr label); + } + + internal static partial class InferenceFaceDetection + { + // Newly added inferernce APIs + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_destroy")] + internal static extern MediaVisionError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_configure")] + internal static extern MediaVisionError Configure(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_prepare")] + internal static extern MediaVisionError Prepare(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_inference")] + internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_inference_async")] + internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_get_result_count")] + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + + [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_get_bound_box")] + internal static extern MediaVisionError GetBoundBox(IntPtr handle, uint index, out int left, out int top, out int right, out int bottom); + } + + internal static partial class InferenceObjectDetection + { + // Newly added inferernce APIs + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_destroy")] + internal static extern MediaVisionError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_configure")] + internal static extern MediaVisionError Configure(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_prepare")] + internal static extern MediaVisionError Prepare(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_inference")] + internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_inference_async")] + internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_get_result_count")] + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + + [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_get_bound_box")] + internal static extern MediaVisionError GetBoundBox(IntPtr handle, uint index, out int left, out int top, out int right, out int bottom); + } + + internal static partial class InferenceFacialLandmarkDetection + { + // Newly added inferernce APIs + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_destroy")] + internal static extern MediaVisionError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_configure")] + internal static extern MediaVisionError Configure(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_prepare")] + internal static extern MediaVisionError Prepare(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_inference")] + internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_inference_async")] + internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_get_result_count")] + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + + [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_get_position")] + internal static extern MediaVisionError GetPoint(IntPtr handle, uint index, out uint posX, out uint posY); + } + + internal static partial class InferencePoseLandmarkDetection + { + // Newly added inferernce APIs + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_destroy")] + internal static extern MediaVisionError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_configure")] + internal static extern MediaVisionError Configure(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_prepare")] + internal static extern MediaVisionError Prepare(IntPtr handle); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_inference")] + internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_inference_async")] + internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_get_result_count")] + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + + [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_get_position")] + internal static extern MediaVisionError GetPoint(IntPtr handle, uint index, out uint posX, out uint posY); + } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs new file mode 100644 index 00000000000..05d358d441d --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; +using System.Threading.Tasks; +using InteropFD = Interop.MediaVision.InferenceFaceDetection; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Provides the ability to detect face. + /// + /// http://tizen.org/feature/vision.inference + /// http://tizen.org/feature/vision.inference.face + /// 12 + public class InferenceFaceDetector : IDisposable + { + private IntPtr _handle; + private bool _disposed; + + /// Initializes a new instance of the class. + /// The required features are not supported. + /// 12 + public InferenceFaceDetector() + { + ValidationUtil.ValidateFeatureSupported(VisionFeatures.Inference); + ValidationUtil.ValidateFeatureSupported(VisionFeatures.InferenceFace); + + InteropFD.Create(out _handle).Validate("Failed to create inference face detector."); + + try + { + InteropFD.Configure(_handle).Validate("Failed to configure inference face detector."); + InteropFD.Prepare(_handle).Validate("Failed to prepare inference face detector."); + } + catch (Exception e) + { + Log.Error(MediaVisionLog.Tag, e.ToString()); + InteropFD.Destroy(_handle); + throw; + } + } + + /// + /// Finalizes an instance of the InferenceFaceDetector class. + /// + ~InferenceFaceDetector() + { + Dispose(false); + } + + /// + /// Detects face on the source image synchronously. + /// + /// + /// If there's no detected face, will be empty. + /// + /// The image data to detect face. + /// A label of detected face. + /// The InferenceFaceDetector already has been disposed. + /// is null. + /// 12 + public InferenceFaceDetectorResult Inference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropFD.Inference(_handle, source.Handle).Validate("Failed to inference face detection."); + + return new InferenceFaceDetectorResult(_handle); + } + + /// + /// Detects face on the source image asynchronously. + /// + /// + /// If there's no detected face, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// The image data to detect face. + /// The InferenceFaceDetector already has been disposed. + /// is null. + /// 12 + public async Task InferenceAsync(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropFD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference face detection."); + + return await Task.Factory.StartNew(() => new InferenceFaceDetectorResult(_handle), + CancellationToken.None, + TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, + TaskScheduler.Default); + } + + /// + /// Requests to detect face on the given source image.
+ ///
+ /// + /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
+ /// If there's no detected face, will be empty.
+ /// Note that this API could use about twice as much memory as . + ///
+ /// The image data to detect face. + /// The InferenceFaceDetector already has been disposed. + /// is null. + /// + /// 12 + public void RequestInference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropFD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference face detection."); + } + + /// + /// Gets the bound box as a result of . + /// + /// + /// If there's no detected face, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// A bound box of detected face. + /// The InferenceFaceDetector already has been disposed. + /// + /// 12 + public InferenceFaceDetectorResult GetBoundBox() + { + return new InferenceFaceDetectorResult(_handle); + } + + /// + /// Releases the unmanaged resources used by the InferenceFaceDetector. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// 12 + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + + if (_handle != IntPtr.Zero) + { + InteropFD.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the InferenceFaceDetector. + /// + /// 12 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Error(MediaVisionLog.Tag, "InferenceFaceDetector handle is disposed."); + throw new ObjectDisposedException(nameof(InferenceFaceDetector)); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs new file mode 100755 index 00000000000..786ee168905 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using InteropFD = Interop.MediaVision.InferenceFaceDetection; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Represents the result of operations. + /// + /// 12 + public class InferenceFaceDetectorResult + { + internal InferenceFaceDetectorResult(IntPtr handle) + { + InteropFD.GetResultCount(handle, out ulong requestOrder, out uint count). + Validate("Failed to get result count."); + + RequestOrder = requestOrder; + var boundBoxes = new List(); + + for (uint i = 0 ; i < count ; i++) + { + InteropFD.GetBoundBox(handle, i, out int left, out int top, out int right, out int bottom). + Validate("Failed to get bound box."); + boundBoxes.Add(new Rectangle(left, top, right - left, bottom - top)); + } + + BoundBox = boundBoxes; + } + + /// + /// Gets the requested order. + /// + /// The requested order. + /// 12 + public ulong RequestOrder { get; } + + /// + /// Gets the boundBox of the detected face. + /// + /// 12 + public IEnumerable BoundBox { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + /// 12 + public override string ToString() => $"BoundBox={BoundBox}"; + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs new file mode 100644 index 00000000000..c252c89d214 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; +using System.Threading.Tasks; +using InteropFLD = Interop.MediaVision.InferenceFacialLandmarkDetection; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Provides the ability to detect facial landmark. + /// + /// http://tizen.org/feature/vision.inference + /// http://tizen.org/feature/vision.inference.face + /// 12 + public class InferenceFacialLandmarkDetector : IDisposable + { + private IntPtr _handle; + private bool _disposed; + + /// Initializes a new instance of the class. + /// The required features are not supported. + /// 12 + public InferenceFacialLandmarkDetector() + { + ValidationUtil.ValidateFeatureSupported(VisionFeatures.Inference); + ValidationUtil.ValidateFeatureSupported(VisionFeatures.InferenceFace); + + InteropFLD.Create(out _handle).Validate("Failed to create inference facial landmark detector."); + + try + { + InteropFLD.Configure(_handle).Validate("Failed to configure inference facial landmark detector."); + InteropFLD.Prepare(_handle).Validate("Failed to prepare inference facial landmark detector."); + } + catch (Exception e) + { + Log.Error(MediaVisionLog.Tag, e.ToString()); + InteropFLD.Destroy(_handle); + throw; + } + } + + /// + /// Finalizes an instance of the InferenceFacialLandmarkDetector class. + /// + ~InferenceFacialLandmarkDetector() + { + Dispose(false); + } + + /// + /// Detects facial landmark on the source image synchronously. + /// + /// + /// If there's no detected facial landmark, will be empty. + /// + /// The image data to detect facial landmark. + /// A label of detected facial landmark. + /// The InferenceFacialLandmarkDetector already has been disposed. + /// is null. + /// 12 + public InferenceFacialLandmarkDetectorResult Inference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropFLD.Inference(_handle, source.Handle).Validate("Failed to inference facial landmark detection."); + + return new InferenceFacialLandmarkDetectorResult(_handle); + } + + /// + /// Detects facial landmark on the source image asynchronously. + /// + /// + /// If there's no detected facial landmark, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// The image data to detect facial landmark. + /// The InferenceFacialLandmarkDetector already has been disposed. + /// is null. + /// 12 + public async Task InferenceAsync(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropFLD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference facial landmark detection."); + + return await Task.Factory.StartNew(() => new InferenceFacialLandmarkDetectorResult(_handle), + CancellationToken.None, + TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, + TaskScheduler.Default); + } + + /// + /// Requests to detect facial landmark on the given source image.
+ ///
+ /// + /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
+ /// If there's no detected facial landmark, will be empty.
+ /// Note that this API could use about twice as much memory as . + ///
+ /// The image data to detect facial landmark. + /// The InferenceFacialLandmarkDetector already has been disposed. + /// is null. + /// + /// 12 + public void RequestInference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropFLD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference facial landmark detection."); + } + + /// + /// Gets the point as a result of . + /// + /// + /// If there's no detected facial landmark, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// A point of detected facial landmark. + /// The InferenceFacialLandmarkDetector already has been disposed. + /// + /// 12 + public InferenceFacialLandmarkDetectorResult GetPoint() + { + return new InferenceFacialLandmarkDetectorResult(_handle); + } + + /// + /// Releases the unmanaged resources used by the InferenceFacialLandmarkDetector. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// 12 + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + + if (_handle != IntPtr.Zero) + { + InteropFLD.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the InferenceFacialLandmarkDetector. + /// + /// 12 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Error(MediaVisionLog.Tag, "InferenceFacialLandmarkDetector handle is disposed."); + throw new ObjectDisposedException(nameof(InferenceFacialLandmarkDetector)); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs new file mode 100755 index 00000000000..04a8ce454e7 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using InteropFLD = Interop.MediaVision.InferenceFacialLandmarkDetection; + + +namespace Tizen.Multimedia.Vision +{ + /// + /// Represents the result of operations. + /// + /// 12 + public class InferenceFacialLandmarkDetectorResult + { + internal InferenceFacialLandmarkDetectorResult(IntPtr handle) + { + InteropFLD.GetResultCount(handle, out ulong requestOrder, out uint count). + Validate("Failed to get result count."); + + RequestOrder = requestOrder; + var points = new List(); + + for (uint i = 0 ; i < count ; i++) + { + InteropFLD.GetPoint(handle, i, out uint x, out uint y).Validate("Failed to get point."); + points.Add(new Point((int)x, (int)y)); + } + + Point = points; + } + + /// + /// Gets the requested order. + /// + /// The requested order. + /// 12 + public ulong RequestOrder { get; } + + /// + /// Gets the point of the detected facial landmark. + /// + /// 12 + public IEnumerable Point { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + /// 12 + public override string ToString() => $"Point={Point}"; + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs new file mode 100644 index 00000000000..ed32a65a381 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; +using System.Threading.Tasks; +using InteropIC = Interop.MediaVision.InferenceImageClassification; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Provides the ability to classify image. + /// + /// http://tizen.org/feature/vision.inference + /// http://tizen.org/feature/vision.inference.image + /// 12 + public class InferenceImageClassifier : IDisposable + { + private IntPtr _handle; + private bool _disposed; + + /// Initializes a new instance of the class. + /// The required features are not supported. + /// 12 + public InferenceImageClassifier() + { + ValidationUtil.ValidateFeatureSupported(VisionFeatures.Inference); + ValidationUtil.ValidateFeatureSupported(VisionFeatures.InferenceImage); + + InteropIC.Create(out _handle).Validate("Failed to create inference image classifier."); + + try + { + InteropIC.Configure(_handle).Validate("Failed to configure inference image classifier."); + InteropIC.Prepare(_handle).Validate("Failed to prepare inference image classifier."); + } + catch (Exception e) + { + Log.Error(MediaVisionLog.Tag, e.ToString()); + InteropIC.Destroy(_handle); + throw; + } + } + + /// + /// Finalizes an instance of the InferenceImageClassifier class. + /// + ~InferenceImageClassifier() + { + Dispose(false); + } + + /// + /// Classifies image objects on the source image synchronously. + /// + /// + /// If there's no classified image, will be empty. + /// + /// The image data to classify. + /// A label of classified image. + /// The InferenceImageClassifier already has been disposed. + /// is null. + /// 12 + public InferenceImageClassifierResult Inference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropIC.Inference(_handle, source.Handle).Validate("Failed to inference image classification"); + + return new InferenceImageClassifierResult(_handle); + } + + /// + /// Classifies image objects on the source image asynchronously. + /// + /// + /// If there's no classified image, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// The image data to classify. + /// The InferenceImageClassifier already has been disposed. + /// is null. + /// 12 + public async Task InferenceAsync(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropIC.InferenceAsync(_handle, source.Handle).Validate("Failed to inference image classification"); + + return await Task.Factory.StartNew(() => new InferenceImageClassifierResult(_handle), + CancellationToken.None, + TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, + TaskScheduler.Default); + } + + /// + /// Requests to classify image objects on the given source image.
+ ///
+ /// + /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
+ /// If there's no classified image, will be empty.
+ /// Note that this API could use about twice as much memory as . + ///
+ /// The image data to classify. + /// The InferenceImageClassifier already has been disposed. + /// is null. + /// + /// 12 + public void RequestInference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropIC.InferenceAsync(_handle, source.Handle).Validate("Failed to inference image classification."); + } + + /// + /// Gets the label as a result of . + /// + /// + /// If there's no classified image, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// A label of classified image. + /// The InferenceImageClassifier already has been disposed. + /// + /// 12 + public InferenceImageClassifierResult GetLabel() + { + return new InferenceImageClassifierResult(_handle); + } + + /// + /// Releases the unmanaged resources used by the InferenceImageClassifier. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// 12 + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + + if (_handle != IntPtr.Zero) + { + InteropIC.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the InferenceImageClassifier. + /// + /// 12 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Error(MediaVisionLog.Tag, "InferenceImageClassifier handle is disposed."); + throw new ObjectDisposedException(nameof(InferenceImageClassifier)); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs new file mode 100755 index 00000000000..fe2afb7f9c9 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using InteropIC = Interop.MediaVision.InferenceImageClassification; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Represents the result of operations. + /// + /// 12 + public class InferenceImageClassifierResult + { + internal InferenceImageClassifierResult(IntPtr handle) + { + InteropIC.GetResultCount(handle, out ulong frameNumber, out uint count). + Validate("Failed to get result count."); + + FrameNumber = frameNumber; + var labels = new List(); + + for (uint i = 0 ; i < count ; i++) + { + InteropIC.GetLabel(handle, i, out IntPtr label).Validate("Failed to get label."); + labels.Add(Marshal.PtrToStringAnsi(label)); + } + + Labels = labels; + } + + /// + /// Gets the frame number. + /// + /// This means that this result is + /// 12 + public ulong FrameNumber { get; } + + /// + /// Gets the labels of the classified image. + /// + /// 12 + public IEnumerable Labels { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + /// 12 + public override string ToString() => $"Label={Labels}"; + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs new file mode 100644 index 00000000000..fbbc31883f4 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; +using System.Threading.Tasks; +using InteropOD = Interop.MediaVision.InferenceObjectDetection; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Provides the ability to detect object. + /// + /// http://tizen.org/feature/vision.inference + /// http://tizen.org/feature/vision.inference.image + /// 12 + public class InferenceObjectDetector : IDisposable + { + private IntPtr _handle; + private bool _disposed; + + /// Initializes a new instance of the class. + /// The required features are not supported. + /// 12 + public InferenceObjectDetector() + { + ValidationUtil.ValidateFeatureSupported(VisionFeatures.Inference); + ValidationUtil.ValidateFeatureSupported(VisionFeatures.InferenceImage); + + InteropOD.Create(out _handle).Validate("Failed to create inference object detector."); + + try + { + InteropOD.Configure(_handle).Validate("Failed to configure inference object detector."); + InteropOD.Prepare(_handle).Validate("Failed to prepare inference object detector."); + } + catch (Exception e) + { + Log.Error(MediaVisionLog.Tag, e.ToString()); + InteropOD.Destroy(_handle); + throw; + } + } + + /// + /// Finalizes an instance of the InferenceObjectDetector class. + /// + ~InferenceObjectDetector() + { + Dispose(false); + } + + /// + /// Detects object on the source image synchronously. + /// + /// + /// If there's no detected object, will be empty. + /// + /// The image data to detect object. + /// A label of detected object. + /// The InferenceObjectDetector already has been disposed. + /// is null. + /// 12 + public InferenceObjectDetectorResult Inference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropOD.Inference(_handle, source.Handle).Validate("Failed to inference object detection."); + + return new InferenceObjectDetectorResult(_handle); + } + + /// + /// Detects object on the source image asynchronously. + /// + /// + /// If there's no detected object, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// The image data to detect object. + /// The InferenceObjectDetector already has been disposed. + /// is null. + /// 12 + public async Task InferenceAsync(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropOD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference object detection."); + + return await Task.Factory.StartNew(() => new InferenceObjectDetectorResult(_handle), + CancellationToken.None, + TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, + TaskScheduler.Default); + } + + /// + /// Requests to detect object on the given source image.
+ ///
+ /// + /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
+ /// If there's no detected object, will be empty.
+ /// Note that this API could use about twice as much memory as . + ///
+ /// The image data to detect object. + /// The InferenceObjectDetector already has been disposed. + /// is null. + /// + /// 12 + public void RequestInference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropOD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference object detection."); + } + + /// + /// Gets the bound box as a result of . + /// + /// + /// If there's no detected object, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// A bound box of detected object. + /// The InferenceObjectDetector already has been disposed. + /// + /// 12 + public InferenceObjectDetectorResult GetBoundBox() + { + return new InferenceObjectDetectorResult(_handle); + } + + /// + /// Releases the unmanaged resources used by the InferenceObjectDetector. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// 12 + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + + if (_handle != IntPtr.Zero) + { + InteropOD.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the InferenceObjectDetector. + /// + /// 12 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Error(MediaVisionLog.Tag, "InferenceObjectDetector handle is disposed."); + throw new ObjectDisposedException(nameof(InferenceObjectDetector)); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs new file mode 100755 index 00000000000..11f48aa9f45 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using InteropOD = Interop.MediaVision.InferenceObjectDetection; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Represents the result of operations. + /// + /// 12 + public class InferenceObjectDetectorResult + { + internal InferenceObjectDetectorResult(IntPtr handle) + { + InteropOD.GetResultCount(handle, out ulong requestOrder, out uint count). + Validate("Failed to get result count."); + + RequestOrder = requestOrder; + var boundBoxes = new List(); + + for (uint i = 0 ; i < count ; i++) + { + InteropOD.GetBoundBox(handle, i, out int left, out int top, out int right, out int bottom). + Validate("Failed to get bound box."); + boundBoxes.Add(new Rectangle(left, top, right - left, bottom - top)); + } + + BoundBox = boundBoxes; + } + + /// + /// Gets the requested order. + /// + /// The requested order. + /// 12 + public ulong RequestOrder { get; } + + /// + /// Gets the boundBox of the detected object. + /// + /// 12 + public IEnumerable BoundBox { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + /// 12 + public override string ToString() => $"BoundBox={BoundBox}"; + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs new file mode 100644 index 00000000000..316a0fbd290 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; +using System.Threading.Tasks; +using InteropPLD = Interop.MediaVision.InferencePoseLandmarkDetection; + +namespace Tizen.Multimedia.Vision +{ + /// + /// Provides the ability to detect pose landmark. + /// + /// http://tizen.org/feature/vision.inference + /// http://tizen.org/feature/vision.inference.face + /// 12 + public class InferencePoseLandmarkDetector : IDisposable + { + private IntPtr _handle; + private bool _disposed; + + /// Initializes a new instance of the class. + /// The required features are not supported. + /// 12 + public InferencePoseLandmarkDetector() + { + ValidationUtil.ValidateFeatureSupported(VisionFeatures.Inference); + ValidationUtil.ValidateFeatureSupported(VisionFeatures.InferenceFace); + + InteropPLD.Create(out _handle).Validate("Failed to create inference pose landmark detector."); + + try + { + InteropPLD.Configure(_handle).Validate("Failed to configure inference pose landmark detector."); + InteropPLD.Prepare(_handle).Validate("Failed to prepare inference pose landmark detector."); + } + catch (Exception e) + { + Log.Error(MediaVisionLog.Tag, e.ToString()); + InteropPLD.Destroy(_handle); + throw; + } + } + + /// + /// Finalizes an instance of the InferencePoseLandmarkDetector class. + /// + ~InferencePoseLandmarkDetector() + { + Dispose(false); + } + + /// + /// Detects pose landmark on the source image synchronously. + /// + /// + /// If there's no detected pose landmark, will be empty. + /// + /// The image data to detect pose landmark. + /// A label of detected pose landmark. + /// The InferencePoseLandmarkDetector already has been disposed. + /// is null. + /// 12 + public InferencePoseLandmarkDetectorResult Inference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropPLD.Inference(_handle, source.Handle).Validate("Failed to inference pose landmark detection."); + + return new InferencePoseLandmarkDetectorResult(_handle); + } + + /// + /// Detects pose landmark on the source image asynchronously. + /// + /// + /// If there's no detected pose landmark, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// The image data to detect pose landmark. + /// The InferencePoseLandmarkDetector already has been disposed. + /// is null. + /// 12 + public async Task InferenceAsync(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropPLD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference pose landmark detection."); + + return await Task.Factory.StartNew(() => new InferencePoseLandmarkDetectorResult(_handle), + CancellationToken.None, + TaskCreationOptions.DenyChildAttach | TaskCreationOptions.LongRunning, + TaskScheduler.Default); + } + + /// + /// Requests to detect pose landmark on the given source image.
+ ///
+ /// + /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
+ /// If there's no detected pose landmark, will be empty.
+ /// Note that this API could use about twice as much memory as . + ///
+ /// The image data to detect pose landmark. + /// The InferencePoseLandmarkDetector already has been disposed. + /// is null. + /// + /// 12 + public void RequestInference(MediaVisionSource source) + { + ValidateNotDisposed(); + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InteropPLD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference pose landmark detection."); + } + + /// + /// Gets the point as a result of . + /// + /// + /// If there's no detected pose landmark, will be empty.
+ /// This API uses about twice as much memory as . + ///
+ /// A point of detected pose landmark. + /// The InferencePoseLandmarkDetector already has been disposed. + /// + /// 12 + public InferencePoseLandmarkDetectorResult GetPoint() + { + return new InferencePoseLandmarkDetectorResult(_handle); + } + + /// + /// Releases the unmanaged resources used by the InferencePoseLandmarkDetector. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// 12 + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + + if (_handle != IntPtr.Zero) + { + InteropPLD.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the InferencePoseLandmarkDetector. + /// + /// 12 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Error(MediaVisionLog.Tag, "InferencePoseLandmarkDetector handle is disposed."); + throw new ObjectDisposedException(nameof(InferencePoseLandmarkDetector)); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs new file mode 100755 index 00000000000..06e2728b199 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using InteropPLD = Interop.MediaVision.InferencePoseLandmarkDetection; + + +namespace Tizen.Multimedia.Vision +{ + /// + /// Represents the result of operations. + /// + /// 12 + public class InferencePoseLandmarkDetectorResult + { + internal InferencePoseLandmarkDetectorResult(IntPtr handle) + { + InteropPLD.GetResultCount(handle, out ulong requestOrder, out uint count). + Validate("Failed to get result count."); + + RequestOrder = requestOrder; + var points = new List(); + + for (uint i = 0 ; i < count ; i++) + { + InteropPLD.GetPoint(handle, i, out uint x, out uint y).Validate("Failed to get point."); + points.Add(new Point((int)x, (int)y)); + } + + Point = points; + } + + /// + /// Gets the requested order. + /// + /// The requested order. + /// 12 + public ulong RequestOrder { get; } + + /// + /// Gets the point of the detected pose landmark. + /// + /// 12 + public IEnumerable Point { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + /// 12 + public override string ToString() => $"Point={Point}"; + } +} From 4e8225bfcf4ff7d46a8560463925be5f00059307 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Tue, 10 Sep 2024 14:11:14 +0900 Subject: [PATCH 2/5] [MediaVision] Remove uselsess method --- .../MediaVision/InferenceFaceDetectorResult.cs | 7 ------- .../MediaVision/InferenceFacialLandmarkDetectorResult.cs | 7 ------- .../MediaVision/InferenceImageClassifierResult.cs | 7 ------- .../MediaVision/InferenceObjectDetectorResult.cs | 7 ------- .../MediaVision/InferencePoseLandmarkDetectorResult.cs | 7 ------- 5 files changed, 35 deletions(-) diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs index 786ee168905..30cadc98cfc 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs @@ -56,12 +56,5 @@ internal InferenceFaceDetectorResult(IntPtr handle) /// /// 12 public IEnumerable BoundBox { get; } - - /// - /// Returns a string that represents the current object. - /// - /// A string that represents the current object. - /// 12 - public override string ToString() => $"BoundBox={BoundBox}"; } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs index 04a8ce454e7..e09ad5d965e 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs @@ -56,12 +56,5 @@ internal InferenceFacialLandmarkDetectorResult(IntPtr handle) /// /// 12 public IEnumerable Point { get; } - - /// - /// Returns a string that represents the current object. - /// - /// A string that represents the current object. - /// 12 - public override string ToString() => $"Point={Point}"; } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs index fe2afb7f9c9..a5b1244df37 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs @@ -56,12 +56,5 @@ internal InferenceImageClassifierResult(IntPtr handle) /// /// 12 public IEnumerable Labels { get; } - - /// - /// Returns a string that represents the current object. - /// - /// A string that represents the current object. - /// 12 - public override string ToString() => $"Label={Labels}"; } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs index 11f48aa9f45..f18dbd4a1b8 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs @@ -56,12 +56,5 @@ internal InferenceObjectDetectorResult(IntPtr handle) /// /// 12 public IEnumerable BoundBox { get; } - - /// - /// Returns a string that represents the current object. - /// - /// A string that represents the current object. - /// 12 - public override string ToString() => $"BoundBox={BoundBox}"; } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs index 06e2728b199..c24174e7d54 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs @@ -56,12 +56,5 @@ internal InferencePoseLandmarkDetectorResult(IntPtr handle) /// /// 12 public IEnumerable Point { get; } - - /// - /// Returns a string that represents the current object. - /// - /// A string that represents the current object. - /// 12 - public override string ToString() => $"Point={Point}"; } } From d54054f7a62f4953d12cbbef6bc57f0aaeaad4d6 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Tue, 10 Sep 2024 14:27:57 +0900 Subject: [PATCH 3/5] [MediaVision] Change property name --- .../Interop/Interop.MediaVision.Inference.cs | 4 ++-- .../InferenceFacialLandmarkDetector.cs | 18 +++++++++--------- .../InferenceFacialLandmarkDetectorResult.cs | 12 ++++++------ .../InferencePoseLandmarkDetector.cs | 18 +++++++++--------- .../InferencePoseLandmarkDetectorResult.cs | 12 ++++++------ 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs index 15d5c7eeea3..fb84d1acc4d 100644 --- a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs @@ -222,7 +222,7 @@ internal static partial class InferenceFacialLandmarkDetection internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_get_position")] - internal static extern MediaVisionError GetPoint(IntPtr handle, uint index, out uint posX, out uint posY); + internal static extern MediaVisionError GetPosition(IntPtr handle, uint index, out uint posX, out uint posY); } internal static partial class InferencePoseLandmarkDetection @@ -250,7 +250,7 @@ internal static partial class InferencePoseLandmarkDetection internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_get_position")] - internal static extern MediaVisionError GetPoint(IntPtr handle, uint index, out uint posX, out uint posY); + internal static extern MediaVisionError GetPosition(IntPtr handle, uint index, out uint posX, out uint posY); } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs index c252c89d214..96f913162e4 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs @@ -67,7 +67,7 @@ public InferenceFacialLandmarkDetector() /// Detects facial landmark on the source image synchronously. /// /// - /// If there's no detected facial landmark, will be empty. + /// If there's no detected facial landmark, will be empty. /// /// The image data to detect facial landmark. /// A label of detected facial landmark. @@ -92,7 +92,7 @@ public InferenceFacialLandmarkDetectorResult Inference(MediaVisionSource source) /// Detects facial landmark on the source image asynchronously. /// /// - /// If there's no detected facial landmark, will be empty.
+ /// If there's no detected facial landmark, will be empty.
/// This API uses about twice as much memory as . ///
/// The image data to detect facial landmark. @@ -120,15 +120,15 @@ public async Task InferenceAsync(MediaVis /// Requests to detect facial landmark on the given source image.
/// /// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
/// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no detected facial landmark, will be empty.
+ /// If there's no detected facial landmark, will be empty.
/// Note that this API could use about twice as much memory as . ///
/// The image data to detect facial landmark. /// The InferenceFacialLandmarkDetector already has been disposed. /// is null. - /// + /// /// 12 public void RequestInference(MediaVisionSource source) { @@ -143,17 +143,17 @@ public void RequestInference(MediaVisionSource source) } /// - /// Gets the point as a result of . + /// Gets the position as a result of . /// /// - /// If there's no detected facial landmark, will be empty.
+ /// If there's no detected facial landmark, will be empty.
/// This API uses about twice as much memory as . ///
- /// A point of detected facial landmark. + /// A position of detected facial landmark. /// The InferenceFacialLandmarkDetector already has been disposed. /// /// 12 - public InferenceFacialLandmarkDetectorResult GetPoint() + public InferenceFacialLandmarkDetectorResult GetPosition() { return new InferenceFacialLandmarkDetectorResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs index e09ad5d965e..fb05cd43363 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs @@ -33,15 +33,15 @@ internal InferenceFacialLandmarkDetectorResult(IntPtr handle) Validate("Failed to get result count."); RequestOrder = requestOrder; - var points = new List(); + var positions = new List(); for (uint i = 0 ; i < count ; i++) { - InteropFLD.GetPoint(handle, i, out uint x, out uint y).Validate("Failed to get point."); - points.Add(new Point((int)x, (int)y)); + InteropFLD.GetPosition(handle, i, out uint x, out uint y).Validate("Failed to get position."); + positions.Add(new Point((int)x, (int)y)); } - Point = points; + Position = positions; } /// @@ -52,9 +52,9 @@ internal InferenceFacialLandmarkDetectorResult(IntPtr handle) public ulong RequestOrder { get; } /// - /// Gets the point of the detected facial landmark. + /// Gets the position of the detected facial landmark. /// /// 12 - public IEnumerable Point { get; } + public IEnumerable Position { get; } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs index 316a0fbd290..6139c97f076 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs @@ -67,7 +67,7 @@ public InferencePoseLandmarkDetector() /// Detects pose landmark on the source image synchronously. /// /// - /// If there's no detected pose landmark, will be empty. + /// If there's no detected pose landmark, will be empty. /// /// The image data to detect pose landmark. /// A label of detected pose landmark. @@ -92,7 +92,7 @@ public InferencePoseLandmarkDetectorResult Inference(MediaVisionSource source) /// Detects pose landmark on the source image asynchronously. /// /// - /// If there's no detected pose landmark, will be empty.
+ /// If there's no detected pose landmark, will be empty.
/// This API uses about twice as much memory as . ///
/// The image data to detect pose landmark. @@ -120,15 +120,15 @@ public async Task InferenceAsync(MediaVisio /// Requests to detect pose landmark on the given source image.
/// /// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
+ /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
/// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no detected pose landmark, will be empty.
+ /// If there's no detected pose landmark, will be empty.
/// Note that this API could use about twice as much memory as . ///
/// The image data to detect pose landmark. /// The InferencePoseLandmarkDetector already has been disposed. /// is null. - /// + /// /// 12 public void RequestInference(MediaVisionSource source) { @@ -143,17 +143,17 @@ public void RequestInference(MediaVisionSource source) } /// - /// Gets the point as a result of . + /// Gets the position as a result of . /// /// - /// If there's no detected pose landmark, will be empty.
+ /// If there's no detected pose landmark, will be empty.
/// This API uses about twice as much memory as . ///
- /// A point of detected pose landmark. + /// A position of detected pose landmark. /// The InferencePoseLandmarkDetector already has been disposed. /// /// 12 - public InferencePoseLandmarkDetectorResult GetPoint() + public InferencePoseLandmarkDetectorResult GetPosition() { return new InferencePoseLandmarkDetectorResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs index c24174e7d54..b6419aad81d 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs @@ -33,15 +33,15 @@ internal InferencePoseLandmarkDetectorResult(IntPtr handle) Validate("Failed to get result count."); RequestOrder = requestOrder; - var points = new List(); + var positions = new List(); for (uint i = 0 ; i < count ; i++) { - InteropPLD.GetPoint(handle, i, out uint x, out uint y).Validate("Failed to get point."); - points.Add(new Point((int)x, (int)y)); + InteropPLD.GetPosition(handle, i, out uint x, out uint y).Validate("Failed to get position."); + positions.Add(new Point((int)x, (int)y)); } - Point = points; + Position = positions; } /// @@ -52,9 +52,9 @@ internal InferencePoseLandmarkDetectorResult(IntPtr handle) public ulong RequestOrder { get; } /// - /// Gets the point of the detected pose landmark. + /// Gets the position of the detected pose landmark. /// /// 12 - public IEnumerable Point { get; } + public IEnumerable Position { get; } } } From 79d048a90d591f9695f3968fc36caf4d6907d31f Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Thu, 12 Sep 2024 14:12:05 +0900 Subject: [PATCH 4/5] [MediaVision] Change API signature and description --- .../Interop/Interop.MediaVision.Inference.cs | 18 +++---- .../MediaVision/InferenceFaceDetector.cs | 48 ++++++++++--------- .../InferenceFaceDetectorResult.cs | 25 +++++----- .../InferenceFacialLandmarkDetector.cs | 47 +++++++++--------- .../InferenceFacialLandmarkDetectorResult.cs | 23 ++++----- .../MediaVision/InferenceImageClassifier.cs | 40 +++++++++------- .../InferenceImageClassifierResult.cs | 13 ++--- .../MediaVision/InferenceObjectDetector.cs | 40 +++++++++------- .../InferenceObjectDetectorResult.cs | 25 +++++----- .../InferencePoseLandmarkDetector.cs | 40 +++++++++------- .../InferencePoseLandmarkDetectorResult.cs | 23 ++++----- 11 files changed, 183 insertions(+), 159 deletions(-) diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs index fb84d1acc4d..dbd93354e86 100644 --- a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Inference.cs @@ -138,7 +138,7 @@ internal static partial class InferenceImageClassification internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); [DllImport(Libraries.MediaVisionInferenceImageClassification, EntryPoint = "mv_image_classification_get_label")] - internal static extern MediaVisionError GetLabel(IntPtr handle, uint index, out IntPtr label); + internal static extern MediaVisionError GetLabels(IntPtr handle, uint index, out IntPtr label); } internal static partial class InferenceFaceDetection @@ -163,10 +163,10 @@ internal static partial class InferenceFaceDetection internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_get_result_count")] - internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestId, out uint count); [DllImport(Libraries.MediaVisionInferenceFaceDetection, EntryPoint = "mv_face_detection_get_bound_box")] - internal static extern MediaVisionError GetBoundBox(IntPtr handle, uint index, out int left, out int top, out int right, out int bottom); + internal static extern MediaVisionError GetBoundingBoxes(IntPtr handle, uint index, out int left, out int top, out int right, out int bottom); } internal static partial class InferenceObjectDetection @@ -191,10 +191,10 @@ internal static partial class InferenceObjectDetection internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_get_result_count")] - internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestId, out uint count); [DllImport(Libraries.MediaVisionInferenceObjectDetection, EntryPoint = "mv_object_detection_get_bound_box")] - internal static extern MediaVisionError GetBoundBox(IntPtr handle, uint index, out int left, out int top, out int right, out int bottom); + internal static extern MediaVisionError GetBoundingBoxes(IntPtr handle, uint index, out int left, out int top, out int right, out int bottom); } internal static partial class InferenceFacialLandmarkDetection @@ -219,10 +219,10 @@ internal static partial class InferenceFacialLandmarkDetection internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_get_result_count")] - internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestId, out uint count); [DllImport(Libraries.MediaVisionInferenceFacialLandmarkDetection, EntryPoint = "mv_facial_landmark_get_position")] - internal static extern MediaVisionError GetPosition(IntPtr handle, uint index, out uint posX, out uint posY); + internal static extern MediaVisionError GetPoints(IntPtr handle, uint index, out uint posX, out uint posY); } internal static partial class InferencePoseLandmarkDetection @@ -247,10 +247,10 @@ internal static partial class InferencePoseLandmarkDetection internal static extern MediaVisionError InferenceAsync(IntPtr handle, IntPtr source); [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_get_result_count")] - internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestOrder, out uint count); + internal static extern MediaVisionError GetResultCount(IntPtr handle, out ulong requestId, out uint count); [DllImport(Libraries.MediaVisionInferencePoseLandmarkDetection, EntryPoint = "mv_pose_landmark_get_position")] - internal static extern MediaVisionError GetPosition(IntPtr handle, uint index, out uint posX, out uint posY); + internal static extern MediaVisionError GetPoints(IntPtr handle, uint index, out uint posX, out uint posY); } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs index 05d358d441d..3f0dc65d2f6 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs @@ -22,7 +22,7 @@ namespace Tizen.Multimedia.Vision { /// - /// Provides the ability to detect face. + /// Provides the ability to detect faces. /// /// http://tizen.org/feature/vision.inference /// http://tizen.org/feature/vision.inference.face @@ -64,13 +64,13 @@ public InferenceFaceDetector() } /// - /// Detects face on the source image synchronously. + /// Detects faces on the source image synchronously. /// /// - /// If there's no detected face, will be empty. + /// can be empty, if there's no detected face. /// - /// The image data to detect face. - /// A label of detected face. + /// The image data to detect faces. + /// The BoundBoxes of detected face. /// The InferenceFaceDetector already has been disposed. /// is null. /// 12 @@ -89,13 +89,13 @@ public InferenceFaceDetectorResult Inference(MediaVisionSource source) } /// - /// Detects face on the source image asynchronously. + /// Detects faces on the source image asynchronously. /// /// - /// If there's no detected face, will be empty.
- /// This API uses about twice as much memory as . + /// can be empty, if there's no detected face.
+ /// This method uses about twice as much memory as . ///
- /// The image data to detect face. + /// The image data to detect faces. /// The InferenceFaceDetector already has been disposed. /// is null. /// 12 @@ -116,21 +116,23 @@ public async Task InferenceAsync(MediaVisionSource TaskScheduler.Default); } + private ulong _requestId = 1; /// - /// Requests to detect face on the given source image.
+ /// Requests detecting faces to get their bounding boxes asynchronously. ///
/// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
- /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no detected face, will be empty.
- /// Note that this API could use about twice as much memory as . + /// This function does not guarantee that inference is done when this method returns. The user can get the result by using .
+ /// If the user calls this method again before the previous one is finished internally, the call will be ignored.
+ /// can be empty, if there's no detected face.
+ /// Note that this method could use about twice as much memory as . ///
- /// The image data to detect face. + /// The image data to detect faces. + /// The request id that indicates the order of request. /// The InferenceFaceDetector already has been disposed. /// is null. - /// + /// /// 12 - public void RequestInference(MediaVisionSource source) + public ulong RequestInference(MediaVisionSource source) { ValidateNotDisposed(); @@ -140,20 +142,22 @@ public void RequestInference(MediaVisionSource source) } InteropFD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference face detection."); + + return _requestId++; } /// - /// Gets the bound box as a result of . + /// Gets the bounding boxes as a result of . /// /// - /// If there's no detected face, will be empty.
- /// This API uses about twice as much memory as . + /// If there's no detected face, will be empty.
+ /// This method uses about twice as much memory as . ///
- /// A bound box of detected face. + /// The bounding boxes of detected face. /// The InferenceFaceDetector already has been disposed. /// /// 12 - public InferenceFaceDetectorResult GetBoundBox() + public InferenceFaceDetectorResult GetRequestResults() { return new InferenceFaceDetectorResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs index 30cadc98cfc..d85aaad4b59 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs @@ -28,33 +28,34 @@ public class InferenceFaceDetectorResult { internal InferenceFaceDetectorResult(IntPtr handle) { - InteropFD.GetResultCount(handle, out ulong requestOrder, out uint count). + InteropFD.GetResultCount(handle, out ulong requestId, out uint count). Validate("Failed to get result count."); - RequestOrder = requestOrder; - var boundBoxes = new List(); + RequestId = requestId; + var boundingBoxes = new List(); for (uint i = 0 ; i < count ; i++) { - InteropFD.GetBoundBox(handle, i, out int left, out int top, out int right, out int bottom). - Validate("Failed to get bound box."); - boundBoxes.Add(new Rectangle(left, top, right - left, bottom - top)); + InteropFD.GetBoundingBoxes(handle, i, out int left, out int top, out int right, out int bottom). + Validate("Failed to get bounding boxes."); + boundingBoxes.Add(new Rectangle(left, top, right - left, bottom - top)); } - BoundBox = boundBoxes; + BoundingBoxes = boundingBoxes; } /// - /// Gets the requested order. + /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// It represents the order of request. ///
- /// The requested order. + /// The request id that indicates the order of request. /// 12 - public ulong RequestOrder { get; } + public ulong RequestId { get; } /// - /// Gets the boundBox of the detected face. + /// Gets the bounding boxes of the detected face. /// /// 12 - public IEnumerable BoundBox { get; } + public IEnumerable BoundingBoxes { get; } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs index 96f913162e4..93e41039581 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs @@ -22,7 +22,7 @@ namespace Tizen.Multimedia.Vision { /// - /// Provides the ability to detect facial landmark. + /// Provides the ability to detect facial landmarks. /// /// http://tizen.org/feature/vision.inference /// http://tizen.org/feature/vision.inference.face @@ -64,13 +64,13 @@ public InferenceFacialLandmarkDetector() } /// - /// Detects facial landmark on the source image synchronously. + /// Detects facial landmarks on the source image synchronously. /// /// - /// If there's no detected facial landmark, will be empty. + /// can be empty, if there's no detected facial landmark. /// - /// The image data to detect facial landmark. - /// A label of detected facial landmark. + /// The image data to detect facial landmarks. + /// The points of detected facial landmarks. /// The InferenceFacialLandmarkDetector already has been disposed. /// is null. /// 12 @@ -89,13 +89,13 @@ public InferenceFacialLandmarkDetectorResult Inference(MediaVisionSource source) } /// - /// Detects facial landmark on the source image asynchronously. + /// Detects facial landmarks on the source image asynchronously. /// /// - /// If there's no detected facial landmark, will be empty.
- /// This API uses about twice as much memory as . + /// can be empty, if there's no detected facial landmark.
+ /// This method uses about twice as much memory as . ///
- /// The image data to detect facial landmark. + /// The image data to detect facial landmarks. /// The InferenceFacialLandmarkDetector already has been disposed. /// is null. /// 12 @@ -116,21 +116,23 @@ public async Task InferenceAsync(MediaVis TaskScheduler.Default); } + private ulong _requestId = 1; /// - /// Requests to detect facial landmark on the given source image.
+ /// Requests detecting facial landmarks to get their points asynchronously. ///
/// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
- /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no detected facial landmark, will be empty.
- /// Note that this API could use about twice as much memory as . + /// This function does not guarantee that inference is done when this method returns. The user can get the result by using .
+ /// If the user calls this method again before the previous one is finished internally, the call will be ignored.
+ /// can be empty, if there's no detected facial landmark.
+ /// Note that this method could use about twice as much memory as . ///
- /// The image data to detect facial landmark. + /// The image data to detect facial landmarks. + /// The request id that indicates the order of request. /// The InferenceFacialLandmarkDetector already has been disposed. /// is null. - /// + /// /// 12 - public void RequestInference(MediaVisionSource source) + public ulong RequestInference(MediaVisionSource source) { ValidateNotDisposed(); @@ -140,20 +142,21 @@ public void RequestInference(MediaVisionSource source) } InteropFLD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference facial landmark detection."); + return _requestId++; } /// - /// Gets the position as a result of . + /// Gets the points as a result of . /// /// - /// If there's no detected facial landmark, will be empty.
- /// This API uses about twice as much memory as . + /// If there's no detected facial landmark, will be empty.
+ /// This method uses about twice as much memory as . ///
- /// A position of detected facial landmark. + /// The points of detected facial landmarks. /// The InferenceFacialLandmarkDetector already has been disposed. /// /// 12 - public InferenceFacialLandmarkDetectorResult GetPosition() + public InferenceFacialLandmarkDetectorResult GetRequestResults() { return new InferenceFacialLandmarkDetectorResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs index fb05cd43363..9d4af7c92b3 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs @@ -29,32 +29,33 @@ public class InferenceFacialLandmarkDetectorResult { internal InferenceFacialLandmarkDetectorResult(IntPtr handle) { - InteropFLD.GetResultCount(handle, out ulong requestOrder, out uint count). + InteropFLD.GetResultCount(handle, out ulong requestId, out uint count). Validate("Failed to get result count."); - RequestOrder = requestOrder; - var positions = new List(); + RequestId = requestId; + var points = new List(); for (uint i = 0 ; i < count ; i++) { - InteropFLD.GetPosition(handle, i, out uint x, out uint y).Validate("Failed to get position."); - positions.Add(new Point((int)x, (int)y)); + InteropFLD.GetPoints(handle, i, out uint x, out uint y).Validate("Failed to get points."); + points.Add(new Point((int)x, (int)y)); } - Position = positions; + Points = points; } /// - /// Gets the requested order. + /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// It represents the order of request. ///
- /// The requested order. + /// The request id that indicates the order of request. /// 12 - public ulong RequestOrder { get; } + public ulong RequestId { get; } /// - /// Gets the position of the detected facial landmark. + /// Gets the points of the detected facial landmark. /// /// 12 - public IEnumerable Position { get; } + public IEnumerable Points { get; } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs index ed32a65a381..11ddd1adb79 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs @@ -64,13 +64,13 @@ public InferenceImageClassifier() } /// - /// Classifies image objects on the source image synchronously. + /// Classifies image synchronously. /// /// - /// If there's no classified image, will be empty. + /// can be empty, if image is not classified. /// /// The image data to classify. - /// A label of classified image. + /// The labels of classified image. /// The InferenceImageClassifier already has been disposed. /// is null. /// 12 @@ -89,11 +89,11 @@ public InferenceImageClassifierResult Inference(MediaVisionSource source) } /// - /// Classifies image objects on the source image asynchronously. + /// Classifies image asynchronously. /// /// - /// If there's no classified image, will be empty.
- /// This API uses about twice as much memory as . + /// can be empty, if image is not classified.
+ /// This method uses about twice as much memory as . ///
/// The image data to classify. /// The InferenceImageClassifier already has been disposed. @@ -116,21 +116,23 @@ public async Task InferenceAsync(MediaVisionSour TaskScheduler.Default); } + private ulong _requestId = 1; /// - /// Requests to classify image objects on the given source image.
+ /// Requests classifing image to get its labels asynchronously. ///
/// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
- /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no classified image, will be empty.
- /// Note that this API could use about twice as much memory as . + /// This function does not guarantee that inference is done when this method returns. The user can get the result by using .
+ /// If the user calls this method again before the previous one is finished internally, the call will be ignored.
+ /// can be empty, if image is not classified.
+ /// Note that this method could use about twice as much memory as . ///
/// The image data to classify. + /// The request id that indicates the order of request. /// The InferenceImageClassifier already has been disposed. /// is null. - /// + /// /// 12 - public void RequestInference(MediaVisionSource source) + public ulong RequestInference(MediaVisionSource source) { ValidateNotDisposed(); @@ -140,20 +142,22 @@ public void RequestInference(MediaVisionSource source) } InteropIC.InferenceAsync(_handle, source.Handle).Validate("Failed to inference image classification."); + + return _requestId++; } /// - /// Gets the label as a result of . + /// Gets the labels as a result of . /// /// - /// If there's no classified image, will be empty.
- /// This API uses about twice as much memory as . + /// If image is not classified, will be empty.
+ /// This method uses about twice as much memory as . ///
- /// A label of classified image. + /// The labels of classified image. /// The InferenceImageClassifier already has been disposed. /// /// 12 - public InferenceImageClassifierResult GetLabel() + public InferenceImageClassifierResult GetRequestResults() { return new InferenceImageClassifierResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs index a5b1244df37..f112fa03cc0 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs @@ -29,15 +29,15 @@ public class InferenceImageClassifierResult { internal InferenceImageClassifierResult(IntPtr handle) { - InteropIC.GetResultCount(handle, out ulong frameNumber, out uint count). + InteropIC.GetResultCount(handle, out ulong requestId, out uint count). Validate("Failed to get result count."); - FrameNumber = frameNumber; + RequestId = requestId; var labels = new List(); for (uint i = 0 ; i < count ; i++) { - InteropIC.GetLabel(handle, i, out IntPtr label).Validate("Failed to get label."); + InteropIC.GetLabels(handle, i, out IntPtr label).Validate("Failed to get labels."); labels.Add(Marshal.PtrToStringAnsi(label)); } @@ -45,11 +45,12 @@ internal InferenceImageClassifierResult(IntPtr handle) } /// - /// Gets the frame number. + /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// It represents the order of request. ///
- /// This means that this result is + /// The request id that indicates the order of request. /// 12 - public ulong FrameNumber { get; } + public ulong RequestId { get; } /// /// Gets the labels of the classified image. diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs index fbbc31883f4..593779dc2d8 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs @@ -64,13 +64,13 @@ public InferenceObjectDetector() } /// - /// Detects object on the source image synchronously. + /// Detects objects on the source image synchronously. /// /// - /// If there's no detected object, will be empty. + /// can be empty, if there's no detected object. /// /// The image data to detect object. - /// A label of detected object. + /// BoundBoxes of detected object. /// The InferenceObjectDetector already has been disposed. /// is null. /// 12 @@ -89,11 +89,11 @@ public InferenceObjectDetectorResult Inference(MediaVisionSource source) } /// - /// Detects object on the source image asynchronously. + /// Detects objects on the source image asynchronously. /// /// - /// If there's no detected object, will be empty.
- /// This API uses about twice as much memory as . + /// can be empty, if there's no detected object.
+ /// This method uses about twice as much memory as . ///
/// The image data to detect object. /// The InferenceObjectDetector already has been disposed. @@ -116,21 +116,23 @@ public async Task InferenceAsync(MediaVisionSourc TaskScheduler.Default); } + private ulong _requestId = 1; /// - /// Requests to detect object on the given source image.
+ /// Requests detecting objects to get their bounding boxes asynchronously. ///
/// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
- /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no detected object, will be empty.
- /// Note that this API could use about twice as much memory as . + /// This function does not guarantee that inference is done when this method returns. The user can get the result by using .
+ /// If the user calls this method again before the previous one is finished internally, the call will be ignored.
+ /// can be empty, if there's no detected object.
+ /// Note that this method could use about twice as much memory as . ///
/// The image data to detect object. + /// The request id that indicates the order of request. /// The InferenceObjectDetector already has been disposed. /// is null. - /// + /// /// 12 - public void RequestInference(MediaVisionSource source) + public ulong RequestInference(MediaVisionSource source) { ValidateNotDisposed(); @@ -140,20 +142,22 @@ public void RequestInference(MediaVisionSource source) } InteropOD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference object detection."); + + return _requestId++; } /// - /// Gets the bound box as a result of . + /// Gets the bounding boxes as a result of . /// /// - /// If there's no detected object, will be empty.
- /// This API uses about twice as much memory as . + /// If there's no detected object, will be empty.
+ /// This method uses about twice as much memory as . ///
- /// A bound box of detected object. + /// The bounding boxes of detected object. /// The InferenceObjectDetector already has been disposed. /// /// 12 - public InferenceObjectDetectorResult GetBoundBox() + public InferenceObjectDetectorResult GetRequestResults() { return new InferenceObjectDetectorResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs index f18dbd4a1b8..49417339021 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs @@ -28,33 +28,34 @@ public class InferenceObjectDetectorResult { internal InferenceObjectDetectorResult(IntPtr handle) { - InteropOD.GetResultCount(handle, out ulong requestOrder, out uint count). + InteropOD.GetResultCount(handle, out ulong requestId, out uint count). Validate("Failed to get result count."); - RequestOrder = requestOrder; - var boundBoxes = new List(); + RequestId = requestId; + var boundingBoxes = new List(); for (uint i = 0 ; i < count ; i++) { - InteropOD.GetBoundBox(handle, i, out int left, out int top, out int right, out int bottom). - Validate("Failed to get bound box."); - boundBoxes.Add(new Rectangle(left, top, right - left, bottom - top)); + InteropOD.GetBoundingBoxes(handle, i, out int left, out int top, out int right, out int bottom). + Validate("Failed to get bounding boxes."); + boundingBoxes.Add(new Rectangle(left, top, right - left, bottom - top)); } - BoundBox = boundBoxes; + BoundingBoxes = boundingBoxes; } /// - /// Gets the requested order. + /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// It represents the order of request. ///
- /// The requested order. + /// The request id that indicates the order of request. /// 12 - public ulong RequestOrder { get; } + public ulong RequestId { get; } /// - /// Gets the boundBox of the detected object. + /// Gets the bounding boxes of the detected object. /// /// 12 - public IEnumerable BoundBox { get; } + public IEnumerable BoundingBoxes { get; } } } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs index 6139c97f076..89bb3740936 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs @@ -64,13 +64,13 @@ public InferencePoseLandmarkDetector() } /// - /// Detects pose landmark on the source image synchronously. + /// Detects pose landmarks on the source image synchronously. /// /// - /// If there's no detected pose landmark, will be empty. + /// can be empty, if there's no detected pose landmark. /// /// The image data to detect pose landmark. - /// A label of detected pose landmark. + /// The points of detected pose landmark. /// The InferencePoseLandmarkDetector already has been disposed. /// is null. /// 12 @@ -89,11 +89,11 @@ public InferencePoseLandmarkDetectorResult Inference(MediaVisionSource source) } /// - /// Detects pose landmark on the source image asynchronously. + /// Detects pose landmarks on the source image asynchronously. /// /// - /// If there's no detected pose landmark, will be empty.
- /// This API uses about twice as much memory as . + /// can be empty, if there's no detected pose landmark.
+ /// This method uses about twice as much memory as . ///
/// The image data to detect pose landmark. /// The InferencePoseLandmarkDetector already has been disposed. @@ -116,21 +116,23 @@ public async Task InferenceAsync(MediaVisio TaskScheduler.Default); } + private ulong _requestId = 1; /// - /// Requests to detect pose landmark on the given source image.
+ /// Requests detecting pose landmarks to get their points asynchronously. ///
/// - /// This API is not guranteed that inference is done when this method returns. The user can get the result by using .
- /// And the user call this API again before the previous one is finished internally, API call will be ignored until the previous one is finished.
- /// If there's no detected pose landmark, will be empty.
- /// Note that this API could use about twice as much memory as . + /// This function does not guarantee that inference is done when this method returns. The user can get the result by using .
+ /// If the user calls this method again before the previous one is finished internally, the call will be ignored.
+ /// can be empty, if there's no detected pose landmark.
+ /// Note that this method could use about twice as much memory as . ///
/// The image data to detect pose landmark. + /// The request id that indicates the order of request. /// The InferencePoseLandmarkDetector already has been disposed. /// is null. - /// + /// /// 12 - public void RequestInference(MediaVisionSource source) + public ulong RequestInference(MediaVisionSource source) { ValidateNotDisposed(); @@ -140,20 +142,22 @@ public void RequestInference(MediaVisionSource source) } InteropPLD.InferenceAsync(_handle, source.Handle).Validate("Failed to inference pose landmark detection."); + + return _requestId++; } /// - /// Gets the position as a result of . + /// Gets the points as a result of . /// /// - /// If there's no detected pose landmark, will be empty.
- /// This API uses about twice as much memory as . + /// If there's no detected pose landmark, will be empty.
+ /// This method uses about twice as much memory as . ///
- /// A position of detected pose landmark. + /// The points of detected pose landmark. /// The InferencePoseLandmarkDetector already has been disposed. /// /// 12 - public InferencePoseLandmarkDetectorResult GetPosition() + public InferencePoseLandmarkDetectorResult GetRequestResults() { return new InferencePoseLandmarkDetectorResult(_handle); } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs index b6419aad81d..54712850b04 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs @@ -29,32 +29,33 @@ public class InferencePoseLandmarkDetectorResult { internal InferencePoseLandmarkDetectorResult(IntPtr handle) { - InteropPLD.GetResultCount(handle, out ulong requestOrder, out uint count). + InteropPLD.GetResultCount(handle, out ulong requestId, out uint count). Validate("Failed to get result count."); - RequestOrder = requestOrder; - var positions = new List(); + RequestId = requestId; + var points = new List(); for (uint i = 0 ; i < count ; i++) { - InteropPLD.GetPosition(handle, i, out uint x, out uint y).Validate("Failed to get position."); - positions.Add(new Point((int)x, (int)y)); + InteropPLD.GetPoints(handle, i, out uint x, out uint y).Validate("Failed to get points."); + points.Add(new Point((int)x, (int)y)); } - Position = positions; + Points = points; } /// - /// Gets the requested order. + /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// It represents the order of request. ///
- /// The requested order. + /// The request id that indicates the order of request. /// 12 - public ulong RequestOrder { get; } + public ulong RequestId { get; } /// - /// Gets the position of the detected pose landmark. + /// Gets the points of the detected pose landmark. /// /// 12 - public IEnumerable Position { get; } + public IEnumerable Points { get; } } } From 1d27833106c86ea253b9d038260663928a2f0218 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Fri, 13 Sep 2024 09:33:51 +0900 Subject: [PATCH 5/5] [MediaVision] Fix documentation --- .../MediaVision/InferenceFaceDetector.cs | 4 ++-- .../MediaVision/InferenceFaceDetectorResult.cs | 4 ++-- .../MediaVision/InferenceFacialLandmarkDetector.cs | 4 ++-- .../MediaVision/InferenceFacialLandmarkDetectorResult.cs | 6 +++--- .../MediaVision/InferenceImageClassifier.cs | 2 +- .../MediaVision/InferenceImageClassifierResult.cs | 4 ++-- .../MediaVision/InferenceObjectDetector.cs | 4 ++-- .../MediaVision/InferenceObjectDetectorResult.cs | 4 ++-- .../MediaVision/InferencePoseLandmarkDetector.cs | 4 ++-- .../MediaVision/InferencePoseLandmarkDetectorResult.cs | 6 +++--- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs index 3f0dc65d2f6..a5fede9d8c8 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetector.cs @@ -70,7 +70,7 @@ public InferenceFaceDetector() /// can be empty, if there's no detected face. /// /// The image data to detect faces. - /// The BoundBoxes of detected face. + /// The BoundingBoxes of detected face. /// The InferenceFaceDetector already has been disposed. /// is null. /// 12 @@ -127,7 +127,7 @@ public async Task InferenceAsync(MediaVisionSource /// Note that this method could use about twice as much memory as . /// /// The image data to detect faces. - /// The request id that indicates the order of request. + /// The request ID that indicates the order of requests. /// The InferenceFaceDetector already has been disposed. /// is null. /// diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs index d85aaad4b59..7050d37226c 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFaceDetectorResult.cs @@ -45,10 +45,10 @@ internal InferenceFaceDetectorResult(IntPtr handle) } /// - /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// Gets the request ID which is matched with request ID of RequestInference() return value.
/// It represents the order of request. ///
- /// The request id that indicates the order of request. + /// The request ID that indicates the order of request. /// 12 public ulong RequestId { get; } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs index 93e41039581..a963a62199b 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetector.cs @@ -70,7 +70,7 @@ public InferenceFacialLandmarkDetector() /// can be empty, if there's no detected facial landmark. /// /// The image data to detect facial landmarks. - /// The points of detected facial landmarks. + /// The coordinates of detected facial landmarks. /// The InferenceFacialLandmarkDetector already has been disposed. /// is null. /// 12 @@ -127,7 +127,7 @@ public async Task InferenceAsync(MediaVis /// Note that this method could use about twice as much memory as . /// /// The image data to detect facial landmarks. - /// The request id that indicates the order of request. + /// The request ID that indicates the order of requests. /// The InferenceFacialLandmarkDetector already has been disposed. /// is null. /// diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs index 9d4af7c92b3..67b7b752ac8 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceFacialLandmarkDetectorResult.cs @@ -45,15 +45,15 @@ internal InferenceFacialLandmarkDetectorResult(IntPtr handle) } /// - /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// Gets the request ID which is matched with request ID of RequestInference() return value.
/// It represents the order of request. ///
- /// The request id that indicates the order of request. + /// The request ID that indicates the order of request. /// 12 public ulong RequestId { get; } /// - /// Gets the points of the detected facial landmark. + /// Gets The coordinates of detected facial landmarks. /// /// 12 public IEnumerable Points { get; } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs index 11ddd1adb79..57b7db8dceb 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifier.cs @@ -127,7 +127,7 @@ public async Task InferenceAsync(MediaVisionSour /// Note that this method could use about twice as much memory as . /// /// The image data to classify. - /// The request id that indicates the order of request. + /// The request ID that indicates the order of requests. /// The InferenceImageClassifier already has been disposed. /// is null. /// diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs index f112fa03cc0..70b59184c68 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceImageClassifierResult.cs @@ -45,10 +45,10 @@ internal InferenceImageClassifierResult(IntPtr handle) } /// - /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// Gets the request ID which is matched with request ID of RequestInference() return value.
/// It represents the order of request. ///
- /// The request id that indicates the order of request. + /// The request ID that indicates the order of request. /// 12 public ulong RequestId { get; } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs index 593779dc2d8..3945e79a657 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetector.cs @@ -70,7 +70,7 @@ public InferenceObjectDetector() /// can be empty, if there's no detected object. /// /// The image data to detect object. - /// BoundBoxes of detected object. + /// BoundingBoxes of detected object. /// The InferenceObjectDetector already has been disposed. /// is null. /// 12 @@ -127,7 +127,7 @@ public async Task InferenceAsync(MediaVisionSourc /// Note that this method could use about twice as much memory as . /// /// The image data to detect object. - /// The request id that indicates the order of request. + /// The request ID that indicates the order of requests. /// The InferenceObjectDetector already has been disposed. /// is null. /// diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs index 49417339021..090031aa46a 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferenceObjectDetectorResult.cs @@ -45,10 +45,10 @@ internal InferenceObjectDetectorResult(IntPtr handle) } /// - /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// Gets the request ID which is matched with request ID of RequestInference() return value.
/// It represents the order of request. ///
- /// The request id that indicates the order of request. + /// The request ID that indicates the order of request. /// 12 public ulong RequestId { get; } diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs index 89bb3740936..a16a3f67474 100644 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetector.cs @@ -70,7 +70,7 @@ public InferencePoseLandmarkDetector() /// can be empty, if there's no detected pose landmark. /// /// The image data to detect pose landmark. - /// The points of detected pose landmark. + /// The coordinates of detected pose landmarks. /// The InferencePoseLandmarkDetector already has been disposed. /// is null. /// 12 @@ -127,7 +127,7 @@ public async Task InferenceAsync(MediaVisio /// Note that this method could use about twice as much memory as . /// /// The image data to detect pose landmark. - /// The request id that indicates the order of request. + /// The request ID that indicates the order of requests. /// The InferencePoseLandmarkDetector already has been disposed. /// is null. /// diff --git a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs index 54712850b04..d7c9c16d713 100755 --- a/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs +++ b/src/Tizen.Multimedia.Vision/MediaVision/InferencePoseLandmarkDetectorResult.cs @@ -45,15 +45,15 @@ internal InferencePoseLandmarkDetectorResult(IntPtr handle) } /// - /// Gets the request id which is matched with request id of RequestInference() return value.
+ /// Gets the request ID which is matched with request ID of RequestInference() return value.
/// It represents the order of request. ///
- /// The request id that indicates the order of request. + /// The request ID that indicates the order of request. /// 12 public ulong RequestId { get; } /// - /// Gets the points of the detected pose landmark. + /// Gets the coordinates of detected pose landmarks. /// /// 12 public IEnumerable Points { get; }