04-16-2012 07:14 PM - edited 04-16-2012 07:14 PM
I note that you have looked at the code given here:
I have had a chance to look at this code now.
The code in the Thread appears to be an implementation of the source from the following link (and uses the "Convolution Matrix"). :
Unfortunately, the implementation is not correct, in fact it is wrong in a number of places. But despite a suggestion to debug the code,
the OP appeared to have no intention of looking hard at the code himself, but asked a number of similar questions on and off the forum:
In fact, I think the code supplied in the link can be used - I have managed to implement this code and it seems to be working. When compared with the supplied implementation, the changes I made to get the code working were not tricky, if you spent the time understanding what the code was doing and how get/setargb work, I suspect you could fix it too.
To demonstrate I got it working, here is the link showing a number of image manipulations, including emboss:
and attached is screen shot from a BlackBerry 9800 Simulator showing emboss:
So have a look at the implementation supplied by the OP, review the Android code from the link above, correct the code as necessary and give it a shot,
04-17-2012 02:26 AM
04-17-2012 04:38 AM
Only had a very quick look, but these lines look wrong to me:
A = pixels[q][r] >> 24;
R = pixels[q][r] >> 16;
G = pixels[q][r] >> 8;
B = pixels[q][r];
Remove A from here, you don't need it in this loop.
The others should be anded with 0xFF, for example:
R = (pixels[q][r] >> 16) & 0xFF;
I would also change this:
A = pixels >> 24;
A = pixels & 0xFF000000;
Then use it later:
arb[y * width + x] = A | R << 16 | G << 8 | B);
Hope this helps.