我試圖在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