问题
I'm trying to understand how convolution matrix works in android and I want to use ScriptIntrinsicConvolve5x5 class to change contrast of my image.
I've multiple variations of this matrix:
R G B A W
R [c 0 0 0 0]
G [0 c 0 0 0]
B [0 0 c 0 0]
A [0 0 0 1 0]
W [t t t 0 1]
c = contrast t = (1.0 - c) / 2.0
But it doesn't work in ScriptIntrinsicConvolve5x5, all i see is a black screen. I want to use a RenderScript because of performance I've been able to change contrast with ColorMatrix class, but it is too slow.
So, my question is: what matrix should I use in ScriptIntrinsicConvolve5x5 in order to change image contrast? or if it's possible to do it with ScriptIntrinsicColorMatrix?
Thank you.
回答1:
Convolve5x5 is a fundamentally different operation that doesn't support different constants per channel. ColorMatrix is really the operation you want and should be fast. I'd suggest focusing on solving the performance issue with ColorMatrix.
来源:https://stackoverflow.com/questions/27441942/how-to-use-scriptintrinsicconvolve5x5-in-android