Java中的共形变换——圆盘到矩形
我必须将图像从光盘共形映射到矩形。
所附图像中的圆可以被视为内半径为零的圆盘。图像中的红线标记开始,蓝线标记结束。
我尝试过使用 AffineTransform在 Java 中,但它不允许您定义自定义转换。有人可以帮我解决这个问题吗?
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 radius 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您只需从极坐标转换为笛卡尔坐标即可。
mindprod 页面上提供了示例代码。
You only need to transform from polar to cartesian coordinates.
Example code is provided on mindprod page.
您不能使用
AffineTransform
,因为您的变换不是仿射变换:它不保留直线的直线度和平行度。不过,您可以定义自己的 Transformation 接口,并使用与 AffineTransform 类中类似的transform
方法来提供您喜欢的任何实现。当处理圆盘正中心的点时,您必须考虑该怎么做。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 ownTransformation
interface and provide whatever implementations you like, withtransform
methods similar to those in theAffineTransform
class. You will have to think about what to do when dealing with the point at the exact centre of the disc.如果您不需要编写代码而只对结果感兴趣,请使用 imageMagick
源:
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