Convert string text to GCode - java

I need to create an app (using Android Studio) that generates CNC code to operate a 3D printer. It takes a String as input.
I've found a couple libraries in Python and Javascript that does this, but as I don't have time to translate whole libraries to Java, can you recommend any libraries that does that for me? If there are no open-source options, can you recommend any guide to help me develop this conversor?

What we ended up doing:
App asks for a String as input;
String is converted to a bitmap and then saved as a .png;
.png is loaded and converted to a .svg file. We used this repo: https://github.com/jankovicsandras/imagetracerandroid
We developed a parser to convert a .svg to g-code.
It worked but it's not the best solution, we're looking to implement something that runs python in Android, as there are many pythons that do all the work already, but that's how we've done it and it's working by now.

Related

Getting handwritten text from images

How to extract handwritten text from images, like bank form images, in Java?
I tried to using Tesseract, OCR, GOCR but didn't working for me. Are there any other ways to extract handwritten text from images in Java which works at least 80-90%?
Question with links to libraries
I don't think JAVA natively supports this function, so you gotta use libraries.
There was a question which asked for working libraries and the general consent was: you won't get a 80-90% working recognition in a free and open source library.
Anyway, you can try this, as it is a wrapper for Tesseract.

Android: converting string to image and saving to gallery

In my project I need to save a JPG image to android gallery. Unfortunately, Unity tools do not provide such function in-the-box, so I must implement this function myself. As far as I know, I need to make a little plugin to do that and already figured how to make a simple plugin, but I have questions about my specific goal.
So, the main part is: I have texture in Unity, I encode it to JPG format, resulting in a byte array. Then I convert this byte array into a string to be able to pass this string via android bridge into method located in a java class. Everything that's going to happen further is a black box for me.
I know the basic theory: I need to convert the string into an image somehow, specify the folder for the pictures of my app, save the image into this folder, and somehow refresh device memory so the image is visible in the gallery. But the implementation is a big mystery for me. I know it can be done after a few days of digging, but I guess that this can be done in one-two simple methods.
Can anybody give me some hints? Are there any issues between conversion from C# code in Unity into Java code in, for example, Eclipse?

Fast conversion from mp3 to WAV on Android

I am trying to convert a mp3 file into WAVE format in my Android application. This operation should take little time, as the application is social, and it is not acceptable for the user to wait for too long.
So here is where I am :
I have already tried to use JLayer (proposed in a similar question Convert mp3 to wav on Android), but the conversion is too slow: it takes about 40 seconds for a 2 minutes mp3 file.
Concerning the library LAME (as in Lame4Android), I also tried it (with Android NDK) but the result is still too slow (15s to 10s).
I came across another library: JUCE, but it is too vast, and including the entire library in the project in order to do that simple conversion seems a bit... excessive. And I am also afraid it will slow the application.
So what I am currently looking for is a C/C++ library to use in order to do that.
Do you know any fast libraries?
Thank you.
Not sure if the license will work for you (GPLv2), but have you considered libmad?
As I understand it, there's not a NDK build available for download, but here is a page describing how to make one yourself...
Another option is libmpg123, which is LGPLv2.1. The same blog has an article describing how to use it in Android.

Is there CMU Sphinx local lmtool for java?

I want to convert words to its Arpabet translation.
Something like:
HELLO HH AH L OW
But I want to do it programatically in java, sphinx offers a web tool here http://www.speech.cs.cmu.edu/tools/lmtool.html. I know I can request this tool in Java using sockets and sniffing out the .dic file returned but I cannot use this because not all users of my app has an internet connection.
I also checked-out logios package of Sphinx but it is written in perl and batch files. I can use it but I want to make my app platform-independent and I think it is a bit overboard if I include perl shell in my project.
If there's any java library or algorithm that I can reuse so I can just do something like ConvertToSphinxArpabet("HELLO") and I get the "HH AH L OW" string returned.
Please check the tutorial:
http://cmusphinx.sourceforge.net/wiki/tutorialdict
For example you can use g2p code from FreeTTS written in Java:
http://cmusphinx.sourceforge.net/projects/freetts
OpenMary Java TTS:
http://mary.dfki.de/
For FreeTTS example see our code in the long audio aligner branch:
http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx/branches/long-audio-aligner/Aligner/src/edu/cmu/sphinx/linguist/dictionary/AllWordDictionary.java?revision=11092&view=markup

How can I find where a specific string is on an image?

I was wondering if anyone knew of a way that I could feed an image file to a Python, C or Java program and get back the coordinates of where a specific string appears on the image?
What you're talking about is called Optical Character Recognition, or OCR.
OCR isn't easy to implement from scratch, but there are libraries out there. OpenCV can be used for OCR.
I looked into this a bit more. It turns out that sikuli does exactly what I needed.

Categories