다음을 통해 공유


필기 인식

업데이트: 2007년 11월

이 단원에서는 WPF 플랫폼에서 디지털 잉크에 관련된 인식의 기본적인 사항에 대해 설명합니다.

인식 솔루션

다음 예제에서는 InkAnalyzer를 사용하여 잉크를 인식하는 방법을 보여 줍니다.

참고

이 샘플을 사용하려면 시스템에 필기 인식 기능이 설치되어 있어야 합니다.

Visual Studio 2005에서 InkRecognition이라고 하는 새 WPF 응용 프로그램 프로젝트를 만듭니다. Window1.xaml 파일의 내용을 다음 XAML 코드로 바꿉니다. 이 코드는 응용 프로그램의 사용자 인터페이스를 렌더링합니다.

<Window x:Class="InkRecognition.Window1"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    Title="InkRecognition" 
    >
  <Canvas Name="theRootCanvas">
    <Border
      Background="White"
      BorderBrush="Black"
      BorderThickness="2"
      Height="300"
      Width="300"
      Canvas.Top="10"
      Canvas.Left="10">
      <InkCanvas Name="theInkCanvas"></InkCanvas>
    </Border>
    <TextBox Name="textBox1"
      Height="25"
      Width="225"
      Canvas.Top="325"
      Canvas.Left="10"></TextBox>
    <Button
      Height="25"
      Width="75"
      Canvas.Top="325"
      Canvas.Left="235"
      Click="buttonClick">Recognize</Button>
  </Canvas>
</Window>

\Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7에 있는 WPF 잉크 분석 어셈블리, IAWinFX.dll, IACore.dll 및 IALoader.dll에 대한 참조를 추가합니다. 코드 숨김 파일의 내용을 다음 코드로 바꿉니다.

Imports System.Windows
Imports System.Windows.Ink

'/ <summary>
'/ Interaction logic for Window1.xaml
'/ </summary>

Namespace InkRecognition

    Class Window1
        Inherits Window


        Public Sub New()
            InitializeComponent()

        End Sub 'New


        ' Recognizes handwriting by using RecognizerContext
        Private Sub buttonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
            Dim theInkAnalyzer As New InkAnalyzer()

            theInkAnalyzer.AddStrokes(theInkCanvas.Strokes)

            Dim status As AnalysisStatus = theInkAnalyzer.Analyze()

            If status.Successful Then
                textBox1.Text = theInkAnalyzer.GetRecognizedString()
            Else
                MessageBox.Show("Recognition Failed")
            End If

        End Sub 'buttonClick
    End Class 'Window1 
End Namespace

using System.Windows;
using System.Windows.Ink;

namespace InkRecognition
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>

    public partial class Window1 : Window
    {

        public Window1()
        {
            InitializeComponent();
        }

        // Recognizes handwriting by using RecognizerContext
        private void buttonClick(object sender, RoutedEventArgs e)
        {
            InkAnalyzer theInkAnalyzer = new InkAnalyzer();

            theInkAnalyzer.AddStrokes(theInkCanvas.Strokes);

            AnalysisStatus status = theInkAnalyzer.Analyze();

            if (status.Successful)
            {
                textBox1.Text = theInkAnalyzer.GetRecognizedString();
            }
            else
            {
                MessageBox.Show("Recognition Failed");
            }
        }

    }
}

참고 항목

참조

InkAnalyzer

AnalysisStatus

InkCanvas