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


java.lang.Object
   javax.media.jai.Warp
      javax.media.jai.WarpPolynomial

All known Subclasses:   javax.media.jai.WarpQuadratic,  javax.media.jai.WarpGeneralPolynomial,  javax.media.jai.WarpCubic,  javax.media.jai.WarpAffine,
WarpPolynomial
abstract public class WarpPolynomial extends Warp (Code)
A polynomial-based description of an image warp.

The mapping is defined by two bivariate polynomial functions X(x, y) and Y(x, y) that map destination (x, y) coordinates to source X and Y positions respectively

The functions X(x, y) and Y(x, y) have the form:

 SUM{i = 0 to n} {SUM{j = 0 to i}{a_ij*x^(i - j)*y^j}}
 where n is the degree os the polynomial
 

WarpAffine, WarpQuadratic, and WarpCubic are special cases of WarpPolynomial for n equal to 1, 2, and 3 respectively. WarpGeneralPolynomial provides a concrete implementation for polynomials of higher degree.
See Also:   WarpAffine
See Also:   WarpQuadratic
See Also:   WarpCubic
See Also:   WarpGeneralPolynomial



Field Summary
protected  intdegree
     The degree of the polynomial, determined by the number of coefficients supplied via the X and Y coefficients arrays.
protected  floatpostScaleX
     A scaling factor applied to the result of the X polynomial evaluation which compensates for the input scaling, so that the correctly scaled result is obtained.
protected  floatpostScaleY
     A scaling factor applied to the result of the Y polynomial evaluation which compensates for the input scaling, so that the correctly scaled result is obtained.
protected  floatpreScaleX
     A scaling factor applied to input (dest) x coordinates to improve computational accuracy.
protected  floatpreScaleY
     A scaling factor applied to input (dest) y coordinates to improve computational accuracy.
protected  float[]xCoeffs
     An array of coefficients that maps a destination point to the source's X coordinate.
protected  float[]yCoeffs
     An array of coefficients that maps a destination point to the source's Y coordinate.

Constructor Summary
public  WarpPolynomial(float[] xCoeffs, float[] yCoeffs, float preScaleX, float preScaleY, float postScaleX, float postScaleY)
     Constructs a WarpPolynomial with a given transform mapping destination pixels into source space.
public  WarpPolynomial(float[] xCoeffs, float[] yCoeffs)
     Constructs a WarpPolynomial with pre- and post-scale factors of 1.

Method Summary
public static  WarpPolynomialcreateWarp(float[] sourceCoords, int sourceOffset, float[] destCoords, int destOffset, int numCoords, float preScaleX, float preScaleY, float postScaleX, float postScaleY, int degree)
     Returns an instance of WarpPolynomial or its subclasses that approximately maps the given scaled destination image coordinates into the given scaled source image coordinates.
public  float[][]getCoeffs()
     Returns the raw coefficients array for both the X and Y coordinate mapping.
public  intgetDegree()
     Returns the degree of the warp polynomials.
public  floatgetPostScaleX()
     Returns the scaling factor applied to the result of the X polynomial.
public  floatgetPostScaleY()
     Returns the scaling factor applied to the result of the Y polynomial.
public  floatgetPreScaleX()
     Returns the scaling factor applied to input (dest) X coordinates.
public  floatgetPreScaleY()
     Returns the scaling factor applied to input (dest) Y coordinates.
public  float[]getXCoeffs()
     Returns the raw coefficients array for the X coordinate mapping.
public  float[]getYCoeffs()
     Returns the raw coefficients array for the Y coordinate mapping.
public  Point2DmapDestPoint(Point2D destPt)
     Computes the source point corresponding to the supplied point.

This method returns the value of pt in the following code snippet:

 double dx = (destPt.getX() + 0.5)*preScaleX;
 double dy = (destPt.getY() + 0.5)*preScaleY;
 double sx = 0.0;
 double sy = 0.0;
 int c = 0;
 for(int nx = 0; nx <= degree; nx++) {
 for(int ny = 0; ny <= nx; ny++) {
 double t = Math.pow(dx, nx - ny)*Math.pow(dy, ny);
 sx += xCoeffs[c] * t;
 sy += yCoeffs[c] * t;
 c++;
 }
 }
 Point2D pt = (Point2D)destPt.clone();
 pt.setLocation(sx*postScaleX - 0.5, sy*postScaleY - 0.5);
 


