Java将BufferedImage“ Subimage”转换为由4分定义 [英] Java transforming BufferedImage "Subimage" defined by 4 Points

查看:56
本文介绍了Java将BufferedImage“ Subimage”转换为由4分定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在做我的学校项目上的一些工作,以至于我再次需要帮助:)我一直在研究如何用Java转换图像,但实际上我还没有找到关于以下方面的任何有用信息:那。我发现了这篇文章,但由于我对Python的了解不多我无法得到他们在做什么。我想做几乎相同的事情,但是用Java。有没有适合您的方法,或者您需要一些高级数学吗?

I've been doing some work on my school project and came to the point where i need help again :) I've been researching about transforming images in Java, but i haven't really found any useful information in terms of that. I have found this article but since I don't know much python i wasn't able to get what they are doing. I'd like to do pretty much the same thing, but in Java. Is there any method that does that for you or do you need some advanced math for it?

此外,我还要保持图像部分的长宽比与现实生活中相同。

Also additionally, i'd like to keep the aspect ratio of the part of image the same as in real life.

编辑:
点必须是任意形状。

The points must be of any shape.

编辑No2:
另外,我想知道如何从缓冲图像中获取任何形状的子图像。关于回答部分问题的评论...我需要我的程序以相反的方式做同样的事情...有什么方法可以计算图像的垂直纵横比吗?

EDIT No2: Also, i'd like to know how to get a subimage of any shape out of a Buffered image. And about the comment that answers a part of a problem... I need my program to do just the same thing reverse way... is there any way of calculating the perpendicular aspect ratio of the image?

如果您需要任何其他信息来回答我,请在下面的评论中问我,因为我不知道该怎么做。

If you need any additionall info to answer me this, please ask me in the comments below, since i don't have idea how i would do that.

推荐答案

这可能就是您要寻找的

https://docs.oracle.com /javase/7/docs/api/java/awt/image/BufferedImage.html#getSubimage(int,%20int,%20int,%20int)

您只需测量原始图像的宽度和高度,然后乘以一个公因子即可。

You'll can just measure the width and the height of you original image and multiply by a common factor

这篇关于Java将BufferedImage“ Subimage”转换为由4分定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