OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 08 Jan 2020 17:43:05 -0600why value of levelWeights given by CascadeClassifier::detectMultiScale can be negative?http://answers.opencv.org/question/224614/why-value-of-levelweights-given-by-cascadeclassifierdetectmultiscale-can-be-negative/I am using CascadeClassifier::detectMultiScale of Opencv4 to do some eye detection.
One thing drives me crazy is that the output of **levelWeights** can be negative.
I understand that it is not normalized and thus can be any value higher than 0, but how to understand a levelWeight value of negative?
According to the document, **levelWeight array contains the weighted sum of the weak classifiers for the last
level, whether accepted or rejected.** Since the output arrays contains only accepted rectangles, I assume that the output levelWeight contains also weights of accepted rects classified as detected targets. In that sense, how would a negative weight work? Ar the absolute values used?
simbaWed, 08 Jan 2020 17:43:05 -0600http://answers.opencv.org/question/224614/How to train for weights ?http://answers.opencv.org/question/129842/how-to-train-for-weights/I am implementing a paper on hierarchical superpixel clustering. The paper has this objective function that measures the similarity between 2 clusters.
![image description](/upfiles/14878596417823255.png)
My question is, how do I determine the ideal weights for each term i.e. `5logw + 2logd + 1logn` Do I have to run **many** iterations with random weights to see which works best ? Or is there a training method for this ?
NbbThu, 23 Feb 2017 08:23:21 -0600http://answers.opencv.org/question/129842/HOGDescriptor::detectMultiScale returns same weight for different scaleshttp://answers.opencv.org/question/81220/hogdescriptordetectmultiscale-returns-same-weight-for-different-scales/Hey,<br>
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?<br>
Is there a possibility to get different weights at different scales?<br>
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:<br>
<b>---------</b><br>
vector<Rect> locations;<br>
vector<double> weights;<br>
HOGDescriptor::detectMultiScale(<br>
image, // cv::Mat<br>
locations,<br>
weights,<br>
0.0, // Threshold for the distance between features and SVM classifying plane<br>
// We assume this parameter is already specified in the detector<br>
// coĆ«fficients (svm hyperplane)<br>
winStride, // =(8,8) Window stride. It must be a multiple of block stride<br>
Size(0,0), // Mock parameter to keep the CPU interface compatibility. It must be (0,0).<br>
scaleIncrease, // =1.1<br>
similarityThreshold, // =0 no grouping.<br>
// Should be an integer if not using meanshift grouping. <br>
false); // no meanshift grouping<br>
OUTPUT:<br>
<b>------------</b><br>
//display all the weights and locations:<br>
for (int i=0; i < locations.size(); i++)<br>
cout << "\n" << weights[i] << "\t\t" << locations[i];<br>
<b>0.216482 [156 x 156 from (1820, 2704)]</b><br>
0.183423 [156 x 156 from (1976, 2704)]<br>
0.0277854 [156 x 156 from (1950, 2730)]<br>
0.118232 [156 x 156 from (1898, 2782)]<br>
<b>0.216482 [172 x 172 from (1800, 2688)]</b><br>
0.183423 [172 x 172 from (1830, 2688)]<br>
0.0277854 [172 x 172 from (1973, 2688)]<br>
0.118232 [172 x 172 from (1943, 2717)]<br>
0.18763 [172 x 172 from (1888, 2775)]<br>
<b>0.216482 [188 x 188 from (1794, 2675)]</b><br>
0.183423 [188 x 188 from (1823, 2675)]<br>
0.0277854 [188 x 188 from (1950, 2675)]<br>
0.118232 [188 x 188 from (1823, 2704)]<br>
0.18763 [188 x 188 from (1917, 2704)]<br>
0.153218 [188 x 188 from (1950, 2704)]<br>
0.126738 [188 x 188 from (1856, 2736)]<br>
0.137723 [188 x 188 from (1888, 2736)]<br>
0.216663 [188 x 188 from (1888, 2769)]<br>
<b>0.216482 [208 x 208 from (36, 1833)]</b><br>
0.183423 [208 x 208 from (1800, 2665)]<br>
0.0277854 [208 x 208 from (1833, 2665)]<br>
0.118232 [208 x 208 from (1937, 2665)]<br>
0.18763 [208 x 208 from (1833, 2701)]<br>
0.153218 [208 x 208 from (1904, 2701)]<br>
0.126738 [208 x 208 from (1937, 2701)]<br>
0.137723 [208 x 208 from (1869, 2733)]<br>
...KwakTue, 29 Dec 2015 04:19:01 -0600http://answers.opencv.org/question/81220/Calculate weight of a cluster in Opencvhttp://answers.opencv.org/question/55770/calculate-weight-of-a-cluster-in-opencv/ Dear forum followers I have a issue which I don't know how deal with it.
I'm developing a tracker (track people in videos) from a particle filter.
I have particles along the image and I cluster them using EM (http://docs.opencv.org/modules/ml/doc/expectation_maximization.html#ml-expectation-maximization) in Opencv.
After clustering, I can check the next values about the output clusters:
- Mean of the cluster (position)
- Weight of the cluster
- Covariance of the clusters
At this point everything is fine.
After I modify some of this clusters and particles and the final step would be recalculate mean, weight and covariance.
I calculcate these variables:
- **Mean**: calculating the average position of the particles.
- **Covariance**: calculateing the covariance of the particles.
- **Weight**: here is my doubt... **HOW** can I calculate the weight of each cluster??
Extend information:
I'm currently doing:
- I call trainE
- I modify things using these results like the **labels**...
-And I want calculate the weight of the clusters; with the labels modified...
I hope you can help me!!!
Thank in advanced!!!RiSaMaFri, 20 Feb 2015 08:06:03 -0600http://answers.opencv.org/question/55770/