Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Library for online handwriting recognition system using UNIPEN database.

, 2 May 2012
a library for handwriting recognition system which can recognize 99% to digit or 90% to capital letter+ digit
capital_letters__digit_89_.zip
lowcase_letter_89_.zip
numberic_97_.zip
UNIPENViewer_demo_source_version_1.01.zip
UNIPENViewer demo source version 1.01
Neurons.dll
NNControl
bin
Debug
Neurons.dll
Neurons.pdb
NNControl.dll
NNControl.pdb
UPImage.dll
UPImage.pdb
Release
Common
NNTraining
obj
Debug
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
NNControl.Common.UPTemplateControl.resources
NNControl.dll
NNControl.FlashForm.resources
NNControl.NNTraining.UP_NNTrainingControl.resources
NNControl.pdb
NNControl.Properties.Resources.resources
NNControl.TrainingParametersForm.resources
NNControl.UPViewer.UpImageViewer.resources
ResolveAssemblyReference.cache
TempPE
Properties.Resources.Designer.cs.dll
UP-NeuralTraining.dll
UP-NeuralTraining.pdb
UPControl.Common.BaseControl.resources
UPControl.Common.UPTemplateControl.resources
UPControl.FlashForm.resources
UPControl.NNTraining.UP_NNTrainingControl.resources
UPControl.TrainingParametersForm.resources
UPControl.UPViewer.UpImageViewer.resources
UP_NeuralTraining.FlashForm.resources
UP_NeuralTraining.TrainingParametersForm.resources
UP_NeuralTraining.UP_NNTrainingControl.resources
Release
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
NNControl.Common.UPTemplateControl.resources
NNControl.dll
NNControl.FlashForm.resources
NNControl.NNTraining.UP_NNTrainingControl.resources
NNControl.pdb
NNControl.Properties.Resources.resources
NNControl.TrainingParametersForm.resources
NNControl.UPViewer.UpImageViewer.resources
ResolveAssemblyReference.cache
TempPE
Properties.Resources.Designer.cs.dll
Properties
Resources
btnBack.png
btnDrag.png
btnFitToScreen.png
btnNext.png
btnOpen.png
btnPreview.png
btnRotate270.png
btnRotate90.png
btnSelect.png
btnZoomIn.png
btnZoomOut.png
cry.png
Drag.cur
file.png
folder-open.png
folder.png
folders_explorer.png
Grab.cur
home.png
label-link.png
script_(stop).gif
smile.png
Stop sign.png
Upload.png
UPViewer
UNIPENviewer
UNIPENviewer.suo
bin
Debug
Config
Neurons.dll
Neurons.pdb
NNControl.dll
NNControl.pdb
UNIPENviewer.exe
UNIPENviewer.pdb
UNIPENviewer.vshost.exe
UNIPENviewer.vshost.exe.manifest
UPImage.dll
UPImage.pdb
Release
Config
obj
Debug
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
ResolveAssemblyReference.cache
TempPE
UNIPENviewer.exe
UNIPENviewer.MainForm.resources
UNIPENviewer.pdb
UNIPENviewer.Properties.Resources.resources
Release
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
ResolveAssemblyReference.cache
TempPE
UNIPENviewer.exe
UNIPENviewer.MainForm.resources
UNIPENviewer.pdb
UNIPENviewer.Properties.Resources.resources
x86
Debug
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
ResolveAssemblyReference.cache
TempPE
UNIPENviewer.exe
UNIPENviewer.Form1.resources
UNIPENviewer.pdb
UNIPENviewer.Properties.Resources.resources
Properties
Settings.settings
UPUnipen
UPImage.dll
UNIPENViewer_demo_version_1.01.zip
UNIPENViewer demo version 1.01
Config
Neurons.dll
NNControl.dll
UNIPENviewer.exe
UNIPENviewer.vshost.exe
UPImage.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  System.IO;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
namespace UNIPENviewer
{
   
    public struct DataLayout
    {
        int iX_Dim;
        int iY_Dim;
        int[] iH_Line;
        int[] iV_Line;
        List<UPDataBox> list_DataBox;
        String hierachy;
    }
    /// <summary>
    /// keywords in file
    /// </summary>
    public class KEYWORD
    {
        public List<String> strContent;
        public String keyName;
        public KEYWORD()
        {
            keyName = "";
            strContent = new List<string>();
        }
    };
  
   /// <summary>
    /// UNIPENFile structure
   /// </summary>
    class UNIPENFile
    {
       /* allocated filecontents, for the Unipenfile and each included file */   
        String cur_path;
        String cur_file_open;
        List<String> upIncludeFiles;        
        /* keywords */
        List<KEYWORD> keywords;
    
