⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geometric image manipulation.htm

📁 是一部关于java高级图像处理的的一本入门书
💻 HTM
📖 第 1 页 / 共 5 页
字号:
        <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=55492>
  <H3>8.2.5 <IMG src="Geometric Image Manipulation.files/space.gif">Table 
  Interpolation</H3></A>The previous-described types of interpolation, 
  nearest-neighbor, bilinear, bicubic, and bicubic2, base the interpolation 
  values on a relatively few pixels: one (nearest-neighbor), four (bilinear), or 
  16 (bicubic and bicubic2). Occasionally, these options don't provide 
  sufficient quality for a specific operation and a general form of 
  interpolation is called for. Table interpolation uses tables to store the 
  interpolation kernels. The set of subpixel positions is broken up into a fixed 
  number of "bins" and a distinct kernel is used for each bin. The number of 
  bins must be a power of two. 
  <P>An <CODE>InterpolationTable</CODE> defines a separable interpolation, with 
  a separate set of kernels for the horizontal and vertical dimensions. The 
  number of bins within each kernel may vary between the two dimensions. The 
  horizontal and vertical kernels may be unique or the same. That is, you can 
  either construct two separate kernels or use the same kernel for both the 
  horizontal and vertical interpolation. 
  <P>The kernels are stored in both floating- and fixed-point form. The fixed 
  point representation has a user-specified fractional precision. You must 
  specify an appropriate level of precision that will not cause overflow when 
  accumulating the results of a convolution against a set of source pixels, 
  using 32-bit integer arithmetic. 
  <P>To use table interpolation, create an <CODE>InterpolationTable</CODE> with 
  either identical horizontal and vertical resampling kernels or with different 
  horizontal and vertical resampling kernels. The table forms the kernels used 
  for the interpolation. 
  <P>During a table interpolation operation, the key value of the resampling 
  kernel, generally the center value, is laid over the source image pixel to be 
  processed. The other kernel values lie over neighboring pixels much like a 
  conventional M x N kernel operation. Each source image pixel that is covered 
  by the kernel is then multiplied by the kernel value that lies over it. The 
  multiplication products are then summed together and this sum becomes the 
  pixel value in the destination. 
  <P>To save memory space and computation time, the table interpolation 
  operation does not use a conventional M x N kernel. Instead, the operation 
  uses separate horizontal and vertical vector arrays (essentially, M x 1 and N 
  x 1) to calculate the same values that a M x N kernel would calculate. The 
  vector arrays allow you to provide fewer data elements for the kernel values. 
  This is particularly significant for large tables with many subsamples. 
  <P>The basic format for the <CODE>InterpolationTable</CODE> constructor is: 
  <P><PRE>     InterpolationTable(int leftPadding, int topPadding, int width,
                        int height, int subsampleBitsH,
                        int subsampleBitsV, int precisionBits,
                        float[] dataH, float[] dataV)
