Recognize number from video - java

Im working on a project now and there is something I dont know how to start work on.
I have a webcam connected to my computer and aiming to a screen that streaming number every few minutes.
I need to capture those number using my webcam...
How can I recognize those number ?
I tought to use openCV but I guess there is a better solution.
thanks
btw, I tought to work on this project in java but if you have a better solution I will glad to hear.

What you want to do is called OCR (Optical Character Recognition). I would recommend to you Google tesseract, a project on OCR that has even bindings for Python (language that I recommend for its simplicity in fields as machine learning and OCR).
Main project: https://github.com/tesseract-ocr
Python bindings: https://pypi.python.org/pypi/pytesseract
Here there is an example from the python bindings:
<!-- language: python -->
import Image
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('test.png')))
Of course there are bindings also for java. Precisely it is provided by javacv.

Related

Using android palette class in desktop java application

Android developers have created a great class to isolate colors from an image
https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/palette/src/android/support/v7/graphics/Palette.java
However I could really use this in a desktop application. I tried ripping the class from the library (as recommended to me , during a Devox java conference by one of the android devs) but he probably didn't realize I would have to drag half of the android library with me then eg: Bitmap, Color
Does anyone know of a tool that might be able to strip the classes I need retroactivly from the library, or give me a better way to solve my original problem, a java class that will give me the dominant colors of an image together with their inverse and adjoining colors ? I can't write it from scratch cause we just don't have the budget/time to do that :(
I stumbled upon your question and I also found this lightweight library on github that is a port of one of the javascript libraries that Chris Banes references in the blog post mentioned above.
It's pretty good at extracting the primary color for images quickly. I would still love it if someone had a way to extract something like what android calls the "vibrant" color. Ideally I would love a way to mimic exactly what happens in the android library so i could have a seamless experience between my android, desktop, and ios experiences. I still haven't found that one yet.
Another Java port - https://github.com/trickl/palette. I wrote this one myself (I was unaware of the existence of other ports at the time). It's a pretty direct port and includes a bunch of the original tests.
There is this Palette ported library. You can use it in your Gradle based java project by adding jcenter() to your repositories and the next dependency into your build.gradle file.
dependencies {
...
compile "com.loyalsound:iris:1.1"
}

Finding characteres in a game image using Java

I'm trying to recognize the characters of a game using Java, so I can process them later.
The images look like this:
http://i.imgur.com/GM0XPgO.jpg
I want to recognize, specially, the 3w in the left-bottom, the 214 and 0.13 in the center and the 1m in the right-bottom.
Anyone have any idea?
This question is related to computer vision and I would suggest using this java OCR library from here:
http://ocrsdk.com/documentation/code-samples/
This will help you recognize English text present on image. I'm pretty sure that it will give you major texts from image.
PS: For image processing, using matlab or python would be better as they have good computer vision libraries like "Computer vision Toolbox for Matlab" and "OpenCv for python". Here are some examples for you task using matlab: http://www.mathworks.com/help/vision/ref/ocr.html

How to capture webcam input in java without an external library?

My question is exactly as the title states. I've spent some time googling and all I can find are recommendations to use external libraries. However, I'd like to do this without using any external libraries and documentation is lacking on how to go about this.
I'm afraid it is not possible. The two main approaches in java is to use either JMF or openCV. JavaFX has no plan to develop a Webcam API so it is not going to change soon.
You should look at this question: How can I take image at webcam with javaFX at win7 64bit?
Here is a link to javafx + opencv integration: http://ladstatt.blogspot.fr/2013/04/using-isight-camera-with-javafx.html
JavaFX + JMF does not seem to work now: Webcam access from JavaFx
But there is hope with JavaFX 8: https://github.com/carldea/WebcamFX
Not possible without external libs unless you depend on JNI. Period.
In the past I got good results using JTwain-based solutions.

Count the number of objects in an Image

I am investigating the possibility of image processing to identify certain objects and also count them in an image.
I will be given a picture and I need to identify the number of boxes present in that image.
Does anybody have any experience with any Machine Vision/ Image Processing libraries like ImageJ, Fiji, JAI, jMagick ,Java Vision Toolkit? Which do you think is best suited for the job? What do you guys suggest? If the APIs can be used from Java, it would be better. Thank you.
Edit:
I am dealing with warehouse brown boxes. Yes I am talking about regular photos. The source is usually a mobile phone picture.
Edit2:
I am sorry the answer got autoselected. : (
I have never used the libraries you listed but I have used OpenCV.
OpenCV is a well supported and proven computer vision library. It has built in features to count the number of primitive shapes in an image. It is written in C++ but you could create a small wrapper to be invoked via JNI.
RoboRealm is another proven computer vision system used by robotic hobbyists. It is a closed source commercial product that uses a socket based control API.
http://opencv.willowgarage.com/wiki/FullOpenCVWiki
http://www.roborealm.com/index.php
If you must stick to Java, you can still use OpenCV.
If it's just boxes you can use Hough Transforms to detect them.
You can use OpenSURF to detect phones based on source images you feed to it.
Don't think this would be feasible in your case: HAAR Cascades. You could create a custom HAAR clasifier, but the training process can be quite time consuming.
HTH,
George
In Java, there are several projects that extend the Java Advanced Imaging API to provide computer vision:
JavaVis
image processing in java + IPJ - computer vision extensions for JAI
Java Vision Toolkit - JVT (EDIT: opps, this is mentioned in the question.)
There is a paper for JavaVis which introduces the library, compares and constrasts with these other two libraries mentioned.
JavaVis has these features:
handles 2D and 3D images (3D being most relevant in this case)
Has a GUI for inspecting potential results
Matlab image export
Also for java is NeatVision. Unlike the others, documentation is clearly visible for this project.
None of these projects are going to give you a simple turnkey solution. You will need to understand how computer vision works, and create a sequence of processing steps on the photos to help get the best results from the vision algorithms. To that end, JavaVis maybe most useful, since it is aimed towards teaching computer vision.
If you are not talking about real time image processing, you could write an API to Amazon Mechanical Turk.
Are you willing to develop your own code for that? There are several techniques that can be applied and tuned to your specific problem, but I never used a packaged library, always developed my own code. I can provide references for that if you're interested.

How to get video and audio streams from web cameras with Java?

How can I get video and audio streams from web cameras with Java (in a cross-platform way)?
For example, we have a computer with 3-4 USB web cameras; we want to get their streams and make them visible in the user interface. How can we perform such a thing? I need code for a simple app which would find ALL cameras on the computer and let us select camera to wach. Can any one, please share such one?
With java media framework JMF or FMJ
Here is an example with JVM
I see your comment about the solution needing to be "pure" java, but this is really "nearly" impossible. You will need to use some sort of native library for accessing the devices, with that being stated; I suggest that you look at Xuggler as your solution. Xuggler supports Windows, Mac, and Linux and they also offer example code for handling audio and video. Lastly the library is FREE.
Webcam capture example: http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler/src/com/xuggle/xuggler/demos/DisplayWebcamVideo.java
While Xuggle does not have an example of microphone capture, you can find samples on the mailing list or you could use code written by the packet-mulitbroadcaster project found here: https://code.google.com/p/packet-multibroadcaster/
You can try my solution. It uses OpenCV to capture the image and jetty server to transmit it via WebSocket. The example has three classes and it will be easy to understand.
Now I can send only video, but I'm working on audio aswell.
I'd use flex. It can be relatively easily integrated with java backend.
UPD:
Pure Java needed
Then you should consider JavaFX solutions. I'm not a big expert in javafx, I've only written some basic test applications, but I'm sure it's a modern way of solving described problem with pure java.

Categories

Resources