Chcę coś podobnego do logo GPU, inny filtr na każdym rogu.Jak korzystać z GPUImage, podzielić obraz na 4 i zastosować różne filtry do wszystkich 4 rogów i zrekombinować?
Do tej pory udało mi się to osiągnąć, ale rozmiar obrazu to połowa z oryginałem. Tutaj uproszczenie mojego kodu:
_cropTopLeft = [[GPUImageCropFilter alloc]
initWithCropRegion:CGRectMake(0.0, 0.0, 0.5, 0.5)];
CGAffineTransform topLeftTransform = CGAffineTransformMakeTranslation(-1, -1);
topLeftTransform = CGAffineTransformScale(topLeftTransform, 0.5, 0.5);
_transformTL = [[GPUImageTransformFilter alloc] init];
_transformTL.affineTransform = topLeftTransform;
// Set up the pipeline: image -> crop -> transform
// I don't apply any effects to the corners for now,
// just try to recreate the original image
[imageSource addTarget:_cropTopLeft];
[_cropTopLeft addTarget:_transformTL];
// Same with the other corners... TR, BL & BR
// Recombine
// Can only apply 2 inputs to a blend filter, so combine using 3 filteres
// The blend filteres are `GPUImageNormalBlendFilter` instances
[_transformTL addTarget:_blendFilterTop];
[_transformTR addTarget:_blendFilterTop];
[_transformBL addTarget:_blendFilterBottom];
[_transformBR addTarget:_blendFilterBottom];
[_blendFilterTop addTarget:_blendFilterAll];
[_blendFilterBottom addTarget:_blendFilterAll];
[_blendFilterAll addTarget:_myGPUImageView];
Problem jest, że gdy róg obrazu jest przycięta, rozmiar płótna o połowę.
Wierzę, że ten połówkowy rozmiar jest następnie wykorzystywany przez rurociąg.
Moja praca polegała na ponownym przejściu do połowy za pomocą transformacji, ale w rezultacie uzyskano obraz o rozdzielczości 1/2.