Conformal transformation in Java - disc to rectangle
I have to conformally map an image, from a disc to a rectangle.
Image - disc to rectangle transformation
The circle in the attached image can be considered as a disc with an inner rad开发者_开发技巧ius of zero. The red line in the image marks the start, and the blue line marks the end.
I've tried using AffineTransform in Java, but it doesn't allow you to define custom transformations. Can someone help me tackle this problem?
You only need to transform from polar to cartesian coordinates.
Example code is provided on mindprod page.
You cannot use AffineTransform
because your transformation is not an affine one: it does not preserve straightness and parallelness of lines. You can, however, define your own Transformation
interface and provide whatever implementations you like, with transform
methods similar to those in the AffineTransform
class. You will have to think about what to do when dealing with the point at the exact centre of the disc.
In the case when you do not need to write the code and are only interested in the result, use imageMagick
source :
https://legacy.imagemagick.org/Usage/distorts/#depolar
精彩评论