📄 image enhancement.htm
字号:
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TH><A name=68880>Policy </A>
<TH><A name=68882>Description </A>
<TR vAlign=top>
<TD><A name=68884>BORDER_ZERO</A><BR>
<TD><A name=68886>Set sample values to zero.</A><BR>
<TR vAlign=top>
<TD><A name=68888>BORDER_COPY</A><BR>
<TD><A name=68890>Set sample values to copies of the nearest valid
pixel. For example, pixels to the left of the valid rectangle will
take on the value of the valid edge pixel in the same row. Pixels both
above and to the left of the valid rectangle will take on the value of
the upper-left pixel.</A><BR>
<TR vAlign=top>
<TD><A name=68892>BORDER_REFLECT</A><BR>
<TD><A name=68918>The output image is defined as if mirrors were
placed along the edges of the source image. Thus if the left edge of
the valid rectangle lies at <EM>x</EM> = 10, pixel (9, <EM>y</EM>)
will be a copy of pixel (10, <EM>y</EM>); pixel (6, <EM>y</EM>) will
be a copy of pixel (13, <EM>y</EM>).</A><BR>
<TR vAlign=top>
<TD><A name=68896>BORDER_WRAP</A><BR>
<TD><A name=68938>The source image is tiled repeatedly in the
plane.</A><BR></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>abstract void extend(WritableRaster raster, PlanarImage im)
<P></P></LI></UL></PRE>
<DL><A name=68781>
<DT>
<DD>fills in the portions of a given <CODE>Raster</CODE> that lie outside
the bounds of a given <CODE>PlanarImage</CODE> with data derived from that
<CODE>PlanarImage</CODE>. </A>
<P></P></DD></DL><A name=72409>
<H4>7.2.2.1 <IMG
src="Image Enhancement.files/space.gif">BorderExtenderZero</H4></A>The
<CODE>BorderExtenderZero</CODE> class is a subclass of
<CODE>BorderExtender</CODE> that implements border extension by filling all
pixels outside of the image bounds with zeros. For example, <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#73911">Figure
7-2</A> shows the result of using <CODE>BorderExtenderZero</CODE> to extend an
image by adding two extra rows to the top and bottom and two extra columns on
the left and right sides.
<P><A name=73910>
<HR>
<CENTER><IMG
src="Image Enhancement.files/Image-enhance.doc.anc15.gif"></CENTER>
<HR>
</A><A name=73911>
<CENTER><FONT size=-1><B><I>Figure 7-2 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> BorderExtenderZero
Example</B></FONT></CENTER></A>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.BorderExtenderZero </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>final void extend(WritableRaster raster, PlanarImage im)
<P></P></LI></UL></PRE>
<DL><A name=72720>
<DT>
<DD>fills in the portions of a given <CODE>Raster</CODE> that lie outside
the bounds of a given <CODE>PlanarImage</CODE> with zeros. The portion of
Raster that lies within <CODE>im.getBounds</CODE> is not altered. </A>
<P></P></DD></DL><A name=72000>
<H4>7.2.2.2 <IMG
src="Image Enhancement.files/space.gif">BorderExtenderConstant</H4></A>The
<CODE>BorderExtenderConstant</CODE> class is a subclass of
<CODE>BorderExtender</CODE> that implements border extension by filling all
pixels outside of the image bounds with constant values. For example, <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#74089">Figure
7-3</A> shows the result of using <CODE>BorderExtenderConstant</CODE> to
extend an image by adding two extra rows to the top and bottom and two extra
columns on the left and right sides.
<P>In the figure, X is the constant fill value. The set of constants is
clamped to the range and precision of the data type of the <CODE>Raster</CODE>
being filled. The number of constants used is given by the number of bands of
the <CODE>Raster</CODE>. If the <CODE>Raster</CODE> has <EM>b</EM> bands, and
there are <EM>c</EM> constants, constants 0 through <EM>b</EM> - 1 are used
when <EM>b</EM> <IMG src="Image Enhancement.files/lt_equal.gif"> <EM>c</EM>.
If <EM>b</EM> > <EM>c</EM>, zeros are used to fill out the constants array.
<P><A name=74088>
<HR>
<CENTER><IMG
src="Image Enhancement.files/Image-enhance.doc.anc14.gif"></CENTER>
<HR>
</A><A name=74089>
<CENTER><FONT size=-1><B><I>Figure 7-3 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> BorderExtenderConstant
Example</B></FONT></CENTER></A>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.BorderExtenderConstant </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>BorderExtenderConstant(double[] constants)
<P></P></LI></UL></PRE>
<DL><A name=72359>
<DT>
<DD>constructs an instance of <CODE>BorderExtenderConstant</CODE> with a
given set of constants. The constants are specified as an array of
<CODE>double</CODE>s. </A>
<P></P></DD></DL><PRE><UL>
<LI>final void extend(WritableRaster raster, PlanarImage im)
<P></P></LI></UL></PRE>
<DL><A name=72379>
<DT>
<DD>fills in the portions of a given <CODE>Raster</CODE> that lie outside
the bounds of a given <CODE>PlanarImage</CODE> with constant values. The
portion of <CODE>Raster</CODE> that lies within <CODE>im.getBounds</CODE> is
not altered. </A>
<P></P></DD></DL><A name=72770>
<H4>7.2.2.3 <IMG
src="Image Enhancement.files/space.gif">BorderExtenderCopy</H4></A>The
<CODE>BorderExtenderCopy</CODE> class is a subclass of
<CODE>BorderExtender</CODE> that implements border extension by filling all
pixels outside of the image bounds with copies of the edge pixels. For
example, <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#74281">Figure
7-4</A> shows the result of using <CODE>BorderExtenderCopy</CODE> to extend an
image by adding two extra rows to the top and bottom and two extra columns on
the left and right sides.
<P>Although this type of extension is not particularly visually appealing, it
is useful as a way of padding source images prior to area or geometric
operations, such as convolution, scaling, or rotation.
<P><A name=74280>
<HR>
<CENTER><IMG
src="Image Enhancement.files/Image-enhance.doc.anc17.gif"></CENTER>
<HR>
</A><A name=74281>
<CENTER><FONT size=-1><B><I>Figure 7-4 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> BorderExtenderCopy
Example</B></FONT></CENTER></A>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.BorderExtenderCopy </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>final void extend(WritableRaster raster, PlanarImage im)
<P></P></LI></UL></PRE>
<DL><A name=73098>
<DT>
<DD>fills in the portions of a given <CODE>Raster</CODE> that lie outside
the bounds of a given <CODE>PlanarImage</CODE> with copies of the edge
pixels of the image. The portion of <CODE>Raster</CODE> that lies within
<CODE>im.getBounds</CODE> is not altered. </A>
<P></P></DD></DL><A name=73128>
<H4>7.2.2.4 <IMG
src="Image Enhancement.files/space.gif">BorderExtenderWrap</H4></A>The
<CODE>BorderExtenderWrap</CODE> class is a subclass of
<CODE>BorderExtender</CODE> that implements border extension by filling all
pixels outside of the image bounds with copies of the whole image. For
example, <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#74469">Figure
7-5</A> shows the result of using <CODE>BorderExtenderWrap</CODE> to extend an
image by adding two extra rows to the top and bottom and two extra columns on
the left and right sides.
<P>This form of extension is appropriate for data that is inherently periodic,
such as the Fourier transform of an image or a wallpaper pattern.
<P><A name=74468>
<HR>
<CENTER><IMG
src="Image Enhancement.files/Image-enhance.doc.anc18.gif"></CENTER>
<HR>
</A><A name=74469>
<CENTER><FONT size=-1><B><I>Figure 7-5 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> BorderExtenderWrap
Example</B></FONT></CENTER></A>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.BorderExtenderWrap </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>final void extend(WritableRaster raster, PlanarImage im)
<P></P></LI></UL></PRE>
<DL><A name=73485>
<DT>
<DD>Fills in the portions of a given <CODE>Raster</CODE> that lie outside
the bounds of a given <CODE>PlanarImage</CODE> with copies of the entire
image. The portion of <CODE>Raster</CODE> that lies within
<CODE>im.getBounds</CODE> is not altered. </A>
<P></P></DD></DL><A name=73456>
<H4>7.2.2.5 <IMG
src="Image Enhancement.files/space.gif">BorderExtenderReflect</H4></A>The
<CODE>BorderExtenderReflect</CODE> class is a subclass of
<CODE>BorderExtender</CODE> that implements border extension by filling all
pixels outside the image bounds with reflected copies of the whole image. For
example, <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#74693">Figure
7-6</A> shows the result of using <CODE>BorderExtenderReflect</CODE> to extend
an image by adding two extra rows to the top and bottom and one extra column
on the left and right sides.
<P>This form of extension avoids discontinuities around the edges of the
image.
<P><A name=74688>
<HR>
<CENTER><IMG
src="Image Enhancement.files/Image-enhance.doc.anc3.gif"></CENTER>
<HR>
</A><A name=74693>
<CENTER><FONT size=-1><B><I>Figure 7-6 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> BorderExtenderReflect
Example</B></FONT></CENTER></A>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.BorderExtenderReflect </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>final void extend(WritableRaster raster, PlanarImage im)
<P></P></LI></UL></PRE>
<DL><A name=73832>
<DT>
<DD>Fills in the portions of a given <CODE>Raster</CODE> that lie outside
the bounds of a given <CODE>PlanarImage</CODE> with suitably reflected
copies of the entire image. The portion of <CODE>Raster</CODE> that lies
within <CODE>im.getBounds</CODE> is not altered. </A>
<P></P></DD></DL><A name=73080>
<H2>7.3 <IMG src="Image Enhancement.files/space.gif">Cropping an
Image</H2></A>The <CODE>Crop</CODE> operation crops a rendered or renderable
image to a specified rectangular area. The <EM>x</EM>, <EM>y</EM>, width, and
height values are clipped to the source image's bounding box. These values are
rounded to type <CODE>int</CODE> for rendered images.
<P>The <CODE>Crop</CODE> operation takes one rendered or renderable source
image and four parameters. None of the parameters have default values; all
must be supplied.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TH><A name=76471>Parameter </A>
<TH><A name=76473>Type </A>
<TH><A name=76475>Description </A>
<TR vAlign=top>
<TD><A name=76477>x</A><BR>
<TD><A name=76479>Float</A><BR>
<TD><A name=76481>The <EM>x</EM> origin for each band.</A><BR>
<TR vAlign=top>
<TD><A name=76483>y</A><BR>
<TD><A name=76485>Float</A><BR>
<TD><A name=76487>The <EM>y</EM> origin for each band.</A><BR>
<TR vAlign=top>
<TD><A name=76489>width</A><BR>
<TD><A name=76491>Float</A><BR>
<TD><A name=76493>The width for each band.</A><BR>
<TR vAlign=top>
<TD><A name=76495>height</A><BR>
<TD><A name=76497>Float</A><BR>
<TD><A name=76499>The height for each band.</A><BR></TR></TBODY></TABLE>
<P><A name=76505>
<HR>
<CENTER><IMG
src="Image Enhancement.files/Image-enhance.doc.anc8.gif"></CENTER>
<HR>
</A><A name=76506>
<CENTER><FONT size=-1><B><I>Figure 7-7 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> Crop
Operation</B></FONT></CENTER></A>
<P><A name=76502>
<H2>7.4 <IMG src="Image Enhancement.files/space.gif">Amplitude
Rescaling</H2></A>Amplitude rescaling provides a linear amplitude
transformation of input pixel values to output pixel values. Amplitude
rescaling can be used to enhance images that have insufficient contrast
between the lightest and darkest values, such as caused by underexposure or
overexposure of the original image.
<P>The full dynamic range of one band of an eight-bit image is 0 to 255. An
underexposed image may only contain pixel values from 10 to 180, resulting in
an image that does not fully use the dynamic range of the display. Such an
image can be greatly improved by linearly stretching the contrast range;
mapping the lowest values to 0 and the highest values to 255.
<P>The <CODE>rescale</CODE> operation takes a rendered or renderable source
image and maps the pixel values of the image from one range to another range
by multiplying each pixel value by one of a set of constants and then adding
another constant to the result of the multiplication. If the number of
constants supplied is less than the number of bands of the destination, the
constant from entry 0 is applied to all the bands. Otherwise, a constant from
a different entry is applied to each band. There must be at least one entry in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -