-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for OCR confidence data? #19
Comments
I'll stick it on the radar, but for now I'm focussed on improving what's already here. |
I'd be happy to implement it, as long as something like that design sounds OK to you and you would have time to review it. |
That sounds good to me. Do you mind if I get my refactor merged in before you start though? |
Not tonight, I'm falling asleep. Soon though, all that's left is finishing error types, the builder pattern and a git history cleanup. |
The refactor has been merged in. You're good to start whenever you're free. |
Any progress on this? |
@Gearme no progress as far as I'm aware. Would you like to pick this up? |
It would be great to be able to access data on the confidence of some OCR result. I'm not super familiar with the C++ API but it looks like this can be obtained by this API.
Would it make sense to adapt this to an
impl Iterator
? One difficulty is that thenext
, etc. functions in the C++ API are all parameterized by a level parameter, whileIterator::next
doesn't take any parameters. One way to get around this would be to have an internalIter
struct that wraps a C++ResultIterator
with a set level, and provide multiple functions likeiter_blocks() -> impl Iterator<Item = ...>
,iter_words() -> impl Iterator<Item = ...>
that internally construct anIter
with the appropriate level.The
Item
would need to be some type, sayOcrResult
, that exposes all of the result data to be passed through. The C++ functions are on the iterator itself, meaning that they can only be called for the current item. Because theIterator
trait doesn't impose any lifetime constraints on theItem
s, I think that this means that all the data inOcrResult
has to be populated upfront when it's constructed in thenext()
call, because it can't be retrieved later. But the upshot would be that theOcrResult
could just be a plain struct that people can pattern match on and destructure. For a start maybe just the confidence value, the text, and the rect would be enough.The text was updated successfully, but these errors were encountered: