|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.OperationDescriptorImpl | +--javax.media.jai.operator.SubsampleBinaryToGrayDescriptor
An OperationDescriptor
describing the "SubsampleBinaryToGray"
operation.
The "SubsampleBinaryToGray" operation collects a Binary image pixels into a gray scale image. Roughly speaking, each pixel (x, y) of the destination, is the sum of the source pixel values of the source pixel matrix of size 1/xScale by 1/yScale. In the noninteger case, the next bigger inter is used. Thus when xScale = yScale = 1/2.2, a 3 x 3 pixel matrix into a single destination pixel, resulting in 10 levels [0..9]. The resulting gray values are then normalized to have gray values in [0..255].
The source is a Binary image and the result of the operation is
a grayscale image. The scale factors xScale
and yScale
must be between (0, 1] and strictly bigger
than 0.
The destination image is a byte image whose
dimensions are:
dstWidth = floor(srcWidth * xScale)
dstHeight = floor(srcHeight * yScale)
It may be noted that the minX, minY, width and height hints as
specified through the JAI.KEY_IMAGE_LAYOUT
hint in the
RenderingHints
object are not honored, as this operator
calculates the destination image bounds itself. The other
ImageLayout
hints, like tileWidth and tileHeight,
however, are honored.
Specifying a scale factor of greater than 1 or less than 0
will cause an exception. To scale image sizes up or down,
see Scale
operator.
Note that if your packed binary source image is not tiled, this operation takes the source image size as the default tile size, resulting in possibly a big destination tile for a small image after subsampling. An ImageLayout through RenderingHints can be passed in to save memory usage as follows:
// example of using SubsampleBinaryToGray operator // src is a RenderedImage pb = new ParameterBlock(); pb.addSource(src); pb.add(scaleX); pb.add(scaleY); ImageLayout il = new ImageLayout(); il.setTileWidth(newTileWidth); il.setTileHeight(newTileHeight); RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, il); RenderedImage dst = (RenderedImage)JAI.create("subsamplebinarytogray", pb, hints);
Name | Value |
---|---|
GlobalName | SubsampleBinaryToGray |
LocalName | SubsampleBinaryToGray |
Vendor | com.sun.media.jai |
Description | Subsamples a binary image into a gray scale image. |
DocURL | http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/SubsampleBinaryToGrayDescriptor.html |
Version | 1.0 |
arg0Desc | The X scale factor. |
arg1Desc | The Y scale factor. |
Name | Class Type | Default Value |
---|---|---|
xScale | java.lang.Float | 1.0F |
yScale | java.lang.Float | 1.0F |
OperationDescriptor
, Serialized FormFields inherited from class javax.media.jai.OperationDescriptorImpl |
resources,
sourceNames,
supportedModes |
Constructor Summary | |
SubsampleBinaryToGrayDescriptor()
Constructor. |
Method Summary | |
Number |
getParamMinValue(int index)
Returns the minimum legal value of a specified numeric parameter for this operation. |
PropertyGenerator[] |
getPropertyGenerators()
Returns an array of PropertyGenerators implementing
property inheritance for the "SubsampleBinaryToGray" operation. |
boolean |
isRenderableSupported()
Returns true since renderable operation is supported. |
protected boolean |
validateParameters(ParameterBlock args,
StringBuffer msg)
Validates the input parameters. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SubsampleBinaryToGrayDescriptor()
Method Detail |
public boolean isRenderableSupported()
true
since renderable operation is supported.OperationDescriptorImpl.isModeSupported(java.lang.String)
public PropertyGenerator[] getPropertyGenerators()
PropertyGenerators
implementing
property inheritance for the "SubsampleBinaryToGray" operation.protected boolean validateParameters(ParameterBlock args, StringBuffer msg)
In addition to the standard checks performed by the superclass method, this method checks that "xScale" and "yScale" are both greater than 0 and less than or equal to 1.
The src image must be a binary, a one band, one bit
per pixel image with a MultiPixelPackedSampleModel
.
args
is null
.msg
is null
and the validation fails.OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)
public Number getParamMinValue(int index)
For the minimum value of "xScale" and "yScale", this method returns 0. However, the scale factors must be a positive floating number and can not be 0.
index
- The index of the parameter to be queried.Number
representing the minimum legal value,
or null
if the specified parameter is not
numeric.index
.ParameterListDescriptor.getParamValueRange(java.lang.String)
,
ParameterListDescriptor.getEnumeratedParameterValues(java.lang.String)
,
ParameterListDescriptor.isParameterValueValid(java.lang.String, java.lang.Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |