I'm currently trying to identify a character based on an 8 bit matrix which I've extracted around a tag as part of my program (I've called this matrix "tag_character" and an example image of the "D" character is below).

Because I need classification to be invariant to rotation, I had PCA recommended as a potential technique, however I'm having a little difficulty with how to use it. The working code is below:

cv::Mat image_row = tag_character.clone ( ).reshape ( 1, 1 ); image_row.convertTo( image_row, CV_32F ); cv::Mat projection_result; cv::PCA pca ( image_row, cv::Mat ( ), CV_PCA_DATA_AS_ROW ); pca.project ( image_row, projection_result ); cv::Point pos = cv::Point(pca.mean.at<double>(0, 0), pca.mean.at<double>(0, 1));

So now that I have the position, I'm not sure how I can use this to actually uniquely identify each tag. By the way, I'm looping over each contour and then classifying them, so the PCA is being run separately for each tag.