docs: protected Mat centerCropIfNeeded(Mat img) {
          int x = 0;
          int y = 0;
          int height = img.rows();
          int width = img.cols();
          int diff = Math.abs(width - height) / 2;
  
          if (width > height) {
              x = diff;
              width = width - diff;
          } else if (height > width) {
              y = diff;
              height = height - diff;
          }
          return img.apply(new Rect(x, y, width, height));
      }