private synchronized Rect[] computeBoundingBoxes(){
  if (!boundingBoxes.isPresent()) {
    Rect[] bb=new Rect[(int)contours.size()];
    for (int i=0; i < contours.size(); i++) {
      bb[i]=boundingRect(contours.get(i));
    }
    boundingBoxes=Optional.of(bb);
  }
  return boundingBoxes.get();
}

private synchronized Rect [ ] computeBoundingBoxes ( ) { if ( ! boundingBoxes . isPresent ( ) ) { Rect [ ] bb = new Rect [ ( int ) contours . size ( ) ] ; for ( int i = 0 ; i < contours . size ( ) ; i ++ ) { bb [ i ] = boundingRect ( contours . get ( i ) ) ; } boundingBoxes = Optional . of ( bb ) ; } return boundingBoxes . get ( ) ; }
compute the bounding boxes of all contours ( if they haven ' t already been computed ) . bounding boxes are used to compute several different properties , so it ' s probably not a good idea to compute them over and over again .