Parameters:
  destPt - the position in destination image coordinatesto map to source image coordinates.

Field Detail
degree
protected int degree(Code)
The degree of the polynomial, determined by the number of coefficients supplied via the X and Y coefficients arrays.



postScaleX
protected float postScaleX(Code)
A scaling factor applied to the result of the X polynomial evaluation which compensates for the input scaling, so that the correctly scaled result is obtained.



postScaleY
protected float postScaleY(Code)
A scaling factor applied to the result of the Y polynomial evaluation which compensates for the input scaling, so that the correctly scaled result is obtained.



preScaleX
protected float preScaleX(Code)
A scaling factor applied to input (dest) x coordinates to improve computational accuracy.



preScaleY
protected float preScaleY(Code)
A scaling factor applied to input (dest) y coordinates to improve computational accuracy.



xCoeffs
protected float[] xCoeffs(Code)
An array of coefficients that maps a destination point to the source's X coordinate.



yCoeffs
protected float[] yCoeffs(Code)
An array of coefficients that maps a destination point to the source's Y coordinate.




Constructor Detail
WarpPolynomial
public WarpPolynomial(float[] xCoeffs, float[] yCoeffs, float preScaleX, float preScaleY, float postScaleX, float postScaleY)(Code)
Constructs a WarpPolynomial with a given transform mapping destination pixels into source space. Note that this is a backward mapping as opposed to the forward mapping used in AffineOpImage.

The xCoeffs and yCoeffs parameters must contain the same number of coefficients of the form (n + 1)(n + 2)/2 for some n, where n is the non-negative degree power of the polynomial. The coefficients, in order, are associated with the terms:

 1, x, y, x^2, x*y, y^2, ..., x^n, x^(n - 1)*y, ..., x*y^(n - 1), y^n
 
and coefficients of value 0 cannot be omitted.

The destination (x, y) coordinates are multiplied by the factors preScaleX and preScaleY prior to the evaluation of the polynomial. The results of the polynomial evaluations are multiplied by postScaleX and postScaleY to produce the source pixel coordinates. This process allows for better precision of the results.
Parameters:
  xCoeffs - The destination to source transform coefficients forthe X coordinate.
Parameters:
  yCoeffs - The destination to source transform coefficients forthe Y coordinate.
Parameters:
  preScaleX - The scale factor to apply to input (dest) X positions.
Parameters:
  preScaleY - The scale factor to apply to input (dest) Y positions.
Parameters:
  postScaleX - The scale factor to apply to the X polynomial output.
Parameters:
  postScaleY - The scale factor to apply to the Y polynomial output.
throws:
  IllegalArgumentException - if xCoeff or yCoeff have an illegal number of entries.




WarpPolynomial
public WarpPolynomial(float[] xCoeffs, float[] yCoeffs)(Code)
Constructs a WarpPolynomial with pre- and post-scale factors of 1.
Parameters:
  xCoeffs - The destination to source transform coefficients forthe X coordinate.
Parameters:
  yCoeffs - The destination to source transform coefficients forthe Y coordinate.




Method Detail
createWarp
public static WarpPolynomial createWarp(float[] sourceCoords, int sourceOffset, float[] destCoords, int destOffset, int numCoords, float preScaleX, float preScaleY, float postScaleX, float postScaleY, int degree)(Code)
Returns an instance of WarpPolynomial or its subclasses that approximately maps the given scaled destination image coordinates into the given scaled source image coordinates. The mapping is given by:
 x' = postScaleX*(xpoly(x*preScaleX, y*preScaleY));
 x' = postScaleY*(ypoly(x*preScaleX, y*preScaleY));
 

Typically, it is useful to set preScaleX to 1.0F/destImage.getWidth() and postScaleX to srcImage.getWidth() so that the input and output of the polynomials lie between 0 and 1.

The degree of the polynomial is supplied as an argument.
Parameters:
  sourceCoords - An array of floats containing thesource coordinates with X and Y alternating.
Parameters:
  sourceOffset - the initial entry of sourceCoordsto be used.
