I am using BufferedImage from Java in an Android project. In this project the user is allowed to select a small portion of an image.
For example: If you have an image of a park with a building. The user can make small selections of grass and the android program needs to save the coordinates of this selection.
I was wondering if there is functionality in BufferedImage that supports this: letting an user select small portions of the image (using touch screen) and getting coordinates from those locations in the image. If not, what else can I do?
You can store the pixel position (x, y) (i.e. cursor position) of the click in to SQLite database and you don’t need to store all values around it. If you want to check a click which comes around this pixel (with a tolerance value), the following code will help you :
Here,
xyOriginalPixelis the original pixel point which is stored in the database and thexyReceivedPixelis the pixel point that is got when another click was made or a pixel point that is to be compared with it. ThexyReceivedPixelis checked whether it is near byxyOriginalPixelwith the maximum difference oftoleranceValue.