
Chapter 28.85. Waving a Magic Wand

Contact Address:
  Dr. Andrew Davison
  Dept. of Computer Engineering
  Prince of Songkla University
  Hat Yai, Songkhla 90112, Thailand
  E-mail: ad@fivedots.coe.psu.ac.th
  http://fivedots.coe.psu.ac.th/~ad/jg


If you use this code, please mention my name, and include a link
to the book's Web site.

Thanks,
  Andrew

---------------------------------
Contents:

* 13 Java files: 
     MagicWand.java, MWPanel.java, 
     ImageAnalyzer.java, JMFCapture.java, 
     BlobsLine.java, BlobsManager.java, Blob.java,
     BlastsManager.java, BlastSprite.java, Sprite.java,
     ImagesLoader.java, ImagesPlayer.java, ImagesPlayerWatcher.java


* An images/ subdirectory 
     It contain an imsInfo.txt image loader file 
     (used by ImagesLoader) and 5 images.

  There are three background images in the directory: 
     desert.jpg (the current one), arctic.jpg, and space.jpg

  If you want to try one of the others, then edit imsInfo.txt and the
  call to imsLoader.getImage() in the MWPanel() constructor. 

---------------------------------
Compilation 

$ javac *.java
    // You must have JMF installed, and use J2SE 5.
    /* Please see the note below about the 
       "unchecked or unsafe operations" message. */

---------------------------------
Execution:

$ java MagicWand
     // You must have JMF installed, and use J2SE 5.
     // Please see the note below about JMF and webcams. 

---------------------------------
Notes on JMF and Webcams

JMF is available from http://java.sun.com/products/java-media/jmf/
I installed the JMF Performance Pack for Windows v.2.1.1e 

The webcam must be registered with "JMF Registry"
before MagicWand can see it. You'll find the registry 
application below the JMF menu item in Windows. 

You can test the webcam separately from MagicWand with "JMStudio", 
which is accessible below the JMF menu item in Windows.

For best results, you should have the webcam positioned as 
shown in Figure 2 in the chapter, with a white background 
behind the wand. Even minor changes will affect the quality 
of the image processing. 

A lot of information about JMF and Webcams can be found in 
Chapter 28.7 at http://fivedots.coe.psu.ac.th/~ad/jg.

---------------------------------
Note on the "unchecked or unsafe operations" Message

The message is due to my use of non-generic collections
in the image loading class, ImagesLoader. There are 14 
places where warnings are issued.

ImagesLoader was originally written for J2SE 1.4.2, where
non-generic collections, such as ArrayList, aren't a
problem. I decided not to update the class, since the
warnings can be safely ignored. 

---------
Last updated: 24th May 2006