net.grelf.grip
Class Kernel

java.lang.Object
  extended by net.grelf.grip.Kernel

public class Kernel
extends java.lang.Object

A square array of values for convolving with an image. Can be set from an image or as a Gaussian hump or loaded from a text (CSV) file.


Constructor Summary
Kernel(int halfWidth, float[][] data)
           
Kernel(java.awt.Point pt, java.awt.image.BufferedImage bim)
          Deprecated. 
Kernel(java.awt.Point pt, java.awt.image.BufferedImage bim, int halfWidth)
          Create a kernel by sampling a square area symmetrically around the given point in the given image.
Kernel(java.awt.Point pt, Image image, int halfWidth)
          Create a kernel by sampling a square area symmetrically around the given point in the given accumulator.
 
Method Summary
 boolean askHalfWidth()
           
static Kernel createGaussianKernel(java.awt.image.BufferedImage im, int halfWidth)
           
 void dump()
           
 float[][] getData()
          First index = band, second index = samples for given colour band.
 int getHalfWidth()
          Kernel will be (2.halfWidth + 1) x (2.halfWidth + 1).
static Kernel load(java.lang.String path, int nBands)
          Load kernel from a comma-separated text file.
 void view(Im im)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Kernel

public Kernel(int halfWidth,
              float[][] data)

Kernel

@Deprecated
public Kernel(java.awt.Point pt,
                         java.awt.image.BufferedImage bim)
Deprecated. 


Kernel

public Kernel(java.awt.Point pt,
              java.awt.image.BufferedImage bim,
              int halfWidth)
Create a kernel by sampling a square area symmetrically around the given point in the given image. The width and height of the square kernel will both be 2 * halfWidth + 1. However, if the halfWidth value is negative, the halfWidth will be redetermined from the image. That is done by scanning spirally around the given point first to find a peak sum of levels in all channels and then spirally outwards until the sum of levels in all channels is always below 10% of the peak value found, or the image edge is reached. This latter method is appropriate for picking up a star image as the kernel, for deconvolving astrophotographs. That is because ideally the star image should be a point.


Kernel

public Kernel(java.awt.Point pt,
              Image image,
              int halfWidth)
Create a kernel by sampling a square area symmetrically around the given point in the given accumulator. The width and height of the square kernel will both be 2 * halfWidth + 1. However, if the halfWidth value is negative, the halfWidth will be redetermined from the image. That is done by scanning spirally around the given point first to find a peak sum of levels in all channels and then spirally outwards until the sum of levels in all channels is always below 10% of the peak value found, or the image edge is reached. This latter method is appropriate for picking up a star image as the kernel, for deconvolving astrophotographs. That is because ideally the star image should be a point.

Method Detail

getHalfWidth

public int getHalfWidth()
Kernel will be (2.halfWidth + 1) x (2.halfWidth + 1).


getData

public float[][] getData()
First index = band, second index = samples for given colour band.


load

public static Kernel load(java.lang.String path,
                          int nBands)
Load kernel from a comma-separated text file. Single band. Expects same number of rows as columns.


askHalfWidth

public boolean askHalfWidth()

createGaussianKernel

public static Kernel createGaussianKernel(java.awt.image.BufferedImage im,
                                          int halfWidth)

dump

public void dump()

view

public void view(Im im)