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

📄 image analysis.htm

📁 是一部关于java高级图像处理的的一本入门书
💻 HTM
📖 第 1 页 / 共 3 页
字号:
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=3><EM>Parameters</EM>: 
          <P></P>
        <TD><CODE>numBins</CODE> 
          <P></P>
        <TD>The number of bins for each band of the image; 
          <CODE>numBins.length</CODE> must be equal to the number of bands of 
          the image which the histogram is taken. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>lowValue</CODE> 
          <P></P>
        <TD>The lowest pixel value checked for each band. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>highValue</CODE> 
          <P></P>
        <TD>The highest pixel value checked for each band. Note when counting 
          the pixel values, this <CODE>highValue</CODE> is not included based on 
          the formula below. 
          <P></P></TR></TBODY></TABLE></A>
    <P><A name=55137></P>
    <DT>
    <DD>If <CODE>binWidth</CODE> is defined as (<CODE>highValue</CODE> - 
    <CODE>lowValue</CODE>)/<CODE>numBins</CODE>, bin i will count pixel values 
    in the range from </A>
    <P><A name=55141></P>
    <DT>
    <DD><IMG src="Image Analysis.files/Analysis.doc.anc3.gif"> </A>
    <P></P></DD></DL><A name=52616>
  <H3>9.4.2 <IMG src="Image Analysis.files/space.gif">Performing the Histogram 
  Operation</H3></A>Once you have created the <CODE>Histogram</CODE> object to 
  accumulate the histogram information, you generate the histogram for an image 
  with the <CODE>histogram</CODE> operation. The <CODE>histogram</CODE> 
  operation scans a specified region of an image and generates a histogram based 
  on the pixel values within that region of the image. The region of interest 
  does not have to be a rectangle. If no region is specified (null), the entire 
  image is scanned to generate the histogram. The image data passes through the 
  operation unchanged. 
  <P>The <CODE>histogram</CODE> operation takes one rendered source image and 
  four parameters:
  <P>
  <TABLE cellPadding=3 border=3>
    <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
    <TBODY>
    <TR vAlign=top>
      <TH><A name=52625>Parameter </A>
      <TH><A name=52627>Type </A>
      <TH><A name=52629>Description </A>
    <TR vAlign=top>
      <TD><A name=52631>specification</A><BR>
      <TD><A name=52633>Histogram</A><BR>
      <TD><A name=52635>The specification for the type of histogram to be 
        generated. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Analysis.doc.html#55111">Section 
        9.4.1, "Specifying the Histogram</A>."</A><BR>
    <TR vAlign=top>
      <TD><A name=52637>roi</A><BR>
      <TD><A name=52639>ROI</A><BR>
      <TD><A name=52641>The region of the image to scan. See <A 
        href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-manipulation.doc.html#51458">Section 
        6.2, "Region of Interest Control</A>."</A><BR>
    <TR vAlign=top>
      <TD><A name=52643>xPeriod</A><BR>
      <TD><A name=52645>Integer</A><BR>
      <TD><A name=52647>The horizontal sampling rate. May not be less than 
        1.</A><BR>
    <TR vAlign=top>
      <TD><A name=52649>yPeriod</A><BR>
      <TD><A name=52651>Integer</A><BR>
      <TD><A name=52653>The vertical sampling rate. May not be less than 
        1.</A><BR></TR></TBODY></TABLE>
  <P>The set of pixels scanned may be further reduced by specifying the 
  <CODE>xPeriod</CODE> and <CODE>yPeriod</CODE> parameters that represent the 
  sampling rate along each axis. These variables may not be less than 1. 
  However, they may be null, in which case the sampling rate is set to 1; that 
  is, every pixel in the ROI is processed. 
  <P><A name=51842>
  <H3>9.4.3 <IMG src="Image Analysis.files/space.gif">Reading the Histogram 
  Data</H3></A>The histogram data is stored in the user supplied 
  <CODE>Histogram</CODE> object, and may be retrieved by calling the 
  <CODE>getProperty</CODE> method on this operation with 
  <CODE>"histogram"</CODE> as the property name. The return value will be of 
  type <CODE>Histogram</CODE>. 
  <P>Several get methods allow you to check on the four histogram parameters: 
  <P>
  <UL>
    <LI>The bin data for all bands (<CODE>getBins</CODE>)<CODE></CODE>
    <P></P></LI></UL>
  <UL>
    <LI>The bin data for a specified band (<CODE>getBins</CODE>)
    <P></P></LI></UL>
  <UL>
    <LI>The number of pixel values found in a given bin for a given band 
    (<CODE>getBinSize</CODE>)
    <P></P></LI></UL>
  <UL>
    <LI>The lowest pixel value found in a given bin for a given band 
    (<CODE>getBinLowValue</CODE>)
    <P></P></LI></UL>The set of pixels counted in the histogram may be limited by 
  the use of a region of interest (ROI), and by horizontal and vertical 
  subsampling factors. These factors allow the accuracy of the histogram to be 
  traded for speed of computation. 
  <P>
  <TABLE border=0>
    <TBODY>
    <TR>
      <TD><IMG src="Image Analysis.files/cistine.gif"></TD>
      <TD>
        <HR>
        <B>API:</B> <CODE>javax.media.jai.Histogram </CODE>
        <HR>
      </TD></TR></TBODY></TABLE><PRE><UL>