Parameters:
  destCoords - An array of floats containing thedestination coordinates with X and Y alternating.
Parameters:
  destOffset - The initial entry of destCoordsto be used.
Parameters:
  numCoords - The number of coordinates fromsourceCoords and destCoords to be used.
Parameters:
  preScaleX - The scale factor to apply to input (dest) X positions.
Parameters:
  preScaleY - The scale factor to apply to input (dest) Y positions.
Parameters:
  postScaleX - The scale factor to apply to X polynomial output.
Parameters:
  postScaleY - The scale factor to apply to the Y polynomial output.
Parameters:
  degree - The desired degree of the warp polynomials. An instance of WarpPolynomial.
throws:
  IllegalArgumentException - if arrays sourceCoords or destCoordsare too small




getCoeffs
public float[][] getCoeffs()(Code)
Returns the raw coefficients array for both the X and Y coordinate mapping. A cloned two-dimensional array of floats giving thepolynomial coefficients for the X and Y coordinate mapping.



getDegree
public int getDegree()(Code)
Returns the degree of the warp polynomials. The degree as an int.



getPostScaleX
public float getPostScaleX()(Code)
Returns the scaling factor applied to the result of the X polynomial.



getPostScaleY
public float getPostScaleY()(Code)
Returns the scaling factor applied to the result of the Y polynomial.



getPreScaleX
public float getPreScaleX()(Code)
Returns the scaling factor applied to input (dest) X coordinates.



getPreScaleY
public float getPreScaleY()(Code)
Returns the scaling factor applied to input (dest) Y coordinates.



getXCoeffs
public float[] getXCoeffs()(Code)
Returns the raw coefficients array for the X coordinate mapping. A cloned array of floats giving thepolynomial coefficients for the X coordinate mapping.



getYCoeffs
public float[] getYCoeffs()(Code)
Returns the raw coefficients array for the Y coordinate mapping. A cloned array of floats giving thepolynomial coefficients for the Y coordinate mapping.



mapDestPoint
public Point2D mapDestPoint(Point2D destPt)(Code)
Computes the source point corresponding to the supplied point.

This method returns the value of pt in the following code snippet:

 double dx = (destPt.getX() + 0.5)*preScaleX;
 double dy = (destPt.getY() + 0.5)*preScaleY;
 double sx = 0.0;
 double sy = 0.0;
 int c = 0;
 for(int nx = 0; nx <= degree; nx++) {
 for(int ny = 0; ny <= nx; ny++) {
 double t = Math.pow(dx, nx - ny)*Math.pow(dy, ny);
 sx += xCoeffs[c] * t;
 sy += yCoeffs[c] * t;
 c++;
 }
 }
 Point2D pt = (Point2D)destPt.clone();
 pt.setLocation(sx*postScaleX - 0.5, sy*postScaleY - 0.5);
 


Parameters:
  destPt - the position in destination image coordinatesto map to source image coordinates. a Point2D of the same class asdestPt.
throws:
  IllegalArgumentException - if destPt isnull.
since:
   JAI 1.1.2



Methods inherited from javax.media.jai.Warp
public Point2D mapDestPoint(Point2D destPt)(Code)(Java Doc)
public Rectangle mapDestRect(Rectangle destRect)(Code)(Java Doc)
public Point2D mapSourcePoint(Point2D sourcePt)(Code)(Java Doc)
public Rectangle mapSourceRect(Rectangle sourceRect)(Code)(Java Doc)
public int[] warpPoint(int x, int y, int subsampleBitsH, int subsampleBitsV, int[] destRect)(Code)(Java Doc)
public float[] warpPoint(int x, int y, float[] destRect)(Code)(Java Doc)
public int[] warpRect(int x, int y, int width, int height, int subsampleBitsH, int subsampleBitsV, int[] destRect)(Code)(Java Doc)
public float[] warpRect(int x, int y, int width, int height, float[] destRect)(Code)(Java Doc)
public int[] warpSparseRect(int x, int y, int width, int height, int periodX, int periodY, int subsampleBitsH, int subsampleBitsV, int[] destRect)(Code)(Java Doc)
abstract public float[] warpSparseRect(int x, int y, int width, int height, int periodX, int periodY, float[] destRect)(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.