public static extern ErrorType opencv_getTextSize(byte[] text, int textLength, CvHersheyFonts fontFace, double fontScale, int thickness, ref int baseLine, out IntPtr returnValue);
public static void PutText(Mat mat, string text, Point <double> point, CvHersheyFonts fontFace, double fontScale, Scalar <double> scalar, int thickness = 1, CvLineTypes lineType = CvLineTypes.Line8, bool bottomLeftOrigin = false) { if (mat == null) { throw new ArgumentNullException(nameof(mat)); } mat.ThrowIfDisposed(); var str = Ncnn.Encoding.GetBytes(text ?? ""); using (var nativePoint = point.ToNative()) using (var nativeScalar = scalar.ToNative()) { NativeMethods.opencv_putText_double(mat.NativePtr, str, str.Length, nativePoint.NativePtr, fontFace, fontScale, nativeScalar.NativePtr, thickness, lineType, bottomLeftOrigin); } }
public static extern ErrorType opencv_putText_float(IntPtr mat, byte[] text, int textLength, IntPtr point, CvHersheyFonts fontFace, double fontScale, IntPtr scalar, int thickness, CvLineTypes lineType, bool bottomLeftOrigin);
public static Size <int> GetTextSize(string text, CvHersheyFonts fontFace, double fontScale, int thickness, ref int baseLine) { var str = Ncnn.Encoding.GetBytes(text ?? ""); var error = NativeMethods.opencv_getTextSize(str, str.Length, fontFace, fontScale, thickness, ref baseLine, out var ret); if (error != NativeMethods.ErrorType.OK) { throw new NcnnException("Unknown Exception"); } return(new Size <int>(ret)); }