1

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.

Community
  • 1
  • 1
Mysterious Wolf
  • 373
  • 1
  • 5
  • 22

1 Answers1

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

Hans
  • 2,354
  • 3
  • 25
  • 35
  • sorry i just looked at it again and found out that it doesn't solve my question, since i need the image of any shape - out of 4 points to be transformed into rectangle image, possibly the same aspect ratio as it would be if you would perpendicularly take a picture of it. – Mysterious Wolf Jan 22 '16 at 21:08