Application Tool Kit

Neosmartpen v2 integration

 Hi, i'm trying to integrate the neosmartpen into your handwriting recognition, i wondered if there was some examples available for windows.


Dear Manuel,

thank you for contacting us.

Currently, we do not have any code sample to use the ATK with the neosmartpen.

To my knowledge, you should be able to find a SDK to extract the strokes (x and y coordinates) from the pen. Then, you can use the "addStroke" API to provide the ATK with these strokes (AddStroke should be called for each stroke).

Let us know if you have further questions.

Best regards,

Olivier
Dear Olivier,
Thanks for the fast response.

I have the SDK to extract the strokes and the dots from the pen, but when i try to use the "addStroke" method it wants a list of CapturePoint and not a list of dots (wich the pen uses).
I've tried to create first a CapturePoint and assign to its point the values of my dots, then create a list of CapturePoint to have a resemblance with the Stroke structure, but it crashes when i start writing with a NullPointerException

Dear Manuel,


here is teh way you should proceed.


Let's say each stroke is define with an array for X, Y, W, T and F (W, T and W, are not mandatory, but T is needed f you need the gestures): strokeX[],  strokeY[], strokeW[], strokeT[],strokeF[].


=>Each array should normally have the same size.


You can then create the CaptureInfo objects and add Strokes as follows;

 
  List<CaptureInfo> points = new ArrayList<>();

  for (int i = 0; i < strokeX.size(); i++)
  {
     CaptureInfo info = new CaptureInfo();
     info.setX(strokeX[i]));
     info.setY(strokeY[i]);
     info.setX(strokeW[i]));
     info.setY(strokeT[i]);
     info.setY(strokeF[i]);
     points.add(info);
  }
  mWidget.addStroke(points);


Let us know if you have further questions.


Best regards,


Olivier

你好Olivier:

我在windows版的ATK的demo中MathWidgetSample中


 

 

private void Button_Click(object sender, RoutedEventArgs e) { 
MyMathWidget.AddStroke(new List<MyScript.Atk.Core.CaptureInfo>() 
{ 
new MyScript.Atk.Core.CaptureInfo(100, 100, 0.5f, 0, 0),
 new MyScript.Atk.Core.CaptureInfo(150, 100, 0.5f, 0, 8),
 new MyScript.Atk.Core.CaptureInfo(200, 100, 0.5f, 0, 16), 
new MyScript.Atk.Core.CaptureInfo(250, 100, 0.5f, 0, 24), 
new MyScript.Atk.Core.CaptureInfo(300, 100, 0.5f, 0, 32), 
new MyScript.Atk.Core.CaptureInfo(350, 100, 0.5f, 0, 40), 
new MyScript.Atk.Core.CaptureInfo(300, 140, 0.5f, 0, 48), 
new MyScript.Atk.Core.CaptureInfo(250, 180, 0.5f, 0, 56), 
new MyScript.Atk.Core.CaptureInfo(200, 220, 0.5f, 0, 64), 
new MyScript.Atk.Core.CaptureInfo(150, 260, 0.5f, 0, 72), 
new MyScript.Atk.Core.CaptureInfo(100, 280, 0.5f, 0, 80), 
new MyScript.Atk.Core.CaptureInfo(100, 300, 0.5f, 0, 88), 
new MyScript.Atk.Core.CaptureInfo(150, 300, 0.5f, 0, 96), 
new MyScript.Atk.Core.CaptureInfo(200, 300, 0.5f, 0, 104), 
new MyScript.Atk.Core.CaptureInfo(250, 300, 0.5f, 0, 112),
 new MyScript.Atk.Core.CaptureInfo(300, 300, 0.5f, 0, 120), 
new MyScript.Atk.Core.CaptureInfo(350, 300, 0.5f, 0, 128), 
});
 }

 

 

为什么结果如下呢?我期望的字母是"Z".然而得到了"\",是我哪里使用的不对吗


image


Dear Yang Jingwei,

