rmtheis/tess-two — pull request #40 by ductranit (2014-02-13 08:26:39+00:00)
Title: Add some useful functions

There are 5 extend functions in base api: GetBoxText, GetHOCRText, SetInputName, SetOutputName, ReadConfigFile

Here is the example for new apis:

```Java
TessBaseAPI baseApi = new TessBaseAPI();
// use the most accuracy mode.
baseApi.init(appPath, "eng", TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED);

// set config output hocr
baseApi.setVariable("tessedit_create_hocr", "1");
baseApi.setImage(new File(grayScaleFileName));

// set the filename for hocr output
baseApi.setInputName("hocr.html");

String hocr = baseApi.getHOCRText(0);
String recognizedText = baseApi.getUTF8Text();
String boxText = baseApi.getBoxText(0);
```
This is a input image:
![20140213_145057_675_grayscale](https://f.cloud.github.com/assets/2063905/2157773/66b1b926-9484-11e3-933b-93e69049d6aa.jpg)

And the result:
- Raw text: http://pastebin.com/kBAarJpG
- Hocr output: http://pastebin.com/1bGimDhz
- Box text: http://pastebin.com/MR6jY6GS

For the Page Iterator, I created test case base on tesseract document (https://code.google.com/p/tesseract-ocr/wiki/APIExample#Result_iterator_example)

```Java
ResultIterator iterator = baseApi.getResultIterator();
int level = PageIteratorLevel.RIL_WORD;
if(iterator != null){
do{
String dataText = iterator.getUTF8Text(level);
float confident = iterator.confidence(level);
if(!TextUtils.isEmpty(dataText)){
int[] box = iterator.getBoundingBox(level);
System.out.println(box);
}
}while(iterator.next(level));
iterator = null;
}
```