|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sourceforge.javaocr.scanner.PixelImage
net.sourceforge.javaocr.ocrPlugins.mseOCR.TrainingImage
public class TrainingImage
Class to hold a training image for a single character. A training image is a representative image for a single character, and is used to determine the likelihood that a given character image is a particular character.
| Field Summary | |
|---|---|
static float |
ASPECT_RATIO_TOLERANCE
This is the maximum variance of aspect ratio between a training image and the actual image segment to be decoded. |
static float |
BOTTOM_WHITE_SPACE_FRACTION_TOLERANCE
This is the maximum variance between the source character's bottom white space fraction and the training image's bottom white space fraction. |
float |
bottomWhiteSpaceFraction
Fraction of the row arrayHeight which is occupied by complete whitespace below the character. |
private static Logger |
LOG
|
private int |
myMaxX
|
private int |
myMaxY
|
static float |
TOP_WHITE_SPACE_FRACTION_TOLERANCE
This is the maximum variance between the source character's top white space fraction and the training image's top white space fraction. |
float |
topWhiteSpaceFraction
Fraction of the row arrayHeight which is occupied by complete whitespace above the character. |
| Fields inherited from class net.sourceforge.javaocr.scanner.PixelImage |
|---|
aspectRatio, FILTER_FIR_COEFFS, height, npix, pixels, width |
| Constructor Summary | |
|---|---|
TrainingImage(int[] pixels,
int width,
int height,
int topWhiteSpacePixels,
int bottomWhiteSpacePixels)
Construct a new TrainingImage object from an array of
gray scale pixels. |
|
| Method Summary | |
|---|---|
double |
calcMSE(int[] theirPixels,
int w,
int h,
int x1,
int y1,
int x2,
int y2)
Calculate the error factor between a block of pixels and our image. |
| Methods inherited from class net.sourceforge.javaocr.scanner.PixelImage |
|---|
filter, filter, getPixel, getPixelIndex, grayScaleToRGB, rgbToImage, toGrayScale |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final float ASPECT_RATIO_TOLERANCE
public static final float TOP_WHITE_SPACE_FRACTION_TOLERANCE
public static final float BOTTOM_WHITE_SPACE_FRACTION_TOLERANCE
public final float topWhiteSpaceFraction
public final float bottomWhiteSpaceFraction
private int myMaxX
private int myMaxY
private static final Logger LOG
| Constructor Detail |
|---|
public TrainingImage(int[] pixels,
int width,
int height,
int topWhiteSpacePixels,
int bottomWhiteSpacePixels)
TrainingImage object from an array of
gray scale pixels.
pixels - An array of pixels in the range 0-255.width - The arrayWidth of the image.height - The arrayHeight of the image.topWhiteSpacePixels - The number of scan lines at the top of this character cell which
are all white. These are excluded from the arrayWidth and arrayHeight of the training image.bottomWhiteSpacePixels - The number of scan lines at the bottom of this character cell
which are all white. These are excluded from the arrayWidth and arrayHeight of the training image.| Method Detail |
|---|
public double calcMSE(int[] theirPixels,
int w,
int h,
int x1,
int y1,
int x2,
int y2)
theirPixels - An array of grayscale pixels which contains the block to be compared
This should be in binary format, with each pixel having a value of either 0
or 255.w - The arrayWidth of the pixel array.h - The arrayHeight of the pixel array.x1 - The position of the left border of the rectangle to be compared.y1 - The position of the top border of the rectangle to be compared.x2 - The position of the right border of the rectangle to be compared.
Note that pixels up to, but not including this position, will be compared.y2 - The position of the bottom border of the rectangle to be compared.
Note that pixels up to, but not including this position, will be compared.
double representing the average per-pixel mean square error.
Lower numbers indicate a better match.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||