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

📄 image enhancement.htm

📁 是一部关于java高级图像处理的的一本入门书
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0098)http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html -->
<HTML><HEAD><TITLE>Image Enhancement</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content=exclude name=collection>
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<CENTER><A 
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/JAITOC.fm.html"><IMG 
alt=Contents src="Image Enhancement.files/contents.gif"></A> <A 
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-manipulation.doc.html"><IMG 
alt=Previous src="Image Enhancement.files/previous.gif"></A> <A 
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Geom-image-manip.doc.html"><IMG 
alt=Next src="Image Enhancement.files/next.gif"></A> 
<P><FONT size=5><I>Programming in Java Advanced Imaging</I></FONT> </CENTER><BR>
<CENTER><A name=47227>
<TABLE width="90%" border=0>
  <TBODY>
  <TR>
    <TD align=right><FONT size=3>C H A P T E R</FONT><FONT size=7><IMG 
      src="Image Enhancement.files/sm-space.gif">7</FONT></TD></TR></TBODY></TABLE></A></CENTER>
<CENTER><A name=47285>
<TABLE width="90%" border=0>
  <TBODY>
  <TR>
    <TD align=right>
      <HR noShade SIZE=7>
      <FONT size=6>Image Enhancement</FONT></TD></TR></TBODY></TABLE></A></CENTER>
