1 | initial version |
Do like you want :
Mat Mat::clone() const
{
Mat m;
copyTo(m);
return m;
}
if you want to test :
TickMeter chronometer;
Mat a(500,500,CV_8UC1);
RNG rr;
rr.fill(a,CV_8UC1, RNG::UNIFORM, 0, 256);
chronometer.start();
for (int i = 0; i < 1000; i++)
{
Mat b = a.clone();
}
chronometer.stop();
cout << "Clone " << chronometer.getTimeSec() << endl;
chronometer.reset();
chronometer.start();
for (int i = 0; i < 1000; i++)
{
Mat b;
a.copyTo(b);
}
chronometer.stop();
cout << "Copy " << chronometer.getTimeSec() << endl;