currently, the AddStroke function API is not working properly for the MathWidget on Win10.

Instead, you should use the PenDown, PenMove and PenUp API (it behaves exactly the same way than AddStroke).

This can be done as follows in your code:

private void Button_Click(object sender, RoutedEventArgs e) {
MyMathWidget.PenDown(new MyScript.Atk.Core.CaptureInfo(100, 100, 0.5f, 0, 0));
MyMathWidget.PenMove(new MyScript.Atk.Core.CaptureInfo(150, 100, 0.5f, 0, 8));
...
MyMathWidget.PenMove(new MyScript.Atk.Core.CaptureInfo(300, 300, 0.5f, 0, 120));
MyMathWidget.PenUP(new MyScript.Atk.Core.CaptureInfo(350, 300, 0.5f, 0, 128));
}

Let us know if this helps.

Best regards,

Olivier


1 person likes this

您好Olivier:

 非常感谢您的回复,问题已经解决了,请问一下Windows版本的MathWidget是否有Win7版本的ATK?如果有能否提供win7版的ATK呢?

Dear Yang Jinwei,

we do not have an ATK version for Windows 7. It only runs on Windows 10 UWP.

Best regards,

Olivier

 Dear Olivier,

Once i've got all my strokes and added to the widget, how can i stop the acquiring and recognize it? Right now i need to click into the widget (wich obviusly makes a dot), then it start recognizing the whole script. Is possible to make the widget recognize one word at time (for example, if the pen is up and it's passed a set amount of time, i want to recognize the word)?

 

Dear Manuel,

Currently, how do you implement the widget?

Indeed, normally, the recognition starts each time a stroke is added, there is not API to tell to start the recognition?

For this reason, I am facing difficulties figuring out your use-case. Indeed, you should need to do a click to start the recognition.

Best regards,

Olivier
Dear Olivier,
Thanks as always for the support, i've actualy resolved this issue (wich was more of a misunderstanding on how sltw works, i think) by checking the "ontextchanged" function.

The widget in the xaml is now set to "not visible" (i don't need to see the pen input on sceen, for that i have the physical paper, or a canvas), then i've added an output wich shows everytime what the recognized text is.
Now for everystroke i add, the output change accordingly to what the widget recognize, with a nice "realtime" recognize effect.
Dear Manuel,

thank you for the update.

Feel free to contact us if you have any other question.

Best regards,

Olivier
Dear Olivier,

I have multiple fields to write in, i can choose wich field is to write in based on my position on paper, but i have some problems.
I actualy have only one widget, wich i clear everytime i start to write in another field.

If i start to write in the first field, then in the second it goes all smoothly, but if i want to write again in the first field i have some issues:
If i just add the recognized word in the "ontextchanged" it adds every step the recognizer does.
ontextchanged(widget w, string text, bool intermediate){
txt = text;
field.text += txt;
}

If i try to add the previous text into the widget, it takes my writing in between the previous text
if(oldfield != newfield){
widget.clear();
widget.text = field.text;
}

i tought i could scroll the widget, sending the old text to the left and start writing in a "blank" space, but it doesn't seems to work, making the recognize do weird stuff:
if(oldfield != newfield){
widget.clear();
widget.text = field.text;
widget.scrollTo(widget.text.lenght);
}
Dear Manuel,

currently, the latest way you proceed is the solution we would recommend.

When you say you you have weird stuff, van you please explain further?

Thank you,

Best regards,

Olivier
Dear Olivier,

It doesn't seems to recognize correctly, nearly everything i write get recognized as a dot, or an a at best, if i set the widget visible and i track how it works visualy it doens't seem to scroll.
I guess that when i call the scrollto(index) function (with index equals to widget.text.lenght), the widget should visually scroll until the last letter is on the borded left, but it doesn't, the only noticeable thing is a cursor that appear at the first letter but nothing more.
I tought that could be wrong the index, so i tried with a +1 or a -1, but i get the same result no matter what.
Login or Signup to post a comment