使用具有自定义缩放功能的 UIImagePickerController 拍照

发布于 2024-11-04 03:46:04 字数 606 浏览 5 评论 0原文

我创建了一个带有叠加层的自定义相机控件...

现在我使用滑块缩放图像..

imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, 

MainSlider.value, MainSlider.value);

其中initialTransform是初始图像转换... MainSlider 是滑块,我用它来获得从 1 到 4 的缩放级别 因此,每次当我使用 Slider 增加图像时...我会参考初始变换并相应地缩放 Slider 值...

我可以通过这样做进行缩放..但是当我使用

[imagePickerController takePicture];

它拍摄照片时它只给我原始图片..不给我任何 EditedImage ...

这个原始图像与没有缩放时相同... 我想要获得缩放后的图像... 意味着屏幕上显示的任何内容......

我尝试为此找到很多,,,,我知道我们可以使用 GetScreenCapture() 但这可能会导致应用程序被拒绝,并且还会降低图像质量......

I created a custom Camera Control with overlay ...

Now i am zooming image by using Slider by ..

imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, 

MainSlider.value, MainSlider.value);

where initialTransform is the initial image transformation ...
MainSlider is slider , which i use to get zoom level from 1 to 4
So each time when i increase image using Slider ... I refer initialTransform and zoom accordingly Slider value ...

I am able to zoom by doing this .. But when i capture photo using

[imagePickerController takePicture];

It gives me Original Picture only .. does not give me any EditedImage ...

This original image is same as without zoom ...
I want to get Image which was zoomed ...
Means whatever showing in screen ...

I try to find a lot for this,,,, I know we can use GetScreenCapture()
but it can be cause of rejection of app and also it lower down the image quality ...

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

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

发布评论

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

评论(1

泪之魂 2024-11-11 03:46:04

捕获图像后,您需要对图像应用相同的变换。正如您所注意到的,设置cameraViewTransform只会影响显示。当您应用统一缩放变换(例如缩放)时,这就是数字缩放。您没有增加像素分辨率。您将从相机中获取照片,然后在处理图像时可以将其裁剪/缩放到您想要的尺寸。您应该在后台线程上进行处理,以尽量减少对主线程的干扰。

You need to apply the same transform to the image after it has been captured. Setting cameraViewTransform will only affect the display, as you've noticed. When you apply a uniform scaling transform (e.g. to zoom) this is a digital zoom. You are not increasing the pixel resolution. You'll get the pic back from the camera and then you can crop/scale it to the size you want when processing the image. You should do your processing on a background thread to minimize disrupting the main thread.

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