<LI>int[][] getBins()
<P></P></LI></UL></PRE>
  <DL><A name=51866>
    <DT>
    <DD>returns the bins of the histogram for all bands. </A>
    <P></P></DD></DL><PRE><UL>
<LI>int[] getBins(int band)
<P></P></LI></UL></PRE>
  <DL><A name=51875>
    <DT>
    <DD>returns the bins of the histogram for a specified band.
    <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>band</CODE> 
          <P></P>
        <TD>The band to be checked 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>int getBinSize(int band, int bin)
<P></P></LI></UL></PRE>
  <DL><A name=51890>
    <DT>
    <DD>returns the number of pixel values found in a given bin for a given 
band.
    <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>band</CODE> 
          <P></P>
        <TD>The band to be checked 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>bin</CODE> 
          <P></P>
        <TD>The bin to be checked 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>float getBinLowValue(int band, int bin)
<P></P></LI></UL></PRE>
  <DL><A name=51905>
    <DT>
    <DD>returns the lowest pixel value found in a given bin for a given band.
    <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>band</CODE> 
          <P></P>
        <TD>The band to be checked 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>bin</CODE> 
          <P></P>
        <TD>The bin to be checked 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><PRE><UL>
<LI>void clearHistogram()
<P></P></LI></UL></PRE>
  <DL><A name=51907>
    <DT>
    <DD>resets the counts of all bins to zero. </A>
    <P></P></DD></DL><PRE><UL>
<LI>void countPixels(java.awt.image.Raster pixels, ROI roi,
       int xStart, int yStart, int xPeriod, int yPeriod)
