Programming in Java Advanced Imaging

Release 1.0, July 1999


Contents




Preface

Disclaimer
About This Book
Related Documentation
Style Conventions

1 Introduction to Java Advanced Imaging

1.1 The Evolution of Imaging in Java
1.2 Why Another Imaging API?
1.3 JAI Features
1.3.1 Cross-platform Imaging
1.3.2 Distributed Imaging
1.3.3 Object-oriented API
1.3.4 Flexible and Extensible
1.3.5 Device Independent
1.3.6 Powerful
1.3.7 High Performance
1.3.8 Interoperable
1.4 A Simple JAI Program

2 Java AWT Imaging

2.1 Introduction
2.1.1 The AWT Push Model
2.1.2 AWT Push Model Interfaces and Classes
2.2 The Immediate Mode Model
2.2.1 Rendering Independence
2.2.2 Rendering-independent Imaging in Java AWT
2.2.3 The Renderable Layer vs. the Rendered Layer
2.2.4 The Render Context
2.3 Renderable and Rendered Classes
2.3.1 The Renderable Layer
2.3.2 The Rendered Layer
2.4 Java Image Data Representation
2.5 Introducing the Java Advanced Imaging API
2.5.1 Similarities with the Java 2D API
2.5.2 JAI Data Classes

3 Programming in Java Advanced Imaging

3.1 Introduction
3.2 An Overview of Graphs
3.3 Processing Graphs
3.3.1 Rendered Graphs
3.3.2 Renderable Graphs
3.3.3 Reusing Graphs
3.4 Remote Execution
3.5 Basic JAI API Classes
3.5.1 The JAI Class
3.5.2 The PlanarImage Class
3.5.3 The CollectionImage Class
3.5.4 The TiledImage Class
3.5.5 The OpImage Class
3.5.6 The RenderableOp Class
3.5.7 The RenderedOp Class
3.6 JAI API Operators
3.6.1 Point Operators
3.6.2 Area Operators
3.6.3 Geometric Operators
3.6.4 Color Quantization Operators
3.6.5 File Operators
3.6.6 Frequency Operators
3.6.7 Statistical Operators
3.6.8 Edge Extraction Operators
3.6.9 Miscellaneous Operators
3.7 Creating Operations
3.7.1 Operation Name
3.7.2 Parameter Blocks
3.7.3 Rendering Hints

4 Image Acquisition and Display

4.1 Introduction
4.1.1 Image Data
4.1.2 Basic Storage Types
4.2 JAI Image Types
4.2.1 Planar Image
4.2.2 Tiled Image
4.2.3 Snapshot Image
4.2.4 Remote Image
4.2.5 Collection Image
4.2.6 Image Sequence
4.2.7 Image Stack
4.2.8 Image MIP Map
4.2.9 Image Pyramid
4.2.10 Multi-resolution Renderable Images
4.3 Streams
4.4 Reading Image Files
4.4.1 Standard File Readers for Most Data Types
4.4.2 Reading TIFF Images
4.4.3 Reading FlashPix Images
4.4.4 Reading JPEG Images
4.4.5 Reading GIF Images
4.4.6 Reading BMP Images
4.4.7 Reading PNG Images
4.4.8 Reading PNM Images
4.4.9 Reading Standard AWT Images
4.4.10 Reading URL Images
4.5 Reformatting an Image
4.6 Converting a Rendered Image to Renderable
4.7 Creating a Constant Image
4.8 Image Display
4.8.1 Positioning the Image in the Panel
4.8.2 The ImageCanvas Class
4.8.3 Image Origin

5 Color Space

5.1 Introduction
5.2 Color Management
5.2.1 Color Models
5.2.2 Color Space
5.2.3 ICC Profile and ICC Color Space
5.3 Transparency
5.4 Color Conversion
5.5 Non-standard Linear Color Conversion (BandCombine)

6 Image Manipulation

6.1 Introduction
6.2 Region of Interest Control
6.2.1 The ROI Class
6.2.2 The ROIShape Class
6.3 Relational Operators
6.3.1 Finding the Maximum Values of Two Images
6.3.2 Finding the Minimum Values of Two Images
6.4 Logical Operators
6.4.1 ANDing Two Images
6.4.2 ANDing an Image with a Constant
6.4.3 ORing Two Images
6.4.4 ORing an Image with a Constant
6.4.5 XORing Two Images
6.4.6 XORing an Image with a Constant
6.4.7 Taking the Bitwise NOT of an Image
6.5 Arithmetic Operators
6.5.1 Adding Two Source Images
6.5.2 Adding a Constant Value to an Image
6.5.3 Adding a Collection of Images
6.5.4 Adding Constants to a Collection of Rendered Images
6.5.5 Subtracting Two Source Images
6.5.6 Subtracting a Constant from an Image
6.5.7 Subtracting an Image from a Constant
6.5.8 Dividing One Image by Another Image
6.5.9 Dividing an Image by a Constant
6.5.10 Dividing an Image into a Constant
6.5.11 Dividing Complex Images
6.5.12 Multiplying Two Images
6.5.13 Multiplying an Image by a Constant
6.5.14 Multiplying Two Complex Images
6.5.15 Finding the Absolute Value of Pixels
6.5.16 Taking the Exponent of an Image
6.6 Dithering an Image
6.6.1 Ordered Dither
6.6.2 Error-diffusion Dither
6.7 Clamping Pixel Values
6.8 Band Copying
6.9 Constructing a Kernel

7 Image Enhancement

