Skip to content

Commit bd6e9b3

Browse files
author
DerekBabb
committed
Tool for building OCR
Used to take a 7-segment display as an image and convert to a character using OCR built by students.
1 parent 29df43c commit bd6e9b3

10 files changed

+1065
-0
lines changed

DigitReader.java

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @author Derek Babb <[email protected]>
3+
* @version 1.0
4+
* @since 7-17-2013
5+
*
6+
* DigitReader is an interface that is used with ScoreMaker to test an
7+
* optical character recognition algorithm for a scoreboard.
8+
*
9+
*/
10+
11+
public interface DigitReader
12+
{
13+
/**
14+
* setImage will accept a PictureEdit object. The image should be saved within the class
15+
* so other methods may "read" the digit.
16+
*
17+
* @param digitPic is the picture of a single digit from a scoreboard.
18+
*/
19+
public void setImage(PictureEdit digitPic);
20+
21+
/**
22+
* getDigit will return the digit that the OCR algorithm beleives is the digit from the image
23+
* that has been previously loaded.
24+
*
25+
* @return a number 0-9 for the digit, return -1 if it cannot be read.
26+
*/
27+
public int getDigit();
28+
29+
/**
30+
* Each OCR should have a name for the purpose of listing in the menu.
31+
*
32+
* @return name of the OCR.
33+
*/
34+
public String getName();
35+
}

ExampleOCR.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class ExampleOCR implements DigitReader
2+
{
3+
PictureEdit digitPic;
4+
5+
public void setImage(PictureEdit pic)
6+
{
7+
digitPic = pic; //load the the input image into the digitPic field.
8+
}
9+
10+
public int getDigit()
11+
{
12+
//This is the method you should process the image.
13+
14+
return (int)(Math.random() * 10);
15+
}
16+
17+
public String getName()
18+
{
19+
return "Example OCR";
20+
}
21+
}

0 commit comments

Comments
 (0)