Yeah, I originally thought that it would be a good idea to find the corners first, and then make lines from them but I've written a little test app and done some "testing" of a few algorithms on paper and there is nothing easy about finding corners - it is easier to find the lines.
Neural network isn't appropriate because I don't want to just check if it exists - I need to know it's exact dimensions to extract angles from it.
All of the maths related solutions I've found seem way to complex, and would require far too much computational power.
Here is what I've come up with so far...have tried on paper and it works really well

...
(by the way, the plan is to have it done in real time at least 10fps on a pda with inbuilt camera)
- firstly, only deal with a component of the original camera image (128x128 pixels)
- split the image into 8x8 pixel grid (16x16 grid)
- for each 8x8 pixel block calculate the gradient by finding where pixels cross the boundary and following it through to an extremity pixel at a time, ignoring white pixels
- each 8x8 cell will have stored xStart, yStart, xEnd, yEnd, xInc, yInc
- once the pixel analysis is complete, then start interpreting the 16x16 grid of gradients by stepping through from top left and seeing if any surrounding element has a similar gradient - if so see if the xStart/yStart/xEnd/yEnd match between them - if so then it can be deemed as the "same line" so follow the gradient through to find the line end (never process element more than once, assumed one gradient per 8x8 pixels - so once an element is flagged as being part of a line it is ignored) - keep array of lines
- from paper tests this seems to be highly effective in extracting lines, but 8x8grid elements containing corners are ignored (only one gradient per element)
- the final step is to identify from the line array which ones intersect within one/perhaps two elements by extending their lines or solving a simultaneous equat etc - haven't got this quite sorted yet - but where they intersect will produce a polygon list and there shouldn't be too many four sided polygons because my edge filtering is biased to highlight transitions between black and white (which the marker I'm trying to identify will be)
Next step is to build a prototype, but the above algorithm should be very fast - the pixel processing, although not cache aligned access will at worst case have to investigate every pixel once in a 128x128 image which should be quick, and from there it's broken down into a 16x16 problem which at most has each element inspected about 5 times, and then depending on how many lines it will take a few more inspections to see how they join to form polygons. ... well that's the plan