<BLOCKQUOTE>
  <P><BR><BR><BR>
  <P><FONT size=7><B>T</B></FONT>HIS chapter describes the basics of improving 
  the visual appearance of images through enhancement operations. 
  <P><A name=50856>
  <H2>7.1 <IMG src="Image Enhancement.files/space.gif">Introduction</H2></A>The 
  JAI API image enhancement operations include: 
  <P>
  <UL>
    <LI>Adding borders
    <P></P></LI></UL>
  <UL>
    <LI>Cropping an image
    <P></P></LI></UL>
  <UL>
    <LI>Amplitude rescaling
    <P></P></LI></UL>
  <UL>
    <LI>Histogram equalization
    <P></P></LI></UL>
  <UL>
    <LI>Lookup table modification
    <P></P></LI></UL>
  <UL>
    <LI>Convolution filtering
    <P></P></LI></UL>
  <UL>
    <LI>Median filtering
    <P></P></LI></UL>
  <UL>
    <LI>Frequency domain processing
    <P></P></LI></UL>
  <UL>
    <LI>Pixel point processing
    <P></P></LI></UL>
  <UL>
    <LI>Thresholding (binary contrast enhancement)
    <P></P></LI></UL><A name=68364>
  <H2>7.2 <IMG src="Image Enhancement.files/space.gif">Adding Borders to 
  Images</H2></A>JAI provides two different ways of adding a border to an image. 
  These two ways are described in the following paragraphs. 
  <P><A name=68604>
  <H3>7.2.1 <IMG src="Image Enhancement.files/space.gif">The Border 
  Operation</H3></A>The <CODE>Border</CODE> operation allows you to add a simple 
  filled border around a source image. The border extends the source image's 
  boundaries by a specified number of pixels.The amount of extension may be 
  specified separately for the top, bottom, and left and right sides. The 
  following types of border fill may be specified: 
  <P>
  <UL>
    <LI>Zero fill - the border area is extended with zeros 
    (<CODE>BORDER_ZERO_FILL</CODE>).
    <P></P></LI></UL>
  <UL>
    <LI>Constant fill - the border area is extended with a specified constant 
    value (<CODE>BORDER_CONST_FILL</CODE>). An array of constants must be 
    supplied. The array must have at least one element, in which case this same 
    constant is applied to all destination image bands. Or, it may have a 
    different constant entry for each corresponding band. For all other border 
    types, this <CODE>constants</CODE> parameter may be <CODE>null</CODE>.
    <P></P></LI></UL>
  <UL>
    <LI>Extend - the border area is created by copying the edge and corner 
    pixels (<CODE>BORDER_COPY</CODE>).
    <P></P></LI></UL>
  <UL>
    <LI>Reflection - the border area is created by reflection of the image's 
    outer edge (<CODE>BORDER_REFLECT</CODE>).
    <P></P></LI></UL>
  <UL>
    <LI>Wrap - the border area is extended by "wrapping" the image plane 
    toroidally, that is, joining opposite edges of the image 
    (<CODE>BORDER_WRAP</CODE>).
    <P></P></LI></UL><A name=68385>
  <HR>

  <CENTER><IMG 
  src="Image Enhancement.files/Image-enhance.doc.ancA9.gif"></CENTER>
  <HR>
  </A><A name=68386>
  <CENTER><FONT size=-1><B><I>Figure 7-1 </I><IMG 
  src="Image Enhancement.files/sm-blank.gif" border=0> Image 
  Borders</B></FONT></CENTER></A>
  <P>The image layout (tile width, height, and offsets; <CODE>SampleModel</CODE> 
  and <CODE>ColorModel</CODE>) is copied from the source. The 
  <CODE>Border</CODE> operation takes one rendered source image and six 
  parameters:
  <P>
  <TABLE cellPadding=3 border=3>
    <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
    <TBODY>
    <TR vAlign=top>
      <TH><A name=68390>Parameters </A>
      <TH><A name=68392>Type </A>
      <TH><A name=68394>Description </A>
    <TR vAlign=top>
      <TD><A name=68396>leftPad</A><BR>
      <TD><A name=68398>Integer</A><BR>
      <TD><A name=68400>The image's left padding.</A><BR>
    <TR vAlign=top>
      <TD><A name=68402>rightPad</A><BR>
      <TD><A name=68404>Integer</A><BR>
      <TD><A name=68406>The image's right padding.</A><BR>
    <TR vAlign=top>
      <TD><A name=68408>topPad</A><BR>
      <TD><A name=68410>Integer</A><BR>
      <TD><A name=68412>The image's top padding.</A><BR>
    <TR vAlign=top>
      <TD><A name=68414>bottomPad</A><BR>
      <TD><A name=68416>Integer</A><BR>
      <TD><A name=68418>The image's bottom padding.</A><BR>
    <TR vAlign=top>
      <TD><A name=68420>type</A><BR>
      <TD><A name=68422>Integer</A><BR>
      <TD><A name=68424>The border type. One of BORDER_ZERO, 
        BORDER_CONST_FILL, BORDER_COPY, BORDER_REFLECT, or BORDER_WRAP. The 
        default is BORDER_ZERO.</A><BR>
    <TR vAlign=top>
      <TD><A name=68426>constant</A><BR>
      <TD><A name=68428>double</A><BR>
      <TD><A name=68430>The constants used by the 
    BORDER_CONST_FILL.</A><BR></TR></TBODY></TABLE>
  <P><A name=68606>
  <H3>7.2.2 <IMG src="Image Enhancement.files/space.gif">Extending the Edge of 
  an Image</H3></A>Some area operations, such as convolve, scale, and rotate, 
  benefit from the addition of an extended border around the source image. The 
  extended border comes into play when the convolution kernel overlaps the 
  source image as the key value is scanned over it. 
  <P>A <CODE>BorderExtender</CODE> may be applied to an operation using a 
  suitable hint. The hints are defined in <A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#68640">Table 
  7-1</A>.
  <P>
  <TABLE cellPadding=3 border=3>
    <CAPTION><FONT size=-1><B><A name=68640><I>Table 7-1 </I><IMG 
    src="Image Enhancement.files/sm-blank.gif" border=0> BorderExtender Hints 
    </A></B></FONT></CAPTION>
    <TBODY>
    <TR vAlign=top>
      <TH><A name=68644>Name </A>
      <TH><A name=68646>Description </A>
    <TR vAlign=top>
      <TD><A name=68648>BorderExtenderZero</A><BR>
      <TD><A name=68650>Extends an image's border by filling all pixels 
        outside the image bounds with zeros. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#72409">Section 
        7.2.2.1, "BorderExtenderZero</A>."</A><BR>
    <TR vAlign=top>
      <TD><A name=70811>BorderExtenderConstant</A><BR>
      <TD><A name=70813>Extends an image's border by filling all pixels 
        outside the image bounds with constant values. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#72000">Section 
        7.2.2.2, "BorderExtenderConstant</A>."</A><BR>
    <TR vAlign=top>
      <TD><A name=68652>BorderExtenderCopy</A><BR>
      <TD><A name=68697>Extends an image's border by filling all pixels 
        outside the image bounds with copies of the edge pixels. Useful as a way 
        of padding source images prior to area or geometric operations, such as 
        convolution, scaling, or rotation. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#72770">Section 
        7.2.2.3, "BorderExtenderCopy</A>."</A><BR>
    <TR vAlign=top>
      <TD><A name=68656>BorderExtenderWrap</A><BR>
      <TD><A name=68658>Extends an image's border by filling all pixels 
        outside the image bounds with copies of the whole image. This form of 
        extension is appropriate for data that is inherently periodic, such as 
        the Fourier transform of an image, or a wallpaper pattern. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#73128">Section 
        7.2.2.4, "BorderExtenderWrap</A>."</A><BR>
    <TR vAlign=top>
      <TD><A name=68660>BorderExtenderReflect</A><BR>
      <TD><A name=68662>Extends an image's border by filling all pixels 
        outside the image bounds with copies of the whole image. This form of 
        extension avoids discontinuities around the edges of the image. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#73456">Section 
        7.2.2.5, "BorderExtenderReflect</A>."</A><BR></TR></TBODY></TABLE>
  <P>The <CODE>BorderExtender</CODE> class is the superclass for four classes 
  that extend a <CODE>WritableRaster</CODE> with additional pixel data taken 
  from a <CODE>PlanarImage</CODE>. Instances of <CODE>BorderExtender</CODE> are 
  used by the <CODE>PlanarImage.getExtendedData</CODE> and 
  <CODE>PlanarImage.copyExtendedData</CODE> methods. 
  <P>The <CODE>PlanarImage.getExtendedData</CODE> method returns a copy of an 
  arbitrary rectangular region of the image in a <CODE>Raster</CODE>. The 
  portion of the rectangle of interest outside the bounds of the image will be 
  computed by calling the given <CODE>BorderExtender</CODE>. If the region falls 
  entirely within the image, the extender will not be used. Thus it is possible 
  to use a <CODE>null</CODE> value for the <CODE>extender</CODE> parameter when 
  it is known that no actual extension will be required. The returned 
  <CODE>Raster</CODE> should be considered non-writable. The 
  <CODE>copyExtendedData</CODE> method should be used if the returned 
  <CODE>Raster</CODE> is to be modified. 
  <P>The <CODE>PlanarImage.copyExtendedData</CODE> method copies an arbitrary 
  rectangular region of the <CODE>RenderedImage</CODE> into a caller-supplied 
  <CODE>WritableRaster</CODE>. The portion of the supplied 
  <CODE>WritableRaster</CODE> that lies outside the bounds of the image is 
  computed by calling the given <CODE>BorderExtender</CODE>. The supplied 
  <CODE>WritableRaster</CODE> must have a <CODE>SampleModel</CODE> that is 
  compatible with that of the image. 
  <P>Each instance of <CODE>BorderExtender</CODE> has an <CODE>extend</CODE> 
  method that takes a <CODE>WritableRaster</CODE> and a 
  <CODE>PlanarImage</CODE>. The portion of the raster that intersects the bounds 
  of the image will already contain a copy of the image data. The remaining area 
  is to be filled in according to the policy of the <CODE>BorderImage</CODE> 
  subclass. The subclasses are described in <A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#68640">Table 
  7-1</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.Planarimage </CODE>
        <HR>
      </TD></TR></TBODY></TABLE><PRE><UL>
