if (tessResult)
始终为假,执行tesseract OCR必须为真,有人可以帮助我吗?
if (!_tesseractApi.Initialized)
await _tesseractApi.Init("eng");
var photo = await TakePic();
if (photo != null)
{
// When setting an ImageSource using a stream,
// the stream gets closed, so to avoid that I backed up
// the image into a byte array with the following code:
var imageBytes = new byte[photo.Source.Length];
photo.Source.Position = 0;
photo.Source.Read(imageBytes, 0, (int)photo.Source.Length);
photo.Source.Position = 0;
var tessResult = await _tesseractApi.SetImage(imageBytes);
if (tessResult)
{
_takenImage.Source = ImageSource.FromStream(() => photo.Source);
_recognizedTextLabel.Text = _tesseractApi.Text;
}
}
}