Click here to Skip to main content
Click here to Skip to main content

Signature

By , 15 Nov 2012
 

Please note

This article is an entry in our AppInnovation Contest. Articles in this sub-section are not required to be full articles so care should be taken when voting.

Introduction

This application is for drawing basic shapes like line, rectangle, circle, ellipse, free hand shapes, eraser, and clear screen. It also provides a feature handwriting recognition. It allows to save the recognized text as text file and only ink strokes can be saved as image.

About the application

This app provides the easy to use UI which helps the user to write any memos or letters. Then user can convert the hand written letters to text format using a single button click. The hand writing can be saved as image. The recognized words are converted in to text format and can be shared using share contracts for mail, and other target apps if any installed. the GPS facility can be enabled if the user needs to insert the exact location in the document. Features of the app:

  1. hand writing recognition
  2. Draw images
  3. Can be saved as text or jpeg
  4. shared using share contracts
  5. GPS enabling to insert exact location
  6. Touchscreen aware.

For handwriting recognition, I have used Windows.UI.Input.Inking namesapce. The basic concept is to useInkManager class. It provides properties and methods to manage the input, manipulation, and processing (including handwriting recognition) of one or more InkStroke objects. When a user write something onto canvas, all the points covered in that path is saved as InkManager objects. InkManager class provide an async method calledRecognizeAsync(). The results of the recognition is a collection of InkRecognitionResult objects. To get the text componets, I have used GetTextCandidates() method of InkRecognitionResult class and it retrieves the collection of strings identified as potential matches for handwriting recognition.

Using the code

The code for changing the stroke thickness of the hand writting

private void cbStrokeThickness_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      StrokeThickness = Convert.ToDouble(cbStrokeThickness.SelectedIndex + 1);
    }


    private void btnExit_Click(object sender, RoutedEventArgs e)
    {
      canvas.Children.Clear();
      App.Current.Exit();
    }


    private void cbBorderColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      if (cbBorderColor.SelectedIndex != -1)
      {
        var pi = cbBorderColor.SelectedItem as PropertyInfo;
        BorderColor = (Color)pi.GetValue(null);
      }
    }


    private void cbFillColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
      if (cbFillColor.SelectedIndex != -1)
      {
        var pi = cbFillColor.SelectedItem as PropertyInfo;
        FillColor = (Color)pi.GetValue(null);
      }
    }


    IReadOnlyList<String> RecognizedText;
    string FinalRecognizedText = "";  //for space
    IReadOnlyList<InkRecognitionResult> x;
    private async void btnRecognize_Click(object sender, RoutedEventArgs e)
    {
      try
      {
        txtRecognizedText.Visibility = Windows.UI.Xaml.Visibility.Visible;
        btnSaveRecognizedText.Visibility = Windows.UI.Xaml.Visibility.Visible;
        canvas.SetValue(Grid.RowProperty, 3);
        canvas.SetValue(Grid.RowSpanProperty, 1);
        MyInkManager.Mode = InkManipulationMode.Inking;
        x = await MyInkManager.RecognizeAsync(InkRecognitionTarget.Recent);
        MyInkManager.UpdateRecognitionResults(x);
        foreach (InkRecognitionResult i in x)
        {
          RecognizedText = i.GetTextCandidates();
          FinalRecognizedText += " " + RecognizedText[0];
          txtRecognizedText.Text += FinalRecognizedText;
        }
        FinalRecognizedText = string.Empty;


      }

Points of Interest

This application demonstrates how a user can draw shapes and how hand writing recognition is performed in a XAML/C# code.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

gokulsrg
India India
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 15 Nov 2012
Article Copyright 2012 by gokulsrg
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid