I have the following code, which is a part of the algorithm that I am following. as you see I need to do some calculation for 10 different bands. and will end up with a matrix for each band that I need to recreate an image from it, the problem is that I dont know how to create/hold the 10 different matrix on the while loop, then after the while loop I can construct the images one by one. if you have any idea please let me know thank you
cv::Mat _reconstructionMatrix(height,width,CV_8UC1);
_reconsPointer = _reconstructionMatrix.ptr<uchar>(0);
while(_bandIteration<_bandsNumber){
if(_mainMatrix.isContinuous())
{
nCols *= nRows;
nRows = 1;
}
//for all the pixels
for(int i = 0; i < nRows; i++)
{
p = _mainMatrix.ptr<uchar>(i);
//in the images
for (int j = 0; j < nCols; j++)
{
if(_pCounter<_totalImgNO){
....
}else{
...
_reconsPointer[_resultFlag]=_summation;
_resultFlag++;
...
}
}
}
_bandIteration++;
}
Your question is a bit vague. But if you are asking simply how to create/hold the 10 different matrix on the while loop?
then you can use STL vectors as normal.
#include<vector>
...
std::vector<cv::Mat> listOfMatrices;
...
cv::Mat M = SomehowGetMatrix();
listOfMatrices.push_back(M);
If this is not what you are looking for, then please provide more detail to your question.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.