public Matrix(Array2DBase array) { if (array == null) { throw new ArgumentNullException(nameof(array)); } array.ThrowIfDisposed(); if (!TryParse(typeof(TElement), out var type)) { throw new NotSupportedException($"{typeof(TElement).Name} does not support"); } this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); var ret = Dlib.Native.mat_matrix(array.ImageType.ToNativeArray2DType(), array.NativePtr, 0, 0, this._ElementType, out var ptr); switch (ret) { case Dlib.Native.ErrorType.MatrixElementTypeNotSupport: throw new ArgumentException($"{array.ImageType} can not convert to {type}."); } this.NativePtr = ptr; this._Indexer = this.CreateIndexer(type); }
public StdVectorMatrixImp() { Matrix <TElement> .TryParse <TElement>(out var type); this._Type = type; this._NativeType = this._Type.ToNativeMatrixElementType(); }
public static extern Dlib.Native.ErrorType loss_mmod_operator_matrixs(IntPtr obj, int type, Dlib.Native.MatrixElementType element_type, IntPtr matrixs, int templateRows, int templateColumns, ulong batchSize, out IntPtr ret);
public static extern Dlib.Native.ErrorType random_cropper_operator( IntPtr cropper, uint numCrops, Dlib.Native.MatrixElementType type, IntPtr images, IntPtr rects, IntPtr crops, IntPtr cropRects);
internal MatrixOp(Dlib.Native.ElementType elementType, MatrixElementTypes type, IntPtr ptr, int templateRows = 0, int temlateColumns = 0) { this._ElementType = elementType; this._MatrixElementType = type.ToNativeMatrixElementType(); this.NativePtr = ptr; this.TemplateRows = templateRows; this.TemplateColumns = temlateColumns; }
public StdVectorMatrixImp(int templateRows, int templateColumns) { Matrix <TElement> .TryParse <TElement>(out var type); this._Type = type; this._NativeType = this._Type.ToNativeMatrixElementType(); this._TemplateRows = templateRows; this._TemplateColumns = templateColumns; }
internal MatrixRangeExp(IntPtr ptr) { if (!SupportTypes.TryGetValue(typeof(T), out var type)) { throw new NotSupportedException($"{typeof(T).Name} does not support"); } this._NativeMatrixElementType = type.ToNativeMatrixElementType(); this._MatrixElementType = type; this.NativePtr = ptr; }
public Matrix() { if (!SupportTypes.TryGetValue(typeof(T), out var type)) { throw new NotSupportedException($"{typeof(T).Name} does not support"); } this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); this.NativePtr = Dlib.Native.matrix_new(this._ElementType); }
internal Row(IntPtr ptr, Dlib.Native.MatrixElementType type, Array2DMatrixBase parent) { if (ptr == IntPtr.Zero) { throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr)); } this._Parent = parent ?? throw new ArgumentNullException(nameof(parent)); this.NativePtr = ptr; this._Type = type; }
public Matrix() { if (!MatrixBase.TryParse(typeof(TElement), out var type)) { throw new NotSupportedException($"{typeof(TElement).Name} does not support"); } this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); this.NativePtr = Dlib.Native.matrix_new(this._ElementType); this._Indexer = this.CreateIndexer(type); }
internal SurfPointMatrix(IntPtr ptr, bool isEnableDispose) : base(ptr, 0, 0, isEnableDispose) { if (!SupportMatrixTypes.TryGetValue(typeof(T), out var matrixType)) { throw new NotSupportedException($"{typeof(T).Name} does not support"); } this._MatrixElementType = matrixType.ToNativeMatrixElementType(); this.NativePtr = ptr; this.MatrixElementType = matrixType; }
internal Matrix(IntPtr ptr, MatrixElementTypes type) { if (ptr == IntPtr.Zero) { throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr)); } this.NativePtr = ptr; this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); this._Indexer = this.CreateIndexer(type); }
public LinearKernel(int templateRow = 0, int templateColumn = 0) { using (var tmp = new T()) { this._MatrixElementTypes = tmp.MatrixElementType; this._ElementType = this._MatrixElementTypes.ToNativeMatrixElementType(); this.TemplateRows = templateRow; this.TemplateColumns = templateColumn; this.NativePtr = Dlib.Native.linear_kernel_new(this._ElementType, templateRow, templateColumn); } }
public MatrixRangeExp(T start, T end, uint num) { if (!SupportTypes.TryGetValue(typeof(T), out var type)) { throw new NotSupportedException($"{typeof(T).Name} does not support"); } this._NativeMatrixElementType = type.ToNativeMatrixElementType(); this._MatrixElementType = type; var param = this.CreataParam(start, end, false, default(T), true, num); this.NativePtr = Dlib.Native.matrix_range_exp_create(this._NativeMatrixElementType, ref param); }
public Array2DMatrix(int rows, int columns) { if (!SupportMatrixTypes.TryGetValue(typeof(T), out var matrixType)) { throw new NotSupportedException($"{typeof(T).Name} does not support"); } this._MatrixElementType = matrixType.ToNativeMatrixElementType(); this.NativePtr = Dlib.Native.array2d_matrix_new1(this._MatrixElementType, rows, columns); if (this.NativePtr == IntPtr.Zero) { throw new ArgumentException($"{matrixType} is not supported."); } this.MatrixElementType = matrixType; }
public Matrix(byte[] array, int row, int column, int elementSize) { if (array == null) { throw new ArgumentNullException(nameof(array)); } if (row < 0) { throw new ArgumentOutOfRangeException($"{nameof(row)}", $"{nameof(row)} should be positive value."); } if (column < 0) { throw new ArgumentOutOfRangeException($"{nameof(column)}", $"{nameof(column)} should be positive value."); } if (column < 1) { throw new ArgumentOutOfRangeException($"{nameof(elementSize)} should be more than 1"); } if (array.Length != row * column * elementSize) { throw new ArgumentOutOfRangeException($"{nameof(array)}.Length should equalt to {nameof(column)}x{nameof(column)}*{nameof(elementSize)}."); } if (!TryParse(typeof(TElement), out var type)) { throw new NotSupportedException($"{typeof(TElement).Name} does not support"); } this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); var size = ElementSizeDictionary[this._ElementType]; if (size != elementSize) { throw new ArgumentOutOfRangeException($"The size of {typeof(TElement).Name} does not equalt to {nameof(elementSize)}."); } unsafe { fixed(byte *src = &array[0]) this.NativePtr = Dlib.Native.matrix_new3(this._ElementType, row, column, src); } this._Indexer = this.CreateIndexer(type); }
public Matrix(int row, int column) { if (!SupportTypes.TryGetValue(typeof(T), out var type)) { throw new NotSupportedException($"{typeof(T).Name} does not support"); } if (row < 0) { throw new ArgumentOutOfRangeException($"{nameof(row)}", $"{nameof(row)} should be positive value."); } if (column < 0) { throw new ArgumentOutOfRangeException($"{nameof(column)}", $"{nameof(column)} should be positive value."); } this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); this.NativePtr = Dlib.Native.matrix_new1(this._ElementType, row, column); }
internal Matrix(IntPtr ptr, bool isEnabledDispose = true) : base(isEnabledDispose) { if (ptr == IntPtr.Zero) { throw new ArgumentException("Can not pass IntPtr.Zero", nameof(ptr)); } if (!MatrixBase.TryParse(typeof(TElement), out var type)) { throw new NotSupportedException($"{typeof(TElement).Name} does not support"); } this.NativePtr = ptr; this._MatrixElementTypes = type; this._ElementType = type.ToNativeMatrixElementType(); this._Indexer = this.CreateIndexer(type); }
public static extern void matrix_op_op_join_rows_delete(Dlib.Native.MatrixElementType type, IntPtr obj, int templateRows, int templateColumns);
public static extern Dlib.Native.ErrorType shape_predictor_matrix_operator_mmod_rect(IntPtr detector, Dlib.Native.MatrixElementType imgType, IntPtr img, IntPtr rect, out IntPtr fullObjDetect);
public static extern Dlib.Native.ErrorType loss_multiclass_log_per_pixel_operator_matrixs(IntPtr obj, int type, Dlib.Native.MatrixElementType element_type, IntPtr matrixs, int templateRows, int templateColumns, out IntPtr ret);
public static extern Dlib.Native.ErrorType matrix_op_op_join_rows_nr(Dlib.Native.MatrixElementType type, IntPtr obj, int templateRows, int templateColumns, out int ret);
public static extern Dlib.Native.ErrorType image_window_set_image_matrix(IntPtr window, Dlib.Native.MatrixElementType type, IntPtr matrix);
public static extern IntPtr image_window_new_matrix1(Dlib.Native.MatrixElementType type, IntPtr image);
public static extern Dlib.Native.ErrorType matrix_op_op_trans_operator_left_shift(Dlib.Native.MatrixElementType type, IntPtr obj, int templateRows, int templateColumns, IntPtr stream);
public static extern Dlib.Native.ErrorType dnn_trainer_loss_multiclass_log_train(IntPtr trainer, int type, Dlib.Native.MatrixElementType dataElementType, IntPtr data, Dlib.Native.MatrixElementType labelElementType, IntPtr label);
public static extern IntPtr image_window_new_matrix2(Dlib.Native.MatrixElementType type, IntPtr image, byte[] title);
public static extern Dlib.Native.ErrorType matrix_op_op_std_vect_to_mat_nc(Dlib.Native.MatrixElementType type, IntPtr obj, int templateRows, int templateColumns, out int ret);
public static extern Dlib.Native.ErrorType frontal_face_detector_matrix_operator( IntPtr detector, Dlib.Native.MatrixElementType imgType, IntPtr img, double adjustThreshold, IntPtr dets);
internal RowHsiPixel(IntPtr ptr, Dlib.Native.MatrixElementType type, Array2DMatrixBase parent) : base(ptr, type, parent) { }