Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Architecture
ASP.NET
ASP.NET MVC
ASP.NET WebForms
B2B (Business Integration)
BizTalk
Book Excerpts
Build and Deploy
C#
C++
Code Contracts
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Design Patterns
Development Process
Display Technologies
Distributed Computing
DotNetNuke
DSL
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Graphics
Internet Explorer 8.0
Interviews
iPhone
Java
Java Script
jQuery
LINQ
Linux
Mac OS X
MDX
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
Network
NHibernate
Object Oriented Development
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
Podcasts
Post Mortem
PowerPoint
Print/Output
Product News
Product Reviews
Project Management
Python
Q&A
Reporting Services
REST
RIA Services
Ruby
Search
Security
Services
SharePoint
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server CE/AnyWhere/Mobile/Compact
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
Tips
UI Design
UML
User Groups
VB Script
VB.NET
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WF
Whitepapers
Windows 7
Windows Azure
Windows Live
Windows Server
Windows Vista
WinForms
Workflow
WPF
XAML
XML
XNA
XSLT



TOWER 48


 


QCon London


Reader rating:
Click here to read 5 comments about this article.
Article source: CoDe (2005 - Vol. 3 - Issue 1 - Tablet PC and Mobile PC)


Article Pages:  1  2 3 4 5 - Next >


Ink Recognition and Ink Analysis

Being able to take handwritten notes or annotations is nice, but the real power of Tablet PCs comes from the ability to analyze and recognize digital Ink. Recognition of handwriting is important as it allows for the conversion of digital Ink into standard text strings. Ink analysis takes the concept a step further and adds spatial interpretation to the mix to apply further semantics. Gesture recognition enables the user to trigger real-time actions.

An application can have several ways to interpret and recognize digital Ink. Simple handwriting recognition returns the most likely result as a string, but you can dig a lot deeper and retrieve alternate results, confidence levels, and much more. It is often helpful to divide Ink into individual segments, such as words or paragraphs.

"
Recognizing Ink as text becomes simple with the Tablet PC SDK.
"

But you can retrieve more information from Ink beyond its simple text representation. Users can perform gestures that your application can interpret separately from the writing itself. For instance, your application could recognize a scratch out gesture to erase a section of previously written Ink.

Your application may need to analyze Ink based on its location. One example is that your application might recognize Ink written at the side of a document with a line attaching it to an area of the document as an annotation. This sort of functionality also requires recognition of primitives, such as lines, circles, triangles, or rectangles, and recognition of the spatial relationship.

Recognizing Ink as Text

Simple recognition is so straightforward that I would almost call it primitive. This, of course, is only true from the developer’s point of view after applying the functionality of the SDK. There is nothing simple or primitive about handwriting recognition at all, but unless you work for Microsoft and/or write custom recognizers, you will not have to worry about the complexity of it.

As a first Ink recognition example, I will walk you through a simple form that provides a panel area that is Ink-enabled through a simple InkCollector (or InkOverlay) object (Figure 1). The details of the implementation of the form are not particularly important (see Listing 1 if you want to follow along with the examples). What matters is that you ultimately arrive at a situation where you have an Ink object stored inside the InkCollector or InkOverlay object. In this first simple example, you’ll learn to convert that digital Ink to a text string. You’ll use a piece of code like this.

Click for a larger version of this image.

Figure 1: This is simple form with an Ink-enabled panel.

string result = collector.Ink.Strokes.ToString();
MessageBox.Show(result);

This takes all the strokes inside the Ink object and returns the most likely recognition result. A lot of work needs to happen under the hood. The system first has to determine which recognizers are installed. Almost all Tablet PC operating systems ship with multiple recognizers including (in the USA) an English handwriting recognizer and a gesture recognizer. To retrieve the most likely result, the default recognizer is used (on a US Windows Tablet PC operating system, that is likely be the English handwriting recognizer), and the collection of strokes is passed to the recognizer engine. This returns a result set that includes a whole lot of information (I will explore the details below), but most of it is ignored and only the single most likely result is returned.

