IPAD must-haves. And fun-to-haves.

Brighten your iPad with a colorful cover, stream to your TV, download pictures from your digital camera, and more. There’s already so much you can do with iPad and iPad mini

Apple Wireless Keyboard

The incredibly thin Apple Wireless Keyboard uses Bluetooth technology, which makes it compatible with iPad

Apple unveils iPad mini: ‘Thin as a pencil, light as paper’

iPad inspires creativity and hands-on learning with features you won’t find in any other educational tool

Lightning connector and FaceTime HD camera

Apple announces 4th generation iPad packing an A6X CPU

Pages

Showing posts with label CIImage. Show all posts
Showing posts with label CIImage. Show all posts

Monday, March 3, 2014

problems with UIImage imageWithCIImage and CIImage imageWithCGImage

Hi,

 

At some point in my phto/video processing, I have a CGImage that I need to convert to CIImage to apply some CIImage adjustments. Eventually, need to convert it to UIImage for display.

 

The code below seems to be the efficient way of doing it:

CIImage *outputImage = [CIImage imageWithCGImage:cgImage]

...do some processing with CIImage...

UIImage *finalImage = [UIImage imageWithCGImage:ref scale:1.0 orientation:imageOrientation];

 

However, it seems to rescale image introducing various artifacts, pretty much messing up the image.

 

On the other hand, if I create another copy of CGImage with:

 

CIImage *outputImage = [CIImage imageWithCGImage:cgImage]

...do some processing with CIImage...

IContext *context = [CIContext contextWithOptions:nil];

    CGImageRef ref = [context createCGImage:outputImage fromRect:outputImage.extent];

    CGImageRelease(cgImage); 

  UIImage *finalImage = [UIImage imageWithCGImage:ref scale:1.0 orientation:imageOrientation];

CGImageRelease(ref)

 

 

the photo is good - i.e. it doesn't mess up the image, but does double allocation causing huge memory spike for a full res photo - it may even crash the app.

 

1. Why is the CGImage to CIImage to UIImage as in the first example broken ?

2. What is the fix?

 

Thx.


View the original article here

Saturday, March 1, 2014

Re: problems with UIImage imageWithCIImage and CIImage imageWithCGImage

I am quite sorry - made a silly copy/paste mistake:

 

I am already using [UIImage imageWithCIImage] - which is where the problem is.

As posted in the question, the problem is with going from cgimage -> ciimage -> uiimage

It works fine if I make an extra conversion from ciimage back to cgimage.

 

The first part of the example code {that doesn't work well} is actually as folllows and not as shown above {copy/paste mistake}

 

CIImage *outputImage = [CIImage imageWithCGImage:cgImage]

...do some processing with CIImage...

UIImage *finalImage = [UIImage imageWithCIImage:outputImage scale:1.0 orientation:imageOrientation];


View the original article here