1
votes

I'm using dlib for object detection, labeling and training dataset is completed using HOG+SVM, it is able to detect the object, but now

  1. I need extract chip from the image
  2. I would like to add label to detected area on win_overlay. my working code snippet here, i searched for both of this, but I could not find for object detection.

    typedef scan_fhog_pyramid<pyramid_down<6> > image_scanner_type;
    image_scanner_type scanner;
    
    object_detector<image_scanner_type> detector;
    deserialize(argv[2]) >> detector;
    array2d<unsigned char> img;
    image_window win;
    load_image(img, "test.jpg");
    std::vector<rectangle> dets = detector(img);
    if (dets.size() > 0) {
    win.clear_overlay();
    win.set_image(img);
    win.add_overlay(dets, rgb_pixel(255, 0, 0));
    }
    

    above snippet is highlighting detection, but i would like to label detected are on "win.add_overlay()" and extract chip(detected area) and save as image.

1

1 Answers

0
votes
  1. You should take a look on this example : http://dlib.net/face_landmark_detection_ex.cpp.html

dlib function extract_image_chips is the way to extract chip from img

  1. In this case: i usually use OpenCV to do this. After you get rectangle from dlib object detector. Convert it to OpenCV cv::Rect . Create a text and imshow all.