I got a bitmap, on that bitmap I got 3 or 4 white points, then when I hit a button, it should make a square (with those points as the edges). I got 2 pictures to demonstrate what I mean, because it could be a little bit confusing.

This must be “convert” to:

I will explain why I want/need this (short).
People can take a picture of the ground (dirt + plants) then my app calculates how many % green their is.
But to get it more accurate, they need to have 3 or 4 white poles in the ground, so the app always calculates the same region of the ground. So I want my app to connect those poles (little white squares) to 1 big square (bottom photo) then only calculate the inside of the square.
But I don’t know how to “tell” the android to connect those poles.
I know how I can “read” colors (RGB).
But how can I say that he needs to “connect” the poles?
I hope you understand what I mean, if not, tell me then I will try to improve my answer.
The solution to your problem is pretty simple.
Say you have the following points:
The missing point, say
p4can easily be calculated and is :p4(x1, y2)Render your image in a panel (
JPanelfor example) and then draw a rectangle with the following points:p1(x1, y1) p2(x2, y1) p3(x2, y2) p4(x1, y2)