public void process ( T gray , GrayU8 binary ) { if ( verbose ) System . out . println ( "ENTER DetectPolygonFromContour.process()" ) ; if ( contourPadded != null && ! contourPadded . isCreatePaddedCopy ( ) ) { int padding = 2 ; if ( gray . width + padding != binary . width || gray . height + padding != binary . height ) { throw new IllegalArgumentException ( "Including padding, expected a binary image with shape " + ( gray . width + padding ) + "x" + ( gray . height + padding ) ) ; } } else { InputSanityCheck . checkSameShape ( binary , gray ) ; } if ( imageWidth != gray . width || imageHeight != gray . height ) configure ( gray . width , gray . height ) ; // reset storage for output. Call reset individually here to ensure that all references // are nulled from last time for ( int i = 0 ; i < foundInfo . size ; i ++ ) { foundInfo . get ( i ) . reset ( ) ; } foundInfo . reset ( ) ; if ( contourEdgeIntensity != null ) contourEdgeIntensity . setImage ( gray ) ; long time0 = System . nanoTime ( ) ; // find all the contours contourFinder . process ( binary ) ; long time1 = System . nanoTime ( ) ; // Using the contours find the polygons findCandidateShapes ( ) ; long time2 = System . nanoTime ( ) ; double a = ( time1 - time0 ) * 1e-6 ; double b = ( time2 - time1 ) * 1e-6 ; milliContour . update ( a ) ; milliShapes . update ( b ) ; if ( verbose ) System . out . println ( "EXIT DetectPolygonFromContour.process()" ) ; }
Examines the undistorted gray scale input image for squares . If p