How to add LateX/Math to Windows 10 Ink API? - c#

From highlights of Microsoft Build 2016, I saw Microsoft was pushing its new Ink API.
What exactly are the new additions?
Can Ink
Understand handwriting and digitize it?
Understand Math/Equations and digitize it (ie Latex)?
Are there any other APIs that can do this for UWP or Unity?
How would I go about creating one myself?
Jeans link refers to custom recognition. Is this what I'm looking for? I feel like there should be an option to add symbols to the lookup dictionary.

Yes for the first point, you can convert ink strokes to text using handwriting recognition.
Recognize ink strokes
For math and equations, didn't see any default Recognizer at the moment.

-Understand handwriting and digitize it?
Yes, that's the whole point of the API.
It's basically OCR 2.0
-Understand Math/Equations and digitize it (ie Latex)?
Nope. Or, at least, not yet because, of course, it would be a logical expansion of the API.
Are there any other APIs that can do this for UWP or Unity?
Not that I had heard of.
Finally, I don't think that Jeans link is what you are looking for. It's not simply a matter of adding a new symbol, but also to represent it conveniently.
For example, how would you do to display \frac{\,\frac{a}{b}\,}{\frac{c}{d}} ?
There is no correct way of positioning the a/b over the fraction bar and the c/d under it. Even if you can use superscript and subscript, there is no way for a standard police to align them vertically.
The good news is: Ink is an API, which means you could create a wrapper that would, for example, automate the latex pdf generation. So yes, you could create the functionality you're looking for with a bit on C# (as it looks you're on a Microsoft environment)
Take a look at this thread: https://tex.stackexchange.com/questions/53914/compile-tex-inside-microsoft-c-net
Best of luck!

For LaTex, there's a Xamarin library called CSharpMath, which uses SkiaSharp to render the math expression. It is ported from the iosMath project.
As the library is .NetStandard, so it also means you can use it in an UWP app.
The repository can be found here.

Related

Using Microsoft InkAnalysis APIs without Tablet input?

