I am developing an image filter app. To apply the effects to the images, i compute a matrix convolution between the image bmp and a kernel.
First, i implemented a convolute() function, but it turned out to be really slow when running it.(it was 4 loops iterating the bitmap and the kernel).
Maybe i was doing something wrong and there is a way to do this faster, but when searching for that i found that android has a renderScript built in to compute matrix convolution.
Now, i tryied the convolution with ScriptIntrinsicConvolve3x3 and it worked really fast. The only problem is that the effects turned out to be really light. I mean, after applying the convolution with an edge detection kernel for example, it works, but the image is too white to be able to notice it.
My guess is that the value multiplication inside the convolution is not separating by color component(a,r,g,b) and that somehow makes the resulting image have the wrong colors.
Does anyone know how this works? Is there any other way i can do this so that it works fast? I was thinking maybe write the convolve function in my own renderScript. Dont know if its worth it.
Aucun commentaire:
Enregistrer un commentaire