简体   繁体   English

捕获图像中的摄像机视图和onverlay

[英]Capture camera view and onverlay in an image

I open the camera view and place an image as an overlay. 我打开相机视图并将图像作为叠加层放置。 I then want to save both the overlay and the camera view's image as one image. 然后我想将叠加层和摄像机视图的图像保存为一个图像。 Previously I achieved this using UIGetScreenImage(). 以前我使用UIGetScreenImage()实现了这一点。 Now that Apple forbid this what are my options ? 现在Apple禁止这个我有什么选择? takePicture will only capture the camera data but the the overlay. takePicture仅捕获相机数据,但捕获覆盖图。 Merging the overlay with the image from takePicture is a bit slow. 将叠加层与takePicture中的图像合并有点慢。

You really will have to merge them, and it shouldn't take more than a second or two. 你真的必须合并它们,它不应该超过一两秒。 Something like(untested, but should give an idea): 像(未经测试,但应该提出一个想法):

UIGraphicsBeginImageContext(myCapturedImage.size);
[myCapturedImage drawAtPoint:CGPointZero]; //You might need to use drawInRect
[overlayImage drawAtPoint:CGPointZero];
UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

以下是我在Apple网站上发现的技术问答QA1714

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM