### Question:
Tesseract implements ITesseract { @Override public List<Rectangle> getSegmentedRegions(BufferedImage bi, int pageIteratorLevel) throws TesseractException { init(); setTessVariables(); try { List<Rectangle> list = new ArrayList<Rectangle>(); setImage(bi, null); Boxa boxes = api.TessBaseAPIGetComponentImages(handle, pageIteratorLevel, TRUE, null, null); Leptonica leptInstance = Leptonica.INSTANCE; int boxCount = leptInstance.boxaGetCount(boxes); for (int i = 0; i < boxCount; i++) { Box box = leptInstance.boxaGetBox(boxes, i, L_CLONE); if (box == null) { continue; } list.add(new Rectangle(box.x, box.y, box.w, box.h)); PointerByReference pRef = new PointerByReference(); pRef.setValue(box.getPointer()); leptInstance.boxDestroy(pRef); } PointerByReference pRef = new PointerByReference(); pRef.setValue(boxes.getPointer()); leptInstance.boxaDestroy(pRef); return list; } catch (IOException ioe) { logger.error(ioe.getMessage(), ioe); throw new TesseractException(ioe); } finally { dispose(); } }  @Deprecated static synchronized Tesseract getInstance(); @Override void setDatapath(String datapath); @Override void setLanguage(String language); @Override void setOcrEngineMode(int ocrEngineMode); @Override void setPageSegMode(int mode); void setHocr(boolean hocr); @Override void setTessVariable(String key, String value); @Override void setConfigs(List<String> configs); @Override String doOCR(File imageFile); @Override String doOCR(File imageFile, Rectangle rect); @Override String doOCR(BufferedImage bi); @Override String doOCR(BufferedImage bi, Rectangle rect); @Override String doOCR(List<IIOImage> imageList, Rectangle rect); @Override String doOCR(List<IIOImage> imageList, String filename, Rectangle rect); @Override String doOCR(int xsize, int ysize, ByteBuffer buf, Rectangle rect, int bpp); @Override String doOCR(int xsize, int ysize, ByteBuffer buf, String filename, Rectangle rect, int bpp); @Override void createDocuments(String filename, String outputbase, List<RenderedFormat> formats); @Override void createDocuments(String[] filenames, String[] outputbases, List<RenderedFormat> formats); @Override List<Rectangle> getSegmentedRegions(BufferedImage bi, int pageIteratorLevel); @Override List<Word> getWords(BufferedImage bi, int pageIteratorLevel);  }### Answer:
@Test public void testGetSegmentedRegions() throws Exception { logger.info("getSegmentedRegions at given TessPageIteratorLevel"); File imageFile = new File(testResourcesDataPath, "eurotext.png"); BufferedImage bi = ImageIO.read(imageFile); int level = TessPageIteratorLevel.RIL_SYMBOL; logger.info("PageIteratorLevel: " + Utils.getConstantName(level, TessPageIteratorLevel.class)); List<Rectangle> result = instance.getSegmentedRegions(bi, level); for (int i = 0; i < result.size(); i++) { Rectangle rect = result.get(i); logger.info(String.format("Box[%d]: x=%d, y=%d, w=%d, h=%d", i, rect.x, rect.y, rect.width, rect.height)); } assertTrue(result.size() > 0); }