How to use ScriptIntrinsicConvolve5x5 in android?

回眸只為那壹抹淺笑 提交于 2019-12-11 11:07:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!