protected async Task <List <Word> > OCROnePage(byte[] pageImageBytes) { //send image to oxford, obtain coordinate and content var ocrResults = await VisionService.RecognizeText(pageImageBytes); //get all valid words with more than 4 characters var allLines = ocrResults.Regions.SelectMany(x => x.Lines).ToList(); var allWords = allLines.SelectMany(p => p.Words).ToList(); //be in valid length var allWordsValidLength = allWords.Where(x => x.Text.Count() > ValidWordDigitCount).ToList(); //be in 62 char set var allValidWordsWithSixtyTwoChars = allWordsValidLength.Where(x => x.Text.ContainsOnlySpecificSetOfChars(StringResources.SixtyTwoChars)).ToList(); //exists in ditionary var allValidWords = allValidWordsWithSixtyTwoChars.Where(x => SpellService.IsWordCorrect(x.Text)).ToList(); return(allValidWords); }
public virtual OcrResults GetTextualAnalysis(MediaItem m) { return(_visionService.RecognizeText(m.GetMediaStream(), "en", true)); }