/// <summary> /// Inverses a matrix. /// </summary> /// <param name="method"></param> /// <returns></returns> public MatExpr Inv(DecompTypes method = DecompTypes.LU) { ThrowIfDisposed(); NativeMethods.HandleException( NativeMethods.core_MatExpr_inv(ptr, (int)method, out var ret)); GC.KeepAlive(this); var retVal = new MatExpr(ret); return(retVal); }
/// <summary> /// /// </summary> /// <param name="method"></param> /// <returns></returns> public MatExpr Inv(DecompTypes method = DecompTypes.LU) { ThrowIfDisposed(); try { IntPtr retPtr = NativeMethods.core_MatExpr_inv(ptr, (int)method); MatExpr retVal = new MatExpr(retPtr); return(retVal); } catch (BadImageFormatException ex) { throw PInvokeHelper.CreateException(ex); } }
/// <summary> /// solves linear system or a least-square problem /// </summary> /// <param name="src1"></param> /// <param name="src2"></param> /// <param name="dst"></param> /// <param name="flags"></param> /// <returns></returns> public static bool Solve(InputArray src1, InputArray src2, OutputArray dst, DecompTypes flags = DecompTypes.LU) { if (src1 == null) throw new ArgumentNullException("src1"); if (src2 == null) throw new ArgumentNullException("src2"); if (dst == null) throw new ArgumentNullException("dst"); src1.ThrowIfDisposed(); src2.ThrowIfDisposed(); dst.ThrowIfNotReady(); int ret = NativeMethods.core_solve(src1.CvPtr, src2.CvPtr, dst.CvPtr, (int)flags); GC.KeepAlive(src1); GC.KeepAlive(src2); dst.Fix(); return ret != 0; }
/// <summary> /// computes inverse or pseudo-inverse matrix /// </summary> /// <param name="src">The source floating-point MxN matrix</param> /// <param name="dst">The destination matrix; will have NxM size and the same type as src</param> /// <param name="flags">The inversion method</param> /// <returns></returns> public static double Invert(InputArray src, OutputArray dst, DecompTypes flags = DecompTypes.LU) { if (src == null) throw new ArgumentNullException("src"); if (dst == null) throw new ArgumentNullException("dst"); src.ThrowIfDisposed(); dst.ThrowIfNotReady(); double ret = NativeMethods.core_invert(src.CvPtr, dst.CvPtr, (int)flags); GC.KeepAlive(src); dst.Fix(); return ret; }
/// <summary> /// /// </summary> /// <param name="method"></param> /// <returns></returns> public MatExpr Inv(DecompTypes method = DecompTypes.LU) { ThrowIfDisposed(); try { IntPtr retPtr = NativeMethods.core_MatExpr_inv(ptr, (int)method); MatExpr retVal = new MatExpr(retPtr); return retVal; } catch (BadImageFormatException ex) { throw PInvokeHelper.CreateException(ex); } }