Reputation: 534
The following will create 1 particle of Mat data structure and initialise it,
static Mat Particle = (Mat_<float>(4, 1) << 0, 0, 0, 0);
But how to create 100 such particles and initialise ?
Upvotes: 1
Views: 109
Reputation: 26259
Maybe something like this (assuming you want them all initialised the same?) :
static Mat Particle = (Mat_<float>(4, 1) << 0, 0, 0, 0);
std::vector<Mat> pParticles;
for (int i = 0; i < 100; ++i)
{
pParticles.push_back(Particle.clone());
}
Upvotes: 1