/// <summary> /// Return the specific diagonal elements of this matrix /// </summary> /// <param name="diag">Array diagonal. Zero corresponds to the main diagonal, -1 corresponds to the diagonal above the main etc., 1 corresponds to the diagonal below the main etc</param> /// <returns>The specific diagonal elements of this matrix</returns> public Matrix <TDepth> GetDiag(int diag) { Matrix <TDepth> subMat = new Matrix <TDepth>(); subMat._array = _array; subMat.AllocateHeader(); subMat._ptr = CvInvoke.cvGetDiag(_ptr, subMat.Ptr, diag); return(subMat); }
/// <summary> /// Get the Matrix, corresponding to a specified column span of the input array /// </summary> /// <param name="endCol">Zero-based index of the ending column (exclusive) of the span</param> /// <param name="startCol">Zero-based index of the selected column</param> /// <returns>the specific column span of the matrix</returns> public Matrix <TDepth> GetCols(int startCol, int endCol) { Matrix <TDepth> subMat = new Matrix <TDepth>(); subMat._array = _array; subMat.AllocateHeader(); subMat._ptr = CvInvoke.cvGetCols(_ptr, subMat.Ptr, startCol, endCol); return(subMat); }
/// <summary> /// Get a submatrix corresponding to a specified rectangle /// </summary> /// <param name="rect">the rectangle area of the sub-matrix</param> /// <returns>A submatrix corresponding to a specified rectangle</returns> public Matrix <TDepth> GetSubRect(Rectangle rect) { Matrix <TDepth> subMat = new Matrix <TDepth>(); subMat._array = _array; subMat.AllocateHeader(); CvInvoke.cvGetSubRect(_ptr, subMat.Ptr, rect); return(subMat); }
/// <summary> /// Return the matrix corresponding to a specified row span of the input array /// </summary> /// <param name="startRow">Zero-based index of the starting row (inclusive) of the span</param> /// <param name="endRow">Zero-based index of the ending row (exclusive) of the span</param> /// <param name="deltaRow">Index step in the row span. That is, the function extracts every delta_row-th row from start_row and up to (but not including) end_row</param> /// <returns>A matrix corresponding to a specified row span of the input array</returns> public Matrix <TDepth> GetRows(int startRow, int endRow, int deltaRow) { Matrix <TDepth> subMat = new Matrix <TDepth>(); subMat._array = _array; subMat.AllocateHeader(); subMat._ptr = CvInvoke.cvGetRows(_ptr, subMat.Ptr, startRow, endRow, deltaRow); return(subMat); }
/// <summary> /// Get reshaped matrix which also share the same data with the current matrix /// </summary> /// <param name="newChannels">the new number of channles</param> /// <param name="newRows">The new number of rows</param> /// <returns>A reshaped matrix which also share the same data with the current matrix</returns> public Matrix <TDepth> Reshape(int newChannels, int newRows) { Matrix <TDepth> res = new Matrix <TDepth>(); res._array = _array; res.AllocateHeader(); CvInvoke.cvReshape(Ptr, res.Ptr, newChannels, newRows); return(res); }