introduction_to_svm.cpp (Bugfix #3431)


Added by 郭震远 郭 about 11 years ago. Updated about 11 years ago.


Status:Done Start date:2013-12-12
Priority:Normal Due date:
Assignee:Steven Puttemans % Done:

100%

Category:samples
Target version:Next Hackathon
Affected version:2.4.7 (latest release) Operating System:Windows
Difficulty:Easy HW Platform:x64
Pull request:

Description

for (int i = 0; i < image.rows; ++i)
for (int j = 0; j < image.cols; ++j) {
Mat sampleMat = (Mat_<float>(1,2) << i,j);
float response = SVM.predict(sampleMat);

if (response == 1)
image.at<Vec3b>(j, i) = green;
else if (response == -1)
image.at<Vec3b>(j, i) = blue;
}

These codes should be :

for (int i = 0; i < image.rows; ++i)
for (int j = 0; j < image.cols; ++j) {
Mat sampleMat = (Mat_&lt;float&gt;(1,2) << j,i);
float response = SVM.predict(sampleMat);
if (response == 1)
image.at&lt;Vec3b&gt;(i, j) = green;
else if (response == -1)
image.at&lt;Vec3b&gt;(i, j) = blue;
}

The index number is not right.

More information at http://blog.csdn.net/resorcap/article/details/17288389


introduction_to_svm.cpp - origin code (2.1 kB) 郭震远 郭, 2013-12-12 03:06 pm

introduction_to_svm_fixed.cpp - changed code (1.9 kB) 郭震远 郭, 2013-12-12 03:06 pm


Associated revisions

Revision 32348604
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #3431 from PhilLab:patch-3

History

Updated by Steven Puttemans about 11 years ago

Actually this sounds correct to me, and it wasn't changed in 2.4.
For that I will re-open this fix and submit it as a pull request. Correct me if wrong.

  • % Done changed from 100 to 0
  • Assignee changed from Andrew Senin to Steven Puttemans
  • Status changed from Done to Open

Updated by Peter Andreas Entschev about 11 years ago

PR already merged, closing report.

  • Status changed from Open to Done
  • % Done changed from 0 to 100

Also available in: Atom PDF