如何在 iPhone 相机预览窗口中动态更改像素颜色?
我正在使用 UIImagePickerController 在 iPhone 上拍照。我想即时调整照片,看来我可以使用 UIImagePickerController 即时调整照片的形状,但我无法找到即时更改颜色的方法。例如,将所有颜色更改为黑/白。
谢谢。
I am using UIImagePickerController to take photos on iPhone. I'd like to adjust the photo on the fly, it appears that I could use UIImagePickerController to adjust the shape of the photo on the fly, but I am not able to find a way to change the color on the fly. For example, change all the color to black/white.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最好的方法是使用 AVCaptureSession 对象。我正在做你在我的免费应用程序“Live Effects Cam”中所说的事情
,网上有几个代码示例,它们也可以帮助你实现这一点。以下是可能有帮助的示例代码块:
The best way to do this is with an AVCaptureSession object. I'm doing exactly what you're talking about in my free app "Live Effects Cam"
There are several code examples on-line that a will help you implement this too. Here is a sample chunk of code that might help:
您可以在图像上叠加视图并更改混合模式以匹配黑/白效果。
查看 Apple 的 QuartzDemo,特别是演示,
混合模式
示例You can overlay a view on the image and change the blending mode to match a Black/White effect.
Check out the QuartzDemo from Apple, specifically in that Demo, the
Blending Modes
example另一种方法是使用 AVFoundation 转换每个帧。我对此没有太多经验,但 WWDC2010 的“第 409 期 - 使用带有 AVFoundation 的相机”视频及其示例项目应该对帮助您解决问题大有帮助。
当然,前提是您可以使用 iOS4 类。
Another way to do this would be to convert each frame using
AVFoundation
. I don't have a ton of experience with this but the "Session 409 - Using the Camera with AVFoundation" video from WWDC2010 and its sample projects should go a long way to helping you with your problem.That is, of course, if you're okay using iOS4 classes.