Java get barcode informaton from barcode scanner - java

I have been searching for this. All the related Java APIs are worked on images. They get the information from barcode contained in the images and print barcode to images.
My question is how to get the barcode directly from the scanner in Java? Is there any API I am missing to read barcode directly from scanner? Or, whether I need to generate in-memory image from the information got by the scanner?

AFAIK, most of barcode scanners have keyboard emulation mode. You can attach scanner to your PC, scan the barcode and scanner will provide you with barcode information emulating ordinary keypresses which you can capture in any acceptable way (e.g. as keypresslistener or inputfield in Java Swing)

Most of modern barcode scanners can be set up to work in serial emulation mode. If you set them up this way, you can communicate with the device as if you are communicating with a normal serial port (read/write). Then you can use a Java library for communicating with the serial device. I used a library called RxTx (http://rxtx.qbang.org/wiki/index.php/Main_Page) which worked great both on Windows and on Linux.

Related

Java: How do I take input from a USB video capture device?

I have a USB device that provides a video stream to the computer. Normally I just use a program to display this information in a window. I'd like to have my Java program take this image data directly into my code. How is this possible?
I already have drivers and everything set up. I just need to let my program access the data stream coming in through USB. I imagine this might be similar to using a USB webcam?
you could try Xuggler
its an open source wrapper for FFmpeg to get started with it look at this java class from the xuggler package
or this tutorial here
or you could use the xuggler media tool .
The class i gave you link to should have anything you need to decode , play , and manipulate video from any source ... just change container.open(url...) change the URL to w.e source and it should work .
Here's an example project i once made with Xuggler :

Android (Java) Real-time Audio Input (microphone AND USB) and Output

I would like to build an Android App to take audio data from two microphones, mix the sound with some from memory, and play the sound through headphones. This needs to be done in real-time. Could you please refer me to some tutorials or any references, for real-time audio input, mixing, and output with Java eclipse?
So far, I am able to record sound, save it, and then play it, but I cannot find any tutorials for real-time interfacing with sound-hardware this way.
Note: One microphone is connected to the 3.5 mm headphone jack of the Android through a splitter and the other is connected through a USB port.
Thanks!
There are two issues that I see here:
1) Audio input via USB.
Audio input can be done using android 3.2+ and libusb but it is not easy (You will need to get the USB descriptors from libusb, parse them yourself and send the right control transfers to the device etc). You can get input latency via USB in the order of 5-10 mS with some phones.
2) Audio out in real-time.
This is a perennial problem in Android and you are pretty much limited to the Galaxy Nexus at the moment if you want to approach real-time (using Native Audio output). However, if you master the USB you may be able to output with less latency as well.
I suppose if you go to the trouble of getting the USB to work, you can get a USB audio device with stereo in. If you had connected one mono mic to each of the input channels, then output via USB you would be very close to your stated goal. You might like to try "USB Audio Tester" or "usbEffects" apps to see what is currently possible.
In terms of coding the mixing and output etc, you will probably want one thread reading each separate input source and writing to a queue in small chunks (100-1000 samples at a time). Then have a separate thread reading off the queue(s) and mixing, placing the output onto another queue and finally a thread (possibly in native code if not doing output via USB) to read the mixed queue and do output.
The following Link http://code.google.com/p/loopmixer/ has a flavor for dealing with the audio itself.

Difference Java Media Framework API and FMJ

I want capture the data from scanner, camera, USB camera for all operating systems.
What is difference between Java Media Framework API and FMJ? Which API is better?
Update
Is there any possible to capture the data from scanner using JMF?
FMJ is an open source replacement for JMF.
It is able to capture live video from a USB camera using the LTI-CIVIL library.
There is no scanner integration AFAIK.
There are some libraries out there for java and scanners, open and closed source.
Have a look at jtwain, jsane, etc:
http://today.java.net/pub/a/today/2004/11/18/twain.html
http://asprise.com/product/jsane/index.php

How to check existing of application on device?

I have just made application which requires BarCode scanner on device. How can I programatically check existing of this application into device? I know package name for BC scanner.
It is all documented on the zxing website.
http://code.google.com/p/zxing/wiki/ScanningViaIntent
I would suggest instead adding the scan functionality within your app, your app should never depend on other Apps to work.

How do I translate a barcode into an integer using the Android API

I am new to programming on the Android and would like to create an app which requires the ability to scan barcodes to function the way I want it to. I found an open source library called zxing, but after some reading around I found that it requires you to have the zxing app on your device in order to use it. I do not want that app to be a requirement for a couple of reasons, but the main one is that I plan on selling my app and feel that a paid app should be fully functional by itself.
A few people in other forums have mentioned that it would not be a trivial task to implement all the features contained within the zxing library, but I do not need all the functionality it has. All I need is the ability to take GTIN-12 or EAN-13 barcodes (I think those are the types of barcodes commonly used on books, cd's and other household items) and convert them to an arbitrary(or not arbitrary) integer. The numbers don't have to be in any way related to the product or what the barcode is actually supposed to represent. I am not interested in using them to look up products or do anything similar to what various other applications can already do well enough.
My problem is that I don't understand how to process an image taken by the camera in such away that would allow me to do this. For example, how would I crop out the rest of the image (everything besides the barcode itself) and measure the widths of the lines and spaces contained within?
Try http://developer.scanlife.com/products/scanlife-sdk
You will need to register, though, and I don't know what is the level of freedom with that API, but analyzing the barcode from scratch will be no small feat to do, so I suggest you to use one of the available options (like as you mentioned zxing, it would not be the first app that requires a barcode scanner installed)

Categories