📄 378-381.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=378-381//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="374-378.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="381-386.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>Color sensation in the human eye is produced when light of various wavelengths falls upon the eye. Most of the color models in common use are based on the <I>tristimulus</I> theory of color perception. The theory is based on a physiological approach that attempts to explain the eye’s behavior in terms of its components. The eye is a photosensitive sensor that contains optical elements and photoreceptor cells. There are two types of photoreceptor cells: rods and cones. These cells enable a spectral response for human vision, which varies not only from person to person but also as an individual ages. Age alters the spectral response of the human eye, because age causes a progressive yellowing of the lens of the eye. Thus, there is no general agreement on the spectral sensitivities of the human visual system [Cowan et al.].</P>
<P>Rods are responsible for low-light imaging and do not play a part in normal color vision. The rods have varying amounts of a photosensitive pigment, called <I>rhodopsin</I>, that absorbs light most strongly in the blue-green part of the spectrum.</P>
<P>Cones are divided into three types: R, G, and B. It has not yet been possible to isolate the pigments in cones [Hunt]. The cones have been found to have a logarithmic response. Also, the spectral response for each of the cones differs in central frequency, peak amplitude, and bandwidth [Faugeras].</P>
<P>The tristimulus theory of color perception says that we need only three primary colors to create the gamut of visible color. Also, an examination of the spectral response curves should enable us to approximate the colors for which the cones have a peak spectral response. These curves happen at about 444 nm (B), 526 nm (G), and 645 nm (R) [Cohen et al.].</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>The red and green cones have a similar spectral sensitivity.<HR></FONT>
</BLOCKQUOTE>
<P>The typical range in human vision is from 380 to 770 nm. So RGB monitors (and systems for the storage of image data) have their roots in the human visual system. Furthermore, the perceptual system is logarithmic in response (for both vision and hearing!). This accounts for the popularity of the logarithmic companding techniques discussed in Chapter 5.
</P>
<P>The tristimulus theory leads to a color model that consists of a 3-D color space. A color model provides a framework for color specification. There are two kinds of color synthesis: additive synthesis and subtractive synthesis.</P>
<P>The <I>additive synthesis</I> color model adds light created via radiance. The RGB color model is a common example of an additive synthesis color model. In the RGB color model, red, green, and blue light are added in equal amounts to create various shades of gray. When red, green, and blue light are combined in equal amounts, at maximum intensity (on, for example, a computer monitor) the color is called white.</P>
<P>The <I>subtractive synthesis</I> color model removes light energy via absorption. The cyan, yellow, and magenta pigments are applied in equal amounts to make varying shades of black. Figure 9.14 shows the relationship between the RGB system and the CMY system. When colors are combined in equal amounts, the color-space points lie on the main diagonal between the white and black points on the color cube.</P>
<P><A NAME="Fig14"></A><A HREF="javascript:displayWindow('images/09-14.jpg',246,260 )"><IMG SRC="images/09-14t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/09-14.jpg',246,260)"><FONT COLOR="#000077"><B>Figure 9.14</B></FONT></A> Additive vs. subtractive color synthesis.</P>
<H4 ALIGN="LEFT"><A NAME="Heading14"></A><FONT COLOR="#000077">The HLS System</FONT></H4>
<P>One of the color spaces held in common use is the hue, luminance, and saturation (HLS) model. This model uses a cylindrical coordinate system, in which the magnitude of a vector is specified as a function of the height and angle. The height is used to represent luminance, and the angle is used to represent hue. The magnitude of the vector represents the saturation. The basic idea of the conversion is that red is assigned a hue angle of 0 degrees, blue, 240 degrees, and green, 120 degrees. Luminance and saturation vary from zero to 1, and the hue varies from zero to 360 degrees.
</P>
<P>The <I>ImageFrame</I> class has been modified to perform the RGB to HLS and HLS to RGB conversions. These facilities are built into the <I>ProcessPlane</I> (<I>pp</I>) instance. Their invocation follows:</P>
<!-- CODE SNIP //-->
<PRE>
public void rgb2hls() {
pp.rgb2hls();
updateDisplay(pp);
}
public void hls2rgb() {
pp.hls2rgb();
updateDisplay(pp);
}
</PRE>
<!-- END CODE SNIP //-->
<P>These are methods in the <I>ImageFrame</I>. The <I>ProcessPlane</I> instance is stored in <I>pp</I>. Menu items have been added to the <I>ImageFrame</I> to automate the invocation of the conversions. Figure 9.15 shows the Color menu from the <I>ImageFrame</I>.</P>
<P><A NAME="Fig15"></A><A HREF="javascript:displayWindow('images/09-15.jpg',119,194 )"><IMG SRC="images/09-15t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/09-15.jpg',119,194)"><FONT COLOR="#000077"><B>Figure 9.15</B></FONT></A> The color menu in the ImageFrame</P>
<P>One complicating aspect of color-space computation is the use of floating-point numbers in the transformation matrices. Recall that in the <I>ProcessPlane</I> class, we store an image as a packed array of 32-bit ints. Such an array is unsuitable for the storage of floating-point computations, because round-off error will build rapidly when only 8 bits are used to represent each color. To mitigate the effect of round-off error and to facilitate other floating-point computations, we have elected to store the images as three arrays of float. This approach presents the programmer with the burden of setting instances of the color conversion classes to null in order to reclaim memory. It also requires that the garbage collector be explicitly invoked if out-of-memory errors occur. We have found that this invocation is seldom needed, because we have associated these instances with windows that are under the users’ control. When a user disposes of an <I>ImageFrame</I> instance, all image data is reclaimed. Thus, memory errors will occur if too many windows are open. As a result, the user must close some windows before proceeding.</P>
<H4 ALIGN="LEFT"><A NAME="Heading15"></A><FONT COLOR="#000077">The IYQ System</FONT></H4>
<P>The IYQ system was invented for color television transmission. The symbol <I>I</I> stands for in-phase, <I>Y</I> for luminance, and <I>Q</I> for quadrature. The <I>IYQ</I> color space is used in several analog color television transmission systems, including PAL (Phase Alternating Lines), NTSC (National Television Systems Committee), and SECAM (Sequentiel Couleur avec Memoire). NTSC is used in the United States, Canada, Mexico, and Japan. SECAM is used in France, the former USSR, and eastern Europe. PAL is used in western Europe.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="374-378.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="381-386.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 + -