<P></P></LI></UL></PRE>
  <DL><A name=51909>
    <DT>
    <DD>adds the pixels of a <CODE>Raster</CODE> that lie within a given region 
    of interest (ROI) to the histogram. The set of pixels is further reduced by 
    subsampling factors in the horizontal and vertical directions. The set of 
    pixels to be accumulated may be obtained by intersecting the grid </A>
    <P><A name=51913></P>
    <DT>
    <DD><IMG src="Image Analysis.files/Analysis.doc.anc4.gif"> </A>
    <P><A name=51951></P>
    <DT>
    <DD>with the region of interest and the bounding rectangle of the 
    <CODE>Raster</CODE>.
    <P>
    <TABLE cellPadding=3 border=3>
      <CAPTION><FONT size=-1><B></B></FONT></CAPTION>
      <TBODY>
      <TR vAlign=top>
        <TD rowSpan=6><EM>Parameters</EM>: 
          <P></P>
        <TD><CODE>pixels</CODE> 
          <P></P>
        <TD>A Raster containing pixels to be histogrammed. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>roi</CODE> 
          <P></P>
        <TD>The region of interest, as a ROI. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>xStart</CODE> 
          <P></P>
        <TD>The initial <EM>x</EM> sample coordinate. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>yStart</CODE> 
          <P></P>
        <TD>The initial <EM>y</EM> sample coordinate. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>xPeriod</CODE> 
          <P></P>
        <TD>The <EM>x</EM> sampling rate. 
          <P></P>
      <TR vAlign=top>
        <TD><CODE>yPeriod</CODE> 
          <P></P>
        <TD>The <EM>y</EM> sampling rate. 
          <P></P></TR></TBODY></TABLE></A>
    <P></P></DD></DL><A name=55476>
  <H3>9.4.4 <IMG src="Image Analysis.files/space.gif">Histogram Operation 
  Example</H3></A><A 
  href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Analysis.doc.html#56595">Listing 
  9-3</A> shows a sample listing for a histogram operation on a three-banded 
  source image.
  <P><CAPTION><FONT size=-1><B><A name=56595>
  <CENTER><FONT size=-1><B><I>Listing 9-3 </I><IMG 
  src="Image Analysis.files/sm-blank.gif" border=0> Example Histogram Operation 
  </B></FONT></CENTER></A>
  <P></B></FONT></CAPTION>
  <HR>
  <TR valign="top"><TD><PRE>     // Set up the parameters for the Histogram object.
     int[] bins = {256, 256, 256};             // The number of bins.
     double[] low = {0.0D, 0.0D, 0.0D};        // The low value.
     double[] high = {256.0D, 256.0D, 256.0D}; // The high value.
</PRE><TR valign="top"><TD><PRE>     // Construct the Histogram object.
     Histogram hist = new Histogram(bins, low, high);
</PRE><TR valign="top"><TD><PRE>     // Create the parameter block.
     ParameterBlock pb = new ParameterBlock();
     pb.addSource(image);               // Specify the source image
     pb.add(hist);                      // Specify the histogram
     pb.add(null);                      // No ROI
     pb.add(1);                         // Sampling
     pb.add(1);                         // periods
</PRE><TR valign="top"><TD><PRE>     // Perform the histogram operation.
     dst = (PlanarImage)JAI.create("histogram", pb, null);
</PRE><TR valign="top"><TD><PRE>     // Retrieve the histogram data.
     hist = (Histogram) dst.getProperty("histogram");
</PRE><TR valign="top"><TD><PRE>     // Print 3-band histogram.
     for (int i=0; i&lt; histogram.getNumBins(); i++) {
        System.out.println(hist.getBinSize(0, i) + " " +
                           hist.getBinSize(1, i) + " " +
                           hist.getBinSize(2, i) + " " +
     }
</PRE>
  <HR>

  <P><A name=51214>
  <H2>9.5 <IMG src="Image Analysis.files/space.gif">Edge Detection</H2></A>Edge 
  detection is useful for locating the boundaries of objects within an image. 
  Any abrupt change in image frequency over a relatively small area within an 
  image is defined as an edge. Image edges usually occur at the boundaries of 
  objects within an image, where the amplitude of the object abruptly changes to 
  the amplitude of the background or another object. 
  <P>The <CODE>GradientMagnitude</CODE> operation is an edge detector that 
  computes the magnitude of the image gradient vector in two orthogonal 
  directions. This operation is used to improve an image by showing the 
  directional information only for those pixels that have a strong magnitude for 
  the brightness gradient. 
  <P>
  <UL>
    <LI>It performs two convolution operations on the source image. One 
    convolution detects edges in one direction, the other convolution detects 
    edges the orthogonal direction. These two convolutions yield two 
    intermediate images.
    <P></P></LI></UL>
  <UL>
    <LI>It squares all the pixel values in the two intermediate images, yielding 
    two more intermediate images.
    <P></P></LI></UL>

⌨️ 快捷键说明

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