问题
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.
EDIT: The points must be of any shape.
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.
回答1:
This might be what you are looking for
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
来源:https://stackoverflow.com/questions/34954955/java-transforming-bufferedimage-subimage-defined-by-4-points