Mat mergeCols(Mat A, Mat B)
{
//CV_ASSERT(A.cols == B.cols&&A.type() == B.type());
int totalCols = A.cols + B.cols;
Mat mergedDescriptors(A.rows, totalCols, A.type());
Mat submat = mergedDescriptors.colRange(0, A.cols);
A.copyTo(submat);
submat = mergedDescriptors.colRange(A.cols, totalCols);
B.copyTo(submat);
return mergedDescriptors;
}
Mat mergeRows(Mat A, Mat B)
{
//CV_ASSERT(A.cols == B.cols&&A.type() == B.type());
int totalRows = A.rows + B.rows;
Mat mergedDescriptors(totalRows, A.cols, A.type());
Mat submat = mergedDescriptors.rowRange(0, A.rows);
A.copyTo(submat);
submat = mergedDescriptors.rowRange(A.rows, totalRows);
B.copyTo(submat);
return mergedDescriptors;
}
两个矩阵,合并成一个矩阵
最新推荐文章于 2023-07-05 19:56:19 发布