Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  • load the images as grayscale [ imread("ghjgjg",0); ] or use cvtColor() to convert, else your pixel-access img_mat.at<uchar>(k,j); is doomed.

  • you want to train one svm, not one per file. put the pixels from all files into one training matrix and then train.

  • you never initialize your labels

------------------------------------------------------------------------------------------------

Mat training_mat( num_files ,image_area,CV_32FC1);
Mat labels(num_files,1,CV_32FC1);

for files :
    load files (grayscale) and put them into traing mat
    add an item to the labels

setup the svm and train it