|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.grelf.grip.Accumulator
public class Accumulator
For adding or averaging images, a data store with 32 bits per pixel per channel to prevent overflow. This needs a lot of memory of course: width x height x 12 bytes for 3-channel images. The data can be saved on disc and reloaded. This uses a GRIP-specific format comprising a text header followed by binary pixel data. The header is Java 2-bytes-per-character text strings, each preceded by an int containing the number of characters in the string. Each string except the first contains an equals sign (=) after which are the digits of a value. There are no line end characters or other formatting. The strings are (UTF-8 encoding): GRIP v... width(px)=... height(px)=... channels=... bitsPerChannel=32 min=... max=... where the first string contains the GRIP version number and min and max show the overall range of values occurring (across all channels). The binary pixel data are stored as int values, in the usual Java big-endian format, in this order: for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int b = 0; b < nBands; b++) { dos.writeInt (accum [x][y][b]); // dos is a java.io.DataOutputStream } } }
| Constructor Summary | |
|---|---|
Accumulator(java.awt.image.BufferedImage bim)
Use the BufferedImage to set the width, height and number of bands (channels) in the accumulator. |
|
Accumulator(int width,
int height,
int nBands)
|
|
Accumulator(java.lang.String filePath)
Reload an accumulator that has previously been saved on disc by GRIP. |
|
| Method Summary | |
|---|---|
void |
add(java.awt.image.BufferedImage bim)
Add pixel values from bim into the accumulator array. |
void |
add(java.awt.image.BufferedImage bim,
double dx,
double dy)
Add pixel values from bim into the accumulator array, offset by vector (dx, dy). |
void |
add(java.awt.image.BufferedImage bim,
int dx,
int dy)
Add pixel values from bim into the accumulator array, offset by vector (dx, dy). |
void |
applyCurve(RangeInt currentRange,
java.util.List<java.awt.Point> points,
java.awt.image.BufferedImage bim)
Apply a look-up curve to transform accumulator pixels into BufferedImage pixels. |
boolean |
averageShiftAccumulate(java.awt.image.BufferedImage bim,
int imNo,
int middleImNo,
java.util.List<MatchPair> matches,
BlobMeas[][] lookup,
int nBrightest)
For image imNo of a sequence, add the pixel values into the accumulator but first shift the image so that matched point pairs are superimposed. |
boolean |
brightestShiftAccumulate(java.awt.image.BufferedImage bim,
int imNo,
int middleImNo,
java.util.List<PointFloat> centres)
For image imNo of a sequence, add the pixel values into the accumulator but first shift the image so that brightest objects in this image and the middle image of the sequence are superimposed. 9.11.26: changed last parameter from BlobMeas [][] lookup. |
void |
divide(int n)
Divide all pixel values (in all bands) in the accumulator by n. |
void |
drawImage(ImFrame imf)
Convert the accumulator data into a BufferedImage, by drawing them into the image displayed in an ImFrame. |
int |
getBitsPerChannel()
Get the number of bits per channel; currently always returns 32. |
RangeInt[] |
getChannelRanges()
Find the range of values in each channel. |
int |
getHeight()
Get the height, in pixels, of the accumulator. |
int |
getNBands()
Get the number of bands (channels) in the accumulator. |
RangeInt |
getOverallRange()
Get overall range of values across all channels. |
int[] |
getPixel(int x,
int y)
Get array of pixel values for all bands at the given (x, y) position. |
RangeInt |
getRange()
Get the minumum and maximum values occurring, across all channels. |
int |
getWidth()
Get the width, in pixels, of the accumulator. |
static boolean |
isAccumFile(java.lang.String path)
Read the start of a file to find out whether it is a saved Accumulator. |
RangeInt |
load(java.lang.String filePath)
Load from an Accumulator file previously saved on disc by GRIP. |
void |
save(java.lang.String filePath)
Save on disc: slower version, has to work out the range of values occurring in the accumulator. |
void |
save(java.lang.String filePath,
RangeInt range)
Save on disc: faster version if the range of values occurring in the accumulator is already known. |
void |
scale(RangeInt[] currentChannelRanges,
java.awt.image.BufferedImage bim)
Offset and scale all values to fit into the supplied image. |
void |
scale(RangeInt[] currentChannelRanges,
RangeInt[] targetChannelRanges)
Offset and scale all values to fit in the given target ranges. |
void |
set(java.awt.image.BufferedImage bim)
Set pixel values from bim into the accumulator array. |
void |
subtract(java.awt.image.BufferedImage bim)
Subtract pixel values of bim from the accumulator array. |
java.lang.String |
toString()
Get a simple description : wd x ht x channels |
boolean |
warpAccumulate(java.awt.image.BufferedImage bim,
int imNo,
int middleImNo,
java.util.List<MatchPair> matches,
BlobMeas[][] lookup,
int nBrightest)
For image imNo of a sequence, add the pixel values into the accumulator but first distort the image so that matched point pairs are superimposed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Accumulator(int width,
int height,
int nBands)
public Accumulator(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageExceptionpublic Accumulator(java.lang.String filePath)
| Method Detail |
|---|
public int getWidth()
public int getHeight()
public int getNBands()
public int getBitsPerChannel()
public RangeInt getRange()
public java.lang.String toString()
toString in class java.lang.Object
public void add(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageException
public void add(java.awt.image.BufferedImage bim,
int dx,
int dy)
throws IncompatibleImageException
IncompatibleImageException
public void add(java.awt.image.BufferedImage bim,
double dx,
double dy)
throws IncompatibleImageException
IncompatibleImageException
public void applyCurve(RangeInt currentRange,
java.util.List<java.awt.Point> points,
java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageExceptionpublic void divide(int n)
public void drawImage(ImFrame imf)
public RangeInt[] getChannelRanges()
public RangeInt getOverallRange()
public int[] getPixel(int x,
int y)
public static boolean isAccumFile(java.lang.String path)
public RangeInt load(java.lang.String filePath)
public void save(java.lang.String filePath)
public void save(java.lang.String filePath,
RangeInt range)
public void scale(RangeInt[] currentChannelRanges,
RangeInt[] targetChannelRanges)
public void scale(RangeInt[] currentChannelRanges,
java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageException
public void set(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageException
public void subtract(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageException
public boolean brightestShiftAccumulate(java.awt.image.BufferedImage bim,
int imNo,
int middleImNo,
java.util.List<PointFloat> centres)
throws IncompatibleImageException
IncompatibleImageException
public boolean averageShiftAccumulate(java.awt.image.BufferedImage bim,
int imNo,
int middleImNo,
java.util.List<MatchPair> matches,
BlobMeas[][] lookup,
int nBrightest)
throws IncompatibleImageException
IncompatibleImageException
public boolean warpAccumulate(java.awt.image.BufferedImage bim,
int imNo,
int middleImNo,
java.util.List<MatchPair> matches,
BlobMeas[][] lookup,
int nBrightest)
throws IncompatibleImageException
IncompatibleImageException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||