这里我对安卓的LUT有疑问。
我有一个4X4 LUT,我的问题是使用这些LUT将滤镜效果应用于android位图图像。下面是到示例LUT文件的链接。
lut link样本
安卓可以吗? 请告诉我申请方法。
提前表示感谢。
解决方法:
我正在研究LUT APP应用程序库,以简化在Android中使用lut图像的过程。 虽然它使用了以下algorythm,但我们希望将来加强它以优化内存使用: 目前还推测了LUT的颜色轴:
3359 github.com/DNT ks/easy lut/wiki
你的LUT图像的红绿蓝颜色尺寸和我以前的颜色尺寸不一样,所以我必须改变获取LUT索引的顺序。 (getLutIndex ) )。
请检查我编辑的答案:
final static int X_DEPTH=16;
final static int Y_DEPTH=16; //onelittlesquarehas 16x 16 pixels init
final static int ROW_DEPTH=4;
final static int COLUMN_DEPTH=4; //theimageconsistsof 4x4little squares
finalstaticintcolor _ distortion=16; //256*256*256=256 no distortion,64 * 64 * 64=256 dividiedby4=64,16x 16x 16=256 dividiedby 16=16
专用位图papplyluttobitmap (位图src,位图Lu tbitmap ) {
int lutWidth=lutBitmap.getWidth (;
intlutcolors [ ]=new int [ lut width * Lu tbitmap.getheight (
lutbitmap.getpixels(lutcolors,0,lutWidth,0,0,lutWidth,lutBitmap.getHeight () );
int mWidth=src.getWidth (;
int mHeight=src.getHeight (;
int [ ] pix=new int [ m width * mheight ];
SRC.getPixels(pix,0,mWidth,0,0,mWidth,mHeight );
int R、g、b;
for(inty=0; y mHeight; y )
for(intx=0; x mWidth; x ) {
int index=y * mWidth x;
intr=(pix[index]16 )0xff )/COLOR_DISTORTION;
intg=(pix[index]8)0xff )/COLOR_DISTORTION;
intb=(pix[index]0xff )/COLOR_DISTORTION;
intlutindex=getlutindex (lut width,r,g,b );
r=() lutcolors[lutindex]16 )0xff );
g=() lutcolors[lutindex]8)0xff );
b=() lutcolors[lutindex] )0xff );
pix[index]=0xff000000|(r16 )|(G8 )| B;
}
bitmapfilteredbitmap=bitmap.create bitmap (m width,mHeight,src.getConfig );
过滤的bitmap.set pixels (pix,0,mWidth,0,0,mWidth,mHeight );
返回过滤位映射;
}
//the magic happens here
私有深度(intlutwidth,int redDepth,int greenDepth,int blueDepth ) {
intl utx=(绿色深度% row _ depth ) * X_DEPTH blueDepth;
int luty=(green depth/column _ depth ) * Y_DEPTH redDepth;
返回luty * lut width lutx;
}
标签: android、bitmap、lookup-tables
资料来源: https://codeday.me/bug/2019 06 09/1202976.html