7.1 Introduction
7.2 Adding Borders to Images
7.2.1 The Border Operation
7.2.2 Extending the Edge of an Image
7.3 Cropping an Image
7.4 Amplitude Rescaling
7.5 Histogram Equalization
7.5.1 Piecewise Linear Mapping
7.5.2 Histogram Matching
7.6 Lookup Table Modification
7.6.1 Creating the Lookup Table
7.6.2 Performing the Lookup
7.6.3 Other Lookup Table Operations
7.7 Convolution Filtering
7.7.1 Performing the Convolve Operation
7.7.2 Box Filter
7.8 Median Filtering
7.9 Frequency Domain Processing
7.9.1 Fourier Transform
7.9.2 Cosine Transform
7.9.3 Magnitude Enhancement
7.9.4 Magnitude-squared Enhancement
7.9.5 Phase Enhancement
7.9.6 Complex Conjugate
7.9.7 Periodic Shift
7.9.8 Polar to Complex
7.9.9 Images Based on a Functional Description
7.10 Single-image Pixel Point Processing
7.10.1 Pixel Inverting
7.10.2 Logarithmic Enhancement
7.11 Dual Image Pixel Point Processing
7.11.1 Overlay Images
7.11.2 Image Compositing
7.12 Thresholding

8 Geometric Image Manipulation

8.1 Introduction
8.2 Interpolation
8.2.1 Nearest-neighbor Interpolation
8.2.2 Bilinear Interpolation
8.2.3 Bicubic Interpolation
8.2.4 Bicubic2 Interpolation
8.2.5 Table Interpolation
8.3 Geometric Transformation
8.3.1 Translation Transformation
8.3.2 Scaling Transformation
8.3.3 Rotation Transformation
8.3.4 Affine Transformation
8.4 Perspective Transformation
8.4.1 Performing the Transform
8.4.2 Mapping a Quadrilateral
8.4.3 Mapping Triangles
8.4.4 Inverse Perspective Transform
8.5 Transposing
8.6 Shearing
8.7 Warping
8.7.1 Performing a Warp Operation
8.7.2 Polynomial Warp
8.7.3 General Polynomial Warp
8.7.4 Grid Warp
8.7.5 Quadratic Warp
8.7.6 Cubic Warp
8.7.7 Perspective Warp
8.7.8 Affine Warp

9 Image Analysis

9.1 Introduction
9.2 Finding the Mean Value of an Image Region
9.3 Finding the Extrema of an Image
9.4 Histogram Generation
9.4.1 Specifying the Histogram
9.4.2 Performing the Histogram Operation
9.4.3 Reading the Histogram Data
9.4.4 Histogram Operation Example
9.5 Edge Detection
9.6 Statistical Operations

10 Graphics Rendering

10.1 Introduction
10.1.1 Simple 2D Graphics
10.1.2 Renderable Graphics
10.2 A Review of Graphics Rendering
10.2.1 Overview of the Rendering Process
10.2.2 Stroke Attributes
10.2.3 Rendering Graphics Primitives
10.3 Graphics2D Example
10.4 Adding Graphics and Text to an Image

11 Image Properties

11.1 Introduction
11.1.1 The PropertySource Interface
11.1.2 The PropertyGenerator Interface
11.2 Synthetic Properties
11.3 Regions of Interest
11.4 Complex Data

12 Client-Server Imaging

12.1 Introduction
12.2 Server Name and Port Number
12.3 Setting the Timeout Period and Number of Retries
12.4 Remote Imaging Test Example
12.4.1 Simple Remote Imaging Example
12.4.2 RemoteImaging Example Across Two Nodes
12.5 Running Remote Imaging
12.5.1 Step 1: Create a Security Policy File
12.5.2 Step 2: Start the RMI Registry
12.5.3 Step 3: Start the Remote Image Server
12.5.4 Step 4: Run the Local Application

13 Writing Image Files

13.1 Introduction
13.2 Writing to a File
13.3 Writing to an Output Stream
13.4 Writing BMP Image Files
13.4.1 BMP Version
13.4.2 BMP Data Layout
13.4.3 Example Code
13.5 Writing JPEG Image Files
13.5.1 JFIF Header
13.5.2 JPEG DCT Compression Parameters
13.5.3 Quantization Table
13.5.4 Horizontal and Vertical Subsampling
13.5.5 Compression Quality
13.5.6 Restart Interval
13.5.7 Writing an Abbreviated JPEG Stream
13.5.8 Example Code
13.6 Writing PNG Image Files
13.6.1 PNG Image Layout
13.6.2 PNG Filtering
13.6.3 Bit Depth
13.6.4 Interlaced Data Order
13.6.5 PLTE Chunk for Palette Images
13.6.6 Ancillary Chunk Specifications
13.7 Writing PNM Image Files
13.8 Writing TIFF Image Files
13.8.1 TIFF Compression
13.8.2 TIFF Tiled Images

14 Extending the API

14.1 Introduction
14.2 Package Naming Convention
14.3 Writing New Operators
14.3.1 Extending the OpImage Class
14.3.2 Extending the OperationDescriptor Interface
14.4 Iterators
14.4.1 RectIter
14.4.2 RookIter
14.4.3 RandomIter
14.4.4 Example RectIter
14.5 Writing New Image Decoders and Encoders
14.5.1 Image Codecs

A Program Examples

A.1 Lookup Operation Example
A.2 Adding an OperationDescriptor Example

B Java Advanced Imaging API Summary

B.1 Java AWT Imaging
B.2 Java 2D Imaging
B.2.1 Java 2D Imaging Interfaces
B.2.2 Java 2D Imaging Classes
B.3 Java Advanced Imaging
B.3.1 JAI Interfaces
B.3.2 JAI Classes
B.3.5 JAI Iterator Interfaces
B.3.6 JAI Iterator Classes
B.3.7 JAI Operator Classes
B.3.8 JAI Widget Interfaces
B.3.9 JAI Widget Classes

Glossary



Copyright © 1999, Sun Microsystems, Inc. All rights reserved.

Casa de Bender