When I create a vector and add new calculated Mat to it using for loop, it will add the same reference as my Mat has same name.
for example:
vector<Mat> hists;
for (int row = 0 ; row < 2 ; row++)
for (int col = 0 ; col < 4 ; col++)
{
hist_mat.set_roi(row , col);
hist_mat.run();
hists.push_back(hist_mat.hist_h);
}
for (int i = 0 ; i < 8 ; i++)
{
cout << hists[i] << endl;
}
This program has same lines; Because all vector elements has same reference. What is a good way to copy and add to the vector?