Dividing into rooms

I trying to write some code which able to detect rooms in a map. The map is represented in an matrix as in black/white pixels.

Part of the map looks like this in which 1 represents black pixels => wall, and 0 represent freespace.

1
2
3
4
5
6
7
8
9

Map = {1,1,1,1,1,1,1,1,1,1
       1,0,0,0,0,0,0,0,0,1
       1,0,0,0,0,0,0,0,0,0
       1,0,0,0,0,0,0,0,0,1
       1,1,1,1,1,1,1,1,1,1
       1,0,0,0,0,0,0,0,0,1
       1,0,0,0,0,0,0,0,0,1
       }



My idea was to have a Class called room which has all the pixels which a room consist in a vector, but how shall I constrain the class to only have the pixels of the room, and not the obstacles as walls in this case, and separate a room with another room.. ??



Topic archived. No new replies allowed.