|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.ai.scorer.AbstractScorer
org.hd.d.pg2k.ai.scorer.AbstractImgScorer
org.hd.d.pg2k.ai.scorer.parameterised.SimpleExposure
public final class SimpleExposure
Simple score/measure of image "exposure" over random sample points; never null. This ignores outlier values of luminance (Y/brightness), and the wider the spread of the remainder normalised to the theoretical range the better and the more confident our prediction. This does not generate negative (bad) results, just good results for those images that seem to have good exposure by this simple metric.
The set of sample points is a grid spaced in a regular (though not a simple grid) pattern across the image. The layout of the sample points depends on the image size and aspect ratio, and is generated from a pseudo-randon generator, to help avoid poor sampling of images with regular patterns in them,
For example, if having discarded the few top and bottom Y values the remainder cover 90% of the available Y range, this returns a score of 90% of MAX.
The confidence depends on the number of selected sample points that are available; if all those chosen are available and fully opaque (no alpha) then the confidence is 1. If no chosen sample points are available and fully opaque then the confidence is 0. Partially-opaque points may be ignored or contribute pro-rata by opacity/alpha.
A single-pixel transparent image should result in a result of (0, 0) ie no range of luminance (Y), and no fully-opaque sample points.
Very small images will have all their pixels sampled, and so can in principle still achieve a MAX confidence.
This scoring method should run in constant time regardless of image size since it samples at most a fixed ceiling number of image points.
This may be most useful for continuous-tone true-colour/greyscale (eg JPEG) images.
| Field Summary | |
|---|---|
private ScorerParamInteger |
brightnessParam
Percentage brightness range that should be spanned for MAX score for this instance; never null. |
private static ScorerParamInteger |
brightnessParamBounds
Min, default and max percentage of Y range that should be spanned for MAX score; never null. |
private static byte |
MAX_BRIGHTNESS
Max brightness returned by samplePoint (minimum is 0); strictly positive. |
private ScorerParamInteger |
outlierParam
Outlier parameter value for this instance; never null. |
private static ScorerParamInteger |
outlierParamBounds
Min, default and max shift for the outlier fraction to remove; never null. |
private ScorerParamInteger |
sampleSizeParam
Target sample size for this instance; never null. |
private static ScorerParamInteger |
sampleSizeParamBounds
Min, default and max shift (power-of-two) for the target sample size; never null. |
private static boolean |
USE_B_NOT_Y
If true then use the B of the HSB model (max of R, G and B), else use the weighted Y value from YUV. |
| Fields inherited from class org.hd.d.pg2k.ai.scorer.AbstractScorer |
|---|
nameAndParameters, parameterNameRegex, parameterSepRegex, scorerNameRegex, SEPARATOR |
| Constructor Summary | |
|---|---|
SimpleExposure()
Create simple non-parameterised instance. |
|
SimpleExposure(java.lang.String nameAndParameters)
Create parameterised version. |
|
SimpleExposure(java.lang.String baseName,
java.util.List<ScorerParam> parameters)
Create parameterised version. |
|
| Method Summary | |
|---|---|
ScoreAndConf |
computeScoreAndConfidence(java.awt.image.RenderedImage stillImage)
Score the image for "exposure"; never null nor negative in any component. |
ScorerIF |
createVariant(java.lang.String nameAndParameters)
Simple non-static factory for the parameterised case. |
ScorerIF |
createVariant(java.lang.String baseName,
java.util.List<ScorerParam> parameters)
Create variant of same base Scorer with base name and parameters; never null. |
java.util.List<ScorerParam> |
getParameterDefsAndValues()
Get parameter definitions and values (immutable) for this Scorer; never null. |
private java.lang.Byte |
samplePoint(java.awt.image.BufferedImage stillImage,
int x,
int y)
Take sample at given point in image; null means point cannot be sampled, else [0,127]. |
| Methods inherited from class org.hd.d.pg2k.ai.scorer.AbstractImgScorer |
|---|
computeScoreAndConfidence |
| Methods inherited from class org.hd.d.pg2k.ai.scorer.AbstractScorer |
|---|
canonicalise, createPerturbedVariant, getBaseName, getDefaultName, getNameAndParameters, getPerturbedDefsAndValues, isValidParameterName, isValidScorerName, paramListAsMap, paramListAsString, parseNameAndParameters, similarNParams, verySimilar |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.hd.d.pg2k.ai.scorer.ScorerIF |
|---|
createPerturbedVariant, getBaseName, getNameAndParameters, getPerturbedDefsAndValues |
| Field Detail |
|---|
private static final byte MAX_BRIGHTNESS
private static final boolean USE_B_NOT_Y
private static final ScorerParamInteger sampleSizeParamBounds
private final ScorerParamInteger sampleSizeParam
Reducing the sample size by a factor of x is assumed to increase the noise, and thus reduce the confidence, by a factor of sqrt(x).
Experience suggests that upwards of a thousand samples gives good consistency.
private static final ScorerParamInteger brightnessParamBounds
private final ScorerParamInteger brightnessParam
private static final ScorerParamInteger outlierParamBounds
A good shift value may line in the region of 3 to 7 thus discarding ~13% to ~1% of the outliers from either extreme.
private final ScorerParamInteger outlierParam
| Constructor Detail |
|---|
public SimpleExposure()
public SimpleExposure(java.lang.String nameAndParameters)
public SimpleExposure(java.lang.String baseName,
java.util.List<ScorerParam> parameters)
| Method Detail |
|---|
public ScorerIF createVariant(java.lang.String nameAndParameters)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - for unparsable or inappropriate input
public ScorerIF createVariant(java.lang.String baseName,
java.util.List<ScorerParam> parameters)
throws java.lang.IllegalArgumentException
ScorerIFMay be able to share some (immutable) state with the original instance, and the value returned is immutable and may not be new.
java.lang.IllegalArgumentException - for unparsable or inappropriate inputpublic ScoreAndConf computeScoreAndConfidence(java.awt.image.RenderedImage stillImage)
computeScoreAndConfidence in class AbstractImgScorerstillImage - non-null still 2D image;
if greater than 256x256 pixels then will be internally scaled
java.lang.IllegalArgumentException - for a null image
private java.lang.Byte samplePoint(java.awt.image.BufferedImage stillImage,
int x,
int y)
public java.util.List<ScorerParam> getParameterDefsAndValues()
getParameterDefsAndValues in interface ScorerIFgetParameterDefsAndValues in class AbstractScorer
|
DHD Multimedia Gallery V1.50.55 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||