I am trying to apply some filters on a Image. To apply the filter, i have to first create an array:
int[] arr = new int[image.width*image.height];// to store each pixel
and then i can pass it to the function which will apply the filter.
Problem: If i have an image greater than 500kb(around), OOME is there saying hello to me.
What i tried: Divide the full image into four parts and apply filter on each part and then join them but again i got OOME in the same line, i.e when creating the int array.
I dont want to compromise on the quality of Image and downsize it.
What i really want is just a hint/logic/architecture which can work on the large image as big as 5 mb….
One way to handle this is to tile the image, like you suggested. Catch the OOME, and keep halving the size of your tiles until the array allocates successfully.
Then process each tile sequentially, re-using the array each time.