Java Doc for ColorQuantizerDescriptor.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » media » jai » operator » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » javax.media.jai.operator 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.media.jai.OperationDescriptorImpl
      javax.media.jai.operator.ColorQuantizerDescriptor

ColorQuantizerDescriptor
public class ColorQuantizerDescriptor extends OperationDescriptorImpl (Code)
This OperationDescriptor defines the "ColorQuantizer" operation.

This operation generates an optimal lookup table (LUT) based on the provided 3-band RGB source image by executing a color quantization algorithm. This LUT is stored in the property "JAI.LookupTable" that has a type of LookupTableJAI. Thus, it can be retrieved by means of getProperty. This LUT can be further utilized in other operations such as "errordiffusion" to convert the 3-band RGB image into a high-quality color-indexed image. The computation of the LUT can be deferred by defining a DeferredProperty from the property "JAI.LookupTable" and providing that as the parameter value for "errordiffusion". This operation also creates a color-indexed destination image based on the nearest distance classification (without dithering). However, the quality of this classification result may not be as good as the result of "errordiffusion".

The supported source image data type is implementation-dependent. For example, the Sun implementation will support only the byte type.

The data set used in the color quantization can be defined by the optional parameters xPeriod, yPeriod and ROI. If these parameters are provided, the pixels in the subsampled image (and in the ROI) will be used to compute the LUT.

Three built-in color quantization algorithms are supported by this operation: Paul Heckbert's median-cut algorithm, Anthony Dekker's NeuQuant algorithm, and the Oct-Tree color quantization algorithm of Gervautz and Purgathofer.

The median-cut color quantization computes the 3D color histogram first, then chooses and divides the largest color cube (in number of pixels) along the median, until the required number of clusters is obtained or all the cubes are not separable. The NeuQuant algorithm creates the cluster centers using Kohonen's self-organizing neural network. The Oct-Tree color quantization constructs an oct-tree of the color histogram, then repeatedly merges the offspring into the parent if they contain a number of pixels smaller than a threshold. With the equivalent parameters, the median-cut algorithm is the fastest, and the NeuQuant algorithm is the slowest. However, NeuQuant algorithm can still generate a good result with a relatively high subsample rate, which is useful for large images. In these three algorithms, the Oct-Tree algorithm is the most space consuming one. For further details of these algorithms, please refer to the following references:
Algorithm References
Median-Cut Color Image Quantization for Frame Buffer Display, Paul Heckbert, SIGGRAPH proceedings, 1982, pp. 297-307
NeuQuant Kohonen Neural Networks for Optimal Colour Quantization, Anthony Dekker, In Network: Computation in Neural Systems, Volume 5, Institute of Physics Publishing, 1994, pp 351-367.
Oct-Tree Interactive Computer Graphics: Functional, Procedural, and Device-Level Methods by Peter Burger and Duncan Gillis, Addison-Wesley, 1989, pp 345.

The generated LUT may have fewer entries than expected. For example, the source image might not have as many colors as expected. In the oct-tree algorithm, all the offspring of a node are merged if they contain a number of pixels smaller than a threshold. This may result in slightly fewer colors than expected.

The learning procedure of the NeuQuant algorithm randomly goes through all the pixels in the training data set. To simplify and speed up the implementation, the bounding rectangle of the provided ROI may be used (by the implementation) to define the training data set instead of the ROI itself.

Resource List
Name Value
GlobalName ColorQuantizer
LocalName ColorQuantizer
Vendor com.sun.media.jai
Description Generates an optimal LUT by executing a color quantization algorithm, and a color-indexed image by the nearest distance classification.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ColorQuantizerDescriptor.html
Version 1.1
arg0Desc The color quantization algorithm name. One of ColorQuantizerDescriptor.MEDIANCUT, ColorQuantizerDescriptor.NEUQUANT, or ColorQuantizerDescriptor.OCTTREE
arg1Desc The maximum color number, that is, the expected number of colors in the result image.
arg2Desc This is an algorithm-dependent parameter. For the median-cut color quantization, it is the maximum size of the three-dimensional histogram. For the neuquant color quantization, it is the number of cycles. For the oct-tree color quantization, it is the maximum size of the oct-tree.
arg3Desc The ROI in which the pixels are involved into the color quantization.
arg4Desc The subsample rate in x direction.
arg4Desc The subsample rate in y direction.

Parameter List
Name Class Type Default Value
quantizationAlgorithm javax.media.jai.operator.ColorQuantizerType ColorQuantizerDescriptor.MEDIANCUT
maxColorNum java.lang.Integer 256
upperBound java.lang.Integer 32768 for median-cut, 100 for neuquant, 65536 for oct-tree
roi javax.media.jai.ROI null
xPeriod java.lang.Integer 1
yPeriod java.lang.Integer 1


See Also:   javax.media.jai.ROI
See Also:   javax.media.jai.OperationDescriptor
since:
   JAI 1.1.2


Field Summary
final public static  ColorQuantizerTypeMEDIANCUT
     The pre-defined median-cut color quantization algorithm.
final public static  ColorQuantizerTypeNEUQUANT
     The pre-defined NeuQuant color quantization algorithm.
final public static  ColorQuantizerTypeOCTTREE
     The pre-defined Oct-Tree color quantization algorithm.

Constructor Summary
public  ColorQuantizerDescriptor()
     Constructor.

