简体   繁体   English

如何捕捉iPhone相机中的动作

[英]How to capture a motion in iphone camera

In My application as the user opens the camera, camera should capture a image as soon as there is a difference in image when compared to previous image and camera should always be in capturing mode. 在我的应用程序中,当用户打开相机时,一旦图像与先前图像相比,相机应该捕获图像,并且相机应始终处于捕获模式。

This should be done automatically without any user interaction.Please Help me out as i couldn't find the solution asap. 这应该在没有任何用户交互的情况下自动完成。请帮助我,因为我无法找到解决方案。

Thanks, ravi 谢谢,拉维

I don't think the iPhone camera can do what you want. 我不认为iPhone相机可以做你想要的。

It sounds like your doing a type of motion detection by comparing two snapshots taken at different times and seeing if something has changed between the older and the newer image. 这听起来像是通过比较在不同时间拍摄的两张快照并查看旧图像和新图像之间是否有某些变化来进行一种运动检测。 To that you need: 为此你需要:

I don't think the iPhone can do what you want. 我不认为iPhone可以做你想要的。 The camera is not setup to automatically take photos and I don't think the hardware can support the level of processing needed to compare two images in enough detail to detect motion. 相机未设置为自动拍照,我认为硬件不能支持比较两个图像所需的处理水平,足以检测运动。

Hmmmm, in thinking about it, you might be able to detect motion by somehow measuring the frame differentials in the compression of video. 嗯,在考虑它时,你可以通过某种方式测量视频压缩中的帧差异来检测运动。 All the video codecs save space by only registering the parts of the video that change from frame-to-frame. 所有视频编解码器仅通过注册逐帧变化的视频部分来节省空间。 So, a large change in the saved data would indicate a large change in the environment. 因此,保存数据的大幅变化将表明环境发生了很大变化。

I have no idea how to go about doing that but it might give you a starting point. 我不知道如何去做,但它可能会给你一个起点。

You could try using opencv for motion detection based on differences between captured frames but I'm not sure if the iPhone API allows reading multiple frames from the camera. 您可以尝试使用opencv进行基于捕获帧之间差异的运动检测,但我不确定iPhone API是否允许从相机读取多个帧。

Look for motempl.c in the opencv distribution. opencv发行版中查找motempl.c。

您可以使用UIGetScreenImage函数执行屏幕截图以自动捕获图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM