private static ResultPoint[] findVertices(BitMatrix matrix,boolean tryHarder){
  int height=matrix.getHeight();
  int width=matrix.getWidth();
  ResultPoint[] result=new ResultPoint[8];
  boolean found=false;
  int[] counters=new int[START_PATTERN.length];
  int rowStep=Math.max(1,height >> (tryHarder ? 9 : 7));
  for (int i=0; i < height; i+=rowStep) {
    int[] loc=findGuardPattern(matrix,0,i,width,false,START_PATTERN,counters);
    if (loc != null) {
      result[0]=new ResultPoint(loc[0],i);
      result[4]=new ResultPoint(loc[1],i);
      found=true;
      break;
    }
  }
  if (found) {
    found=false;
    for (int i=height - 1; i > 0; i-=rowStep) {
      int[] loc=findGuardPattern(matrix,0,i,width,false,START_PATTERN,counters);
      if (loc != null) {
        result[1]=new ResultPoint(loc[0],i);
        result[5]=new ResultPoint(loc[1],i);
        found=true;
        break;
      }
    }
  }
  counters=new int[STOP_PATTERN.length];
  if (found) {
    found=false;
    for (int i=0; i < height; i+=rowStep) {
      int[] loc=findGuardPattern(matrix,0,i,width,false,STOP_PATTERN,counters);
      if (loc != null) {
        result[2]=new ResultPoint(loc[1],i);
        result[6]=new ResultPoint(loc[0],i);
        found=true;
        break;
      }
    }
  }
  if (found) {
    found=false;
    for (int i=height - 1; i > 0; i-=rowStep) {
      int[] loc=findGuardPattern(matrix,0,i,width,false,STOP_PATTERN,counters);
      if (loc != null) {
        result[3]=new ResultPoint(loc[1],i);
        result[7]=new ResultPoint(loc[0],i);
        found=true;
        break;
      }
    }
  }
  return found ? result : null;
}

private static ResultPoint [ ] findVertices ( BitMatrix matrix , boolean tryHarder ) { int height = matrix . getHeight ( ) ; int width = matrix . getWidth ( ) ; ResultPoint [ ] result = new ResultPoint [ 8 ] ; boolean found = false ; int [ ] counters = new int [ START_PATTERN . length ] ; int rowStep = Math . max ( 1 , height > > ( tryHarder ? 9 : 7 ) ) ; for ( int i = 0 ; i < height ; i += rowStep ) { int [ ] loc = findGuardPattern ( matrix , 0 , i , width , false , START_PATTERN , counters ) ; if ( loc != null ) { result [ 0 ] = new ResultPoint ( loc [ 0 ] , i ) ; result [ 4 ] = new ResultPoint ( loc [ 1 ] , i ) ; found = true ; break ; } } if ( found ) { found = false ; for ( int i = height - 1 ; i > 0 ; i -= rowStep ) { int [ ] loc = findGuardPattern ( matrix , 0 , i , width , false , START_PATTERN , counters ) ; if ( loc != null ) { result [ 1 ] = new ResultPoint ( loc [ 0 ] , i ) ; result [ 5 ] = new ResultPoint ( loc [ 1 ] , i ) ; found = true ; break ; } } } counters = new int [ STOP_PATTERN . length ] ; if ( found ) { found = false ; for ( int i = 0 ; i < height ; i += rowStep ) { int [ ] loc = findGuardPattern ( matrix , 0 , i , width , false , STOP_PATTERN , counters ) ; if ( loc != null ) { result [ 2 ] = new ResultPoint ( loc [ 1 ] , i ) ; result [ 6 ] = new ResultPoint ( loc [ 0 ] , i ) ; found = true ; break ; } } } if ( found ) { found = false ; for ( int i = height - 1 ; i > 0 ; i -= rowStep ) { int [ ] loc = findGuardPattern ( matrix , 0 , i , width , false , STOP_PATTERN , counters ) ; if ( loc != null ) { result [ 3 ] = new ResultPoint ( loc [ 1 ] , i ) ; result [ 7 ] = new ResultPoint ( loc [ 0 ] , i ) ; found = true ; break ; } } } return found ? result : null ; }
locate the vertices and the codewords area of a black blob using the start and stop patterns as locators .
