开发者

How to create a 2D map of room by a few images/movie frames?

开发者 https://www.devze.com 2022-12-28 19:19 出处:网络
I\'d like to create a simple 2D map of a room by getting pictures (ceiling) of all directions (360° - e.g. movie frames), recognize the walls by edge detection, delete other unwanted objects, concat

I'd like to create a simple 2D map of a room by getting pictures (ceiling) of all directions (360° - e.g. movie frames), recognize the walls by edge detection, delete other unwanted objects, concat the images at the right position (cf. walls, panorama) and finally create the approximate 2D map (looking on it from above). Getting the scale would be anot开发者_JAVA技巧her parameter, which might be useful.

I have some own ideas at the moment, by using e.g. the Sobel algorithm, but it would be interesting if somebody out there knows some project or software (GPL,freeware prefered) doing this already, as I'm still looking for some examples, which might help me.

Thanks.


There are two ways I can see this (kinda) working:

1) Figure out the distance between the wall and the point the photo was taken. The simple, consistent way to do this would be to use a laser or similar external measuring device. If you were to rely on the device alone to do this, you would need to take into account the height of the person taking the photo, the angle of the camera, and of course the lens characteristics of the device itself (ie focal length distortion).

2) Create a real world control object that the device can use as a "baseline". Make an obnoxiously bright red cube that is known to be 10x10x10cm; place it in the corner of a room; take a photo / video of the wall from corner to corner, use image detection to find the wall boundaries and object recognition for the cube; figuring out walls dimensions is simple maths from then on. Depending on the lens, this method may be less sensitive to focal length distortion and the like, but for an accurate reading I would've thought you'd still need to take the lens' characteristics into account.

Good luck with this, it's no small undertaking. Image detection for the walls alone will be a challenge. :)


I had a "some what" similar project for an internship and in the end the internship was never finished because we all ran out of time (3 months, and no money for anything).

But anyway in the end what we were going to do was to take a large grid paper then point the camera at it so then we could map out the lens' characteristics and use that to tweak the pictures that came out of the camera.

Secondly we were going to put in a "well known/understood" object next/on each wall and use that to interpolate the size (length/height) of each wall.

Now this method would require more "time" to setup because you would need to place the object on each wall and then take picture of each wall with a bit of overlap so that latter you could be able to snitch it together. Then the user would then tell the program where each "corner/edge" was located so the program would know the "general shape" of the room then it would use the object placed on the wall to interpolate the length/height of each wall.

Now keep in mind this would be an relatively manual process, but with a well designed software/process it could be relatively quick. By this I mean the slowest manual steps would be placing the object on the wall, then taking the "panorama" of the room. Once the pictures has been uploaded into the computer, it could take care of pre-processing, snitching it together, then pop up an picture with some "line tools" in which you could use to tell the program where the corner/etc were and then it would do the calculation/adjustment/sizing/etc...


It sounds like an interesting problem. Here is a link to a Microsoft research paper that might be relevant.

Photo Tourism: Exploring Photo Collections in 3D

In particular look at the section on Image Based Modelling (3.1).


I think what you want is Structure from Motion, it's technique to get 3D point clouds from 2D moving images (video), I could recommend you these pages:

  • https://github.com/MasteringOpenCV/code/tree/master/Chapter4_StructureFromMotion
  • http://boofcv.org/index.php?title=Example_Stereo_Single_Camera

You will need to calibrate the camera first, after you get the point cloud you need to find the corresponding planes of the walls, optionally mesh it and then you could measure your walls.

With a Nexus One it will be slow, but maybe with newer phones you could use theirs GPU and optimize some code to make it run faster. If it were me I rather take a video and do a Desktop Application and then port it to Android, but I know little about Android development.

0

精彩评论

暂无评论...
验证码 换一张
取 消