HOGDescriptor::detectMultiScale returns same weight for different scales

asked 2015-12-29 04:19:01 -0500

Kwak gravatar image

Hey,
I'm using the function detectMultiScale to detect objects based on HOG features. An object is generally detected several times, at slightly different locations and scales. It seems like the weights of the detections are the same for different scales. I see no reason why that would be. In fact, i was hoping to find the best scale by searching for the detection with the highest confidence. I am aware that i can use grouping, but i d like to implement my own grouping algorithm here.

Is it normal that the weights are the same at different scales?
Is there a possibility to get different weights at different scales?
I could call detectMultiScale for a single scale, resize the image for detection at a different scale and then call detectMultiScale again. But maybe there is a cleaner solution out there?

CODE:
---------
vector<rect> locations;
vector<double> weights;
HOGDescriptor::detectMultiScale(
    image, // cv::Mat
    locations,
    weights,
    0.0,                 // Threshold for the distance between features and SVM classifying plane
                           // We assume this parameter is already specified in the detector
                           // coëfficients (svm hyperplane)
    winStride,       // =(8,8) Window stride. It must be a multiple of block stride
    Size(0,0),        // Mock parameter to keep the CPU interface compatibility. It must be (0,0).
    scaleIncrease, // =1.1
    similarityThreshold,        // =0 no grouping.
                                           // Should be an integer if not using meanshift grouping.
    false);                             // no meanshift grouping

OUTPUT:
------------
//display all the weights and locations:
for (int i=0; i < locations.size(); i++)
cout << "\n" << weights[i] << "\t\t" << locations[i];

0.216482 [156 x 156 from (1820, 2704)]
0.183423 [156 x 156 from (1976, 2704)]
0.0277854 [156 x 156 from (1950, 2730)]
0.118232 [156 x 156 from (1898, 2782)]
0.216482 [172 x 172 from (1800, 2688)]
0.183423 [172 x 172 from (1830, 2688)]
0.0277854 [172 x 172 from (1973, 2688)]
0.118232 [172 x 172 from (1943, 2717)]
0.18763 [172 x 172 from (1888, 2775)]
0.216482 [188 x 188 from (1794, 2675)]
0.183423 [188 x 188 from (1823, 2675)]
0.0277854 [188 x 188 from (1950, 2675)]
0.118232 [188 x 188 from (1823, 2704)]
0.18763 [188 x 188 from (1917, 2704)]
0.153218 [188 x 188 from (1950, 2704)]
0.126738 [188 x 188 from (1856, 2736)]
0.137723 [188 x 188 from (1888, 2736)]
0.216663 [188 x 188 from (1888, 2769)]
0.216482 [208 x 208 from (36, 1833)]
0.183423 [208 x 208 from (1800, 2665)]
0.0277854 [208 x 208 from (1833, 2665)]
0.118232 [208 x 208 from (1937, 2665)]
0.18763 [208 x 208 from (1833, 2701)]
0.153218 [208 x 208 from (1904, 2701)]
0.126738 [208 x 208 from (1937, 2701)]
0.137723 [208 x 208 from (1869, 2733)]
...

edit retag flag offensive close merge delete