xdxiaoxin

Hi, guys, I am now programming for recognition of inks on the tabletPC. But I met with a big problem: Once I found the handwriting input is not correct and I erase them, rewrite them, the new result will be changed to the string but will be appended to the end of the former string, see my example:

first time Handwriting: I am a new student in the U of Calgary, Canada and I am asking for help about a problem

Recognized String: I am a new student in the U of Calgary, Canada and I am asking for help about a problem

Once I erased the fourth word and change it to be "old", things seems out of control, see the result

second time Handwriting(this time I erase "new" and write "old" on "new"'s position): I am a old student in the U of Calgary, Canada and I am asking for help about a problem

Recognized String: I am a student in the U of Calgary, Canada and I am asking for help about a problem old

As you see, the changed word can be recognized correctly, but on a totally wrong position. that seems the inkcollector collects the ink with the time sequence rather than the space sequence. What should I do then Anybody had ever met with the problem

Thank you very much and your kind help will be greatly appreciated. If you have a good answer and sample programme, please send to mavericwong@gmail.com Thanks my dear friends




Re: Notebook, Tablet PC, and UMPC Development questions about the ink erase

Stefan Wick - MSFT

Hi Alex,

can you include some details about what APIs you are using to call into the recognizer A code snippet would be helpful here, so we can give you the best advice on how to address the problem in your program.

Thanks,

Stefan Wick

Microsoft - Windows Experience






Re: Notebook, Tablet PC, and UMPC Development questions about the ink erase

xdxiaoxin

Hi, Thank you for your reply. My program is just, firstly capture and show the handwriting on one panel, and then recognize the text of that writing, send it to a textbox. The way I made it is:

inkOverlay = new InkOverlay(panel.Handle);//set the panel to be a area for handwriting

inkOverlay.Enabled = true;//I do not use any inkoverlay event. And therefore it is an asynchronous recognition

private void onRecognizeButtonClick(object sender, System.EventArgs e)

{

textBox1.text = inkOverlay.Ink.Strokes.ToString();

}//change to be a text. The function is quite simple but works well, of course, except the problem i have mentioned.

private void OnEraseButtonClick(object sender, System.EventArgs e)

{

inkOverlay.Enabled = false;

inkOverlay.EditingMode = Microsoft.Ink.InkOverlayEditingMode.Delete;

inkOverlay.Enabled = true;

}

private void OnEditButtonClick(object sender, System.EventArgs e)

{

inkOverlay.Enabled = false;

inkOverlay.EditingMode = Microsoft.Ink.InkOverlayEditingMode.Ink;

inkOverlay.Enabled = true;

}

the above is all the code for the functions of handwriting edit, erase, and recognitio. It is quite simple, and powerful, But It really cannot adress the problem I have mentioned. Once you write a handwriting, recognized it, and then erase it , and write something else on the space which you have erased, the last writing will be recognized but will be appended to the back of the whole string. Therefore, i think the TabletPC SDK could only recognize the ink by the time sequence but not the position. The stroke that was written at the last time, no matter whether it is on the first line of the handwriting, will be put into the end of the text. That is too bad.






Re: Notebook, Tablet PC, and UMPC Development questions about the ink erase

Stefan Wick - MSFT

Hi Alex,

I wasn't able to reproduce the problem when using your code. I tried it on XP TabletPC Edition 2005 and on Vista - both worked fine. What system are you using

Anyway, I noticed that code is using a deprecated function. Using the Strokes.ToString() method is not a recommended way to perform recognition. It's marked as deprecated in the SDK:

http://msdn.microsoft.com/library/default.asp url=/library/en-us/tpcsdk10/lonestar/microsoft.ink/Classes/strokes/Methods/tostring.asp

Try changing the code behind the recognition button to the below and let me know if this helps with the problem you are seeing.

Code Snippet
private void onRecognizeButtonClick(object sender, EventArgs e)
{
RecognitionStatus status;
RecognizerContext recoContext = new RecognizerContext();
recoContext.Strokes = inkOverlay.Ink.Strokes;
RecognitionResult result = recoContext.Recognize(out status);
if (status == RecognitionStatus.NoError)
{
textBox1.Text = result.TopString;
}
}

Thanks,

Stefan Wick

Microsoft - Windows Experience






Re: Notebook, Tablet PC, and UMPC Development questions about the ink erase

xdxiaoxin

Hi, stefan, I really appreciate your helps on my program. I have tested your method, that is quite good. But the problem still exists.

And that seems very interesting. If you just type simple sentence with less than 10 words, like:"This is a test"; Everything is OK. But If you type "I am a new student in U of Calgary and I really love this campus enivornment, I would like to be member of the MSDN to get more helps", long sentence, like that. The problem will be exposed. Please try it.

I am using XP tablet PC edition 2005. Remember please: Long sentence with many words, erase and wirte the words on the first of the sentence, you will see what I am talking about. Such as, you type my above example and instead the Calgary with Montreal or something you like.






Re: Notebook, Tablet PC, and UMPC Development questions about the ink erase

Stefan Wick - MSFT

Hi Alex,

I am seeing the type of issue you describe when writing on multiple lines - it doesn't have to be long sentences. Are you writing your long sentence on multiple lines

Please note that by default, the RecognizerContext runs in free-form mode in which the recognizer has limited knowledge/assumptions on the structure of your ink. There are several ways to improve the results here:

1) use an InkDivider object to break up the ink into lines and recognize them seperately

2) assign a RecognizerGuide to let the RecognizerContext know about the lines you want the user to write on

3) use the new InkAnalysis API, which does a structural analysis of your ink automatically to figure out the lines, paragraphs, etc.

I don't know what the end goal of your application is, so I am not sure which approach will be best, but I would recommend looking into the InkAnalysis API. You can download the SDK supplement from here:

http://www.microsoft.com/downloads/details.aspx familyid=884012e7-dd97-4dbc-bf79-68ce8ee2b590&displaylang=en

Here is the modified code from your app, now using InkAnalysis:

Code Snippet
private void onRecognizeButtonClick(object sender, EventArgs e)
{
InkAnalyzer inkAnalyzer = new InkAnalyzer(inkOverlay.Ink, this);
inkAnalyzer.AddStrokes(inkOverlay.Ink.Strokes);
inkAnalyzer.SetStrokesType(inkOverlay.Ink.Strokes, StrokeType.Writing);
inkAnalyzer.Analyze();
textBox1.Text = inkAnalyzer.GetRecognizedString();
}

Thanks,

Stefan Wick

Microsoft - Windows Experience






Re: Notebook, Tablet PC, and UMPC Development questions about the ink erase

xdxiaoxin

Hi, Stefan, your codes are now working well on my program, The problem has been perfectly solved .Thank you very much! Thank you for so many helps. I hope I could get more knowledge on TabletPC programing and then help others just like what you are doing now!

Thank you!