我非常沮丧。为什么不垂直翻转我的CIImage?
recognizedImage = [recognizedImage imageByApplyingTransform:CGAffineTransformTranslate(CGAffineTransformMakeScale(1, -1), 0, recognizedImage.extent.size.height)];
答案 0 :(得分:4)
不要忘记将CoreImage.framework
添加到您的项目中。
这对我有用:
// Load image
UIImage *u = [UIImage imageNamed:@"myimage"];
// Convert to CIImage
CIImage *c = [[CIImage alloc] initWithImage:u];
// Apply transform
c = [c imageByApplyingTransform:CGAffineTransformTranslate(CGAffineTransformMakeScale(1, -1), 0, c.extent.size.height)];
// Convert back to UIImage
CIContext *context = [CIContext contextWithOptions:nil];
u = [UIImage imageWithCGImage:[context createCGImage:c fromRect:c.extent]];
// Load the UIImage into the view
[self.imageView setImage:u];
答案 1 :(得分:2)
您是否尝试将其分为两部分?
myImage = [myImage imageByApplyingTransform:CGAffineTransformMakeScale(1, -1)];
myImage = [myImage imageByApplyingTransform:CGAffineTransformMakeTranslation(0, extent.size.height)];