peter55555
peter55555

Reputation: 1475

OCR in opencv - how to pass objects

I'd like to write OCR in OpenCV. I need to recognize single letters. I'd like to use K-Nearest Neighbors. I'd like to recognize letters with different size and font and handwritten.

So, I'll prepare images to train. The first question is. Should I use letters in the (1) same size of images or (2) fit image?

1)

(1)

2)

enter image description here

How about found letters? Should I pass it as 1 (with the same size as train images) or 2 (just fit rectangle to letter)???

Upvotes: 0

Views: 167

Answers (1)

Jerry
Jerry

Reputation: 657

The "benchmark" MNIST dataset normalizes and centers the characters as in scenario (1) you described. If you're just interested in classification, it might make any difference how you do it.

If I understand you correctly, your second question has to do with what's called "preprocessing" in ML jargon. If you apply a transformation to convert each raw image into one of type either (1) or (2), it's called a preprocessing step -- which ever one you choose. Whatever preprocessing you do to the training set, the exact same preprocessing has to be done to the data before applying the model.

To make it simple, if you have a giant data set that you want to split into "training" and "testing" examples, first transform this into a "preprocessed data" set, and split this one. That way you're sure the exact same transformation parameters are used for both training and testing.

Upvotes: 1

Related Questions