objective c - blurred image from AVCaptureVideoPreviewLayer in iOS7 -
i developing ios7 video recording application. camera screen in our application requires show blurred backgound similar 1 shown in ios7 control center. while video preview being shown, need show blurred control center. suggested in wwdc video 226, have used code provided below camera preview snapshot , applying blur , setting blurred image view.
uigraphicsbeginimagecontextwithoptions(_camerapreview.frame.size, null, 0); [_camerapreview drawviewhierarchyinrect:rect]; uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); lightimage = [newimage applylighteffect] here _camerapreview uiview contains avcapturevideopreviewlayer. *newimage obtained context reason black.
however if use [_camerapreview snapshotview] returns me uiview previewlayer content. there no way apply blur on uiview.
how can blurred image camera preview layer?
i suggest put overlay onto video preview composited video layer, , add blur filter that. (check wwdc avfoundation sessions , avsimpleeditorios sample code compositing images onto video) way you're staying on gpu instead of doing readbacks gpu->cpu, slow. drop overlay's ui elements on top of video preview within clear background uiview.
that should provide greater performance. apple? well, using private stuff developers don't yet have access to...
Comments
Post a Comment