JIGL
v1.6

jigl.image.ops
Class Convolve

java.lang.Object
  |
  +--jigl.image.SimpleOperator
        |
        +--jigl.image.ops.Convolve
All Implemented Interfaces:
Operator

public class Convolve
extends SimpleOperator

Performs Convolution on an image using a supplied normalized kernel. Supports GrayImage, RealGrayImage, ColorImage, RealColorImage.

If the kernel is not normalized, the colvolution result may look strange.


Nested Class Summary
(package private)  class Convolve.Threader
          Inner class for class Convolve.
 
Field Summary
private  ImageKernel kernel
          The image kernel for convolution
 
Constructor Summary
Convolve(ImageKernel k)
          Initilizes Convolve.
 
Method Summary
protected  Image apply(ColorImage image)
          Applies the kernel to image.
protected  Image apply(ColorImage image, ROI roi)
          Applies the kernel to image with a Region of Interest.
protected  Image apply(GrayImage image)
          Applies the kernel to image.
protected  Image apply(GrayImage image, ROI roi)
          Applies the kernel to image in a Region of Interest.
protected  Image apply(RealColorImage image)
          Applies the kernel to a RealColorImage.
protected  Image apply(RealColorImage image, ROI roi)
          Applies the kernel to a RealColorImage with a Region of Interest.
protected  Image apply(RealGrayImage image)
          Applies the kernel to image.
protected  Image apply(RealGrayImage image, ROI roi)
          Applies the kernel to image in a Region of Interest.
 ColorImage applyThreaded(ColorImage gr)
          Applys a threaded version for faster execution on machine supporting multi-threads.
static void main(String[] argv)
          Allows for command line options.
 
Methods inherited from class jigl.image.SimpleOperator
apply, apply, apply, apply, apply, apply
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kernel

private ImageKernel kernel
The image kernel for convolution

Constructor Detail

Convolve

public Convolve(ImageKernel k)
Initilizes Convolve. Assumes that the width and height of k are odd, and the kernel is normalized.

Method Detail

apply

protected Image apply(GrayImage image)
               throws ImageNotSupportedException
Applies the kernel to image. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a GrayImage of the same size as the original image. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - GrayImage to convolve.
Returns:
GrayImage.
ImageNotSupportedException

apply

protected Image apply(GrayImage image,
                      ROI roi)
               throws ImageNotSupportedException
Applies the kernel to image in a Region of Interest. The enter of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a GrayImage of the same size with the area under the roi are convolved. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - GrayImage to convolve.
roi - Region of Interest of image.
Returns:
GrayImage.
ImageNotSupportedException

apply

protected Image apply(RealGrayImage image)
Applies the kernel to image. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a RealGrayImage of the same size as the original image. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - RealGrayImage to convolve.
Returns:
RealGrayImage.

apply

protected Image apply(RealGrayImage image,
                      ROI roi)
Applies the kernel to image in a Region of Interest. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a RealGrayImage of the same size with the area under the roi are convolved. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - RealGrayImage to convolve.
roi - Region of Interest of image.
Returns:
RealGrayImage.

apply

protected Image apply(ColorImage image)
               throws ImageNotSupportedException
Applies the kernel to image. Kernel is applied to each plane of the image separately. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a ColorImage of the same size.

Overrides:
apply in class SimpleOperator
Parameters:
image - ColorImage to convolve.
Returns:
ColorImage.
ImageNotSupportedException

apply

protected Image apply(ColorImage image,
                      ROI roi)
               throws ImageNotSupportedException
Applies the kernel to image with a Region of Interest. Kernel is applied to each plane of the image separately. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a ColorImage of the same size. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - ColorImage to convolve.
roi - Region of Interest of image.
Returns:
ColorImage.
ImageNotSupportedException

apply

protected Image apply(RealColorImage image)
Applies the kernel to a RealColorImage. Kernel is applied to each plane of the image separately. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). image is not modified. Returned image is a RealColorImage of the same size.

Overrides:
apply in class SimpleOperator
Parameters:
image - RealColorImage to convolve.
Returns:
RealColorImage.

apply

protected Image apply(RealColorImage image,
                      ROI roi)
Applies the kernel to a RealColorImage with a Region of Interest. Kernel is applied to each plane of the image separately. The center of the kernel is specified at the position of (kernel.X()/2, kernel.Y()/2). Returned image is a RealColorImage of the same size. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - RealColorImage to convolve.
roi - Region of Interest of image.
Returns:
RealColorImage.

applyThreaded

public ColorImage applyThreaded(ColorImage gr)
Applys a threaded version for faster execution on machine supporting multi-threads.


main

public static void main(String[] argv)
Allows for command line options. The first commandline parameter is the image file, the second commandline parameter is the kernel file and the third is the file for output.


JIGL
v1.6

Submit a bug or feature
Revised in May 2002 by Weiming Liu