Tesseract-android-tools  1.0
 Todo Clases Namespaces Archivos Funciones Variables
Skew.java
Ir a la documentación de este archivo.
00001 /*
00002  * Copyright (C) 2011 Google Inc.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00005  * use this file except in compliance with the License. You may obtain a copy of
00006  * the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
00013  * License for the specific language governing permissions and limitations under
00014  * the License.
00015  */
00016 
00025 package com.googlecode.leptonica.android;
00026 
00031 public class Skew {
00032         static {
00033                 System.loadLibrary("lept");
00034         }
00035 
00036         // Text alignment defaults
00037 
00041         public final static float SWEEP_RANGE = 30.0f;
00042 
00044         public final static float SWEEP_DELTA = 5.0f;
00045 
00049         public final static int SWEEP_REDUCTION = 8;
00050 
00054         public final static int SEARCH_REDUCTION = 4;
00055 
00060         public final static float SEARCH_MIN_DELTA = 0.01f;
00061 
00069         public static float findSkew(Pix pixs) {
00070                 return findSkew(pixs, SWEEP_RANGE, SWEEP_DELTA, SWEEP_REDUCTION,
00071                                 SEARCH_REDUCTION, SEARCH_MIN_DELTA);
00072         }
00073 
00105         public static float findSkew(Pix pixs, float sweepRange, float sweepDelta,
00106                         int sweepReduction, int searchReduction, float searchMinDelta) {
00107                 if (pixs == null)
00108                         throw new IllegalArgumentException("Source pix must be non-null");
00109 
00110                 return nativeFindSkew(pixs.mNativePix, sweepRange, sweepDelta,
00111                                 sweepReduction, searchReduction, searchMinDelta);
00112         }
00113 
00114         // ***************
00115         // * NATIVE CODE *
00116         // ***************
00117 
00118         private static native float nativeFindSkew(int nativePix, float sweepRange,
00119                         float sweepDelta, int sweepReduction, int searchReduction,
00120                         float searchMinDelta);
00121 
00122 }
 Todo Clases Namespaces Archivos Funciones Variables