@Test
public void testGetMaxPosition() {

  opencv_core.Mat src = LaneManager.readImage(getResourcePath(TEST_IMAGE));
  opencv_core.Mat saturationChannel = LaneManager.getSaturationChannel(src);
  opencv_core.Mat histogram = LaneManager.histogram(saturationChannel);
  // Compute manual
  float max = -1.0f;
  int maxIndex = -1;
  FloatIndexer idx = histogram.createIndexer();
  for (int row = 0; row < histogram.rows(); row++) {
    for (int col = 0; col < histogram.cols(); col++) {
      float value = idx.get(row, col);
      //System.out.println(String.format(Locale.US, "row: %d, col: %d, value: %f", row, col, value));
      if (max == -1 || value > max) {
        maxIndex = row;
        max = value;
      }
    }
  }
  // Compute with OpenCV
  HistogramPosition position = LaneManager.getMaxPosition(histogram);
  // Both results should match
  assertEquals(position.getBinIndex(), 21);
  assertEquals(position.getBinValue(), 36377.0, DELTA);
  assertEquals(position.getBinIndex(), maxIndex);
  assertEquals(position.getBinValue(), max, DELTA);
}