Update filtered image

2 replies [Last post]
nuthinking
User offline. Last seen 9 years 1 week ago. Offline
Joined: 10/07/2012
Posts:

Interestingly enough, it looks like the procedure (pseudo code)...

-(void)viewDidLoad
{
    create filter
    myimage.image = [filter imageByFilteringImage:originalImage];
}
-(void)calledLater
{
    update filter
    myimage.image = [filter imageByFilteringImage:originalImage];
}

...works only in the simulator. In the device the image is not updated.

Thanks!

Brad Larson
Brad Larson's picture
User offline. Last seen 4 years 49 weeks ago. Offline
Joined: 05/14/2008
Posts:

That's because of the way that I optimize image downloads when running on iOS hardware. If you use -imageByFilteringImage:, I memory map between the final filtered frame and the resulting UIImage to save memory and have a much faster image download process from OpenGL ES. However, it means that the filter will be locked to that image until the original image is deallocated.

You'll have to get rid of the original image first (perhaps by setting its property to nil) before re-filtering the source image.

This doesn't happen in the Simulator, because I disable this memory caching optimization there due to the Simulator not supporting it.

nuthinking
User offline. Last seen 9 years 1 week ago. Offline
Joined: 10/07/2012
Posts:

Thanks Brad for the info, this is very useful to know! Would GPUImagePicture+GPUImageView make it work? (ref: http://www.sunsetlakesoftware.com/forum/how-make-filter-animations)

Syndicate content