![](/img/trans.png)
[英]How do I create a vector of cv::matrix in opencv and assign submatrix of image data to matrices on all index of vector
[英]How do I create a vector using the data from the vector
我設法將值插入范圍向量,但是在范圍向量中我有數據RangeA,RangeB,RangeC。
使用此數據,我想在塊向量下為此范圍創建一個向量,我應該如何處理呢?
vector <string> range;
for(int i=0;i<range.size();i++)
{
cout<<"range: "<<range[i]<<endl;
vector <string> block[i]; <<<<<<<
}
輸出:
范圍:RangeA
范圍:RangeB
范圍:RangeC
提前致謝!
vector <string> range;
for(int i=0;i<range.size();i++)
{
cout<<"range: "<<range[i]<<endl;
// create a vector of size i
// with each element of default
// value "default"
vector <string> block(i,string("default"));
}
vector<string> range;
//Create block vector with size
//same as range vector
vector <string> block(range.size());
//Now you can iterate range vector
//and initialize the block vector with value
for (int i = 0 ; i < range.size(); i++)
{
block[i]=string(range[i]);
}
for (int i = 0 ; i < block.size(); i++)
{
cout<<block[i];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.