I'm new to Mathematica but I found an interesting usage of it: I'm programming a 2D game, with a top-view, where I'd like to have the edge coordinates of the walls. EdgeDetection delivers me quite a good result:
In this post, I saw a really impressing example of getting picture points
into a (even) 3D plot. I found PixelValuePositions[background, 1]
which delivers me all white pixels. However, I really don't understand how to get the 4 corners of after running EdgeDetect
and creating a immense list of white pixels.
How can I (iterate) through the points, to get the 4 corners every wall has?
Update 1:
I view walls as simple rectangular shapes, given by two corners. The expected results are for each "wall rectangle" two points that define the rectangle (x1, y1) and (x2, y2).
Is it possible to get an output just like:
x1 y1 x2 y2
x1 y1 x2 y2
this means, just "printing out" the coordinates of a rectangle on a line, then give the next rectangle on a new line?
Update 2:
As s.s.o mentioned, it seems to be quite related to this post.
The accepted answer uses ComponentMeasurements
, but I simply don't get it
how it works and if it does for my situation, too.
MorphologicalGraph
as well? $\endgroup$