public IWord Execute(Word word, int imgWidth, int imgHeight)
        {
            if (word == null)
            {
                throw new ArgumentNullException(nameof(word));
            }

            var coord = _createRelativeCoordinate.Execute(word.Rectangle, imgWidth, imgHeight);

            return(new OcrMetadata.Model.Word(coord, word.Text));
        }
示例#2
0
        public ISentence Execute(Line line, int lineCount, int imgWidth, int imgHeight, int index)
        {
            if (line?.Words == null || !line.Words.Any())
            {
                return(null);
            }

            var words = line.Words.Select(word => _createWordFromAzureWord.Execute(word, imgWidth, imgHeight)).ToList();
            var text  = words.Select(x => x.Value).Aggregate((i, j) => i + " " + j).Trim();

            return(new Sentence(words, _createRelativeCoordinate.Execute(line.Rectangle, imgWidth, imgHeight), text,
                                lineCount, index));
        }