/// <summary> /// Recognize text using Beam Search /// Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values. /// </summary> /// <param name="image">Input image CV_8UC1 with a single text line (or word)</param> /// <param name="mask">Text mask CV_8UC1 image</param> /// <param name="rects">Method will output a list of Rects for the individual text elements found (e.g. words)</param> /// <param name="texts">Method will output a list of text strings for the recognition of individual text elements found (e.g. words)</param> /// <param name="confidences">Method will output a list of confidence values for the recognition of individual text elements found (e.g. words)</param> /// <param name="component_level"></param> /// <returns></returns> public override string Run(Mat image, Mat mask, out Rect[] rects, out string[] texts, out float[] confidences, CvText.OCRLevel component_level) { using (VectorOfRect vecRects = new VectorOfRect()) using (VectorOfString vecTexts = new VectorOfString()) using (VectorOfFloat vecConfidences = new VectorOfFloat()) { NativeMethods.text_OCRBeamSearchDecoder_run2(ptr, image.CvPtr, mask.CvPtr, vecRects.CvPtr, vecTexts.CvPtr, vecConfidences.CvPtr, (int)component_level); rects = vecRects.ToArray(); texts = vecTexts.ToArray(); confidences = vecConfidences.ToArray(); } return(texts.Length > 0 ? texts[0] : String.Empty); }
/// <summary> /// Recognize text using Beam Search /// Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values. /// </summary> /// <param name="image">Input image CV_8UC1 with a single text line (or word)</param> /// <param name="mask">Text mask CV_8UC1 image</param> /// <param name="rects">Method will output a list of Rects for the individual text elements found (e.g. words)</param> /// <param name="texts">Method will output a list of text strings for the recognition of individual text elements found (e.g. words)</param> /// <param name="confidences">Method will output a list of confidence values for the recognition of individual text elements found (e.g. words)</param> /// <param name="component_level"></param> /// <returns>Best match</returns> public abstract string Run(Mat image, Mat mask, out Rect[] rects, out string[] texts, out float[] confidences, CvText.OCRLevel component_level);
public override string Run(Mat image, Mat mask, out Rect[] rects, out string[] texts, out float[] confidences, CvText.OCRLevel component_level) { throw new Exception("Masked processing is not implemented in OCRHMMDecoder"); }