Ask Your Question

mcExchange's profile - activity

2019-03-14 14:06:32 -0500 received badge  Notable Question (source)
2018-02-20 10:31:55 -0500 received badge  Popular Question (source)
2016-04-20 09:34:37 -0500 received badge  Scholar (source)
2016-04-19 13:24:05 -0500 commented answer Toy example using opencv 3.0 object in a custom class

I guess it's kind of fine thanks! I still get some error while compiling, but that might be due to some missing linked library: error: undefined reference to 'cv::ml::SVM::create()'

2016-04-19 12:24:24 -0500 commented answer Toy example using opencv 3.0 object in a custom class

I'm not sure entirely whether it's 3.0 or 3.1 I'm dealing with, since I'm doing surgery in the code of somebody else, but it's clearly not 2.4.x.

2016-04-19 11:56:02 -0500 received badge  Editor (source)
2016-04-19 11:54:36 -0500 asked a question Toy example using opencv 3.0 object in a custom class

I'm new to opencv 3.0. I cannot figure out how to use a SVM object in a custom class. Can someone give me a toy example how to do it?

Here is an example for opencv 2.4.x:

// Class Definition    
class myClass{
    public:
        myClass();

    private:
        CvSVM svm;
};

// Constructor
myClass::myClass()
{
    myClass::svm.load("Some/hard/coded/path/to/a/SVM/File");
}

I guess the class definition should look similar to this:

class myClass {
    private:
    static cv::Ptr<cv::ml::SVM> svm;
};

But my Constructor keeps on failing:

myClass::myClass(){
    myClass::svm->load("Some/hard/coded/path/to/a/SVM/File");
}

with the following error message:

error: no matching function for call to 'cv::ml::SVM::load(const char [120])'
2016-04-15 12:41:36 -0500 asked a question Deconstructor of an SVM object

This question might apply to other objects as well.

I need to deconstruct a CvSVM object because I fear the risk of memory leakage. I know that in opencv Mat objects can be explicitly destroyed using the myMat.release() method. However I'm unsure how to do it for other objects like for example CvSVM.

Can I just call

CvSVM SVM;
delete SVM;

or is there another way?

I couldn't find any deconstructor method in the source code of CvSVM.

2016-02-28 07:27:53 -0500 asked a question parallel execution of opencv kmeans

I need to run 3000 instances of kmeans and therefore would like to parllelize the code. However as soon as I'm starting to call kmeans from within a boost::thread group the results of kmeans look bad and are not random anymore. I guess inside a boost::threadGroup the random number generator just doesn't work anymore. Does anyone have a good suggestion how to solve this issue? Maybe there is even a better way to parralelize the execution of kmeans? Any help would be appreciated :)

2015-07-18 08:53:26 -0500 received badge  Student (source)
2015-07-17 12:00:27 -0500 commented question Wrong definition of Chi ² distance?

:D Oh I didn't realize. Ok. Thanks for your answer

2015-07-17 11:04:20 -0500 asked a question Wrong definition of Chi ² distance?

Could it be that the formula for computing the chi² distance between histograms as pointed out here is wrong?

If one divides the squared difference of (h1 and h2) by h1 the distance is not symmetrical anymore which is not logical.

Here is a paper that defines the chi square distance between histograms as:

1/2 * sum over i of (h1_i - h2_i)^2 / (h1_i + h2_i)

which is symmetric and makes more sense as a distance measure

2015-06-12 10:30:39 -0500 received badge  Supporter (source)
2015-04-01 08:51:39 -0500 asked a question Meaning of Input Array and noArray()

Hi

In the wiki I found the following description of a function:

C++: Vec2d EM::predict(InputArray sample, OutputArray probs=noArray())

what does it mean exactly? I.e.

a) What exact type can "InputArray" be? A cv::Mat? or also a std::vector or also a simple C-style array?

b) What does the value noArray() specify? Is this a function? Or does it simply mean that I don't have to pass this argument because OpenCV can choose a default value here?