protected final boolean touchesBorder ( List < Point2D_I32 > contour ) { int endX = imageWidth - 1 ; int endY = imageHeight - 1 ; for ( int j = 0 ; j < contour . size ( ) ; j ++ ) { Point2D_I32 p = contour . get ( j ) ; if ( p . x == 0 || p . y == 0 || p . x == endX || p . y == endY ) { return true ; } } return false ; }
Checks to see if some part of the contour touches the image border . Most likely cropped