Efficient Webcam Library - java

I need an extremely efficient webcam library (I'll explain later) that works on all platforms.
Basically there will be two webcams and I need to alternate between them at a very fast rate (a least 50fps, it has to be a fluid video still)
Anybody have experience in this field and have some suggestions?

While developing my Webcam Capture project I've tested several frameworks and decided to use part of OpenIMAJ framework. I actually had to extract part of its core-video-capture subproject and refince code to remove all necessary dependencies it has. When I included refine code in my project I was able to stream 250 FPS (EDIT: due to bug in Windows impl) 50 FPS as BufferedImage objects (on Windows XP, without painting, just fetch image from webcam). I can honestly recommend it since it is compatible with most operating systems - Windows (x86 and x64), Linux (x86, x64 and ARM), Mac OS. If you are interested, you can find refined code here.
JMF is also very fast, but its pretty outdated and not maintained any more. It's not portable - when you want to use it, you have to install JMF.
I don't recommend JavaCV, it require huge OpenCV installation package (~100MB), have no Java documentation and it's not portable.
LTI-CIVIL / FMJ are also outdated, not being maintained any more.
VLCj work correctly only on Linux (since it is using V4L4j) and you have to have VLC installed on your PC (not portable).

I have used OpenCV for Java ( http://ubaa.net/shared/processing/opencv/ )
It is very "user-friendly", but I do not know the exact parameters about its efficiency.

A while ago I used Java Media Framework to process and save stream from webcam (Didn't had any performance issues with it). Maybe it could help you in your task.

Related

How can I take image at webcam with javaFX at win7 64bit?

I want to take an image from webcam. How can I do this?
If is there any sample codes for your advice library, it's better than other for me.
I examined these:
Jmyron
Java Media Framework
JavaCV
lt-civil
These are not useful. These do not work or do not have sample code.
Have you got any advice?
Try this project:
http://github.com/rladstaetter/isight-java/
and the corresponding blog post
http://ladstatt.blogspot.co.at/2013/04/using-isight-camera-with-javafx.html
Keep in mind that you'll have to have the correct opencv dll for your architecture (x64)
I stripped down OpenIMAJ Core Video Capture Library to get images from webcam. It works well on my macbook, linux deskdop and windows 7 env.
You don't need to install anything, two jars are all you need. You can find the example from my site:
http://www.sleepingdumpling.com/blog/download/jvideoinput/
Here is a link to a Demonstration JavaFX Camera capture application using LTI-CIVIL
You are correct that the LTI-CIVIL library is 32 bit only, so perhaps not useful In your case if 64 bit is an imperative.

Java IDE for working over Remote Desktop

I have recently found out that anything Swing(NetBeans, IDEA) is excruciatingly slow to paint the UI over Remote Desktop(RDP).
Can you guys give me any suggestion for something that will work properly over RDP?
Actually, contrary to everything I've seen - mostly the "Dsun.java2d.noddraw=true", which is mentioned in a number of places, it is actually setting it to false that fixed the drawing issues(for me at least). Go figure.
RDP is optimized for native Windows apps and, regrettably, newer versions of RCP (like Vista/Win7's default RDP) is even more hostile to non-native apps than older (XP/Server 2003) versions. Here's a good link:
http://devnet.jetbrains.net/thread/280673
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4204845
One workaround is to get a screaming fast CPU/graphics board, tons and tons of memory and a super high-speed network connection :)
Another is to:
Select "32-bit true color" in your Terminal Services settings
Select "Modem"
Reduce screen resolution (heck, use 1024x768 if possible)
Here are some additional tips:
http://www.codinghorror.com/blog/2006/04/remote-desktop-tips-and-tricks.html
Try setting "Dsun.java2d.noddraw=true"
http://ubuntuforums.org/archive/index.php/t-1129187.html
http://www.mindfiresolutions.com/Solving-DIRECT-DRAW-ddraw-problems-in-Java-Swing-730.php
I am launching a java swing application from Linux, and display it as a Windows frame thanks to MobaXterm.
If you haven't done it already, please have a look at the following documentation :
https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html
Using -Dsun.java2d.noddraw=true did not fixed my issue, but setting xrender to true did.
So here's the code I used on Linux :
export _JAVA_OPTIONS='-Dsun.java2d.xrender=true'
java -jar my_java_application.jar
Maybe it's not only Swing that paints slow over Remote Desktop. However, Eclipse is based on SWT, based on native widgets, so it is not Swing.
You should give JavaWIDE a try. It is an IDE designed for access to a JDK without it installed on a system, with a built-in storage system so you just need access to the internet. It's not exactly a program for accessing everything on the computer but it will do a good job with your programming. It may take a while however, as the compiling is done on a separate server.

Using JMF on Mac OSX

I'm trying to use JMF (Java Media Framework) to play a video. I've tried sample code from four different websites now. I'm using a Mac running Lion.
Everytime I load an mpg file I have, I get:
Unable to handle format: MPEG, 352x240, FrameRate=29.9, Length=126720
What does this mean? Are there problems with JMF? I'm using the cross platform version.
The cross-platform version will probably not support too many formats. There are performance packs which might help. But there isn't a performance pack for MAC and probably never will be.
You can try Jffmpeg, which provides MPEG codecs (among many other formats) for JMF. However, bear in mind that the last release is 2006.
Another alternative if FMJ.

Is there an easily hackable open-source Tivo media server?

Series 2 and later Tivos have a "Music on [computername]" option under "Music, Photos & Showcases" which lets you play music that's hosted on some other machine. This option seems to appear for each computer on the local network with a compatible server running. For example, a Windows PC running Tivo Desktop can show up if configured correctly. My NAS also has support for this. Neither of these servers are as configurable as I would like, however. (And the only Windows box in our house is a laptop, so it can't really be relied on as a server since it's asleep most of the time.)
Is there an easily hackable open-source Tivo media server (or library for building one)? I need something that can run on Linux, and I'd prefer something written in Python or Java.
I mostly care about being able to serve music (mp3 files), but supporting the "Photos on [computername]" thing would be a nice bonus.
I've never done this, but there's a package called pyTiVo which claims to serve videos, music, and photos. (Here's a blog post of how someone set it up in an old version of Ubuntu.)
There is JavaHMO which is GPL. I haven't used it in ages but it should be worth investigating.
Updated:
Just after writing that I see that JavaHMO is now Galleon.
Take a look at HME/VLC Video Streamer. It's cross-platform Python and GPL 2.1 licensed. Pretty easy to set up.

Access USB with Java, in order to find thumbdrive manufacturer's serial#/unique-ID

Looking for a way to read the unique ID / serial# of a USB thumb drive;
please note that
- I am looking for the value of the manufacturer, not the one Windows allocates for it.
- I need to support multiple OS (Windows, Unix, Mac), thus needs to be a Java solution
The idea is to be able to distinguish between different USB thumb drives.
RXTX is the way to go. In the world of model trains, JMRI (Java Model Railroad Interface) has become very popular. JMRI runs on all platforms (Windows, Linux and Mac) and communicates with a variety of USB based devices (command stations). RXTX is in fact used by JMRI.
You might give a look at the following projects:
javax-usb and jusb. They seem to support Linux and Windows.
Anyway, since USB access in Java requires the use of native libraries, you might not achieve the required portability.
I've never tried using it (it's been on my todo list for a good few months now), but there is the "marge" project on java.net:
http://marge.java.net/
This should let you connect to bluetooth devices (although I don't think it is 100% feature complete, there is demo code on there), and then the ClientDevice class has a "getBluetoothAddress" method which I believe should be unique to that device
http://marge.java.net/javadoc/v06/marge-core/net/java/dev/marge/entity/ClientDevice.html
As I say though, I've never tried it...
I have never investigated this thoroughly, but from memory the RXTX library implementation of the javax.comm packages are supposedly very good and now have USB support.

Categories