使用 iPhone 测量房间
我需要在 iPhone 应用程序中测量房间(如果可能的话),并且我正在寻找一些关于如何实现这一目标的想法。极高的精确度并不重要,但精确度低至 1 英尺就足够了。到目前为止我的一些想法是:
- 在房间里走动并使用 GPS 进行测量。不太可能足够准确,特别是对于 iPod touch 用户而言
- 从麦克风发出声音并测量声音返回所需的时间。已经有一些应用程序可以执行此操作,例如 PocketMeter。我怀疑这对用户不友好,而且噱头多于实用性。
有人还有其他想法吗?
I have a need to measure a room (if possible) from within an iPhone application, and I'm looking for some ideas on how I can achieve this. Extreme accuracy is not important, but accuracy down to say 1 foot would be good. Some ideas I've had so far are:
- Walk around the room and measure using GPS. Unlikely to be anywhere near accurate enough, particularly for iPod touch users
- Emit sounds from the microphone and measure how long they take to return. There are some apps out there that do this already, such as PocketMeter. I suspect this would not be user friendly, and more gimmicky than practical.
Anyone have any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
您可以站在一个角落,然后将手机扔到远处的角落。手机可以在某个加速点开始测量,在减速点结束测量
You could stand in one corner and throw the phone against the far corner. The phone could begin measurement at a certain point of acceleration and end measurement at deceleration
1) 将 iPhone 从一堵墙开始放在地板上,底座靠墙。
2) 在 iPhone 顶部结束处标记线。
3) 拿起 iPhone 并将底座移动到您刚刚画线的位置。
4) 重复步骤1->3,直到到达另一面墙。
5) 将到达另一面墙所需的线数乘以 iPhone 的长度即可得出最终测量值。
=)
1) Set iPhone down on the floor starting at one wall with base against the wall.
2) Mark line where iPhone ends at top.
3) Pick iPhone up and move base to where the line is you just drew.
4) Repeat steps 1->3 until you reach the other wall.
5) Multiply number of lines it took to reach other wall by length of iPhone to reach final measurement.
=)
我记得看到过房地产经纪人的程序,其中涉及在图片中举起参考对象。该程序将识别图像中的参考对象和其他平坦表面,并从中计算尺寸。它的目的是测量房屋的外部。它可以沿着它假设成直角的相连墙壁行驶。
您可以使用一些常见的家用物品,例如一张打印纸,而不是像这些程序那样附带参考对象。让用户从常见物体列表中选择他们将哪些扁平物体举到墙上。
检测墙壁和参考对象的边缘是一些棘手的模式识别,然后是一些棘手的数学将找到的边缘转换为平面。不过,仍然比把手机扔到远处的墙上好。
I remember seeing programs for realtors that involved holding a reference object up in a picture. The program would identify the reference object and other flat surfaces in the image and calculate dimensions from that. It was intended for measuring the exterior of houses. It could follow connected walls that it could assume were at right angles.
Instead of shipping with a reference object, as those programs did, you might be able to use a few common household objects like a piece of printer paper. Let the user pick from a list of common objects what flat item they are holding up to the wall.
Detecting the edges of walls, and of the reference object, is some tricky pattern recognition, followed by some tricky math to convert the found edges to planes. Still better than throwing you phone at the far wall though.
相反,我的兄弟。
这是最用户友好且准确的测量房间尺寸的方法。
PocketMeter 以半英寸的精度测量到一堵墙的距离。
如果您使用相同的公式来测量距离,但让该人站在房间的角落附近(这样到墙壁、地板和天花板的距离都不同),您应该能够计算所有三个测量值(长度、宽度和高度)和一个声纳脉冲。
根据评论进行编辑,添加:
在理想的世界中,您将获得 6 个脉冲,每个表面各有一个脉冲。然而,我们并不生活在一个理想的世界中。以下是您必须考虑的一些事项:
如果我不得不猜测,因为我过去做过类似的事情,所以你将不得不发出由低频、中频和高频组成的多频音调。您必须对收到的声波执行快速傅里叶变换才能选出您传输的频率。
现在,我不想让你灰心。可以进行计算。然而,这需要一些工作。毕竟 PocketMeter 已经使用了一段时间了,而且它们只测量到一堵墙的距离。
Au contraire, mon frère.
This is the most user friendly, not to mention accurate, way of measuring the dimensions of a room.
PocketMeter measures the distance to one wall with an accuracy of half an inch.
If you use the same formulas to measure distance, but have the person stand near a corner of the room (so that the distances to the walls, floor, and ceiling are all different), you should be able to calculate all three measurements (length, width, and height) with one sonar pulse.
Edited, because of the comment, to add:
In an ideal world, you would get 6 pulses, one from each of the surfaces. However, we don't live in an ideal world. Here are some things you'll have to take into account:
If I had to guess, because I've done something similar in the past, you're going to have to emit a multi-frequency tone, made up of a low frequency, a medium frequency, and a high frequency. You'll have to perform a fast Fourier Transform on the sound wave you receive to pick out the frequencies that you transmitted.
Now, I don't want to discourage you. The calculations can be done. However, it's going to take some work. After all PocketMeter has been at it for a while, and they only measure the distance to one wall.
我认为更简单的方法是使用毕达哥拉斯定理。大多数房间高 8 或 10 英尺,如果用户能够准确猜测,您可以使用摄像头进行一些分析并计算数字。 (您可能需要一些巧妙的方法来检测角度)
怎么做
我预计你的底线会因此减少 5 分;)
I think an easier way to do this would be to use the Pythagorean theorem. Most rooms are 8 or 10 feet tall and if the user can guess accurately, you can use the camera to do some analysis and crunch the numbers. (You might have to have some clever way to detect the angle)
How to do it
I expect 5 points off of your bottom line for this ;)
让我看看是否有帮助。拿一个已知长度的物体并将其放在墙边,然后用 iPhone 拍摄墙壁以及您放在墙边的物体的照片。现在从 Iphone 中的图像中获取墙壁宽度和物体宽度的比率。当您知道物体的宽度时,您可以轻松计算出墙的宽度。对每面墙重复此操作,您将获得房间尺寸。
Let me see if it helps. Take an object of known length and keep it beside the wall and with Iphone, take pic of wall along with the object that you kept beside the wall. Now get the ratio of wall width and object width from the image in Iphone. And as you know the width of the object, you can easily calcualte the width of wall. repeat it for each wall and you will have a room measurement.
您的用户可以通过配速来测量已知距离,从而校准他们的配速长度。然后他们可以以步为单位输入每面墙的距离,手机会将其转换为英尺。这可能会非常方便,并且可能精确到 10% 以内。
如果他们可能需要更准确的读数,请让他们选择从卷尺输入测量值。
Your users could measure a known distance by pacing it off, and thereby calibrate the length of their pace. Then they could enter the distance of each wall in paces, and the phone would convert it to feet. This would probably be very convenient, and would probably be accurate to within 10%.
If they may need more accurate readings, then give them the option of entering in a measurement from a tape measure.
这个答案有点类似于 Jitendra 的答案,但他建议的方法仅适用于您可以一次拍摄整个墙壁的情况。
找一个已知大小的物体,然后将其靠在墙上,同时将 iPhone 靠在另一堵墙上(需要两个人或 blutac)拍照。然后,您可以通过查看照片中对象的大小(以像素为单位)来计算墙壁之间的距离。您可以使用 PDF 将打印文档制作为已知尺寸的对象,并使用 2D 条形码让 iPhone 拾取它。
This answer is somewhat similar to Jitendra's answer, but the method he suggests will only work where you can fit the whole wall in a single shot.
Get an object of know size and photograph it held against the wall with the iphone held against the other wall (two people or blutac needed). Then you can calculate the distance between the walls by looking at the size of the object (in pixels) in the photo. You could use a PDF to make a printed document the object of known size and use a 2D barcode to get the iphone to pick it up.
当用户想要测量某些东西时,他会拍摄一张照片,但实际上您拍摄的是两张单独的图像,一张打开闪光灯,一张关闭闪光灯。然后,您可以分析图像中的光照差异和闪光反射来确定图像的比例。我猜这只适用于近距离且不太闪亮的物体。
但这是我考虑从没有任何固定物体的图像中扣除比例的唯一其他方法。
When the user wants to measure something, he takes a picture of it, but you're actually taking two separate images, one with flash on, one with flash off. Then you can analyze the lighting differences in the image and the flash reflection to determine the scale of the image. This will only work for close and not too shining objects I guess.
But that's about the only other way I thought about deducting scale from an image without any fixed objects.