You can write code to implement this approach yourself.

Recognizers recs = new Recognizers();
Recognizer reco = recs.GetDefaultRecognizer();
RecognizerContext context = 
    reco.CreateRecognizerContext();
context.Strokes = this.collector.Ink.Strokes;
RecognitionStatus status = 
    RecognitionStatus.NoError;
RecognitionResult res = 
    context.Recognize(out status);
if (status == RecognitionStatus.NoError)
{
    MessageBox.Show(res.TopAlternate.ToString());
}

You can use a Recognizers object to determine the default recognizer installed (which replicates the behavior of the ToString() method. In real-life scenarios, it is more prudent to explicitly pick a specific language recognizer, such as the US-English recognizer, instead of relying on the default being set properly). Once you have that object, you have to create a private context.

&

By: Markus Egger

Markus is an international speaker, having presented sessions at numerous conferences in North & South America and Europe. Markus has written many articles for publications including CoDe Magazine, Visual Studio Magazine, MSDN Brazil, ASP.net Pro, FoxPro Advisor, Fuchs, FoxTalk and Microsoft Office & Database Journal. Markus is the publisher of CoDe Magazine.

Markus is also the President and Chief Software Architect of EPS Software Corp., a custom software development and consulting firm located Houston, Texas. He specializes in consulting for object-oriented development, Internet development, B2B, and Web Services. EPS does most of its development using Microsoft Visual Studio (.NET). EPS has worked on software projects for Fortune 500 companies including Philip Morris, Qualcomm, Shell, and Microsoft. Markus has also worked as a contractor on the Microsoft Visual Studio team, where he was mostly responsible for object modeling and other object- and component-related technologies.

Markus received the Microsoft MVP Award (1996-present) for his contributions to the developer community. Visual LandPro, one of the applications Markus was responsible for, was nominated three times in the Microsoft Excellence Awards.

megger@eps-software.com

Fast Facts

Digital Ink is only a collection of lines rendered on the screen, but with Ink recognition and Ink analysis, that information can be turned into meaningful information. Such information can be text and drawings; in the case of gestures, it can be commands, and in the case of spatial analysis, it can be contextual information such as the relationship between two shapes. Using the Tablet PC SDK, it is surprisingly simple to detect these types of information in Digital Ink.



Listing 1: To follow the examples in this article, a form with fundamental Ink capabilities is needed. This listing provides such a form.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Ink;
using Microsoft.Ink;

namespace InkReco
{
    public class InkPanelForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Panel panel1;
        private System.ComponentModel.Container components = null;

        private InkCollector collector;

        public InkPanelForm()
        {
            InitializeComponent();

            this.collector = new InkCollector(this.panel1);
            this.collector.Enabled = true;
        }

        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        private void InitializeComponent()
        {
            this.panel1 = new System.Windows.Forms.Panel();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.Color.White;
            this.panel1.Location = new System.Drawing.Point(8, 8);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(400, 328);
            this.panel1.TabIndex = 0;
            // 
            // InkPanelForm
            // 
            this.AutoScaleBaseSize =                 new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(416, 342);
            this.Controls.Add(this.panel1);
            this.Name = "InkPanelForm";
            this.Text = "InkPanelForm";
            this.ResumeLayout(false);
        }
        #endregion
    }
}


Article Pages:  1  2 3 4 5 - Next Page: 'Recognizing Ink as Text (con't)' >>

Page 1: Ink Recognition and Ink Analysis
Page 2: Recognizing Ink as Text (con't)
Page 3: Recognizing Ink as Text (con't)
Page 4: Recognizing Gestures
Page 5: Ink Analysis

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
2.6 out of 5

37 people have rated this article.

      QCon London

 

INSTANTLY dtSearch® TERABYTES OF TEXT