+ private void model4(Mat src, int interpolation) {
+ int width = 3 * src.cols() / 16;
+ int height = 3 * src.rows() / 9;
+ Mat[] cropped = new Mat[] {
+ /* LEFT */ src.submat(0, src.rows(), 0, width),
+ /* RIGHT */ src.submat(0, src.rows(), src.cols() - width, src.cols()),
+ /* TOP */ src.submat(0, height, 0, src.cols()),
+ /* BOTTOM */ src.submat(src.rows() - height, src.rows(), 0, src.cols()),
+ };
+ images = new Mat[] {new Mat(), new Mat(), new Mat(), new Mat()};
+// Imgproc.resize(cropped[ListPosition.LEFT.ordinal()], images[ListPosition.LEFT.ordinal()], new Size(3, config.leds.rows), 0, 0, interpolation);
+ Imgproc.resize(cropped[0], images[0], new Size(3, config.leds.rows), 0, 0, interpolation);
+ Imgproc.resize(cropped[1], images[1], new Size(3, config.leds.rows), 0, 0, interpolation);
+ Imgproc.resize(cropped[2], images[2], new Size(config.leds.cols, 3), 0, 0, interpolation);
+ Imgproc.resize(cropped[3], images[3], new Size(config.leds.cols, 3), 0, 0, interpolation);
+// Imgproc.resize(src, colImage, new Size(config.leds.cols, 9), 0, 0, interpolation);
+// Imgproc.resize(src, rowImage, new Size(16, config.leds.rows), 0, 0, interpolation);
+ }
+
+ private Color wrappedGetLedColor(ListPosition listPosition, int xy) {
+ Color c = getLedColor(listPosition, xy);
+ double[] hsv = c.toHSV();
+ return Color.hsv(hsv[0], 1, 1);
+ }
+
+ private Color getLedColor(ListPosition listPosition, int xy) {
+ // TODO: maybe use highest value from pixels? 100 % from 1st, 66 % from 2nd, 33 % from 3rd. colors might be strange.