Fix for CvSVM tutorial documentation (Bugfix #3969)


Added by Yida Wang over 10 years ago. Updated over 10 years ago.


Status:Cancelled Start date:2014-10-23
Priority:High Due date:
Assignee:- % Done:

90%

Category:documentation
Target version:3.0
Affected version:branch 'master' (3.0-dev) Operating System:Windows
Difficulty:Easy HW Platform:x64
Pull request:

Description

[Liquid Syntax Error] Variable '{{501, 10}' was not properly terminated with regexp: /\}\}/
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 labels[4] = {1.0, -1.0, -1.0, -1.0}; float trainingData[4][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);+

Associated revisions

Revision 90c3d7d3
Added by Maksim Shabunin almost 10 years ago

Merge pull request #3969 from Dikay900:master_to_2_4

History

Updated by Yida Wang over 10 years ago

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);

Updated by Steven Puttemans over 10 years ago

Double

  • Status changed from New to Cancelled

Also available in: Atom PDF