introduction_to_svm.cpp (Bugfix #3431)
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_<float>(1,2) << j,i);
float response = SVM.predict(sampleMat);
if (response == 1)
image.at<Vec3b>(i, j) = green;
else if (response == -1)
image.at<Vec3b>(i, j) = blue;
}
The index number is not right.
More information at http://blog.csdn.net/resorcap/article/details/17288389
Associated revisions
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