I have just got into working with RSS feeds to bring data of current weather conditions into my Java projects. RSS is a format for accessing regularly changing info e.g. news headlines, stocks and weather. I use Rome which is a plugin for Java that reads RSS which I use in combination with the yahooWeatherService plugin which makes it easy to call the relevant weather data from yahoo. I am interested in getting the current weather conditions for sites around the world at regular intervals and visualising and comparing the data. The Yahoo weather service gives good data (from the weather channel) which describes the current weather conditions and future forecasts. To see some results click here.
There are many different ways to draw in Java, but for me getting Java to save in formats that I can use in other applications is really important. When I am making a drawing I am not sure whether I will need to print it, show it on screen or CAM it to a laser cutter etc. I have found that the best formats for me are .PDF and .SVG. SVG is the most attractive as it is using the XML format which is a big part of my work anyway and just seems more open and editable. SVG also has a huge range of other formats it can be transferred even to mobiles which is of interest to me. SVG can also be used to make animations which again can be helpful. to find out more click here.
Java is not the best language for working with external media, developers are still amazed they can play mp3's and the sun's java media framework (JMF) is embarrasing, mainly because it has not been touched for quite a while. This means that accessing DV cameras or webCams is tiresome for a long time quicktime for java was the best bet, but it seems that Apple are not going to support it any more. Quicktime for java does still work though and on mac and pc and with some effort it can be pretty stable and perform well. But it is scary that something you make may not work when a new version of quicktime comes out... I think that quicktime will be usable in Java in the future, but it will be a rebuilt library made away from Apple and possibly only available on a mac via calls to cocoa.
There is hope out there though and I have been working using .dsj which is a wrapper (on windows only) for using directShow in Java. I have been using it in my projects for a while now and I can get access to a DVCam through Firewire and it is fast and doesn't crash! Being windows only is a bit of a problem, but I guess I am starting to think that Java's cross platform focus is it's downfall when it comes to external media.
Below is some code for grabbing still frames from a DVCam using .dsj and returning a bufferedImage. It is a good starting point for getting image data for motion detection etc. What it does is it opens a JFrame with the video in it, this does not need to be visible to get the images though. On the .dsj site there is also some tutorial code and a player that you can use to test whether your devices will work.
package imageComponents;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.swing.JFrame;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageDecoder;
import de.humatic.dsj.DSFiltergraph;
import de.humatic.dsj.DSJException;
public class DVStream extends JFrame implements java.beans.PropertyChangeListener{
private DSFiltergraph stream;
private String type;
public DVStream(){
openVideoStream();
}
public void openVideoStream(){
try {
stream = DSFiltergraph.createDSFiltergraph("dv",0, (PropertyChangeListener) this);
} catch (DSJException e) {
// TODO Auto-generated catch block
System.out.println("video Stream broken on start up");
}
this.getContentPane().add(java.awt.BorderLayout.CENTER, stream.asComponent());
this.pack();
this.setVisible(true);
}
public BufferedImage getStillImage(){
BufferedImage image = stream.getImage();
return image;
}
}