Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
14,914 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.kanjitomo; | ||
|
||
/** | ||
* Character and background color. | ||
*/ | ||
public enum CharacterColor { | ||
|
||
/** | ||
* Character color is detected automatically. (default) | ||
*/ | ||
AUTOMATIC, | ||
|
||
/** | ||
* Black characters over white background | ||
*/ | ||
BLACK_ON_WHITE, | ||
|
||
/** | ||
* White characters over black background | ||
*/ | ||
WHITE_ON_BLACK; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package net.kanjitomo; | ||
|
||
import java.awt.Rectangle; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* List of areas inside a single column (or row in horizontal orientation) | ||
*/ | ||
public class Column { | ||
|
||
// this is a simplified version of net.kanjitomo.area.Column intended to be used | ||
// as a result object from KanjiTomo class | ||
|
||
/** | ||
* Rectangles around characters in this column. | ||
* Ordered in reading direction (top-down or left-right). | ||
*/ | ||
public List<Rectangle> areas; | ||
|
||
/** | ||
* Bounding box around areas | ||
*/ | ||
public Rectangle rect; | ||
|
||
/** | ||
* Next column in reading direction | ||
*/ | ||
public Column nextColumn; | ||
|
||
/** | ||
* Previous column in reading direction | ||
*/ | ||
public Column previousColumn; | ||
|
||
/** | ||
* If true, this column has vertical reading direction. If false, horizontal. | ||
*/ | ||
public boolean vertical; | ||
|
||
/** | ||
* If true, this column contains furigana characters | ||
*/ | ||
public boolean furigana; | ||
|
||
/** | ||
* Furigana columns next to this column | ||
*/ | ||
public List<Column> furiganaColumns = new ArrayList<Column>(); | ||
|
||
@Override | ||
public String toString() { | ||
return "rect:"+rect+" areas:"+areas.size()+" vertical:"+vertical+" furigana:"+furigana; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.kanjitomo; | ||
|
||
/** | ||
* Type of dictionary used for searching and refining OCR results | ||
*/ | ||
public enum DictionaryType { | ||
|
||
/** | ||
* Normal Japanese dictionary | ||
*/ | ||
JAPANESE_DEFAULT, | ||
|
||
/** | ||
* Japanese names dictionary | ||
*/ | ||
JAPANESE_NAMES, | ||
|
||
/** | ||
* Chinese dictionary | ||
*/ | ||
CHINESE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package net.kanjitomo; | ||
|
||
import java.awt.Rectangle; | ||
import java.util.List; | ||
|
||
/** | ||
* OCR results for a single target character | ||
*/ | ||
public class IdentifiedCharacter { | ||
|
||
/** | ||
* List of reference characters that match the target character best, | ||
* ordered by OCR score (first character is the closest match). | ||
*/ | ||
public final String referenceCharacters; | ||
|
||
/** | ||
* OCR scores for each reference character. Same order as in referenceCharacters. | ||
* Higher score is better but reference characters might have been re-ordered if | ||
* first match didn't result in a valid dictionary word. | ||
*/ | ||
public final List<Integer> scores; | ||
|
||
// TODO normalized scores | ||
|
||
/** | ||
* Location of the character in target image's coordinates | ||
*/ | ||
public final Rectangle location; | ||
|
||
public IdentifiedCharacter(String matchedCharacters, Rectangle location, | ||
List<Integer> scores) { | ||
|
||
this.referenceCharacters = matchedCharacters; | ||
this.location = location; | ||
this.scores = scores; | ||
} | ||
} |
Oops, something went wrong.