我试图在Matrix.M中保存4个矩阵,但我不确定是否可以这样做。因此我将4矩阵转换为4个矢量。现在我想在矩阵中插入4个向量。我的代码是:将节点保存在Mat中opencv
Mat hist_TL = Mat::zeros(20,1, CV_32F);
Mat hist_TR = Mat::zeros(20,1, CV_32F);
Mat hist_BL = Mat::zeros(20,1, CV_32F);
Mat hist_BR = Mat::zeros(20,1, CV_32F);
for(int i=1;i<=21;i++)
{
for(int k=0;k<TL_k_stats.rows;k++)
{
if((angl_TL<=bins[i]) && (angl_TL>bins[i-1]))
{
hist_TL.at<float>(i-1,0)+=TL_k_stats.at<float>(k,4);
}
if((angl_TR<=bins[i]) && (angl_TR>bins[i-1]))
{
hist_TR.at<float>(i-1,0)+=TR_k_stats.at<float>(k,4);
}
if((angl_BL<=bins[i]) && (angl_BL>bins[i-1]))
{
hist_BL.at<float>(i-1,0)+=BL_k_stats.at<float>(k,4);
}
if((angl_BR<=bins[i]) && (angl_BR>bins[i-1]))
{
hist_BR.at<float>(i-1,0)+=BR_k_stats.at<float>(k,4);
}
}
hist_TL=hist_TL.inv();
hist_TR=hist_TR.inv();
hist_BL=hist_BL.inv();
hist_BR=hist_BR.inv();
std::vector<float> vhist_TL;
std::vector<float> vhist_TR;
std::vector<float> vhist_BL;
std::vector<float> vhist_BR;
hist_TL.copyTo(vhist_TL);
hist_TR.copyTo(vhist_TR);
hist_BL.copyTo(vhist_BL);
hist_BR.copyTo(vhist_BR);
所以我想复制4个向量到一个矩阵。如果有什么办法可以不用矩阵来vector.Please转换让我know.In matlab的我们可以把它直接存储到一个数组中,并返回它像这样
features[] = {hist_TL', hist_TR', hist_BL', hist_BR'};
那么,如何才能做到这一点在opencv ??
但我不得不调换垫hist_TL和其他节能it.So在这之前将有一个单行munltiple列 – user1583647