本文介绍了这段代码是如何工作的?(SVM分类)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我无法理解这行以下代码是如何工作的:
Mat sampleMat =(Mat_< float>(1,2 )<< i,j);
什么是Mat_?
为什么(1,2)?
HiI can't understand how does work this line of following code:
Mat sampleMat = (Mat_<float>(1,2) << i,j);
what is "Mat_" ?
Why (1,2)?
Vec3b green(0,255,0), blue (255,0,0);
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;
}
为什么在if-else条件下它使用(j,i)not(i, j)?
这里有完整的解释:http://docs.opencv.org/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html
Also why in if-else conditions it uses (j,i) not (i,j) ?
The complete explanation is exist here : http://docs.opencv.org/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html
推荐答案
这篇关于这段代码是如何工作的?(SVM分类)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!