Industrial Training

Image Prcessing



First in a series
This lesson is the first lesson in a new series intended to teach you how to use Java to create special effects with images by directly manipulating the pixels in the images.
Not a lesson on JAI
If you arrived at this lesson while searching for instructions on how to use the Java Advanced Imaging (JAI) API, you are certainly welcome to be here.  However, that is not the purpose of the lessons in this series.  (Maybe I will write a series on that topic later.)  The purpose of this series is to get right down in the mud and to learn how to implement many of the algorithms that are commonly used to create special effects with images by working directly with the pixels.
Manipulate pixels directly and individually
In this lesson, I will provide and explain a program that makes it easy to:

  • Manipulate and modify the pixels that belong to an image
  • Display the modified image along with the original image for easy comparison in a before and after sense

A framework or driver program
This program is designed to be used as a framework or driver that controls the execution of another program that actually processes the pixels.
By using this program as a driver, you can concentrate on writing and executing image-processing algorithms without having to worry about many of the details involving image files, image display, etc.
A simple image-processing program
Also in this lesson, I will provide and explain the first of several image-processing programs designed to teach you how to modify an image by directly modifying the pixels that represent the image.
The image-processing program provided in this lesson will be relatively simple with the intent being to get you started but not necessarily to produce a modified image that is especially interesting.
More interesting imaging processing programs
Future lessons will show you how to write image-processing programs that implement many common special effects as well as a few that aren't so common.  This will include programs to do the following:

  • Highlight a particular area in an image.
  • Blur all or part of an image.
  • Sharpen all or part of an image.
  • Perform edge detection on an image.
  • Apply color filtering to an image.
  • Apply color inversion to an image.
  • Morphing one image into another image.
  • Rotating an image.
  • Squeezing part of an image into a smaller size.
  • Controlling the brightness of an image using linear and non-linear algorithms.
  • Other special effects that I may dream up or discover while doing the background research for the lessons in this series.

Figures 1 through 4 show examples of the first four special effects in the above list.
Viewing tip
You may find it useful to open another copy of this lesson in a separate browser window.  That will make it easier for you to scroll back and forth among the different figures and listings while you are reading about them.
Highlighting an image
The special effect illustrated by Figure 1 begins with a picture of a starfish taken in a well-lighted aquarium and converts it to what looks like a picture taken by a SCUBA diver deep underwater.


In Figure 1, as in all of the graphic output produced by this program, the original image is shown at the top and the modified image is shown at the bottom.
The program that produced the modified image in Figure 1 allows the user to interactively control the degree to which the light is concentrated in the center of the picture.  In other words, the illumination can range from being concentrated in a very small area in the center to being spread throughout the image.
Blurring an image
Figure 2 illustrates a well-known algorithm that implements the common special effect of blurring an image.


The original image is at the top, and the blurred image is at the bottom.
The program used to produce Figure 2 allows the user to interactively control the extent of the blurring, ranging from no blurring at all, to extreme blurring.

Hi I am Pluto.