捕获相机视图并叠加在图像中

发布于 2024-09-26 08:29:30 字数 162 浏览 0 评论 0原文

我打开相机视图并将图像作为叠加层放置。 然后我想将叠加层和相机视图的图像保存为一张图像。 之前我使用 UIGetScreenImage() 实现了这一点。 既然苹果禁止这样做,我有什么选择? takePicture 只会捕获相机数据,但不会捕获叠加层。 将覆盖层与 takePicture 中的图像合并有点慢。

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().
Now that Apple forbid this what are my options ?
takePicture will only capture the camera data but the the overlay.
Merging the overlay with the image from takePicture is a bit slow.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦巷 2024-10-03 08:29:30

您确实必须合并它们,并且花费的时间不会超过一两秒。类似的东西(未经测试,但应该给出一个想法):

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

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文