/**
* Copyright @ 2012 Quan Nguyen
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package net.sourceforge.tess4j;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;
import com.ochafik.lang.jnaerator.runtime.NativeSize;
import net.sourceforge.lept4j.Boxa;
import net.sourceforge.lept4j.Pix;
import net.sourceforge.tess4j.util.LoadLibs;
/**
* A Java wrapper for <code>Tesseract OCR 3.04 API</code> using
* <code>JNA Direct Mapping</code>.
*/
public class TessAPI1 implements Library, ITessAPI {
static {
Native.register(LoadLibs.getTesseractLibName());
}
/**
* Gets the version identifier.
*
* @return the version identifier
*/
public static native String TessVersion();
/**
* Deallocates the memory block occupied by text.
*
* @param text the pointer to text
*/
public static native void TessDeleteText(Pointer text);
/**
* Deallocates the memory block occupied by text array.
*
* @param arr text array pointer reference
*/
public static native void TessDeleteTextArray(PointerByReference arr);
/**
* Deallocates the memory block occupied by integer array.
*
* @param arr int array
*/
public static native void TessDeleteIntArray(IntBuffer arr);
/* Renderer API */
public static native TessResultRenderer TessTextRendererCreate(String outputbase);
public static native TessResultRenderer TessHOcrRendererCreate(String outputbase);
public static native TessResultRenderer TessPDFRendererCreate(String outputbase, String datadir);
public static native TessResultRenderer TessUnlvRendererCreate(String outputbase);
public static native TessResultRenderer TessBoxTextRendererCreate(String outputbase);
public static native void TessDeleteResultRenderer(TessResultRenderer renderer);
public static native void TessResultRendererInsert(TessResultRenderer renderer, TessResultRenderer next);
public static native TessResultRenderer TessResultRendererNext(TessResultRenderer renderer);
public static native int TessResultRendererBeginDocument(TessResultRenderer renderer, String title);
public static native int TessResultRendererAddImage(TessResultRenderer renderer, PointerByReference api);
public static native int TessResultRendererEndDocument(TessResultRenderer renderer);
public static native Pointer TessResultRendererExtention(TessResultRenderer renderer);
public static native Pointer TessResultRendererTitle(TessResultRenderer renderer);
public static native int TessResultRendererImageNum(TessResultRenderer renderer);
/**
* Creates an instance of the base class for all Tesseract APIs.
*
* @return the TesseractAPI instance
*/
public static native TessBaseAPI TessBaseAPICreate();
/**
* Disposes the TesseractAPI instance.
*
* @param handle the TesseractAPI instance
*/
public static native void TessBaseAPIDelete(TessBaseAPI handle);
/**
* Set the name of the input file. Needed only for training and reading a
* UNLV zone file, and for searchable PDF output.
*
* @param handle the TesseractAPI instance
* @param name name of the input file
*/
public static native void TessBaseAPISetInputName(TessBaseAPI handle, String name);
/**
* These functions are required for searchable PDF output. We need our hands
* on the input file so that we can include it in the PDF without
* transcoding. If that is not possible, we need the original image.
* Finally, resolution metadata is stored in the PDF so we need that as
* well.
*
* @param handle the TesseractAPI instance
* @return input file name
*/
public static native String TessBaseAPIGetInputName(TessBaseAPI handle);
public static native void TessBaseAPISetInputImage(TessBaseAPI handle, Pix pix);
public static native Pix TessBaseAPIGetInputImage(TessBaseAPI handle);
public static native int TessBaseAPIGetSourceYResolution(TessBaseAPI handle);
public static native String TessBaseAPIGetDatapath(TessBaseAPI handle);
/**
* Set the name of the bonus output files. Needed only for debugging.
*
* @param handle the TesseractAPI instance
* @param name name of the output file
*/
public static native void TessBaseAPISetOutputName(TessBaseAPI handle, String name);
/**
* Set the value of an internal "parameter." Supply the name of the
* parameter and the value as a string, just as you would in a config file.
* Returns false if the name lookup failed. E.g.,
* <code>SetVariable("tessedit_char_blacklist", "xyz");</code> to ignore x,
* y and z. Or <code>SetVariable("classify_bln_numeric_mode", "1");</code>
* to set numeric-only mode. <code>SetVariable</code> may be used before
* <code>Init</code>, but settings will revert to defaults on
* <code>End()</code>.<br>
* <br>
* Note: Must be called after <code>Init()</code>. Only works for non-init
* variables (init variables should be passed to <code>Init()</code>).
*
*
* @param handle the TesseractAPI instance
* @param name name of the input
* @param value variable value
* @return 1 on success
*/
public static native int TessBaseAPISetVariable(TessBaseAPI handle, String name, String value);
/**
* Get the value of an internal int parameter.
*
* @param handle the TesseractAPI instance
* @param name name of the input
* @param value pass the int buffer value
* @return 1 on success
*/
public static native int TessBaseAPIGetIntVariable(TessBaseAPI handle, String name, IntBuffer value);
/**
* Get the value of an internal bool parameter.
*
* @param handle the TesseractAPI instance
* @param name pass the name of the variable
* @param value pass the int buffer value
* @return 1 on success
*/
public static native int TessBaseAPIGetBoolVariable(TessBaseAPI handle, String name, IntBuffer value);
/**
* Get the value of an internal double parameter.
*
* @param handle the TesseractAPI instance
* @param name pass the name of the variable
* @param value pass the double buffer value
* @return 1 on success
*/
public static native int TessBaseAPIGetDoubleVariable(TessBaseAPI handle, String name, DoubleBuffer value);
/**
* Get the value of an internal string parameter.
*
* @param handle the TesseractAPI instance
* @param name pass the name of the variable
* @return the string value
*/
public static native String TessBaseAPIGetStringVariable(TessBaseAPI handle, String name);
/**
* Print Tesseract parameters to the given file.<br>
* <br>
* Note: Must not be the first method called after instance create.
*
* @param handle the TesseractAPI instance
* @param filename name of the file where the variables will be
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
drguo-VerificationCodeRecognition-master.zip (58个子文件)
VerificationCodeRecognition
.project 403B
tessdata
pdf.ttx 33KB
configs
api_config 27B
hocr 22B
digits 38B
eng.traineddata 20.86MB
osd.traineddata 10.07MB
pdf.ttf 1KB
imgs
2107.jpg 7KB
8627.png 5KB
5046.jpg 7KB
8163.jpg 8KB
0056.png 4KB
5386.jpg 7KB
3990.jpg 7KB
0654.jpg 6KB
7330.jpg 7KB
2743.png 5KB
src
com
recognition
software
jdeskew
ImageDeskew.java 5KB
ImageUtil.java 4KB
blog
csdn
net
dr_guo
VCR.java 809B
net
sourceforge
tess4j
libtesseract304.dll 2.55MB
Tesseract1.java 22KB
TessAPI1.java 54KB
util
ImageHelper.java 8KB
LoadLibs.java 6KB
PdfUtilities.java 11KB
ImageIOHelper.java 18KB
Utils.java 2KB
LoggHelper.java 1014B
LoggerConfig.java 1KB
gsdll64.dll 14.94MB
TessAPI.java 51KB
ITessAPI.java 21KB
Tesseract.java 23KB
TesseractException.java 1KB
Word.java 2KB
ITesseract.java 8KB
lib
ghost4j-1.0.1.jar 176KB
jai-imageio-core-1.3.1.jar 588KB
log4j-1.2.17.jar 478KB
junit-4.12.jar 309KB
jna-4.2.2.jar 1.08MB
logback-core-1.1.6.jar 450KB
itext-2.1.7.jar 1.08MB
commons-beanutils-1.9.2.jar 228KB
xmlgraphics-commons-1.5.jar 588KB
rococoa-core-0.5.jar 98KB
hamcrest-core-1.3.jar 44KB
jul-to-slf4j-1.7.19.jar 4KB
logback-classic-1.1.6.jar 285KB
lept4j-1.1.2.jar 2.1MB
commons-io-2.4.jar 181KB
commons-logging-1.2.jar 60KB
slf4j-api-1.7.19.jar 40KB
.settings
org.eclipse.jdt.core.prefs 598B
.classpath 1KB
.gitignore 6B
共 58 条
- 1
资源评论
转呼啦圈的东皇
- 粉丝: 38
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功