Developers looking for developers

关于sdk4.1.4 混合识别问题

安卓端的sdk更新到了4.1.4。采用的是后台识别模式,要实现,同时识别形状、文本、数学公式。 我设置成"Raw Content"识别出来的没有文本。

image

image

image

这是整个初始话流程,单独设置成Text、Math都可以。就是不知道这个混合模式要怎么用





Hello,


Thank you for contacting us.


To better assist you, could you please explain your use case in more detail?
Do you need to use our interactive features, such as gestures or typesetting, or do you only need to perform ink recognition?
See https://developer.myscript.com/docs/interactive-ink/4.1/concepts/interactive-ink/.
As far as I understand, you are using your own rendering. Could you please confirm?

This information will help us guide you in using either a Raw Content Recognizer, Editor, or OffscreenEditor object and the corresponding Android sample.


The Raw Content part is very flexible, so you must configure it according to your classification and recognition types:

https://developer.myscript.com/docs/interactive-ink/4.1/concepts/ink-classification/

You can also take a look at this page of the documentation:

https://developer.myscript.com/docs/interactive-ink/4.1/overview/content-types/#raw-content-highlights


Best regards,


Gwenaëlle


你好!我们只需要使用墨水识别,使用的是自己的渲染。我们的软件不太方便把你们整个的内容套进来,我们是把点发送到你们的sdk,然后读取结果。

我使用你们最新的demo中的,"parts\Raw Content\text_math_shape.json",这个配置文件,配置成Raw Content,可以同时识别文本和形状、但识别不了数学公式是为什么了?

读取过来的形状包含位置信息,文本没有位置信息,如何解决文本没有位置信息这个问题了,也就是文本最终如何排版了。

Hello,


Thank you for your answer.


If you don't use our rendering, nor our interactive features, using a Raw Content Recognizer may be the most straight forward solution for you.

The code would be very simple as below:


// Create your Engine
val engine = IInkApplication.getEngine()

// Configure according to your need 
engine.apply {
configuration.apply {
val confDir = "zip://${application.packageCodePath}!/assets/conf"
setStringArray("recognizer.configuration-manager.search-path", arrayOf(confDir))
// choose your recognition language
setString("recognizer.lang", "zh_CN")
// customize the jiix export according to what you need. See https://developer.myscript.com/docs/interactive-ink/4.1/reference/jiix/
setBoolean("export.jiix.strokes", false)
setBoolean("export.jiix.ranges", true)
setBoolean("export.jiix.text.words", true)
setBoolean("export.jiix.text.chars", false)
setBoolean("export.jiix.lines", true)
setBoolean("export.jiix.spans", true)

// Choose the classification and recognition according to what you want. See https://developer.myscript.com/docs/interactive-ink/4.1/concepts/ink-classification/
setStringArray("recognizer.raw-content.classification.types", arrayOf("text", "math", "shape", "drawing"))
setStringArray("recognizer.raw-content.recognition.types", arrayOf("text", "math", "shape"))

}
}


// create the Raw Content Recognizer object
val recognizer = engine.createRecognizer(1f, 1f, "Raw Content")

// add a listener to be notified of recognition results and of error
recognizer.addListener(recognizerListener)

// send your pointer Events for recognition
recognizer.pointerEvents(yourPointerEvents)

// wait until recognition is complete
recognizer.waitForIdle()

// get recognition result
val recognitionResult = recognizer.getResult(MimeType.JIIX)

// cleanup
recognizer.removeListener(recognizerListener)
recognizer.close()



You can find below a simple example of RecognizerListener implementation:


    private val recognizerListener: IRecognizerListener by lazy {
        object : IRecognizerListener {
            override fun resultChanged(p0: Recognizer, p1: String) {
                Log.d(TAG, "resultChanged" + p1)
            }

            override fun onError(p0: Recognizer, p1: RecognizerError, p2: String) {
                Log.d(TAG, "onError " + p1.toString() + "error code, message=" + p2 )
            }

        }
    }



Do not forget to deploy the required resources in your project, according to your configuration:


In addition to the myscript-iink-recognition-raw-content2.zip package, the following table lists resources that you must deploy in your project according to the recognition types that you use:

Recognition content typeRequired configuration bundlesResource and configuration package names
text${recognizer.lang}Language package defined by your recognizer.lang configuration. See principles of language resources
mathmath2myscript-iink-recognition-math2.zip
shapeshapemyscript-iink-recognition-shape.zip


Best regards,


Gwenaëlle

Login or Signup to post a comment