Java Doc for KMeansOpImage.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » ca » forklabs » media » jai » opimage » 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 » ca.forklabs.media.jai.opimage 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.media.jai.UntiledOpImage
   ca.forklabs.media.jai.opimage.KMeansOpImage

KMeansOpImage
public class KMeansOpImage extends UntiledOpImage (Code)
Class KMeansOpImage is the OpImage for operator kmeans.
author:
   Daniel Léonard
version:
   $Revision: 1.2 $


Field Summary
protected  intclusters
     The number of clusters to make.
protected  int[][]color_map
     The color map of the segmented image.
protected  KMeansDescriptor.EvaluationFunctionfunction
     The evaluation function.
protected  intiterations
     The number of iteration to perform.

Constructor Summary
public  KMeansOpImage(RenderedImage source, int clusters, KMeansDescriptor.EvaluationFunction function, int iterations, int[][] color_map, Map hints, ImageLayout layout)
     Constructor.

Method Summary
protected  double[]calculateSquareDistances(double[] pixel, double[][] centers, double[] distances)
     Calculate the square of the distance of the pixel from each center pixel.
Parameters:
  pixel - the pixel.
Parameters:
  centers - the center pixels.
Parameters:
  distances - the arrays to store the square distances.
protected  voidcomputeImage(Raster[] sources, WritableRaster sink, Rectangle bounds)
     Computes the k-means image.
protected  intfindClosestCenter(double[] distances)
     Gets the position of the smallest distance.
Parameters:
  distances - the distances.
protected  intgetClusters()
     Gets the desired number of clusters.
protected  int[][]getColorMap()
     Gets the color map.
protected  KMeansDescriptor.EvaluationFunctiongetEvaluationFunction()
     Gets the evaluation function.
protected  intgetIterations()
     Gets the desired number of iterations.
protected  StringgetUnknownDataTypeErrorMessage(int type)
     Gets the error message telling that the raster data type is unknown.
Parameters:
  type - the bad type.
protected  double[][]initializeCenters(Raster source, Rectangle bounds, KMeansDescriptor.EvaluationFunction function)
     Initialize the new centers.
protected  voidresetNewCenters(double[][] positions, double[] population)
     Resets the new center data structures.
protected  voidsetClusters(int clusters)
     Changes the number of clusters.
protected  voidsetColorMap(int[][] color_map)
     Changes the color map.
protected  voidsetEvaluationFunction(KMeansDescriptor.EvaluationFunction function)
     Changes the evaluation function.
protected  voidsetIterations(int iterations)
     Changes the number of iterations.
protected  voidsetup(int clusters, KMeansDescriptor.EvaluationFunction function, int iterations, int[][] color_map)
     Sets up this image.
protected  voidsortCenters(double[][] centers)
     Performs a stable in-place sort of the center from smallest to greatest.

Field Detail
clusters
protected int clusters(Code)
The number of clusters to make.



color_map
protected int[][] color_map(Code)
The color map of the segmented image.



function
protected KMeansDescriptor.EvaluationFunction function(Code)
The evaluation function.



iterations
protected int iterations(Code)
The number of iteration to perform.




Constructor Detail
KMeansOpImage
public KMeansOpImage(RenderedImage source, int clusters, KMeansDescriptor.EvaluationFunction function, int iterations, int[][] color_map, Map hints, ImageLayout layout)(Code)
Constructor.
Parameters:
  source - the image to segment.
Parameters:
  clusters - the number of desired clusters.
Parameters:
  function - the evaluation function.
Parameters:
  iterations - the maximum number of iterations.
Parameters:
  color_map - the color_map of the segmented image.
Parameters:
  hints - rendering hints.
Parameters:
  layout - image layout.




Method Detail
calculateSquareDistances
protected double[] calculateSquareDistances(double[] pixel, double[][] centers, double[] distances)(Code)
Calculate the square of the distance of the pixel from each center pixel.
Parameters:
  pixel - the pixel.
Parameters:
  centers - the center pixels.
Parameters:
  distances - the arrays to store the square distances. distances .



computeImage
protected void computeImage(Raster[] sources, WritableRaster sink, Rectangle bounds)(Code)
Computes the k-means image.
Parameters:
  sources - the source rasters.
Parameters:
  sink - the sink raster.
Parameters:
  the - bounds to work within.



findClosestCenter
protected int findClosestCenter(double[] distances)(Code)
Gets the position of the smallest distance.
Parameters:
  distances - the distances. the position.



getClusters
protected int getClusters()(Code)
Gets the desired number of clusters. the number of clusters.



getColorMap
protected int[][] getColorMap()(Code)
Gets the color map. the color map.



getEvaluationFunction
protected KMeansDescriptor.EvaluationFunction getEvaluationFunction()(Code)
Gets the evaluation function. the function.



getIterations
protected int getIterations()(Code)
Gets the desired number of iterations. the number of iterations.



getUnknownDataTypeErrorMessage
protected String getUnknownDataTypeErrorMessage(int type)(Code)
Gets the error message telling that the raster data type is unknown.
Parameters:
  type - the bad type. the formatted error message.



initializeCenters
protected double[][] initializeCenters(Raster source, Rectangle bounds, KMeansDescriptor.EvaluationFunction function)(Code)
Initialize the new centers. It tries to have different values for centers, but is not always capable of doing so, especially if there are less segments than clusters.
Parameters:
  source - the source.
Parameters:
  bounds - the source boundaries.
Parameters:
  function - the evaluation function. the initial centers.



resetNewCenters
protected void resetNewCenters(double[][] positions, double[] population)(Code)
Resets the new center data structures.
Parameters:
  positions - the position of the new centers.
Parameters:
  population - the population of each new center.



setClusters
protected void setClusters(int clusters)(Code)
Changes the number of clusters.
Parameters:
  clusters - the new number of clusters.



setColorMap
protected void setColorMap(int[][] color_map)(Code)
Changes the color map.
Parameters:
  color_map - the new color map.



setEvaluationFunction
protected void setEvaluationFunction(KMeansDescriptor.EvaluationFunction function)(Code)
Changes the evaluation function.
Parameters:
  function - the new function.



setIterations
protected void setIterations(int iterations)(Code)
Changes the number of iterations.
Parameters:
  iterations - the new number of iterations.



setup
protected void setup(int clusters, KMeansDescriptor.EvaluationFunction function, int iterations, int[][] color_map)(Code)
Sets up this image.
Parameters:
  clusters - the number of desired clusters.
Parameters:
  function - the evaluation function.
Parameters:
  iterations - the number of desired iterations.
Parameters:
  color_map - the color map.



sortCenters
protected void sortCenters(double[][] centers)(Code)
Performs a stable in-place sort of the center from smallest to greatest. A center is smaller if its square distance from the origin is smaller then another square distance.
Parameters:
  centers - the center to sort.



Methods inherited from javax.media.jai.UntiledOpImage
abstract protected void computeImage(Raster[] sources, WritableRaster dest, Rectangle destRect)(Code)(Java Doc)
public Raster computeTile(int tileX, int tileY)(Code)(Java Doc)
public Point[] getTileDependencies(int tileX, int tileY, int sourceIndex)(Code)(Java Doc)
public Rectangle mapDestRect(Rectangle destRect, int sourceIndex)(Code)(Java Doc)
public Rectangle mapSourceRect(Rectangle sourceRect, int sourceIndex)(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.