Method Summary
public static  RenderedOpcreate(RenderedImage source0, ColorQuantizerType algorithm, Integer maxColorNum, Integer upperBound, ROI roi, Integer xPeriod, Integer yPeriod, RenderingHints hints)
     Color quantization on the provided image.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(StringParameterBlockRenderingHints) .
See Also:   JAI
See Also:   ParameterBlockJAI
See Also:   RenderedOp
Parameters:
  source0 - RenderedImage source 0.
Parameters:
  algorithm - The algorithm to be chosen.

public  RangegetParamValueRange(int index)
     Returns the minimum legal value of a specified numeric parameter for this operation.
protected  booleanvalidateParameters(String modeName, ParameterBlock args, StringBuffer msg)
     Returns true if this operation is capable of handling the input parameters.

Field Detail
MEDIANCUT
final public static ColorQuantizerType MEDIANCUT(Code)
The pre-defined median-cut color quantization algorithm.



NEUQUANT
final public static ColorQuantizerType NEUQUANT(Code)
The pre-defined NeuQuant color quantization algorithm.



OCTTREE
final public static ColorQuantizerType OCTTREE(Code)
The pre-defined Oct-Tree color quantization algorithm.




Constructor Detail
ColorQuantizerDescriptor
public ColorQuantizerDescriptor()(Code)
Constructor.




Method Detail
create
public static RenderedOp create(RenderedImage source0, ColorQuantizerType algorithm, Integer maxColorNum, Integer upperBound, ROI roi, Integer xPeriod, Integer yPeriod, RenderingHints hints)(Code)
Color quantization on the provided image.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(StringParameterBlockRenderingHints) .
See Also:   JAI
See Also:   ParameterBlockJAI
See Also:   RenderedOp
Parameters:
  source0 - RenderedImage source 0.
Parameters:
  algorithm - The algorithm to be chosen. May be null.
Parameters:
  maxColorNum - The maximum color number. May be null.
Parameters:
  upperBound - An algorithm-dependent parameter. See the parametertable above. May be null.
Parameters:
  roi - The region of interest. May be null.
Parameters:
  xPeriod - The X subsample rate. May be null.
Parameters:
  yPeriod - The Y subsample rate. May be null.
Parameters:
  hints - The RenderingHints to use.May be null. The RenderedOp destination.
throws:
  IllegalArgumentException - if source0 is null.




getParamValueRange
public Range getParamValueRange(int index)(Code)
Returns the minimum legal value of a specified numeric parameter for this operation.



validateParameters
protected boolean validateParameters(String modeName, ParameterBlock args, StringBuffer msg)(Code)
Returns true if this operation is capable of handling the input parameters.

In addition to the default validations done in the super class, this method verifies that the provided quantization algorithm is one of the three predefined algorithms in this class.
throws:
  IllegalArgumentException - If args is null.
throws:
  IllegalArgumentException - If msg is nulland the validation fails.




Fields inherited from javax.media.jai.OperationDescriptorImpl
final protected String[][] resources(Code)(Java Doc)
final protected String[] sourceNames(Code)(Java Doc)
final protected String[] supportedModes(Code)(Java Doc)

Methods inherited from javax.media.jai.OperationDescriptorImpl
public boolean arePropertiesSupported()(Code)(Java Doc)
protected static Class getDefaultSourceClass(String modeName)(Code)(Java Doc)
public Class getDestClass(String modeName)(Code)(Java Doc)
public Class getDestClass()(Code)(Java Doc)
public Object getInvalidRegion(String modeName, ParameterBlock oldParamBlock, RenderingHints oldHints, ParameterBlock newParamBlock, RenderingHints newHints, OperationNode node)(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public int getNumParameters()(Code)(Java Doc)
public int getNumSources()(Code)(Java Doc)
public Class[] getParamClasses()(Code)(Java Doc)
public Object getParamDefaultValue(int index)(Code)(Java Doc)
public Object[] getParamDefaults()(Code)(Java Doc)
public Number getParamMaxValue(int index)(Code)(Java Doc)
public Number getParamMinValue(int index)(Code)(Java Doc)
public String[] getParamNames()(Code)(Java Doc)
public ParameterListDescriptor getParameterListDescriptor(String modeName)(Code)(Java Doc)
public PropertyGenerator[] getPropertyGenerators(String modeName)(Code)(Java Doc)
public PropertyGenerator[] getPropertyGenerators()(Code)(Java Doc)
public Class getRenderableDestClass()(Code)(Java Doc)
public Class[] getRenderableSourceClasses()(Code)(Java Doc)
public ResourceBundle getResourceBundle(Locale locale)(Code)(Java Doc)
public String[][] getResources(Locale locale)(Code)(Java Doc)
public Class[] getSourceClasses(String modeName)(Code)(Java Doc)
public Class[] getSourceClasses()(Code)(Java Doc)
public String[] getSourceNames()(Code)(Java Doc)
public String[] getSupportedModes()(Code)(Java Doc)
public boolean isImmediate()(Code)(Java Doc)
public boolean isModeSupported(String modeName)(Code)(Java Doc)
public boolean isRenderableSupported()(Code)(Java Doc)
public boolean isRenderedSupported()(Code)(Java Doc)
protected static Class[][] makeDefaultSourceClassList(String[] supportedModes, int numSources)(Code)(Java Doc)
public boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
public boolean validateArguments(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateParameters(String modeName, ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateParameters(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
public boolean validateRenderableArguments(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateRenderableSources(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateSources(String modeName, ParameterBlock args, StringBuffer msg)(Code)(Java Doc)
protected boolean validateSources(ParameterBlock args, StringBuffer msg)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.