Ink Canvas
Ink canvas
The InkCanvas aims to capture and draw ink in order to perform real-time batch recognition on transient ink.
It relies on the REST API/v4.0/iink/recognize endpoint and enables rapid setup for dedicated content type ink recognition.
Several content types
The type of content to be recognized is selected using configuration options when loading the Canvas.
The possible types are TEXT, MATH, Raw Content, and SHAPE.
TEXT,MATHandSHAPEare relevant when you are sure that all ink content corresponds to one of these types.Raw Contentallows you to analyze unstructured ink and separate blocks that correspond to structured text, shapes, and math from those that do not. Then, the configured recognition is applied to the blocks.
Configuration
The default configuration is done with the InkCanvasConfiguration object. You can customize any subset of the configuration options of the Canvas.
One of the first configuration you want to customize is to choose your content type. For instance to use the MATH recognize endpoint:
const editorOptions = {
configuration: {
recognition: {
type: 'MATH'
}
}
}
Then depending on the chosen content type, you may tune dedicated configuration options.
MATH type
This example illustrates MATH recognition using an InkCanvas.
Raw Content type
When using the Raw Content type, you can:
- Override the classification configuration with the
recognition.raw-content.classification.typesproperty according to your needs, to control the list of content types that can be identified by the ink strokes classifier. Default value is "text", "math", "shape", "decoration", "drawing". - Define the recognition configuration with the
recognition.raw-content.recognition.typesto control the list of content types that are recognized after classification. Default value is "text", "math", "shape". - If you want to perform text recognition, define your recognition language with the
recognition.langproperty. You can either use:
This example illustrates Raw Content recognition using an InkCanvas.
TEXT type
When performing text recognition with TEXT type, you can choose a specific language by setting the recognition.lang property.
This example illustrates TEXT recognition using an InkCanvas.
SHAPE type
This example illustrates SHAPE recognition using an InkCanvas.
Advanced example using several canvas instances
Below is an advanced example of iinkTS InkCanvas integration for grading. On this webpage, the user must write grades in different math cells and a comment in a text cell for three different people. The recognized content can then be retrieved by clicking the "Get Summary" button.
Reference documentation
To gain a more advanced understanding, you can review the architecture of InkCanvas.