Skip to content

Commit

Permalink
Added more to the README, optimised one section of code, changed to 1…
Browse files Browse the repository at this point in the history
….0.3
  • Loading branch information
RubbaBoy committed Nov 16, 2018
1 parent b73f7fa commit a7d2822
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ NewOCR is on Central, so it's insanely easy to get on both Maven and Gradle.

Gradle:
```Groovy
compile 'com.uddernetworks.newocr:NewOCR:1.0.2'
compile 'com.uddernetworks.newocr:NewOCR:1.0.3'
```

Maven:
```XML
<dependency>
<groupId>com.uddernetworks.newocr</groupId>
<artifactId>NewOCR</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</dependency>
```

Expand All @@ -66,6 +66,12 @@ You will _not_ be required to run any queries manually once you have created a t

Before you do anything with detecting characters you must train the OCR. It does not use any Neural Networks as shown in the explanation above, but it needs to register how the font works. In order to get this working in `Main.java`, make sure in the main method you have `new Main().run(args)` uncommented, and that more down the file that `new File("training.png")` and `new File("HWTest.png")` points to valid paths, the first one being the training image as described above, and then your input image. When you run the program, type `yes` when it asks if you want to train, and then wait a minute or so. When the program exits, you should be able to run it again, answer `no` to that question, and after a few seconds it should give its output.

### System properties used
NewOCR uses a few system properties for some extra options for debugging and other things. Here is a list of them (More may be added in the future):
- **newocr.rewrite** [Boolean] - Rewrites the image to a new BufferedImage before it's scanned. This could fix some weird encoding issues happening in the past
- **newocr.error** [Boolean] - If the system should output certain problems it thinks may have occurred (NOT stacktraces, those are always shown)
- **newocr.debug** [Boolean] - If the system should display some certain debug messages used in the program

## Resources
The following papers were used as inspiration, ideas, knowledge gathering, whatever it may be towards the advancement of this OCR. I could have forgotten a few research papers, I read a lot of them. They might just be stuff I thought was really cool related to the subject, I'm generalizing this description to hell so I won't have to change it later.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apply plugin: 'io.codearte.nexus-staging'

group 'com.uddernetworks.newocr'
archivesBaseName = "NewOCR"
version '1.0.2'
version '1.0.3'

sourceCompatibility = 1.8

Expand Down
14 changes: 2 additions & 12 deletions src/main/java/com/uddernetworks/newocr/OCRHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,8 @@ public ScannedImage scanImage(File file) throws IOException {
.filter(Objects::nonNull)
.sorted(Comparator.comparingInt(ImageLetter::getX))
.forEachOrdered(imageLetter -> {
if ( imageLetter.getLetter() == ','
|| imageLetter.getLetter() == '.'
|| imageLetter.getLetter() == '_'
|| imageLetter.getLetter() == '`'
|| imageLetter.getLetter() == '\''
|| imageLetter.getLetter() == '"'
|| imageLetter.getLetter() == '*'
) {
secondList.add(imageLetter);
} else {
firstList.add(imageLetter);
}
char cha = imageLetter.getLetter();
(cha == ',' || cha == '.' || cha == '_' || cha == '`' || cha == '\'' || cha == '"' || cha == '*' ? secondList : firstList).add(imageLetter);
});

// Orders characters in their correct lines.
Expand Down

0 comments on commit a7d2822

Please sign in to comment.