<LI>Raster getExtendedData(Rectangle region, 
       BorderExtender  extender)
<P></P></LI></UL></PRE>
  <DL><A name=68977>
    <DT>
    <DD>returns a copy of an arbitrary rectangular region of this image in a 
    Raster.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=2><EM>Parameters</EM>: 
          <P></P>
        <TD><CODE>region</CODE> 
          <P></P>
        <TD>The region of the image to be returned. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>extender</CODE> 
          <P></P>
        <TD>An instance of <CODE>BorderExtender</CODE>, used only if the 
          region exceeds the image bounds. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>void copyExtendedData(WritableRaster dest, 
       BorderExtender  extender)
<P></P></LI></UL></PRE>
  <DL><A name=69184>
    <DT>
    <DD>copies an arbitrary rectangular region of the <CODE>RenderedImage</CODE> 
    into a caller-supplied <CODE>WritableRaster</CODE>.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=2><EM>Parameters</EM>: 
          <P></P>
        <TD><CODE>dest</CODE> 
          <P></P>
        <TD>A <CODE>WritableRaster</CODE> to hold the returned portion of the 
          image. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>extender</CODE> 
          <P></P>
        <TD>An instance of <CODE>BorderExtender</CODE>. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL>
  <TABLE border=0>
    <TBODY>
    <TR>
      <TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
      <TD>
        <HR>
        <B>API:</B> <CODE>javax.media.jai.BorderExtender </CODE>
        <HR>
      </TD></TR></TBODY></TABLE><PRE><UL>
<LI>static BorderExtender createInstance(int extenderType)
<P></P></LI></UL></PRE>
  <DL><A name=68824>
    <DT>
    <DD>returns an instance of <CODE>BorderExtender</CODE> that implements a 
    given extension policy. The policies understood by this method are:
    <P>
    <TABLE cellPadding=3 border=3>

⌨️ 快捷键说明

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