27-03-2012, 12:20 PM
Java Advanced Imaging API: A Tutorial
5963-18954-1-PB.pdf (Size: 420.73 KB / Downloads: 71)
Introduction
In spite of the existence of several image processing softwares with many image processing
functions, tailored for several different uses, there is often the need for implementation
of specific algorithms which are not available on those softwares – for example, a user
may want to implement his/her own image classification or filtering algorithm or tweak some
already implemented algorithm parameters. Some of those softwares allow the development
of user-defined modules, often using the same API developed for the software itself. The
developer may be able to use those APIs to develop his/hew own routines, but often there is
an additional cost or licensing restrictions.
Image data representation
Image processing algorithms usually require the manipulation of the image data (pixels).
In this section the model used by JAI for image data storage and manipulation will be
presented, with the corresponding Java/JAI classes.
Images in JAI may be multidimensional (i.e. with several values associated to a single
pixel) and may have pixel with either integer or floating point values (altough there are
restrictions on the types of images which can be stored in disk). Pixels may be packed in
different ways or unpacked in the image data array. Different color models can be used. As
one may expect, in order to be able to represent a variety of image data, one must deal with a
variety of classes.
Image data access
Often there is the need to access individual pixel values from an image in order to
perform some operation on that image – classification algorithms, for example, often require
access to all pixels on an image for evaluation and classification.
One simple method that can be used to access pixels from an image is through the
use of iterators. Iterators allow the access to the pixels on an image in a specific order. For
example, an instance of RectIter scans the image column by column, from the top line
to the bottom line, updating automatically the scanned pixels’ coordinates and allowing the
access (reading only) for all pixels in a band or for a pixel in a particular band at the present
scan coordinate. Another iterator, RandomIter allows the direct access to a pixel using
user-specified X and Y coordinates.
Conclusions and further information
Several examples of the Java Advanced Imaging API were shown in this tutorial. The
author expects that the example, while simple and short, were enough to give the readers an
idea of the workings of the JAI API and serve as basis for the development of more complex
classes and applications.
Several listings shown in this tutorial are simplified versions of code found in [5], with
comments removed in order to save space.