views:

41

answers:

1

I have an occupancy grid that has 3 states - Occupied, Free, Unknown. Occupancy grid is a simple 2 dimensional array of states. The grid represents a floor plan where Occupied=Wall, Free=Open Floor, Unknown=what's behind the wall or not mapped. This grid is say 800x800 wide with each cell representing 5cm of the real world.

I want to take this and make it into a WPF Path Shape. Then I can then manipulate on the screen, Allow a user to add walls (by drawing lines), and eventually export to some form of CAD standard/SVG/etc.

I started playing with writable bitmaps and can create a perfect picture of the grid, how ever a bitmp isn't a path, and some of my lines are jagged or unconnected.

I am looking for ideas on how to translate this grid, or thebitmap, into clean wpf shapes. Lines, Polygons, Polylines, or Paths would all make me very happy becuase once I have those I can do anything. Any ideas?

A: 

If your walls are only in some basic geometrical shapes (lines, others like circles get much more complicated) you might want to use Hough transform or some other transform, depending how your images look like. If I understand it correctly that your images have only three colours you might not have to use some edge detection algorithm.

Edit: If the Occupied state represents only thin surfaces of walls that is all you need. You would get lines for your walls (delimiting free/unknown areas)

Lukas
good pointers - but once I have the edges detected and shapened how do you advise I translate those into a line/polyline/path?
Marc Samale
After Hough (or similar) transform you get points (in transformed space) representing lines that are found in your image (even if you supply just some coordinates, not a real image (that should be even faster)). After this you compare those lines to your map data to determine their length. This gives you a set of lines covering your walls. If you take their intersections (set of points) you should be able to create a polyline, polygon or whatever else you need. I am just before starting a real programming (not just drawing and thinking) work on something very similar - any experience welcome
Lukas
I am first trying to vectorize the bitmap and see if that gets me what I want. There are some edge detection functs in the library I am using (Potrace - well .net port of Potrace). I think if i get an svg I can then translate that to a path/poly and I am a happy guy. I will update with progress
Marc Samale
Potrace is giving me some really good results. Feel from to contact me directly if you want some pointers. Hough Transform got me no where!
Marc Samale