gpt4 book ai didi

ios - UIImagePickerController适配

转载 作者:行者123 更新时间:2023-11-29 04:10:43 25 4
gpt4 key购买 nike

我在 iOS 中使用UIImagePickerControllerSourceTypeCamera。我在使用相机之前的目的是引导用户将相机精确地放置在图像对象的前面。我有一个已知的目标图像 (TI),一张扑克牌,更具体地说是方 block 7,并且我需要 TI 上的 7 位于相机前面的正确位置。有没有办法在用户拍照时将 TI 叠加在屏幕顶部,或者屏蔽部分屏幕,以便只有 7 出现的地方才会显示要拍摄的照片。

一旦相机定位正确,我会要求用户保持相机静止并将未知的卡片放置在相机前面,而不看卡片。

最佳答案

UIImagePickerController有一个 cameraOverlayView 属性,您可以为其分配自定义类的实例。该类可以绘制您需要的目标区域图形,并将其显示在相机图像的顶部。

如果您需要检查卡片实际上在该区域内,那么您就处于计算机视觉区域中,事情会变得更加复杂。 OpenCV是理解相机所显示内容的典型起点。

cameraOverlayView

The custom view to display on top of the default image picker interface. @property (nonatomic, retain) UIView *cameraOverlayView Discussion

You can use an overlay view to present a custom view hierarchy on top of the default image picker interface. The image picker layers your custom overlay view on top of the other image picker views and positions it relative to the screen coordinates. If you have the default camera controls set to be visible, incorporate transparency into your view, or position it to avoid obscuring the underlying content.

关于ios - UIImagePickerController适配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14442796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com