sclass ULetterbox1 implements IIIRecognizer { public void run( IProbabilisticScheduler scheduler, IIntegralImage img, IVF1 valueToAction) { var cell = uCell(img); var whole = cell; var middle = cell.slice(1, 1.0/3.0, 1.0/3.0); // We assume the border is black. // If the picture fills the whole screen, it will tend // to equal brightness everywhere. Thus whole = middle*3 // (because it's 3 times as large). // If only "middle" is not black, we have whole = middle. // Thus the border position can be estimated as: double borderPos = (2-doubleRatio(whole, middle))*cell.getHeight(); DoubleRect rect = doubleRectFromPoints(0, borderPos, cell.getWidth(), cell.getHeight()-borderPos); // No probabilities used. scheduler.schedule(1.0, () -> valueToAction.get(rect)); //var antiBorder = cell.slice(1, 1.0/8.0, 1-1/8.0); //var border = whole.pixelSum()-antiBorder.pixelSum(); } }