Fix for CvSVM tutorial documentation (Bug #3970)
Description
In the OpenCV machine learning tutorial: [[http://docs.opencv.org/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html#explanation]]
Explanation
1.Set up the training data
The training data of this exercise is formed by a set of labeled 2D-points that belong to one of two different classes; one of the classes consists of one point and the other of three points.
float labels4 = {1.0, -1.0, -1.0, -1.0};
float trainingData4[2] = {501, 10}, {255, 10}, {501, 255}, {10, 501};
The function
CvSVM::train that will be used afterwards requires the training data to be stored as Mat objects of floats. Therefore, we create these objects from the arrays defined above: Mat trainingDataMat(3, 2, CV_32FC1, trainingData); Mat labelsMat (3, 1, CV_32FC1, labels);
*The Mat dimension initiating is wrong. *
It should be fixed as:
Mat trainingDataMat(4, 2, CV_32FC1, trainingData);
Mat labelsMat (4, 1, CV_32FC1, labels);
History
Updated by Steven Puttemans over 10 years ago
I cancelled all the other issues. Please do try to contain your issue to a single one in the future.
- Status changed from New to Open
Updated by Steven Puttemans over 10 years ago
Actually look at
http://docs.opencv.org/2.4/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html#explanation
You can see that it is already fixed for the following stable 2.4.10 release.
So this can be put on done!
- Status changed from Open to Done
Updated by Yida Wang over 10 years ago
OK, It's the first time I use the new browser, something stuck in the submitting process.
Steven Puttemans wrote:
I cancelled all the other issues. Please do try to contain your issue to a single one in the future.