コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FaceTrackingModel"/> class with the specified path.
 /// </summary>
 /// <remarks>
 /// Models saved by <see cref="Save(string)"/> can be loaded.
 /// </remarks>
 /// <param name="modelPath">Path to the model to load.</param>
 /// <exception cref="ArgumentNullException"><paramref name="modelPath"/> is null.</exception>
 /// <exception cref="FileNotFoundException"><paramref name="modelPath"/> is invalid.</exception>
 /// <exception cref="NotSupportedException">
 ///     The feature is not supported.<br/>
 ///     -or-<br/>
 ///     <paramref name="modelPath"/> is not supported format.
 /// </exception>
 /// <exception cref="UnauthorizedAccessException">No permission to access the specified file.</exception>
 /// <seealso cref="Save(string)"/>
 /// <since_tizen> 4 </since_tizen>
 public FaceTrackingModel(string modelPath)
 {
     if (modelPath == null)
     {
         throw new ArgumentNullException(nameof(modelPath));
     }
     InteropModel.Load(modelPath, out _handle).Validate("Failed to load FaceTrackingModel from file.");
 }
コード例 #2
0
        private MediaVisionError InvokePrepare(MediaVisionSource source, Quadrangle region)
        {
            if (region != null)
            {
                var quad = region.ToMarshalable();
                return(InteropModel.Prepare(Handle, IntPtr.Zero, source.Handle, ref quad));
            }

            return(InteropModel.Prepare(Handle, IntPtr.Zero, source.Handle, IntPtr.Zero));
        }
コード例 #3
0
        /// <summary>
        /// Releases the resources used by the <see cref="FaceTrackingModel"/> object.
        /// </summary>
        /// <param name="disposing">
        /// true to release both managed and unmanaged resources; otherwise false to release only unmanaged resources.
        /// </param>
        /// <since_tizen> 4 </since_tizen>
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            InteropModel.Destroy(_handle);
            _disposed = true;
        }
コード例 #4
0
        /// <summary>
        /// Saves the tracking model to the file.
        /// </summary>
        /// <param name="path">Path to the file to save the model.</param>
        /// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
        /// <exception cref="UnauthorizedAccessException">No permission to write to the specified path.</exception>
        /// <exception cref="ObjectDisposedException">The <see cref="FaceTrackingModel"/> has already been disposed of.</exception>
        /// <exception cref="DirectoryNotFoundException">The directory for <paramref name="path"/> does not exist.</exception>
        /// <since_tizen> 4 </since_tizen>
        public void Save(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            var ret = InteropModel.Save(path, Handle);

            if (ret == MediaVisionError.InvalidPath)
            {
                throw new DirectoryNotFoundException($"The directory for the path({path}) does not exist.");
            }

            ret.Validate("Failed to save tracking model to file");
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FaceTrackingModel"/> class.
 /// </summary>
 /// <exception cref="NotSupportedException">The feature is not supported.</exception>
 /// <since_tizen> 4 </since_tizen>
 public FaceTrackingModel()
 {
     InteropModel.Create(out _handle).Validate("Failed to create FaceTrackingModel.");
 }