</PRE>The parameters to the constructor are described in the following 
  paragraphs. 
  <P><A name=65628>
  <H4>8.2.5.1 <IMG 
  src="Geometric Image Manipulation.files/space.gif">Padding</H4></A>The 
  <CODE>leftPadding</CODE> and <CODE>topPadding</CODE> parameters define the 
  location of the central sample or key value, relative to the left and top of 
  the horizontal and vertical kernels, respectively. These parameters actually 
  define the number of samples to the left of or above the central sample, as 
  shown in <A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Geom-image-manip.doc.html#65694">Figure 
  8-2</A>. 
  <P><A name=65693>
  <HR>

  <CENTER><IMG 
  src="Geometric Image Manipulation.files/Geom-image-manip.doc.anc20.gif"></CENTER>
  <HR>
  </A><A name=65694>
  <CENTER><FONT size=-1><B><I>Figure 8-2 </I><IMG 
  src="Geometric Image Manipulation.files/sm-blank.gif" border=0> Table 
  Interpolation Padding</B></FONT></CENTER></A>
  <P><A name=65762>
  <H4>8.2.5.2 <IMG src="Geometric Image Manipulation.files/space.gif">Width and 
  Height</H4></A>The <CODE>width</CODE> and <CODE>height</CODE> parameters 
  define the size of the horizontal and vertical kernels, respectively. These 
  parameters specify the number of data elements in each subsample of the 
  kernel. The horizontal and vertical tables can have different kernel sizes. 
  For the two examples shown in <A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Geom-image-manip.doc.html#65694">Figure 
  8-2</A>, the <CODE>width</CODE> parameter would be 7, the <CODE>height</CODE> 
  parameter would be 5. 
  <P>The <CODE>getWidth</CODE> and <CODE>getHeight</CODE> methods return the 
  number of samples required for horizontal and vertical resampling, 
  respectively. 
  <P><A name=65830>
  <H4>8.2.5.3 <IMG src="Geometric Image Manipulation.files/space.gif">Subsample 
  Bits</H4></A>The <CODE>subsampleBitsH</CODE> and <CODE>subsampleBitsV</CODE> 
  parameters define the number of bins used to describe the horizontal and 
  vertical subpixel positions, respectively. The number of bins must be a power 
  of two, so the values are integers expressed as the log<SUB>2</SUB> of the 
  number of horizontal or vertical subsample positions, respectively. The value 
  <CODE>subsampleBitsH</CODE> = 1 defines two subsamples per horizontal sample, 
  <CODE>subsampleBitsH</CODE> = 2 defines four subsamples per sample, and so on. 

  <P>For each subsample, you must define separate kernel data. Typically, the 
  kernel values for each subsample are weighted according to the subsample 
  location's proximity to the pixels used in the calculation. The closer a pixel 
  is to the subsample location, the more weight it carries in the kernel. 
  <P><A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Geom-image-manip.doc.html#70742">Figure 
  8-3</A> shows how the interpolation tables are used to determine which kernel 
  applies to a particular subsample location. The figure shows a subsample of 4 
  in both the horizontal and vertical directions. 
  <P>Typically, the kernel values for each subsample are weighted according to 
  the subsample location's proximity to the pixels used in the calculation. The 
  closer a pixel is to the subsample location, the more weight it carries in the 
  kernel. 
  <P><A name=70741>
  <HR>

  <CENTER><IMG 
  src="Geometric Image Manipulation.files/Geom-image-manip.doc.anc37.gif"></CENTER>
  <HR>
  </A><A name=70742>
  <CENTER><FONT size=-1><B><I>Figure 8-3 </I><IMG 
  src="Geometric Image Manipulation.files/sm-blank.gif" border=0> Table 
  Interpolation Backwards Mapping</B></FONT></CENTER></A>
  <P><A name=73514>
  <H4>8.2.5.4 <IMG 
  src="Geometric Image Manipulation.files/space.gif">Precision</H4></A>The 
  <CODE>precisionBits</CODE> parameter defines the number of fractional bits to 
  be used when resampling integral sample values. The same precision value is 
  used for both horizontal and vertical resampling. It is important to choose an 
  appropriate level of precision that will not cause overflow when accumulating 
  the results of a convolution against a set of source pixels, using 32-bit 
  integer arithmetic. 
  <P><A name=65837>
  <H4>8.2.5.5 <IMG src="Geometric Image Manipulation.files/space.gif">Kernel 
  Data</H4></A>The kernel data for each table is an array of floating point 
  numbers. The <CODE>dataH</CODE> and <CODE>dataV</CODE> parameters specify the 
  floating-point data values for the horizontal and vertical kernels, 
  respectively. The number of data elements in the kernel is: 
  <P>
  <DL><A name=65891>
    <DT>
    <DD><CODE>width</CODE> x 2<SUP>subsampleBitsH</SUP> for <CODE>dataH</CODE> 
    </A>
    <P><A name=65892></P>
    <DT>
    <DD><CODE>height</CODE> x 2<SUP>subsampleBitsV</SUP> for <CODE>dataV</CODE> 
    </A>
    <P></P></DD></DL>For a two-element kernel size with eight subsample bins 
  (<CODE>subsampleBits</CODE> = 4), you need to define an array of 16 floating 
  point values. The first two values define the kernel for the first subsample, 
  the second two values define the kernel for the second subsample, and so on. 
  For example:
  <P><CAPTION><FONT size=-1><B></B></FONT></CAPTION>
  <HR>
  <TR valign="top"><TD><PRE>     float[] kernelData = {1.0,    0.0,
                           0.875,  0.125,    // 7/8,  1/8
                           0.75,   0.25,     // 6/8,  2/8
                           0.625,  0.375,    // 5/8,  3/8
                           0.5,    0.5,      // 4/8,  4/8
                           0.375,  0.625,    // 3/8,  5/8
                           0.25,   0.75,     // 2/8,  6/8
                           0.125,  0.875 };  // 1/8,  7/8
