Interactive Ink

Direct conversion to digital type-set from x,y co-ordinates

I have an app which fetches x and y coordinates of recorded strokes from a JSON file and draws them on a canvas. Is there a way to convert the text generated by the strokes into digital type-set by passing x,y coordinates directly?

I have a recycler view of drawables with some stroke data drawn on it.  For each drawable, I wish to display the recognized text in the corresponding text-view.


EDIT Olivier: add question from other topic:

Broader issue 

Can anyone please give the precise steps one needs to follow in  order to integrate MyScript Library in an already existing android  application. What dependencies are needed? Is UI Reference  Implementation mandatory to have? 

Specific issue 

I have an app which gets the strokes' coordinates from a JSON  file and I draw them on a drawable object(which is nothing but canvas).  How can I only pass the coordinates to MyScript and get the  converted(digital type-set) form?


Please help

Thanks

Regards



Dear Kushal,

Thank you for contating us.

Currently, you can indeed add X and Y coordinates. You can find several topics explaining how to proceed: https://developer-support.myscript.com/support/discussions/topics/16000021050


Basically, you should proceed as follows:

-first, ensure you have an iink Editor properly initialized, such as in the code samples

-Create a content package: ContentPackage pkg = engine.createPackage(«myfile.iink »)

-Create a text content part: ContentPart part = pkg.createPart(« Text »)

-Set this part to the editor: Editor.setPart(part)

-Feed the editor with your ink using editor.pointerEvents(eventArray, false), where eventArray is your ink converted into pointer events (pointerDown, pointerMove+, pointerUp) and false means the gestures where deactivated

-wait for the recognition to end: editor.waitForIdle()

-export in JIIX format: editor.export_(MimeType.JIIX)

=>You can then display the text result in your view

Can anyone please give the precise steps one needs to follow in  order to integrate MyScript Library in an already existing android  application. What dependencies are needed?

>>You can follow our tutorial, that shows all the necessary steps: https://developer.myscript.com/docs/interactive-ink/1.1/android/fundamentals/get-started/

Is UI Reference Implementation mandatory to have?

>>No, it is not necessary, or you can choose to implement your own one.


Best regards,


Olivier


1 person likes this

Hi Olivier,
Thanks for the reply!
I'm halfway through with what you're suggesting.

-wait for the recognition to end: editor.waitForIdle()

-export in JIIX format: editor.export_(MimeType.JIIX)

-> where should I call editor.waitForidle()? In the onContentChanged() listener callback? Or just after calling editor.pointerEvents(eventArray, false)?

Also where should I export_ () , should I do it in onContentChanged ()?Or directly?


Thanks again!

Kushal

Do i need the listener callbacks at all?


Hi Olivier,

Why is it necassary to convert it into jiix mime type? Can't we export it using text mime?

Thanks

Regards 

Kushal


Dear Kushal,


Currently, you can call all the functions sequentially, i.e. one after one. The editor.waitForidle() is just to ensure the recognition is ended. You can then call the export function just after. Indeed, in case the recognition is not finished, the "export" may return with a partial resullt.


Why is it necassary to convert it into jiix mime type? Can't we export it using text mime?

>>You can choose the export type you prefer, e.g. TEXT if you do not need any other information than the TEXT result. The advantage of the JIIX type is that it contains type of recognition, bounding box, alternates candidates...


Best regards,


Olivier

Login or Signup to post a comment