gpt4 book ai didi

ios - 当 scaleKey 大于某个值时,Lanczos 比例不起作用

转载 作者:行者123 更新时间:2023-11-29 12:36:54 25 4
gpt4 key购买 nike

我有这个代码

CIImage * input_ciimage = [CIImage imageWithCGImage:self.CGImage];
CIImage * output_ciimage =
[[CIFilter filterWithName:@"CILanczosScaleTransform" keysAndValues:
kCIInputImageKey, input_ciimage,
kCIInputScaleKey, [NSNumber numberWithFloat:0.72], // [NSNumber numberWithFloat: 800.0 / self.size.width],
nil] outputImage];
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef output_cgimage = [context createCGImage:output_ciimage
fromRect:[output_ciimage extent]];
UIImage *output_uiimage;
output_uiimage = [UIImage imageWithCGImage:output_cgimage
scale:1.0 orientation:self.imageOrientation];
CGImageRelease(output_cgimage);
return output_uiimage;

因此,当 scaleKey 大于某个值时,output_uiimage 为黑色图像。

在我的例子中,如果键 kCIInputScaleKey 的值 > @0.52 那么结果是黑色图像。当我将图像旋转 90 度时,我得到了相同的结果,但值为 0.72(而不是 0.52)。

库有什么问题或我的代码有错误吗?

如果需要,我有 iPhone 4、iOS 7.1.2 和 xCode 6.0。

最佳答案

Apple 是这么说的:

This scenario exposes a bug in Core Image. The bug occurs when rendering requires an intermediate buffer that has a dimension greater than the GPU texture limits (4096) AND the input image fits into these limits. This happens with any filter that is performing a convolution (blur, lanczos) on an input image that has width or height close to the GL texture limit.
Note: the render is succesful if the one of the dimensions of the input image is increased to 4097.

Replacing CILanczosScaleTransform with CIAffineTransform (lower quality) or resizing the image with CG are possible workarounds for the provided sample code.

关于ios - 当 scaleKey 大于某个值时,Lanczos 比例不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26063040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com