00001 /* 00002 * Copyright 2011 Robert Theis 00003 * Copyright 2012 Jaime Navarro Santapau 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00025 package edu.uoc.ocr; 00026 00027 import java.util.List; 00028 00029 import android.graphics.Point; 00030 import android.graphics.Rect; 00031 00038 public final class OcrResultText { 00039 private final String text; 00040 00041 private final int[] wordConfidences; 00042 private final int meanConfidence; 00043 private final Point bitmapDimensions; 00044 private final List<Rect> regionBoundingBoxes; 00045 private final List<Rect> textlineBoundingBoxes; 00046 private final List<Rect> stripBoundingBoxes; 00047 private final List<Rect> wordBoundingBoxes; 00048 private final List<Rect> characterBoundingBoxes; 00049 00050 public OcrResultText(String text, int[] wordConfidences, 00051 int meanConfidence, Point bitmapDimensions, 00052 List<Rect> regionBoundingBoxes, List<Rect> textlineBoundingBoxes, 00053 List<Rect> stripBoundingBoxes, List<Rect> wordBoundingBoxes, 00054 List<Rect> characterBoundingBoxes) { 00055 this.text = text; 00056 this.wordConfidences = wordConfidences; 00057 this.meanConfidence = meanConfidence; 00058 this.bitmapDimensions = bitmapDimensions; 00059 this.regionBoundingBoxes = regionBoundingBoxes; 00060 this.textlineBoundingBoxes = textlineBoundingBoxes; 00061 this.stripBoundingBoxes = stripBoundingBoxes; 00062 this.wordBoundingBoxes = wordBoundingBoxes; 00063 this.characterBoundingBoxes = characterBoundingBoxes; 00064 } 00065 00066 public String getText() { 00067 return text; 00068 } 00069 00070 public Point getBitmapDimensions() { 00071 return bitmapDimensions; 00072 } 00073 00074 public int[] getWordConfidences() { 00075 return wordConfidences; 00076 } 00077 00078 public int getMeanConfidence() { 00079 return meanConfidence; 00080 } 00081 00082 public List<Rect> getRegionBoundingBoxes() { 00083 return regionBoundingBoxes; 00084 } 00085 00086 public List<Rect> getTextlineBoundingBoxes() { 00087 return textlineBoundingBoxes; 00088 } 00089 00090 public List<Rect> getStripBoundingBoxes() { 00091 return stripBoundingBoxes; 00092 } 00093 00094 public List<Rect> getWordBoundingBoxes() { 00095 return wordBoundingBoxes; 00096 } 00097 00098 public List<Rect> getCharacterBoundingBoxes() { 00099 return characterBoundingBoxes; 00100 } 00101 00102 @Override 00103 public String toString() { 00104 return text + " " + meanConfidence; 00105 } 00106 }