</PRE>
  <HR>

  <P>The above example creates a bilinear interpolation table with eight 
  subsamples. The kernel values indicate how much influence the source image 
  pixels will have on the destination value. A kernel value of 1 indicates that 
  a source pixel completely determines the value of the destination pixel. A 
  kernel value of 0 indicates that the source pixel has no influence on the 
  destination value. 
  <P>To preserve the source image's intensity in the destination image, the sum 
  of the data values in each interpolation kernel should equal one. If the 
  kernel values sum to greater than one, the destination image's intensity will 
  be increased. Conversely, if the kernel values sum to less than one, the 
  destination image's intensity will be decreased. 
  <P>If a value of <CODE>null</CODE> is given for <CODE>dataV</CODE>, the 
  <CODE>dataH</CODE> table data is used for vertical interpolation as well, and 
  the <CODE>topPadding</CODE>, <CODE>height</CODE>, and 
  <CODE>subsampleBitsV</CODE> parameters 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.InterpolationTable </CODE>
        <HR>
      </TD></TR></TBODY></TABLE><PRE><UL>
<LI>InterpolationTable(int padding, int width, int subsampleBits, 
       int precisionBits, float[] data)
<P></P></LI></UL></PRE>
  <DL><A name=70927>
    <DT>
    <DD>constructs an <CODE>InterpolationTable</CODE> with identical horizontal 
    and vertical resampling kernels.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=5><EM>Parameters</EM>: 
          <P></P>
        <TD><CODE>padding</CODE> 
          <P></P>
        <TD>The number of samples to the left or above the central sample to 
          be used during resampling. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>width</CODE> 
          <P></P>
        <TD>The width or height of a resampling kernel. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>subsample-Bits</CODE> 
          <P></P>
        <TD>The log<SUB>2</SUB> of the number of subsample bins. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>precision-Bits</CODE> 
          <P></P>
        <TD>The number of bits of fractional precision to be used when 
          resampling integral sample values. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>data</CODE> 
          <P></P>
        <TD>The kernel entries, as a float array of 
          <CODE>width</CODE>*2<SUP>subsampleBitsH</SUP> entries. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>InterpolationTable(int padding, int width, int subsampleBits, 
       int precisionBits, double[] data)
<P></P></LI></UL></PRE>
  <DL><A name=71047>
    <DT>
    <DD>constructs an InterpolationTable with identical horizontal and vertical 
    resampling kernels. </A>
    <P></P></DD></DL><PRE><UL>
<LI>InterpolationTable(int padding, int width, int subsampleBits, 
       int precisionBits, int[] data)
<P></P></LI></UL></PRE>
  <DL><A name=73456>
    <DT>
    <DD>Constructs an InterpolationTable with identical horizontal and vertical 
    resampling kernels. </A>
    <P></P></DD></DL><PRE><UL>
<LI>InterpolationTable(int leftPadding, int topPadding, int width, 
       int height, int subsampleBitsH, int subsampleBitsV, 
       int  precisionBits, float[] dataH, float[] dataV)
<P></P></LI></UL></PRE>
  <DL><A name=65594>
    <DT>
    <DD>constructs an <CODE>InterpolationTable</CODE> with specified horizontal 
    and vertical extents (support), number of horizontal and vertical bins, 
    fixed-point fractional precision, and kernel entries. The kernel data values 
    are organized as 2<SUP>subsampleBits</SUP> entries each containing 
    <CODE>width</CODE> floats.
    <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>leftPadding</CODE> 
          <P></P>
        <TD>The number of samples to the left of the central sample to be used 
          during horizontal resampling. 
          <P></P>
      <TR vAlign=top>
        <TD>
          <P></P>
        <TD><CODE>topPadding</CODE> 
          <P></P>
        <TD>The number of samples above the central sample to be used during 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -