Ask Your Question
1

understanding the letter recognition sample of OpenCV

asked Sep 29 '16

BenNG gravatar image

updated Sep 30 '16

Eduardo gravatar image

Hi all,

I try to understand the letter recognition sample of OpenCV and i'm stuck on this line

        int cls_label = responses.at<int>(i) - 'A';

Can somebody explain what this line means ? more precisely what this 'A' is doing here ?

Thank you !

Preview: (hide)

Comments

Ok. I think that the image samples are only 'A'

BenNG gravatar imageBenNG (Sep 29 '16)edit

2 answers

Sort by » oldest newest most voted
2

answered Sep 30 '16

berak gravatar image

updated Sep 30 '16

data in that example is read from this csv file , which has letters for labels in the 1st column.

subtracting 'A' from those makes 0-based labels again, since:

'A' - 'A' = 0, 'B' - 'A' = 1, 'C' - 'A' = 2, etc.

Preview: (hide)
1

answered Sep 29 '16

'A' means ascii code of A as integer. output of the code below is 35 ( 100 - 65 )

   int a = 100;
   a = a - 'A';
   std::cout << a;
Preview: (hide)

Question Tools

1 follower

Stats

Asked: Sep 29 '16

Seen: 297 times

Last updated: Sep 30 '16