📄 geometric image manipulation.htm
字号:
<TD><CODE>samples</CODE>
<P></P>
<TD>A two-dimensional array of ints.
<P></P>
<TR vAlign=top>
<TD><CODE>xfrac</CODE>
<P></P>
<TD>The <EM>x</EM> subsample position, multiplied by
2<SUP>subsampleBits</SUP>.
<P></P>
<TR vAlign=top>
<TD><CODE>yfrac</CODE>
<P></P>
<TD>The <EM>y</EM> subsample position, multiplied by
2<SUP>subsampleBits</SUP>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>float interpolate(float[][] samples, float xfrac, float yfrac)
<P></P></LI></UL></PRE>
<DL><A name=65370>
<DT>
<DD>performs interpolation on a two-dimensional array of floating-point
samples. This is the same as the above method, only using float values
instead of ints. </A>
<P></P></DD></DL><PRE><UL>
<LI>double interpolate(double[][] samples, float xfrac,
float yfrac)
<P></P></LI></UL></PRE>
<DL><A name=69291>
<DT>
<DD>Performs interpolation on a 2-dimensional array of double samples. </A>
<P></P></DD></DL><PRE><UL>
<LI>int interpolate(int s00, int s01, int s10, int s11, int xfrac,
int yfrac)
<P></P></LI></UL></PRE>
<DL><A name=65163>
<DT>
<DD>performs interpolation on a 2 x 2 grid of integral samples. It should
only be called if width == height == 2 and leftPadding == topPadding == 0.
</A>
<P><A name=65243></P>
<DT>
<DD>The <CODE>s00</CODE>, <CODE>s01</CODE>, <CODE>s10</CODE>, and
<CODE>s11</CODE> parameters are the sample values (see the 2 x 2 grid
illustration in <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Geom-image-manip.doc.html#66155">Figure
8-1</A>). </A>
<P></P></DD></DL><PRE><UL>
<LI>float interpolate(float s00, float s01, float s10, float s11,
float xfrac, float yfrac)
<P></P></LI></UL></PRE>
<DL><A name=65402>
<DT>
<DD>performs interpolation on a 2 x 2 grid of integral samples. This is the
same as the above method, only using float values instead of ints. </A>
<P></P></DD></DL><PRE><UL>
<LI>double interpolate(double s00, double s01, double s10, double
s11, float xfrac, float yfrac)
<P></P></LI></UL></PRE>
<DL><A name=69315>
<DT>
<DD>performs interpolation on a 2 x 2 grid of double samples. </A>
<P></P></DD></DL><PRE><UL>
<LI>int interpolate(int s__, int s_0, int s_1, int s_2, int s0_,
int s00, int s01, int s02, int s1_, int s10, int s11,
int s12, int s2_, int s20, int s21, int s22, int xfrac,
int yfrac)
<P></P></LI></UL></PRE>
<DL><A name=65317>
<DT>
<DD>performs interpolation on a 4 x 4 grid of integral samples. It should
only be called if width == height == 4 and leftPadding == topPadding == 1.
</A>
<P><A name=65331></P>
<DT>
<DD>The <CODE>s__</CODE>, <CODE>through</CODE> <CODE>s22</CODE> parameters
are the sample values (see the 4 x 4 grid illustration in <A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Geom-image-manip.doc.html#66155">Figure
8-1</A>). </A>
<P></P></DD></DL><PRE><UL>
<LI>float interpolate(float s__, float s_0, float s_1, float s_2,
float s0_, float s00, float s01, float s02, float s1_,
float s10, float s11, float s12, float s2_, float s20,
float s21, float s22, float xfrac, float yfrac)
<P></P></LI></UL></PRE>
<DL><A name=65477>
<DT>
<DD>performs interpolation on a 4 x 4 grid of integral samples. This is the
same as the above method, only using float values instead of ints. </A>
<P></P></DD></DL><PRE><UL>
<LI>abstract int getSubsampleBitsH()
<P></P></LI></UL></PRE>
<DL><A name=70501>
<DT>
<DD>returns the number of bits used to index subsample positions in the
horizontal direction. All integral <CODE>xfrac</CODE> parameters should be
in the range of 0 to 2<SUP>(getSubsampleBitsH)</SUP> - 1. </A>
<P></P></DD></DL><PRE><UL>
<LI>int getSubsampleBitsV()
<P></P></LI></UL></PRE>
<DL><A name=70518>
<DT>
<DD>returns the number of bits used to index subsample positions in the
vertical direction. All integral <CODE>yfrac</CODE> parameters should be in
the range of 0 to 2<SUP>(getSubsampleBitsV)</SUP> - 1. </A>
<P></P></DD></DL><A name=70504>
<H3>8.2.1 <IMG
src="Geometric Image Manipulation.files/space.gif">Nearest-neighbor
Interpolation</H3></A>Nearest-neighbor interpolation, also known as zero-order
interpolation, is the fastest interpolation method, though it can produce
image artifacts called <EM>jaggies</EM> or <EM>aliasing error</EM>. Jaggies
are image artifacts in which the straight edges of objects appear to be rough
or jagged.
<P>Nearest-neighbor interpolation simply assigns to point <EM>D</EM> in the
destination image the value of the pixel nearest <EM>S</EM> in the source
image.
<P>Neighborhoods of sizes 2 x 1, 1 x 2, 2 x 2, 4 x 1, 1 x 4, 4 x 4, N x 1, and
1 x N, that is, all the <CODE>interpolate()</CODE> methods defined in the
<CODE>Interpolation</CODE> class, are supported in the interest of simplifying
code that handles a number of types of interpolation. In each case, the
central sample is returned and the rest are ignored.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Geometric Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.InterpolationNearest </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>InterpolationNearest()
<P></P></LI></UL></PRE>
<DL><A name=73430>
<DT>
<DD>constructs an <CODE>InterpolationNearest</CODE>. The return value of
<CODE>getSubsampleBitsH()</CODE> and <CODE>getSubsampleBitsV()</CODE> will
be 0. </A>
<P></P></DD></DL><A name=55403>
<H3>8.2.2 <IMG src="Geometric Image Manipulation.files/space.gif">Bilinear
Interpolation</H3></A>Bilinear interpolation, also known as first-order
interpolation, linearly interpolates pixels along each row of the source
image, then interpolates along the columns. Bilinear interpolation assigns to
Point <EM>D</EM> in the destination a value that is a bilinear function of the
four pixels nearest <EM>S</EM> in the source image.
<P>Bilinear interpolation results in an improvement in image quality over
nearest-neighbor interpolation, but may still result in less-than-desirable
smoothing effects.
<P>Bilinear interpolation requires a neighborhood extending one pixel to the
right and below the central sample. If the subsample position is given by
(<EM>u</EM>, <EM>v</EM>), the resampled pixel value will be:
<P>
<DL><A name=55410>
<DT>
<DD><IMG
src="Geometric Image Manipulation.files/Geom-image-manip.doc.anc4.gif"> </A>
<P></P></DD></DL>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Geometric Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.InterpolationBilinear </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>InterpolationBilinear(int subsampleBits)
<P></P></LI></UL></PRE>
<DL><A name=55414>
<DT>
<DD>constructs an <CODE>InterpolationBilinear</CODE> object with a given
subsample precision, in bits.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>subsampleBits</CODE>
<P></P>
<TD>The subsample precision.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>InterpolationBilinear()
<P></P></LI></UL></PRE>
<DL><A name=55423>
<DT>
<DD>constructs an <CODE>InterpolationBilinear</CODE> object with the default
subsample precision. </A>
<P></P></DD></DL><A name=55431>
<H3>8.2.3 <IMG src="Geometric Image Manipulation.files/space.gif">Bicubic
Interpolation</H3></A>Bicubic interpolation reduces resampling artifacts even
further by using the 16 nearest neighbors in the interpolation and by using
bicubic waveforms rather than the linear waveforms used in bilinear
interpolation. Bicubic interpolation preserves the fine detail present in the
source image at the expense of the additional time it takes to perform the
interpolation.
<P>The bicubic interpolation routine assigns to point <EM>D</EM> in the
destination image a value that is a bicubic function of the 16 pixels nearest
<EM>S</EM> in the source image.
<P>Bicubic interpolation performs interpolation using the following piecewise
cubic polynomial:
<P>
<DL><A name=55445>
<DT>
<DD><IMG
src="Geometric Image Manipulation.files/Geom-image-manip.doc.anc1.gif"> </A>
<P></P></DD></DL>Bicubic interpolation requires a neighborhood extending one
sample to the left of and above the central sample, and two samples to the
right of and below the central sample.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Geometric Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.InterpolationBicubic </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>InterpolationBicubic(int subsampleBits)
<P></P></LI></UL></PRE>
<DL><A name=60066>
<DT>
<DD>constructs an <CODE>InterpolationBicubic</CODE> with a given subsample
precision, in bits.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD><EM>Parameters</EM>:
<P></P>
<TD><CODE>subsampleBits</CODE>
<P></P>
<TD>The subsample precision.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><A name=55447>
<H3>8.2.4 <IMG src="Geometric Image Manipulation.files/space.gif">Bicubic2
Interpolation</H3></A>Bicubic2 interpolation is basically the same as bicubic
interpolation, but uses a different polynomial function. Bicubic2
interpolation uses the following piecewise cubic polynomial:
<P>
<DL><A name=55459>
<DT>
<DD><IMG
src="Geometric Image Manipulation.files/Geom-image-manip.doc.anc3.gif"> </A>
<P></P></DD></DL>Bicubic interpolation requires a neighborhood extending one
sample to the left of and above the central sample, and two samples to the
right of and below the central sample.
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Geometric Image Manipulation.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.InterpolationBicubic2 </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>InterpolationBicubic2(int subsampleBits)
<P></P></LI></UL></PRE>
<DL><A name=55480>
<DT>
<DD>constructs an <CODE>InterpolationBicubic2</CODE> with a given subsample
precision, in bits.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -