photo: fix integer overflow
photo: fix integer overflow

There is no cast to wide integer type:
    std::numeric_limits<ST>::max() * std::numeric_limits<ST>::max()

opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv