Java image conversion

I need to create a 3d depth effect for my image. Number 1 is what I have, and number 2 is the form where I want to convert number 1. So is there any method for this in standard Java graphic libraries or in some other open source libraries?

alt text http://i26.tinypic.com/27y8ntj.png

+6
java image transform
source share
2 answers

This cannot be done using the AffineTransform class. See Wikipedia article on affine transformation:

In general, an affine transformation consists of linear transformations (rotation, scaling, or translation) and translation (or β€œtranslation”).

You need some form of perspective conversion. From http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/PerspectiveTransform.html

A promising transformation is able to map an arbitrary quadrangle into another arbitrary quadrangle, while maintaining a straight line of lines. Unlike affine conversion, parallelism of strings in the source is not necessarily preserved in the output.

From http://answers.google.com/answers/threadview/id/515829.html

The Java Advanced Visualization API makes it easy to perform perspective conversion.

As in Java2D and Java3D, these procedures are optimized, they do not start in the usual java-interpreted form - so they are very fast, as well.

JAI can be downloaded from

http://java.sun.com/products/java-media/jai/downloads/download-1_1_2.html

You can find information on how to start perspective conversion to:

http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/

+5
source share

If you want to do a lot of quick drawing in 3D, I would suggest looking in 3D rendering, such as OpenGL / JOGL.

If it's just a quick one-time conversion, you can easily simulate it with

  • Quoting all the lines in 2.
  • Scaling the corresponding line in 1. and drawing it on the line in 2, stretching it to the desired proportion (for this you need some basic mathematical data)
0
source share

All Articles