Hi all,

I have a project where I need to read in an image of a maze and use a graph data structure to find certain points in the maze to place nodes and trace edges. I plan to have the maze be in only two different colors. The walls/background as red and the maze path as white.

My Problem:
I'm not sure what I can do about parsing an image to find intersections, dead-ends, and turns to place nodes. If I recall, you can place each pixel of the image into a 2D array and search through the image that way (or something like this), but would this be easy to do, or is there an easier way to determine node placements of intersections, dead-ends, and turns?

Any help would be much appreciated. I want to plan as much as possible before I code so I don't waste time.

Thanks in advance!

Recommended Answers

All 2 Replies

The BufferedImage class has a method that returns an array of pixels that can be scanned.
I do not know of any class or method that will scan that array for what you wan to find.

I'll use the BufferedImage class then.

I assumed I would have to write my own algorithm to find the locations and place nodes where neccessary, so that's a not a big deal.

I'll set this to solved :) ty

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.