Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Minor changes to comments and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtheis committed Feb 17, 2014
1 parent 65c979e commit d7a45fd
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
20 changes: 10 additions & 10 deletions tess-two/jni/com_googlecode_tesseract_android/tessbaseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
24 changes: 21 additions & 3 deletions tess-two/src/com/googlecode/tesseract/android/PageIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
50 changes: 25 additions & 25 deletions tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <b>Warning</b> 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: <i>tessdata/configs, tessdata/tessconfigs</i>
* and also accepts a relative or absolute path name.
* @param filename the configuration file name, without path, should be place in <b>tessdata/configs, tessdata/tessconfigs</b>
* Read a "config" file containing a set of variable, value pairs.
* Searches the standard places: <i>tessdata/configs, tessdata/tessconfigs</i>.
*
* @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);
}

// ******************
Expand Down

0 comments on commit d7a45fd

Please sign in to comment.