1 | initial version |
Mat square(const Mat &in) {
size_t n = in.total(); size_t ns = (size_t)sqrt(double(size_t)n); CV_Assert(ns*ns == n); //make sure, there was no rounding. return in.reshape(0, ns); }
2 | No.2 Revision |
Mat square(const Mat &in)
3 | No.3 Revision |
Mat square(const Mat &in)
{
size_t n = in.total(); //count of all elements
size_t ns = (size_t)sqrt(double(size_t)n); (size_t)sqrt(double(n)); // squared
CV_Assert(ns*ns == n); //make sure, there was no rounding.
return in.reshape(0, ns);
}