I recently discovered that all Windows 7 machines have an handwriting recognition API within them called Microsoft Ink Analysis ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms704040(v=vs.85).aspx ).
I would like to use the API for intelligent character recognition - to convert individually spaced handwritten letters from an image into text. I have found demos of the API being used with paper surveys ( http://msdn.microsoft.com/en-us/library/ms840402.aspx ), but it appears in all the demos the handwriting itself needs to be entered live -
Is it possible to use the Ink Analysis API to analyze images, instead of live input? If so, how is this done?
Ink Analysis uses stroke information inputted from ink panels to recognize handwriting (aka "live input"), and does not do analysis on raw image data.
Unfortunately, you'll need to find an OCR library for that.
I have been trying to answer that question myself, in theory it only works with live input, but ink analysis also enables developers to save and load ink strokes using Ink.Load and Ink.Save. Maybe you can turn a bitmap image into an array, and save this array into an ink object. Then you can use ink analysis to analyze your strokes.

Google Maps in C# Visual Studio application

For my university I have to create an application that for the User Interfaces paper that I'm doing. I want to create an application that focuses on Africa and allows the user to plot on the map some points of interest.
First thing first though, i need to be able to get the Google maps API working in a form. Does anyone have any idea how I would do this?
Google maps is based on JavaScript. You will need to embed the maps objects into the page and use it that way.
A good starting point would be http://code.google.com/apis/maps/index.html and the most basic of tutorials is available at http://code.google.com/apis/maps/documentation/javascript/tutorial.html#HelloWorld.
I would definatley recommend then links above and then move onto something like http://googlemap.codeplex.com/. It's better to know what's going on underneath before abstracting it away.
Alternatively, you may wish to check out GMap.net (the website is not GMap.net: http://greatmaps.codeplex.com/)
GMap.NET is great and Powerful, Free, cross platform, open source .NET
control. Enable use routing, geocoding and maps from Coogle, Yahoo!,
Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yandex, Mapy.cz, Maps.lt,
iKarte.lv, NearMap, OviMap, CloudMade in Windows Forms & Presentation,
supports caching and runs on windows mobile!
I've used this before with WinForms and found it pretty handy. I suggest this because parts of Africa may be better served by different map vendors.

How to plot XY graph in C#?

I am developing an application in C# which deals with specific genetic algorithm problem. The execution of the algorithm provides output parameters that are required to draw a chart.The graphic chart consists of 2 independent axis, lets say X is number of generation and Y represents corresponding maximum value of fitness function. To be more specific, I've uploaded picture from Excel so here it is :
http://img97.imageshack.us/img97/2046/graphnb.png
My priority is to make this application fully-functional by allowing user (who sets random execution factors such as mutation percentage, population and generation number, number of elite individuals, etc.) to see generated X-Y graph inside the generated "Form" in C#. I've found site that partially solves my problem, but that's not the whole point (http://csharp.net-informations.com/excel/csharp-excel-chart-picturebox.htm). So I'm asking if there is a way to implement mentioned graph by not using any other applications, but maybe only C# libraries and functions for plotting or something like that? Hope I made myself clear. Best regards.
Free and native answer is http://zedgraph.org/wiki/index.php?title=Main_Page
Does not involve WPF
Does not cost
Only C# libraries
Works inside a .NET WinForm
personally I like XtraChart of DeveloperExpress, but there are also many many other cheaper or more expensive alternatives, also other questions similar to yours here in SO: WPF chart controls
I like to use libraries whenever I can so I can focus on my real business case instead of trying to re-invent the wheel everytime, also because usually it's not trivial to reach the same level of results of people working hard to deliver specific components.
As all have said you have to work on WPF (different platform then WinForms) with 3rd party charting library that are much easier to integrate with your application.
If you want to know further about charting library then you should see this page
Click here
If you can use it, try WPF. It's much better for developing graphically rich user interfaces than standard Windows Forms -- especially if you don't want to use third-party libraries.

Is it practical to port code from Flash to C#?

My goal is to gain a better understanding of the characteristics of C#, and become more comfortable creating simple apps. I am fairly competent with Flash (Actionscript 3), and found an old Tic-Tac-Toe game I'd written. I started wondering about porting this code into a C# application. Not knowing much about C#, I'm wondering how difficult the migration would be.
On the one hand, the underlying game logic is syntactically similar, and therefore would be easy to port.
However, as far as the graphics are concerned, I don't even know where to begin. So far, I've only exposed myself to Windows Forms and Console apps in C#.
I'm wondering if these Flash concepts have similar analogs in C#, or if the procedures and syntax are radically different:
Placing graphic elements on a stage
Rendering lines from start/end coordinates
Event listeners on movie clips
Swapping the image inside a graphic element (or, in my Flash version, nextFrame() in a movie clip)
You may want to try developping your little game using Silverlight. Silverlight applications, coded using C# and Xaml, are pretty similar in form with flash applications, and you should find everything you need without trouble.
So I suggest you download the Silverlight SDK (free) and give it a try.
Firstly, Flash is to WPF (close enough) as ActionScript is to C#.
The WPF/Silverlight model is much more similar to Flex that it is to Flash. Everything is added to the UI tree as a object, even lines.
Likewise, adding event handlers to controls (like a button click) can be done in the "code behind" (the code that lives with the view), but the recommendation is to use the MVVM pattern. If you are new to the concepts of separation of concerns and unit testing, feel free to start with the simpler "code behind" method.
While WPF and Silverlight are very similar, I'd recommend starting with Silverlight as the SDK and available samples are richer. You can easily move onto WPF later on (though porting an application from Silverlight to WPF is not automatic).
Swapping images, as you mentioned, would be done via "Visual States" in Silverlight (or possibly changing the image reference, which is more "hacky").
Have a look at the following links to get started:
Learn # Silverlight.net
Silverlight on MSDN
Shapes and Drawing (Silverlight)
If you're looking specifically to do games and the like, you may wish to look into the free XNA framework. However, there will be differences as Flash gives you far more ability to "set up" things beforehand and modify them.
Placing graphic elements on a stage
If you go the XNA route, you will be drawing sprites using the spritebatch, you tell them where and how to draw and that's where they will go
Rendering lines from start/end coordinates
In windows forms you can do this via a simple System.Drawing call, however if you wish to do this in XNA, you will either have to make a 1 pixel square and stretch/rotate it to what you want, or use 3d primitives (Though this will limit you to a 1 pixel line)
Event listeners on movie clips
Look into delegates, but there isn't really an equivalent for movie clips to my knowledge
Swapping the image inside a graphic element (or, in my Flash version, nextFrame() in a movie clip)
This is fairly simple, depending on what you mean. If you want to, say, animate a sprite. You can do this by moving the source rectangle or changing the texture of the spritesheet. If you mean the screen as a whole, this is mostly handled for you provided you use the spritebatch. In windows forms you'll have to do more of it yourself, but the base concepts are the same.
Overall it's not that bad, but if that doesn't sound appealing check out Silverlight. It's basically C# styled flash so you may find the transition easier.
Good luck and hope this helps.

How can I programmatically access the ArcGIS 3D Analyst Toolbar's "Features to 3D" command?

I need to take a 2D shape file in the ".shp" format that ArcGIS accepts, and add 3D information supplied by a raster DEM. I'm looking for how to do this with the ArcObjects API. I'd like to do it in C#, but examples in any .NET language would be welcome. The only thing I've been able to find are descriptions of how to do this manually in one of the ArcGIS desktop apps. Like this helpful HowTo article, or the wonderful full color illustrations on page 22 of this tutorial. That's great and all, but I need to use this feature in the middle of an automated chain of operations. I don't want to have a manual step in the middle.
OK. I figured it out. I'm jotting down an outline of what I did here in case anyone else runs into the same problem.
The key method is ISurface.InterpolateShape. It will copy an existing 2D IGeometry and add 3D information to it from a surface (raster or TIN). I translated this example VB6 code from VB6 to C#, and modified it to call InterpolateShape for each copied IGeometry in the input shape FeatureClass before inserting it into the output FeatureClass.
I won't post any of the code here because I developed it on my company's dime, but this should be enough to figure it out reasonably quickly. Hopefully this will help some other struggling developer get through the problem more quickly.

Categories