自定义相机变焦功能 iPhone 拍照

发布于 2024-11-03 21:18:04 字数 770 浏览 4 评论 0原文

我成功地能够使用自定义相机视图中的滑块使用以下代码进行自定义缩放,

imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, MainSlider.value, MainSlider.value); 

屏幕看起来应该是这样的缩放... 但是,当我调用拍照功能

[self.imagePickerController takePicture];

并尝试在方法中访问照片时:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {



UIImage *Originalimage = [info valueForKey:UIImagePickerControllerOriginalImage];


UIImage *Editimage = [info valueForKey:UIImagePickerControllerEditedImage];


}

这里我收到没有缩放的原始图像“Originalimage”,但我在“Editimage”中没有得到任何内容,

我正在尝试使用cameraViewTransform获取带有缩放的图像!

我希望现在更清楚了......

谢谢

I am successfully able to Make custom Zoom using Slider in my Custom Camera view using following code

imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, MainSlider.value, MainSlider.value); 

Screen Looks Zoom as it should be ...
But when i call Take Picture function

[self.imagePickerController takePicture];

and tryng to access Photo in method :

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {



UIImage *Originalimage = [info valueForKey:UIImagePickerControllerOriginalImage];


UIImage *Editimage = [info valueForKey:UIImagePickerControllerEditedImage];


}

Here I receive Original Image without Zoom n "Originalimage" but i dont get anything in "Editimage"

I am trying to get Image with Zoom that i get using cameraViewTransform!!

I hope its more clear now ... .

Thank you

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

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

发布评论

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

评论(1

隐诗 2024-11-10 21:18:04

好吧..我有间接的方法来获取缩放图像....

一旦我缩放图像并拍照,我就拍摄原始照片并将该图像缩放到该比例...然后使用此功能
所选边界的“UIGraphicsGetImageFromCurrentImageContext”...

我得到了缩放图像...

我仍然不知道为什么我在 UIImagePickerControllerEditedImage 中没有得到任何内容,可能我没有编辑任何内容...只是缩放它...可能这就是为什么它的原因编辑图像中没有给我任何内容...

感谢您的帮助和支持!

Ok .. I got indirect way to get the zoomed image ....

Once i zoom image and take picture , I take the Originial picture and zoom that Image upto that scale ... and than use of this function
"UIGraphicsGetImageFromCurrentImageContext" for selected bound ...

And i get that zoomed image ...

Still i dont know why i dont get anything in UIImagePickerControllerEditedImage , May be i am editing nothing... just scaling it ... may be thats why its not giving me anythiing in Edited Image ...

Thank you for your help and support !!

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