double image_sum(const SDoublePlane& input) { double *start = input.data_ptr(); double *end = start + input.rows()*input.cols(); return std::accumulate(start, end, 0); }
double image_max(const SDoublePlane& input) { double *start = input.data_ptr(); double *end = start + input.rows()*input.cols(); double *pos = std::max_element(start, end); return (pos == end)? -1.0: *pos; }