(English) Using the Normal Bayes classifier for image categorization in OpenCV

Leider ist der Eintrag nur auf English verfügbar.

2 comments

  1. Thank you for your wonderful articles and in particular for your simple demo sources. This helped me a lot to get a brief insight into “bag of words” of OpenCV. Unfortunately I wasted some time to look into the example from the samples folder in OpenCV (the “bagofwords_classification.cpp”) which I think is a much worse example than yours, because it has over 2500 lines of code with much file handling overhead, actually not necessary to understand the basics of BOW implementation in OpenCV.

    I think it would be of huge value for other people if you could contribute the sources directly into the OpenCV repository (resp. community).

  2. Thanks for your useful topic. After detector->detect(img, keypoint); detects keypoints, when i want to clean keypoints using keypoint.clear(); or when the function wants to return the following error will be appeared.

    “Unhandled exception at 0x011f45bb in BOW.exe: 0xC0000005: Access violation reading location 0x42ebe098.”

    and also detected keypoints have bizarre points coordinates like cv::Point_ pt{x=-1.5883997e+038y=-1.5883997e+038 }

    Part of the code

    Ptr matcher = DescriptorMatcher::create(“FlannBased”);
    Ptr extractor = new SurfDescriptorExtractor();
    Ptr detector = new SurfFeatureDetector(2000);
    void extractTrainingVocabulary() {
    IplImage *img;
    int i,j;
    CvSeq *imageKeypoints = 0;
    for(j=1;j<=60;j++)
    for(i=1;i<=60;i++){
    sprintf( ch,"%d%s%d%s",j," (",i,").jpg");
    const char* imageName = ch;
    Mat img = imread(ch);
    vector keypoint;
    detector->detect(img, keypoint);
    Mat features;
    extractor->compute(img, keypoint, features);
    bowTrainer.add(features);
    keypoint.clear();//problem
    }
    return;
    }