我有一个矢量图像切片和一个3D:
cv::Mat RTstruct3D(3,DImensions3D, CV_8U, Scalar(0))
我想把我的向量放到3D cv::Mat的特定索引中。
//Make a 3D Organ
int programCounter = 0;
vector<Mat>imageSlices;
for (size_t k = 0; k < Npoint_Z.size(); k++)
{
Mat finalSliceImage = Mat :: zeros(DImensions3D[0], DImensions3D[1],CV_8U);
vector<vector<int>> polies;
for (size_t h = 0; h < Npoint_Z[k][0]; h++)
{
vector<int>x_y;
x_y.push_back(ContourData[programCounter][0]); //x
x_y.push_back(ContourData[programCounter][1]); //y
polies.push_back(x_y);
programCounter++;
}
fillPoly(finalSliceImage, polies, Scalar(0, 255, 0));
imageSlices.push_back(finalSliceImage);
}
//Add Organ to RTSTRUCT 3D
Mat RTstruct3D(3,DImensions3D, CV_8U, Scalar(0));
类似于以下图像:
请帮帮我!谢谢。
2条答案
按热度按时间cngwdvgl1#
您可以尝试使用Mat cv::Mat::operator()(const std::vector < Range >& ranges)const来访问子矩阵,然后使用Mat& cv::Mat::operator=(const Mat & m)
示例:
vof42yt12#