Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. find contours
  2. get boundingRect() of it
  3. get image ROI (crop) of that rect, resize to the HOG windowsize, you trained your SVM on
  4. get HOG feature from that ROI
  5. predict()

    ok, let's summarize the 2 approaches.

    if you want to detect a single object class (detectMultiscale):

    • train:
    • crop all positive and negative images to same windowsize(e.g. 24x24). this is the minimum size, that can be detected later
    • use train_HOG.cpp (from the samples), to train an SVM(regression), and save it
    • detect:
    • load the single, pretrained SVM support vector into the HOGDescriptor
    • detectMultiscale on an (abitrary sized) grayscale image.

    if you want to classify multiple traffic signs:

    • train:
    • crop all images to same windowsize(e.g. 24x24) (same as above)
    • get HOG descriptors for each, reshape them to a single row, and push_back all of them into a single large Mat. you also need a "labels" Mat, containing the class id for each descriptor
    • train an SVM (or ANN, or KNN) with this data and labels (classification)

    • test:

    • find contourscontours in large image
    • get boundingRect() of it
    • get image ROI (crop) of that rect, resize to the HOG windowsize, you trained your SVM on
    • get HOG feature from that ROI
    • predict()
predict() with that HOG feature