GithubHelp home page GithubHelp logo

huangfuquang / handwriterecognizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wmz46/handwriterecognizer

0.0 1.0 0.0 336 KB

封装Microsoft.Ink为C++动态库,可供其他语言调用手写识别

License: GNU General Public License v3.0

C# 61.26% C++ 26.72% C 12.02%

handwriterecognizer's Introduction

HandWriteRecognizer

封装Microsoft.Ink为C++动态库,可供其他语言调用手写识别

在java中使用

根据windows系统下载release中的win32.zip或win64.zip。其中HandWriteRecognizerLib.dll为C++动态库,Microsoft.Ink.dll为微软手写识别库,HandWriteRecognizerCSharp.dll是C#封装的中间层。 将C#的两个dll拷贝到java的bin目录,如果java是32位拷贝win32的,如果java是64位的拷贝win64的。

jna引用HandWriteRecognizerLib.dll

识别接口:

char* recognizer(char* strokes, int count)

strokes入参为笔画字符串,多个笔画用,eb,分割,笔画中的每个点按x1,y1,x2,y2,x3,y3顺序拼接。如x1,y1,x2,y2,x3,y3,eb,x1,y1,x2,y2,...

count入参为返回的最大识别字符数,返回接口可能小于等于该数。

返回为识别结果字符串,字符以英文空格间隔。

调用示例

定义jna接口

public interface HandWriteRecognizerLibrary  extends Library {
    //虽然loadLibrary已过时,不过试了load在springboot网站无法正常加载,原因未知。
    HandWriteRecognizerLibrary INSTANCE = Native.loadLibrary("HandWriteRecognizerLib", HandWriteRecognizerLibrary.class);
    Pointer recognizer(Pointer strokes, int count); 

} 

调用jna接口

Pointer strokesStrPointer = new Memory(strokesStr.length());
byte[] bytes = strokesStr.getBytes();
strokesStrPointer.write(0, bytes, 0, bytes.length);
Pointer result = new Memory(count * 2);
result = HandWriteRecognizerLibrary.INSTANCE.recognizer(strokesStrPointer, count);
String temp = result.getString(0);
if (StringUtils.isEmpty(temp)) {
    return new String[0];
} else {
    return temp.split(" ");
} 

handwriterecognizer's People

Contributors

wmz46 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.