diff --git a/tess-two/jni/com_googlecode_tesseract_android/pageiterator.cpp b/tess-two/jni/com_googlecode_tesseract_android/pageiterator.cpp
index 45063d140..16dfb6f21 100644
--- a/tess-two/jni/com_googlecode_tesseract_android/pageiterator.cpp
+++ b/tess-two/jni/com_googlecode_tesseract_android/pageiterator.cpp
@@ -46,7 +46,7 @@ jintArray Java_com_googlecode_tesseract_android_PageIterator_nativeBoundingBox(J
int size = 4;
jintArray result = env->NewIntArray(size);
- LOG_ASSERT((result != NULL), "Could not create Java confidence array!");
+ LOG_ASSERT((result != NULL), "Could not create Java bounding box array!");
PageIterator *pageIterator = (PageIterator *) nativePageIterator;
PageIteratorLevel enumLevel = (PageIteratorLevel) level;
@@ -61,7 +61,7 @@ jintArray Java_com_googlecode_tesseract_android_PageIterator_nativeBoundingBox(J
fill[3] = y2;
env->SetIntArrayRegion(result, 0, size, fill);
- return result;
+ return result;
}
#ifdef __cplusplus
diff --git a/tess-two/jni/com_googlecode_tesseract_android/tessbaseapi.cpp b/tess-two/jni/com_googlecode_tesseract_android/tessbaseapi.cpp
index a53216d92..dba14a7b0 100644
--- a/tess-two/jni/com_googlecode_tesseract_android/tessbaseapi.cpp
+++ b/tess-two/jni/com_googlecode_tesseract_android/tessbaseapi.cpp
@@ -437,7 +437,7 @@ jstring Java_com_googlecode_tesseract_android_TessBaseAPI_nativeGetHOCRText(JNIE
}
jstring Java_com_googlecode_tesseract_android_TessBaseAPI_nativeGetBoxText(JNIEnv *env,
- jobject thiz, jint page) {
+ jobject thiz, jint page) {
native_data_t *nat = get_native_data(env, thiz);
@@ -451,31 +451,31 @@ jstring Java_com_googlecode_tesseract_android_TessBaseAPI_nativeGetBoxText(JNIEn
}
void Java_com_googlecode_tesseract_android_TessBaseAPI_nativeSetInputName(JNIEnv *env,
- jobject thiz,
- jstring name) {
+ jobject thiz,
+ jstring name) {
native_data_t *nat = get_native_data(env, thiz);
const char *c_name = env->GetStringUTFChars(name, NULL);
nat->api.SetInputName(c_name);
env->ReleaseStringUTFChars(name, c_name);
-}
+}
void Java_com_googlecode_tesseract_android_TessBaseAPI_nativeSetOutputName(JNIEnv *env,
- jobject thiz,
- jstring name) {
+ jobject thiz,
+ jstring name) {
native_data_t *nat = get_native_data(env, thiz);
const char *c_name = env->GetStringUTFChars(name, NULL);
nat->api.SetOutputName(c_name);
env->ReleaseStringUTFChars(name, c_name);
-}
+}
void Java_com_googlecode_tesseract_android_TessBaseAPI_nativeReadConfigFile(JNIEnv *env,
- jobject thiz,
- jstring fileName) {
+ jobject thiz,
+ jstring fileName) {
native_data_t *nat = get_native_data(env, thiz);
const char *c_file_name = env->GetStringUTFChars(fileName, NULL);
nat->api.ReadConfigFile(c_file_name);
env->ReleaseStringUTFChars(fileName, c_file_name);
-}
+}
#ifdef __cplusplus
}
#endif
diff --git a/tess-two/src/com/googlecode/tesseract/android/PageIterator.java b/tess-two/src/com/googlecode/tesseract/android/PageIterator.java
index 1095ea805..9b42c7def 100644
--- a/tess-two/src/com/googlecode/tesseract/android/PageIterator.java
+++ b/tess-two/src/com/googlecode/tesseract/android/PageIterator.java
@@ -61,9 +61,27 @@ public boolean next(int level) {
}
/**
- * get bounding box x,y,w,h
- * @param level
- * @return
+ * Get bounding box: x, y, w, h
+ *
+ * ============= Accessing data ==============.
+ * Coordinate system:
+ * Integer coordinates are at the cracks between the pixels.
+ * The top-left corner of the top-left pixel in the image is at (0,0).
+ * The bottom-right corner of the bottom-right pixel in the image is at
+ * (width, height).
+ * Every bounding box goes from the top-left of the top-left contained
+ * pixel to the bottom-right of the bottom-right contained pixel, so
+ * the bounding box of the single top-left pixel in the image is:
+ * (0,0)->(1,1).
+ * If an image rectangle has been set in the API, then returned coordinates
+ * relate to the original (full) image, rather than the rectangle.
+ *
+ * Returns the bounding rectangle of the current object at the given level.
+ * See comment on coordinate system above.
+ * The returned bounding box may clip foreground pixels from a grey image.
+ *
+ * @param level the page iterator level. See {@link PageIteratorLevel}.
+ * @return the bounding rectangle of the current object at the given level
*/
public int[] getBoundingBox(int level){
return nativeBoundingBox(mNativePageIterator, level);
diff --git a/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java b/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java
index a4e337fa8..b3397d998 100644
--- a/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java
+++ b/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java
@@ -486,54 +486,54 @@ public ResultIterator getResultIterator() {
return new ResultIterator(nativeResultIterator);
}
- /**
- *
- * Make a HTML-formatted string with hOCR markup from the internal data
- * structures.
- * GetHOCRText STL removed from original patch submission and refactored by
- * rays.
- * Warning make sure call {@link #setInputName} before this method
- * @param page is 0-based but will appear in the output as 1-based.
- * @return HTML-formatted string with hOCR markup
- */
+ /**
+ * Make a HTML-formatted string with hOCR markup from the internal data
+ * structures.
+ *
+ * @param page is 0-based but will appear in the output as 1-based.
+ * @return HTML-formatted string with hOCR markup
+ */
public String getHOCRText(int page){
- return nativeGetHOCRText(page);
+ return nativeGetHOCRText(page);
}
/**
* Set the name of the input file. Needed only for training and
- * loading a UNLV zone file.
- * @param name input file name
+ * reading a UNLV zone file.
+ *
+ * @param name input file name
*/
public void setInputName(String name){
- nativeSetInputName(name);
+ nativeSetInputName(name);
}
- /** Set the name of the output files.
+ /**
+ * Set the name of the output files.
* Needed only for debugging.
* @param name output file name
*/
public void setOutputName(String name){
- nativeSetOutputName(name);
+ nativeSetOutputName(name);
}
/**
- * Read a "config" file containing a set of parameter name, value pairs.
- * Searches the standard places: tessdata/configs, tessdata/tessconfigs
- * and also accepts a relative or absolute path name.
- * @param filename the configuration file name, without path, should be place in tessdata/configs, tessdata/tessconfigs
+ * Read a "config" file containing a set of variable, value pairs.
+ * Searches the standard places: tessdata/configs, tessdata/tessconfigs.
+ *
+ * @param filename the configuration filename, without path
*/
public void ReadConfigFile(String filename){
- nativeReadConfigFile(filename);
+ nativeReadConfigFile(filename);
}
/**
- * The recognized text is returned which is coded
- * as a UTF8 box file.
- * @param page is a 0-base page index that will appear in the box file.
+ * The recognized text is returned as coded in the same format as a UTF8
+ * box file used in training.
+ *
+ * @param page is a 0-based page index that will appear in the box file.
*/
public String getBoxText(int page){
- return nativeGetBoxText(page);
+ return nativeGetBoxText(page);
}
// ******************