📄 374-378.html
字号:
<HTML>
<HEAD>
<META name=vsisbn content="1558515682"><META name=vstitle content="Java Digital Signal Processing"><META name=vsauthor content="Douglas A. Lyon"><META name=vsimprint content="M&T Books"><META name=vspublisher content="IDG Books Worldwide, Inc."><META name=vspubdate content="11/01/97"><META name=vscategory content="Web and Software Development: Programming, Scripting, and Markup Languages: Java"><TITLE>Java Digital Signal Processing:Image Processing in Java</TITLE>
<!-- HEADER --><STYLE type="text/css"> <!-- A:hover { color : Red; } --></STYLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<!--ISBN=1558515682//-->
<!--TITLE=Java Digital Signal Processing//-->
<!--AUTHOR=Douglas A. Lyon//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=9//-->
<!--PAGES=374-378//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="371-374.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="378-381.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>We say that the algorithm is <I>O</I>(<I>N<SUP>2</SUP></I>), because, in the worst case, we will be able to create vectors that are one pixel long. This is a pathological case created by an advisory and occurs when there is no pixel adjacency. This seldom happens. In fact, it might be better to consider an average case of <I>O</I>(<I>V<SUP>2</SUP></I>), where <I>V</I> would be the expected number of vectors. Computing the average case is probably practical only when the domain is known in advance (such as in a compression ratio for text images).</P>
<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">The Slope Class</FONT></H4>
<P>Two parameters are central in controlling the behavior of the raster to vector algorithm. The first, the slope tolerance, is stored in the <I>Slope</I> class. The second, the radius squared of a circle about the vector endpoints, is described in the next section. The following code resides in the <I>lyon.ipl</I> package and is contained in the <I>Slope.java</I> file:</P>
<!-- CODE SNIP //-->
<PRE>
package lyon.ipl;
class Slope {
public double dx, dy;
</PRE>
<!-- END CODE SNIP //-->
<P>The slope of a vector is represented by the change in <I>y</I> divided by the change in <I>x</I>. As we attempt to extend an existing vector, we will add to a vector’s endpoint only if the slope changes by less than some [epsilon] amount. The value of [epsilon] will depend on the desired compression ratio and the tolerance for loss in the compression. Lower values of [epsilon] will result in a higher compression ratio with greater loss.</P>
<!-- CODE SNIP //-->
<PRE>
public static double eps = 0.001;
Slope() {};
Slope(double dx_, double dy_) {
dx = dx_;
dy = dy_;
}
</PRE>
<!-- END CODE SNIP //-->
<P>The <I>isEqual</I> method checks for [epsilon] difference in the slopes between the existing slope and a proposed slope.</P>
<!-- CODE //-->
<PRE>
public boolean isEqual(Slope s) {
if (s.dx == 0 && dx == 0)
return true;
if ((s.dx != 0) &&( dx != 0))
return (Math.abs((s.dy/s.dx) - (dy/dx)) < eps);
else
return false;
}
} // class Slope
</PRE>
<!-- END CODE //-->
<H4 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077">The Points Class</FONT></H4>
<P>The <I>Points</I> class resides in the <I>lyon.ipl</I> package and is used to store a list of points that are used as input to the <I>Xy2vec</I> algorithm. A central parameter that controls the loss in the output as well as the compression ratio is the radius of a circle about a vector endpoint that determines adjacency.</P>
<P>To determine whether two points are adjacent, we use a Boolean method called <I>isAdjacent</I>, which we embed in the <I>Points</I> class:</P>
<!-- CODE SNIP //-->
<PRE>
package lyon.ipl;
class Points {
double x,y;
</PRE>
<!-- END CODE SNIP //-->
<P>The square of the radius of the distance between two points that are judged adjacent is called <I>dr</I>.</P>
<!-- CODE SNIP //-->
<PRE>
double dr = 1.0;
Points(double px, double py) {
x = px;
y = py;
}
</PRE>
<!-- END CODE SNIP //-->
<P>To decide whether two points are adjacent, we check the distance between them in pixels. This distance is compared with <I>dr</I>. We can adjust <I>dr</I> to be a number greater than 1, but it will introduce some geometric distortion:</P>
<!-- CODE //-->
<PRE>
public boolean isAdjacent(Points p) {
double dx = x-p.x;
double dy = y - p.y;
double r = dx * dx + dy * dy;
return r <= dr;
} // isPointsAdjacent
} // class Points
</PRE>
<!-- END CODE //-->
<H3><A NAME="Heading13"></A><FONT COLOR="#000077">Color Models</FONT></H3>
<P>Light energy is a form of electromagnetic radiation. As Maxwell said, it consists of waves propagated through an electromagnetic field according to electromagnetic laws [Banerjee]. A light source may radiate energy with several spectral components. To determine the spectra of a light source, an instrument called a spectrometer is used. A typical light source (such as a tungsten filament in an incandescent lamp) is heated to a temperature that causes a phenomenon known as <I>radiancy</I>. Radiancy is defined as the rate per unit surface area at which energy is radiated into the forward hemisphere [Resnick]. Radiancy is typically given in watts per centimeter squared and is found by integrating the <I>spectral radiancy</I>. The spectral radiancy is found by using a spectrometer to measure the amount of energy that falls over an area at a particular wavelength.</P>
<P>A <I>cavity radiator</I> is an idealized heated solid that emits a radiancy that is given by the following:</P>
<P ALIGN="CENTER"><IMG SRC="images/09-30d.jpg"></P>
<P>(9.18)
</P>
<P>Where <I>T</I> is in degrees Kelvin and is the Stefan-Boltzmann constant. A typical cavity radiator is made of a block of metal (such as tantalum, tungsten, or molybdenum). The cavity is created by drilling a small hole. Radiancy is typically measured when temperatures are in the 1,500–7,000 K range. It is important to realize that the radiancy at the surface of various materials is a material property but that the radiancy of all cavity radiators is governed by Equation 9.18 and is independent of the material.</P>
<P>Another attribute of the cavity radiator (which is also known as a <I>black-body radiator, full radiator,</I> or <I>Planckian radiator</I>) is the spectral radiancy. Spectral radiancy for the Planckian radiator is given by</P>
<P ALIGN="CENTER"><IMG SRC="images/09-31d.jpg"></P>
<P>(9.19)
</P>
<P>where</P>
<P ALIGN="CENTER"><IMG SRC="images/09-32d.jpg"></P>
<P>[Hunt].
</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>All cavity radiators have the same spectral radiancy.<HR></FONT>
</BLOCKQUOTE>
<P>To summarize, light is energy that has a spectral radiancy. We can compute the PSD for light just as we do for sound. To reconstruct the light we must therefore duplicate the spectral radiancy. Such an effort may be impractical if the objective is to build a computer display for the purpose of human vision. For the rest of this section, we discuss how to reconstruct the spectral radiancy of light for the purpose of human perception. This assumption enables the construction of practical computer display systems.
</P>
<P>The human perception of the spectral radiancy of light is called <I>color vision</I>. For the purpose of this discussion, we use the term <I>color</I> to mean the human perception of color. Our goal is to describe a color model that can assist in reconstructing colors for humans to see. In that case, color becomes a <I>psychophysical</I> quantity. The known relationships between the psychological color experience and physical light stimulation have given rise to several conflicting theories about how the human nervous system works [Teevan].</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="371-374.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="378-381.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<hr width="90%" size="1" noshade><div align="center"><font face="Verdana,sans-serif" size="1">Copyright © <a href="/reference/idgbooks00001.html">IDG Books Worldwide, Inc.</a></font></div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed --><!-- reference_subfoot = footer --><!-- reference_footer = subfoot --></BODY></HTML><!-- END FOOTER -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -