2

I want to use IOS core image filter CIPerspectiveTransform. I have fund a function but when I call this function the image is disapper from the view I am unable to understand why image is disappear ?

// I have picked picture from UIImageView 
 CIImage *inputImage = [[CIImage alloc] initWithImage:getImageFOrOCR.image];

 CIFilter *filter2 = [CIFilter
                         filterWithName:@"CIPerspectiveTransform"];
    [filter2 setDefaults];
    [filter2 setValue:beginImage forKey:@"inputImage"];
    [filter2 setValue:[CIVector vectorWithX:100 Y:500 ]
               forKey:@"inputTopLeft"];
    [filter2 setValue:[CIVector vectorWithX:600 Y:500 ]
               forKey:@"inputTopRight"];
    [filter2 setValue:[CIVector vectorWithX:600 Y:0  ]
               forKey:@"inputBottomLeft"];
    [filter2 setValue:[CIVector vectorWithX:0  Y:0  ]
               forKey:@"inputBottomRight"];

    CIImage *ciImageOut = [filter2 valueForKey:@"outputImage"];


    CIContext *context = [CIContext contextWithOptions:nil];
   // set image to UIImageView
    getImageFOrOCR.image = [UIImage imageWithCGImage:
                            [context createCGImage:ciImageOut
                                                   fromRect:ciImageOut.extent]];
Shinning River
  • 813
  • 1
  • 10
  • 23
  • This filter is not currently available on iOS, as of iOS 5.1: http://stackoverflow.com/q/8528726/19679 . Your CIFilter is most likely nil as a result, leading to a nil image for an output. – Brad Larson May 20 '12 at 22:06

0 Answers0