이미지에 대한 많은 해결 효과를 얻었습니다. 그러나 나는 선택 GPUImage (GPUImageLookupFilter
) 내 이미지를 확인하십시오.
내 소스 코드를 사용합니다. 나 라이브러리에 비디오 또는 선택 많은 이미지 배열의 이미지 (엄지 손가락으로 작동 할 때
IO - Objective-c GPUImage 조회 필터는 조회 이미지와 함께 효과를냅니다. 4x4
GPUImagePicture *sourceImagePic = [[GPUImagePicture alloc] initWithImage:sourceImage];
GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"lookup.png"]];
GPUImageLookupFilter *lookupImageFilter = [[GPUImageLookupFilter alloc] init];
[sourceImagePic addTarget:lookupImageFilter];
[lookupImageSource addTarget:lookupImageFilter];
[lookupImageFilter useNextFrameForImageCapture];
[sourceImagePic processImage];
[lookupImageSource processImage];
resultImage = [lookupImageFilter imageFromCurrentFramebufferWithOrientation:UIImageOrientationUp];
return resultImage;
우선 전 조회 화상의 8x8 (512 2)
를 사용하지만) 메모리가 더 높습니다.
작은 조회 이미지 (4x4)를 사용하면 메모리를 줄일 수 있다고 생각합니다. 조회 이미지 4x4 (16)를 만듭니다.
와 나는 GPUImageLookupFilter
의 편집 코드를 시도했지만 작동하지.
void main(){
highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
highp float blueColor = textureColor.b * 63.0;
highp vec2 quad1;
quad1.y = floor(floor(blueColor)/8.0);
quad1.x = floor(blueColor) - (quad1.y * 8.0);
highp vec2 quad2;
quad2.y = floor(ceil(blueColor)/8.0);
quad2.x = ceil(blueColor) - (quad2.y * 8.0);
highp vec2 texPos1;
texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
highp vec2 texPos2;
texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);
lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);
lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
gl_FragColor = mix(textureColor, vec4(newColor.rgb, textureColor.w), intensity);
}
날 이미지 4 × 4와 코드가 작동을 편집 할 수 있습니다.
고맙습니다!.
왜 63.0을 변경하지 않습니까? 나는 15.0을 바꾼다? –
왜 63입니까? 63 = 2^6 - 1? 감사합니다. –
. 그것은 작동합니다. 63.0은 알 수 없습니다 :). –