        /// <summary>
        /// 
        /// </summary>
        public String m_Cur_file_open
        {
            get
            {
                return cur_file_open;
            }
            set
            {
                if (cur_file_open == value)
                    return;
                cur_file_open = value;
            }
        }
        public String m_Cur_path
        {
            get
            {
                return cur_path;
            }
            set
            {
                if (cur_path == value)
                    return;
                cur_path = value;
            }
        }
        public List<String> m_UpIncludePaths
        {
            get
            {
                return upIncludeFiles;
            }
            set
            {
                if (upIncludeFiles == value)
                    return;
                upIncludeFiles = value;
            }
        }
        public List<KEYWORD> m_Keywords
        {
            get
            {
                return keywords;
            }
            set
            {
                if (keywords == value)
                    return;
                keywords = value;
            }
        }
        //----------------------------------------------------------------------------------------------------------------------//
        KEYWORD currentKeyword;
        bool bfirstkey;
             
        public UNIPENFile()
        {
            upIncludeFiles = new List<string>();
            currentKeyword =null;
            bfirstkey = true;
            keywords = new List<KEYWORD>();
           
        }

        public void GetKeywordsOfUNIPENFile(string filename)
        {
            try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                cur_file_open = filename;
                using (StreamReader sr = new StreamReader(filename))
                {
                    string line;
                    // Read and display lines from the file until the end of 
                    // the file is reached.
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (UpLib.SubStringExist(null, line, "."))
                        {
                            String str = "";
                            if (line.IndexOf(" ") > 0)
                            {
                                str = line.Substring(0, line.IndexOf(" "));
                            }
                            else
                            {
                                str = line;
                            }
                            foreach (String st in UpLib.keyworkNames)
                            {
                                if (str.CompareTo(st) == 0)
                                {

                                    if (currentKeyword==null)
                                    {
                                        KEYWORD kw = new KEYWORD();
                                        kw.keyName = str;
                                        currentKeyword = kw;
                                    }
                                    else
                                    {
                                        keywords.Add(currentKeyword);
                                        KEYWORD kw = new KEYWORD();
                                        kw.keyName = str;
                                        currentKeyword = kw;
                                    }
                                    break;
                                }
                            }
                        }
                        if (currentKeyword != null)
                        {
                            currentKeyword.strContent.Add(line);
                        }
                        
                    }
                   
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            
            //read include paths
            foreach (var item in keywords)
            {
                if (item.keyName == UpLib.keyInclude)
                {
                    //get include paths
                    foreach (var s in item.strContent)
                    {
                        String sTemp = "";
                        if (UpLib.SubStringExist(null, s, UpLib.keyInclude))
                        {
                            sTemp = s.Substring(s.IndexOf(UpLib.keyInclude) + UpLib.keyInclude.Length).Trim();
                        }
                        else
                        {
                            sTemp = s.Trim();
                        }
                        upIncludeFiles.Add(sTemp);
                    }
                }
            }
            //read keywords in include files
            foreach (var item in upIncludeFiles)
            {
                String tempString = item.Replace("/", "\\");
                String path = String.Format("{0}\\{1}\\{2}", cur_path, "UnipenData\\include", tempString);
                try
                {
                      // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                    using (StreamReader sr = new StreamReader(path))
                    {
                        string line;
                        // Read and display lines from the file until the end of 
                        // the file is reached.
                        while ((line = sr.ReadLine()) != null)
                        {
                            if (UpLib.SubStringExist(null, line, "."))
                            {
                                String str = "";
                                if (line.IndexOf(" ") > 0)
                                {
                                    str = line.Substring(0, line.IndexOf(" "));
                                }
                                else
                                {
                                    str = line;
                                }
                                foreach (String st in UpLib.keyworkNames)
                                {
                                    if (str.CompareTo(st) == 0)
                                    {
                                        if (currentKeyword==null)
                                        {
                                            KEYWORD kw = new KEYWORD();
                                            kw.keyName = str;
                                            currentKeyword = kw;
                                        }
                                        else
                                        {
                                            keywords.Add(currentKeyword);
                                            KEYWORD kw = new KEYWORD();
                                            kw.keyName = str;
                                            currentKeyword = kw;
                                        }
                                        break;
                                    }
                                }
                            }
                            if (currentKeyword != null)
                            {
                                currentKeyword.strContent.Add(line);
                            }
                        
                        }
                   
                    }
                }
                catch (Exception)
                {
                    
                    throw;
                }
            }
            
        }
        
        public void GetCurrentCharacters(List<Point> points)
        {
            int index = 0;
            foreach (var item in keywords)
            {
                String st = item.keyName;
                Point p = new Point();
                switch (st)
                {
                    case ".PEN_DOWN":
                        if (index ==74)
                        {
                            foreach (var str in item.strContent)
                            {
                                if (String.IsNullOrEmpty(str) == false)
                                {
                                    if (UpLib.SubStringExist(null, str, ".") == false)
                                    {
                                        List<String> sList = new List<String>();
                                        UpLib.GetWordsFromString(null, str, sList);
                                        p.X = Convert.ToInt32((String)sList.ElementAt(0));
                                        p.Y = Convert.ToInt32(sList.ElementAt(1));
                                        points.Add(p);
                                    }
                                }
                            }
                            
                        }
                        if(index>75)
                            goto exitloop;
                        index++;
                          
                        break;
              
                }
               
            }
        exitloop: ;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

About the Author

Vietdungiitb
Vietnam Maritime University
Vietnam Vietnam
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 3 May 2012
Article Copyright 2012 by Vietdungiitb
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid