public boolean process ( T image ) { configureContourDetector ( image ) ; binary . reshape ( image . width , image . height ) ; inputToBinary . process ( image , binary ) ; detectorSquare . process ( image , binary ) ; detectorSquare . refineAll ( ) ; detectorSquare . getPolygons ( found , null ) ; clusters = s2c . process ( found ) ; c2g . process ( clusters ) ; List < SquareGrid > grids = c2g . getGrids ( ) ; SquareGrid match = null ; double matchSize = 0 ; for ( SquareGrid g : grids ) { if ( g . columns != numCols || g . rows != numRows ) { if ( g . columns == numRows && g . rows == numCols ) { tools . transpose ( g ) ; } else { continue ; } } double size = tools . computeSize ( g ) ; if ( size > matchSize ) { matchSize = size ; match = g ; } } if ( match != null ) { if ( tools . checkFlip ( match ) ) { tools . flipRows ( match ) ; } tools . putIntoCanonical ( match ) ; if ( ! tools . orderSquareCorners ( match ) ) return false ; extractCalibrationPoints ( match ) ; return true ; } return false ; }
Process the image and detect the calibration target