Ink Canvas Element

Modified on 2018/08/03 00:59 by Administrator — Categorized as: Base Elements, Elements, Input Registration

Summary

Element Icon Ink Canvas
Info
Category: Input Registration AddIn: Base Layer
Creator: OkazoLab Scope: Parent event
Owns Snippets: None Usage: Stimulus screen

Properties

NameDescription                              ConstraintsTypeOn
runtime
change
Settings
Reset On Onset        Defines whether the old canvas strokes and text recognition results are reset on the onset of the parent event                Boolean         
Normal Tip Mode        Specifies the mode of the pointing device as it interacts with the canvas                enInkC..         
Inverted Tip Mode        Specifies the mode of the inverted pointing device as it interacts with the canvas (e.g. with the inverted tip of a stylus)                enInkC..         
Drawing Attributes
Behold Pressure        Defines whether the thickness of a rendered stroke changes according the amount of pressure applied (if an input device can report a pressure)                Boolean         
Is Highlighter        Defines whether the rendered stroke looks like a highlighter (semi-transparent).                Boolean         
Pen Size        Defines a size of the drawing pen.                clSize         
Pen Color        Defines a color of the drawing pen.                stColor         
Drawn Color        Defines a color that highlights the currently drawing stroke. When a stroke is finished, it turns back to the pen color. No highlighting is applied, when the transparent color (0,255,255,255) is selected.                stColor         
Smoothing        Defines whether Bezier smoothing is used to render strokes.                Boolean         
Pen Shape        Defines a shape of the drawing pen. Assign 0 for rectangle and 1 for ellipse                enPenS..         
Canvas Background        Defines the background of the ink canvas.                stColor         
Actions
Clear Canvas Now        Set to true to clear canvas and erase all collected strokes.                Boolean         
Save Ink File Now        Assign a fully specified filename to save the current strokes to a file at runtime                String         
Open Ink File Now        Assign a fully specified filename to load strokes from a file at runtime. Only the Ink Serialized Format (.isf) files are supported.                String         
Recognize Text Now        Runtime command that performs text recognition on the current canvas content. The result is returned via the 'Recognized Text' property.                Boolean         
Runtime Status
Stroke Number        Returns a number of drawn strokes                Int32         
Recognized Text        Return a recognized text in a result of the Recognize Text action                String         
Recognition Confidence        Return a confidence rank in results of the Recognize Text action                String         
Visual Appearance
Alpha Masking        Defines, whether the visual content is used to create an opacity mask on the event surface. If masking is on, the content's pixel luminance (or, its inverse) defines transparency within element's viewport. The alpha masking allows, for example, create transparent holes on the event surface.                Int32         
AntiAliasing        if true, the rendered content will be antialiased for smoother visual appeariance. If false, rendering will be authentic to its source, e.g. a bitmap.                Boolean         
Position        Defines a position of the rendering viewport on the screen                clPoint         
Size        Defines a size of the element's rendering viewport on the screen                clSize         
Z Order        Indicates Z Order of the element on the given event                Int32         
Pivot Point        Defines alignment of the pivot point (or, element's position) relative to element's rendering area. The pivot point sets the center of element's rotation and scale directions.                stAlig..         
Visible        Defines whether the element is visible                Boolean         
Rotation        Rotation angle in degrees                Double         
Effects
Transparent Color        The color of the original pixels of rendered content that will be set as transparent                stColor         
Transparent Tolerance        Tolerance ratio for choosing colors that become transparent. Zero means that effect is not applied, 1 denotes that all colors will become trasparent                Int32         
Color Mask        Produces a multiplicative combination of the original pixels and the selected mask color (except the alpha channel).  The effect emulates a look through a colored glass.  White or transparent mask color dont change the original pixels                stColor         
Opacity        Opacity of the rendered content                Int32         
Contrast        Contrast of the rendered content                Int32         
Brightness        Brightness the rendered content                Int32         
Saturation        Saturation of the rendered content                Double         
Pixelation        Pixelation of the rendered content                Int32         
Blurring        The radius used in the gaussian blur of rendered content, as a pixel-based factor. The default is 0 which means no blurring.                Int32         
Scrambling                        Double         
Scrambling Grid Size        Defines a size of the scrambling grid                clSize         
Positional Jitter
Reset Jitter Now        Runtime command that resets the positional jitter.                Boolean         
Current Jitter        Returns the current jitter                clPoint         
Jitter Range        Defines a possible range for the random jitter. The range is centered to the position of the element.                clSize         
Test Jitter        Click to test the current jitter                Boolean         
Control
Is Enabled        If set to false the element is completely omitted when the experiment is run                Boolean         
Title        Title of the element                String         

Ink Canvas Element allows to record and visualize painting strokes made by an participant.


Description

The Ink canvas element defines a screen area that receives and displays drawing and writing strokes made by a participant. The strokes can be done with a pen tablet, touchscreen or mouse. The element records explicit statistics of the drawing process, including stroke timing and coordinates/pressure of each dot. (See the demo video below) The element can also recognize handwritten text at request.

Demo video



Snapshots

Experiment Run

Experiment Run

After experiment  Picture Stays in InkCanvas

After experiment
Picture Stays in InkCanvas

Cat Recognized correctly

Cat Recognized correctly

Recorgnized that user  wrote wrong word

Recorgnized that user
wrote wrong word


Practical Use

Creating the Ink Canvas element

  1. Add a new Ink Canvas element to the chosen event.
  2. Adjust the canvas area either in the event surface editor or via element's Position and Size properties.
  3. Adjust other properties of the Ink Canvas canvas element. For example, you can define the canvas background, stroke color and different drawing modes.
  4. Double-click on the canvas area in the event surface editor and try to draw several strokes for testing. Make a double-click again to exit the test mode.
  5. Write code that resets the canvas, requests text recognition and records drawing results in accordance with a logic of your experiment. To control the element at runtime, create proxy variable for the element's properties.
  6. Start the experiment. After the onset of the parent event the element becomes functional.

Saving the drawing results at runtime

  1. Add a new Ink Canvas element to the chosen event and prepare it as described above.
  2. Create proxy variables for the following properties: 'Save Ink File Now' and 'Clear Canvas Now'.
  3. Add the following code in a snippet that is called after a participant completes drawing:
    
    
    SaveInkFileNow="C:\\Data\\Participant_"+ParticipantCode+"_"+DrawingNumber+".csv";
    ClearCanvasNow=true;

    This code saves the collected stroke statistics and resets the made drawing. Note that you need to declare and adjust global variables ParticipantCode and DrawingNumber to form an unique file name (you can use other ID variables).

Using the Ink Canvas element to recognize handwritten text

  1. Add a new Ink Canvas element to the chosen event and prepare it as described above.
  2. Create proxy variables for the following properties: 'Recognize Text Now', 'Recognized Text' and 'Recognition Confidence'.
  3. Add the following code in a snippet that is called after a participant completes writing:
    
    
    RecognizeTextNow=true;
  4. Add the following code in a subsequent snippet that is called after (importantly!) the 'RecognizeTextNow' snippet:
    
    
    string S=RecognizedText; // string S now contains a text recognized by the Ink Canvas;
    string C=RecognitionConfidence; // string C now contains one of the confidence ranks, e.g. 'week', 'average', 'strong'

    if you try to read the RecognizedText or RecognitionConfidence variables before or simultaneously with the 'RecognizeTextNow=true' command, the results wont be yet updated.

Notes