Ask Your Question

KNN OCR Confidence

asked 2018-07-03 18:48:54 -0500

Tars gravatar image

updated 2018-07-04 11:08:15 -0500

My program scans an image and is able to identify a string of numbers. It crops and rotates the image to include only the area of interest. Unfortunately, given the circumstances I have no way of knowing whether the image is upside down or rightside up. However, I do know that it is one of the two, and is not sideways or angled.

The only way I can know if the image is upright is if the numbers indicate that it is. So I am trying to figure out a method of determining confidence for KNN OCR so that I can decide to rotate 180 degrees or not.

The test would go something like this:

randomly take 10 bounding rects

call k nearest on each

save confidence for whole as a single number "A"

rotate bounding rects 180 degrees

call k nearest on each

save confidence for whole as a single number "B"

if B is greater than A, rotate ROI by 180 degrees

Any advice on getting that confidence value?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-07-11 03:25:06 -0500

darioc85 gravatar image


if the numbers are 0,1,..., 9, what do you think about considering the number of digits detected with the rectangles and their version rotated by 180 degrees as a confidence metric? If there are no just 0, 1, 6, 9 (that could be undetermined, depending on the font type), it should work, if I understood well your problem.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-07-03 18:48:54 -0500

Seen: 148 times

Last updated: Jul 11 '18