使用 iPhone 进行运动检测

发布于 2024-08-15 03:11:14 字数 177 浏览 5 评论 0原文

我在 AppStore 中看到至少有 6 个应用程序在检测到运动时拍照(即一种 Spy 的东西)。有谁知道使用 iPhone SDK 执行此类操作的一般方法是什么?

我猜他们的应用程序每 X 秒拍摄一次照片,并将当前图像与之前的图像进行比较,以确定是否有任何差异(阅读“运动”)。还有更好的想法吗?

谢谢你!

I saw at least 6 apps in AppStore that take photos when detect motion (i.e. a kind of Spy stuff). Does anybody know what is a general way to do such thing using iPhone SDK?

I guess their apps take photos each X seconds and compare current image with previous to determine if there any difference (read "motion"). Any better ideas?

Thank you!

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

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

发布评论

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

评论(4

执着的年纪 2024-08-22 03:11:14

您或许还可以使用麦克风来检测噪音。这实际上就是许多安全系统运动探测器的工作原理——但它们监听超声波。此操作的成功很大程度上取决于 iPhone 的麦克风灵敏度以及您对信号的 API 访问类型。如果麦克风不够灵敏,聆听人类听觉范围内的常规噪音可能足以满足您的需求(尽管这不是“真正的”运动检测)。

至于图像 - 考虑使用某种字符串编辑距离算法,但对于图像。每 X 时间拍摄一张照片,并将其与上一张拍摄的图像进行比较。如果图像差异太大(编辑距离太大),则会发出警报。这将考虑到日光的缓慢变化,并且可能比在监视周期开始时拍摄单个参考图像然后将所有其他图像与其进行比较效果更好。

如果将这两种方法(图像和声音)结合起来,它可能会满足您的需求。

You could probably also use the microphone to detect noise. That's actually how many security system motion detectors work - but they listen in on ultrasonic sound waves. The success of this greatly depends on the iPhone's mic sensitivity and what sort of API access you have to the signal. If the mic's not sensitive enough, listening for regular human-hearing-range noise might be good enough for your needs (although this isn't "true" motion-detection).

As for images - look into using some sort of string-edit-distance algorithm, but for images. Something that takes a picture every X amount of time, and compares it to the previous image taken. If the images are too different (edit distance too big), then the alarm sounds. This will account for slow changes in daylight, and will probably work better than taking a single reference image at the beginning of the surveillance period and then comparing all other images to that.

If you combine these two methods (image and sound), it may get you what you need.

又爬满兰若 2024-08-22 03:11:14

您可以让手机检测光线变化,即使用手机顶部正面的传感器。我只是不知道你如何访问手机的这一部分

You could have the phone detect light changes meaning using the sensor at the top front of the phone. I just don't know how you would access that part of the phone

倥絔 2024-08-22 03:11:14

我想您已经弄清楚了 - 手机可能会保留图像 B 和图像 A 之间的增量超过某个预定义阈值的图像。

您必须找到一个用 Objective-C 编写的图像库才能进行分析。

I think you've about got it figured out- the phone probably keeps images where the delta between image B and image A is over some predefined threshold.

You'd have to find an image library written in Objective-C in order to do the analysis.

一身软味 2024-08-22 03:11:14

我有这个应用程序。 10 年前我为 Delphi 编写了一个库,但分析是相同

重点是从整个屏幕创建一个矩阵,例如 25x25,然后为每个单元格创建平均颜色。之后,将一张图片与另一张图片的平均颜色的 R、G、B、H、S、V 进行比较,如果差异超过设定值,则出现运动。

在我的应用程序中,我使用片段着色器来实时显示运动。如有任何问题,请随时提问;)

I have this application. I wrote a library for Delphi 10 years ago but the analysis is the same.

The point is to make a matrix from whole the screen, e.g. 25x25, and then make an average color for each cell. After that, compare the R,G,B,H,S,V of average color from one picture to another and, if the difference is more than set, you have motion.

In my application I use fragment shader to show motion in real time. Any question, feel free to ask ;)

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