📄 image enhancement.htm
字号:
<TD><A name=51309>254</A><BR>
<TR vAlign=top>
<TD><A name=51332>254</A><BR>
<TD><A name=51334>255</A><BR>
<TR vAlign=top>
<TD><A name=51336>255</A><BR>
<TD><A name=51338>255</A><BR></TR></TBODY></TABLE></A>
<P></P></DD></DL>This example provides a non-linear amplitude transformation
between input and output pixel values, in which the smaller input amplitude
values are amplified and the larger input values are attenuated. Other types
of lookup values can be used to solve nearly any non-linear amplitude scaling
problem.
<P><A name=51408>
<H3>7.6.1 <IMG src="Image Enhancement.files/space.gif">Creating the Lookup
Table</H3></A>The <CODE>LookupTableJAI</CODE> object represents a single- or
multi-banded table or a color cube of any supported data types. A single- or
multi-banded source image of integer data types is passed through the table
and transformed into a single- or multi-banded destination image of both
integral and float or double data types.
<P>The <CODE>LookupTableJAI</CODE> object is used for the
<CODE>ErrorDiffusion</CODE> operation, where it describes a color map, and the
<CODE>Lookup</CODE> operation, where it describes the lookup table. For the
<CODE>Lookup</CODE> operation, the table data may cover only a subrange of the
legal range of the input data type. The subrange is selected by means of an
offset parameter that is to be subtracted from the input value before indexing
into the table array.
<P>The procedures for constructing a lookup table vary slightly, depending on
whether the input image is single-banded or multi-banded. For a single-band
input image, you construct a single lookup table. For a multi-band image, you
construct a single lookup table with entries for each band.
<P><A name=56774>
<H4>7.6.1.1 <IMG src="Image Enhancement.files/space.gif">Creating a
Single-band Lookup Table</H4></A>The single-banded lookup table contains data
for a single channel or image component. To create a lookup table for a
single-band input image, use one of the single-band constructors. The
constructors take up to three parameters:
<P>
<UL>
<LI>A pointer to the data to be stored in the table. The data may be of type
<CODE>Byte</CODE>, <CODE>Short</CODE>, <CODE>UShort</CODE>,
<CODE>Int</CODE>, <CODE>Float</CODE>, or <CODE>Double</CODE>.
<P></P></LI></UL>
<UL>
<LI>The offset. The offset selects the lookup table subrange. The offset
value is subtracted from the input value before indexing into the table
array.
<P></P></LI></UL>
<UL>
<LI>A boolean flag that indicates whether Short data is of type Short or
UShort.
<P></P></LI></UL><A
href="http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-enhance.doc.html#69572">Listing
7-3</A> shows an example of the construction of a single-band byte lookup
table.
<P><CAPTION><FONT size=-1><B><A name=69572>
<CENTER><FONT size=-1><B><I>Listing 7-3 </I><IMG
src="Image Enhancement.files/sm-blank.gif" border=0> Example Single-band
Lookup Table</B></FONT></CENTER></A>
<P></B></FONT></CAPTION>
<HR>
<TR valign="top"><TD><PRE> byte[] tableData = new byte[0x10000];
for (int i = 0; i < 0x10000; i++) {
tableData[i] = (byte)(i >> 8);
}
// Create a LookupTableJAI object to be used with the
// "lookup" operator.
LookupTableJAI table = new LookupTableJAI(tableData);
</PRE>
<HR>
<P>
<TABLE border=0>
<TBODY>
<TR>
<TD><IMG src="Image Enhancement.files/cistine.gif"></TD>
<TD>
<HR>
<B>API:</B> <CODE>javax.media.jai.LookupTableJAI </CODE>
<HR>
</TD></TR></TBODY></TABLE><PRE><UL>
<LI>LookupTableJAI(byte[] data)
<P></P></LI></UL></PRE>
<DL><A name=52020>
<DT>
<DD>constructs a single-banded byte lookup table with an index offset of 0.
<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>data</CODE>
<P></P>
<TD>The single-banded byte data
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(byte[] data, int offset)
<P></P></LI></UL></PRE>
<DL><A name=55653>
<DT>
<DD>constructs a single-banded byte lookup table with an index offset.
<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>data</CODE>
<P></P>
<TD>The single-banded byte data
<P></P>
<TR vAlign=top>
<TD><CODE>offset</CODE>
<P></P>
<TD>The offset
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(short[] data, boolean isUShort)
<P></P></LI></UL></PRE>
<DL><A name=55831>
<DT>
<DD>constructs a single-banded short or unsigned short lookup table with an
index offset of 0.
<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>data</CODE>
<P></P>
<TD>The single-banded short data
<P></P>
<TR vAlign=top>
<TD><CODE>isUShort</CODE>
<P></P>
<TD>True if the data type is <CODE>DataBuffer.TYPE_USHORT</CODE>;
false if the data type is <CODE>DataBuffer.TYPE_SHORT</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(short[] data, int offset, boolean isUShort)
<P></P></LI></UL></PRE>
<DL><A name=55893>
<DT>
<DD>constructs a single-banded short or unsigned short lookup table with an
index offset.
<P>
<TABLE cellPadding=3 border=3>
<CAPTION><FONT size=-1><B></B></FONT></CAPTION>
<TBODY>
<TR vAlign=top>
<TD rowSpan=3><EM>Parameters</EM>:
<P></P>
<TD><CODE>data</CODE>
<P></P>
<TD>The single-banded short data
<P></P>
<TR vAlign=top>
<TD><CODE>offset</CODE>
<P></P>
<TD>The offset
<P></P>
<TR vAlign=top>
<TD><CODE>isUShort</CODE>
<P></P>
<TD>True if the data type is <CODE>DataBuffer.TYPE_USHORT</CODE>;
false if the data type is <CODE>DataBuffer.TYPE_SHORT</CODE>.
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(int[] data)
<P></P></LI></UL></PRE>
<DL><A name=56100>
<DT>
<DD>constructs a single-banded int lookup table with an index offset
<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>data</CODE>
<P></P>
<TD>The single-banded int data
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(int[] data, int offset)
<P></P></LI></UL></PRE>
<DL><A name=56136>
<DT>
<DD>constructs a single-banded int lookup table with an index offset
<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>data</CODE>
<P></P>
<TD>The single-banded int data
<P></P>
<TR vAlign=top>
<TD><CODE>offset</CODE>
<P></P>
<TD>The offset
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(float[] data)
<P></P></LI></UL></PRE>
<DL><A name=56333>
<DT>
<DD>constructs a single-banded float lookup table with an index offset of 0
<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>data</CODE>
<P></P>
<TD>The single-banded float data
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(float[] data, int offset)
<P></P></LI></UL></PRE>
<DL><A name=56373>
<DT>
<DD>constructs a single-banded float lookup table with an index offset
<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>data</CODE>
<P></P>
<TD>The single-banded float data
<P></P>
<TR vAlign=top>
<TD><CODE>offset</CODE>
<P></P>
<TD>The offset
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(double[] data)
<P></P></LI></UL></PRE>
<DL><A name=56522>
<DT>
<DD>constructs a single-banded double lookup table with an index offset of 0
<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>data</CODE>
<P></P>
<TD>The single-banded double data
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><PRE><UL>
<LI>LookupTableJAI(double[] data, int offset)
<P></P></LI></UL></PRE>
<DL><A name=56558>
<DT>
<DD>constructs a single-banded double lookup table with an index offset
<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>data</CODE>
<P></P>
<TD>The single-banded double data
<P></P>
<TR vAlign=top>
<TD><CODE>offset</CODE>
<P></P>
<TD>The offset
<P></P></TR></TBODY></TABLE></A>
<P></P></DD></DL><A name=56722>
<H4>7.6.1.2 <IMG src="Image Enhancement.files/space.gif">Creating a Multi-band
Lookup Table</H4></A>The multi-band lookup table contains data for more than
one channels or image components, such as separate arrays for R, G, and B. To
create a lookup table for a multi-band input image, use one of the multi-band
constructors. Like the single-band constructors, the multi-band constructors
take up to three parameters:
<P>
<UL>
<LI>A pointer to the data to be stored in the table. The data may be of type
Byte, Short, UShort, Int, Float, or Double.
<P></P></LI></UL>
<UL>
<LI>The offset. The offset selects the lookup table subrange. The offset
value is subtracted from the input value before indexing into the table
array. The constructors allow you to specify one offset for all of the bands
or separate offsets for each band.
<P></P></LI></UL>
<UL>
<LI>A boolean flag that indicates whether Short data is of type Short or
UShort.
<P></P></LI></UL><A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -