Guikunzhi / BeautifyFaceDemo

A simple demo of realtime face beautification based on GPUImage
http://weibo.com/u/1988131695/home
MIT License
2.49k stars 494 forks source link

Nil when filtering image #11

Open jvicjvic opened 5 years ago

jvicjvic commented 5 years ago

When filtering an image, instead of a live stream, I'm getting nil. Any ideas on what could be happening? Here's the code:

GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:img];
GPUImageBeautifyFilter * filter = [[GPUImageBeautifyFilter alloc] init];

[stillImageSource addTarget:filter];
[filter useNextFrameForImageCapture];
[stillImageSource processImage];

UIImage * result = [filter imageFromCurrentFramebuffer];  // nil

I've also tried using [filter imageByFilteringImage:img], but it's the same.

YBYHunter commented 5 years ago

UIImage 和 Framebuffer的编码格式不同,不能这么直接转换。 在多试试其他的方法。 UIImage and Framebuffer have different encoding formats and cannot be converted directly. Try other methods more.