public final class Blob_ extends java.lang.Object implements Blob, java.io.Serializable
Representing the shape of a contiguous set of pixels which have been detected in an image. The shape is described by a list of points defining the boundary together with a list of horizontal lines (of type Blob.BlobRow) defining the area enclosed by the boundary. This double description is to facilitate drawing and measuring the object.
This class also contains a static method for detecting a list of Blobs from a mask, such as would have been set by thresholding - see class ImThreshRGBDialogue.
Modifier and Type | Class and Description |
---|---|
static class |
Blob_.BlobRow |
Constructor and Description |
---|
Blob_(int x,
int y)
Construct a 1-pixel blob at (x, y) - for a detected pixel with no
neighbours.
|
Blob_(java.util.List<java.awt.Point> aBoundary,
byte[][] mask)
Construct a Blob from a boundary (list of points) and a mask.
|
Modifier and Type | Method and Description |
---|---|
int |
area()
Measure the area of the blob, as the total number of pixels in its rows.
|
int[] |
boundaryMedianLevel(Image image)
Get the median level in each channel around the boundary in the given image.
|
int[] |
brightness(Image image)
Measure the integrated detected brightness (NOT the average) in each
channel
|
PointFloat |
densityCentre(Image image)
Calculate the centre of the blob with weighting from pixel densities
(brightnesses).
|
BlobFrame |
display(ImFrame srcFrame,
BlobMeas meas)
Display this blob magnified in a new BlobFrame.
|
void |
drawBoundary(byte[][] mask,
byte value)
Draw the boundary of the blob in the mask array with the given value.
|
void |
drawBoundary(Image image,
int[] levels)
Draw the boundary of the blob in the given image with the given levels.
|
void |
drawRegion(byte[][] mask,
byte value)
Draw the rows of the blob in the mask array with the given value.
|
void |
drawRegion(Image image,
int[] levels)
Draw the rows of the blob in the given image with the given levels.
|
void |
erase(byte[][] mask)
Erase this blob from a given mask.
|
void |
eraseToBackground(BlobMeas meas,
ImFrame parentFrame)
For removing stars during comet stacking.
|
Blob |
getBackgroundDisc()
For accurate brightness measurement in BlobMenu.
|
java.util.List<java.awt.Point> |
getBoundary() |
Bounds |
getBounds()
Get the bounds of this Blob.
|
Blob |
getBrightnessDisc()
For accurate brightness measurement in BlobMenu.
|
protected Blob |
getDisc(int radius,
int imWd,
int imHt,
byte value)
Get a blob describing a solid disc of given radius in the centre of a
rectangle of given width and height.
|
float |
getMeasuringRingSizeFactor()
Get the factor by which the measuring circles in display () are expanded.
|
java.util.List<Blob_.BlobRow> |
getRegion() |
java.util.List<Blob_.BlobRow> |
getRows()
Representing the filled region, including the boundary.
|
java.util.List<PointFloat> |
getVerticalCentreLineFromBoundary()
Get a list of the centre points of all horizontal rows that comprise
the blob with a simple shape.
|
java.util.List<PointFloat> |
getVerticalCentreLineFromRegion()
Get a list of the centre points of all horizontal rows that comprise
the blob.
|
boolean |
hasRows()
Whether region comprises at least one row.
|
boolean |
isSaturatedInRegion(Image srcImage)
Rescan the region (rows) of this blob to determine whether it is saturated
(ie, reaching maximum level in any band).
|
boolean |
isSaturatedInRegion(ImFrame srcFrame)
Rescan the region (rows) of this blob to determine whether it is saturated
(ie, reaching maximum level in any band).
|
LineSegment |
longestLine()
Find the two points on the boundary which are furthest apart from each
other, returning the result as a LineSegment.
|
PointFloat |
maskCentre()
Calculate the centre of the blob simply as average of detected x and y,
with no weighting from pixel densities.
|
BlobMeas |
measure(Image image)
Measure brightness, density-weighted centre and area (pixel count) all
on one pass.
|
void |
measureAccurately(BlobMeas meas,
Image image)
Measure meanBackground, accurateBrightnesses and snRatios fields of the
given BlobMeas using backgroundDisc and brightnessDisc in the given frame
(which is assumed to be the parent frame of the magnified blob frame).
The signal-to-noise (S/N) ratio for each channel is measured as (mean (starBrightness) - mean (backgroundBrightness)) / stdDev (backgroundBrightness) where mean (starBrightness) is the accurately measured brightness in the inner disc divided by the number of pixels in that disc. |
void |
measureAccurately(BlobMeas meas,
ImFrame parentFrame)
Measure meanBackground, accurateBrightnesses and snRatios fields of the
given BlobMeas using backgroundDisc and brightnessDisc in the given frame
(which is assumed to be the parent frame of the magnified blob frame).
The signal-to-noise (S/N) ratio for each channel is measured as (mean (starBrightness) - mean (backgroundBrightness)) / stdDev (backgroundBrightness) where mean (starBrightness) is the accurately measured brightness in the inner disc divided by the number of pixels in that disc. |
protected void |
nullRows()
Available for saving memory if the boundary has to be kept but we no
longer need the region.
|
double |
perimeter()
Measure the perimeter of the blob as the length of its boundary vectors.
|
void |
recolourIfSaturated(Image32 im32)
First tests isSaturatedInRegion() - if true, looks at the boundary to find
average ratios of bands, then adjusts the saturated pixels upwards to have
the same ratios.
|
void |
remeasureAccurately(BlobMeas meas,
Image image) |
void |
remeasureAccurately(BlobMeas meas,
ImFrame parentFrame) |
void |
setMeasuringRingSizeFactor(float factor)
Set the factor by which the measuring circles in display () are expanded.
|
java.lang.String |
toString()
Get a simple description of the Blob
|
java.lang.StringBuffer |
toXML(java.lang.String indent)
The indent string would typically contain some tab characters (\t).
|
void |
translate(int dx,
int dy)
Move the blob by the given pixel displacement.
|
public Blob_(java.util.List<java.awt.Point> aBoundary, byte[][] mask)
public Blob_(int x, int y)
public java.util.List<java.awt.Point> getBoundary()
getBoundary
in interface Blob
public java.util.List<Blob_.BlobRow> getRows()
public java.util.List<Blob_.BlobRow> getRegion()
protected void nullRows()
public boolean hasRows()
Blob
public LineSegment longestLine()
longestLine
in interface Blob
public Blob getBrightnessDisc()
getBrightnessDisc
in interface Blob
public Blob getBackgroundDisc()
getBackgroundDisc
in interface Blob
public boolean isSaturatedInRegion(ImFrame srcFrame)
isSaturatedInRegion
in interface Blob
public boolean isSaturatedInRegion(Image srcImage)
isSaturatedInRegion
in interface Blob
public void recolourIfSaturated(Image32 im32)
recolourIfSaturated
in interface Blob
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.StringBuffer toXML(java.lang.String indent)
public java.util.List<PointFloat> getVerticalCentreLineFromBoundary()
getVerticalCentreLineFromBoundary
in interface Blob
public java.util.List<PointFloat> getVerticalCentreLineFromRegion()
getVerticalCentreLineFromRegion
in interface Blob
public void erase(byte[][] mask)
public Bounds getBounds()
public void drawBoundary(Image image, int[] levels)
drawBoundary
in interface Blob
public void drawBoundary(byte[][] mask, byte value)
drawBoundary
in interface Blob
public void drawRegion(Image image, int[] levels)
drawRegion
in interface Blob
public void drawRegion(byte[][] mask, byte value)
drawRegion
in interface Blob
public int[] boundaryMedianLevel(Image image)
boundaryMedianLevel
in interface Blob
public int[] brightness(Image image)
brightness
in interface Blob
public int area()
public double perimeter()
public PointFloat maskCentre()
maskCentre
in interface Blob
public PointFloat densityCentre(Image image)
densityCentre
in interface Blob
public BlobMeas measure(Image image)
public void remeasureAccurately(BlobMeas meas, ImFrame parentFrame)
remeasureAccurately
in interface Blob
public void eraseToBackground(BlobMeas meas, ImFrame parentFrame)
public void measureAccurately(BlobMeas meas, ImFrame parentFrame)
measureAccurately
in interface Blob
public void measureAccurately(BlobMeas meas, Image image)
Blob
measureAccurately
in interface Blob
public float getMeasuringRingSizeFactor()
getMeasuringRingSizeFactor
in interface Blob
public void setMeasuringRingSizeFactor(float factor)
setMeasuringRingSizeFactor
in interface Blob
public BlobFrame display(ImFrame srcFrame, BlobMeas meas)
protected Blob getDisc(int radius, int imWd, int imHt, byte value)