I might be wrong, but I think you should do your research on image recognition instead of pattern recognition, and you might find a solution easier that way. otherwise, I don't know anything about either recognition, just thought I'd give an idea.
Are you really interested in looking at the pixels of an image one by one and then trying to determine if there is a recognizable shape there?
Take a piece of graph paper, draw a shape and go thru it starting at 0,0 to the ending x,y. Record when there is a pixel that is part of the shape.
Do you really have to do this? Pattern/shape recognition is possibly the hardest thing ever to program.
If you must then you have a choice of three main strategies - look for lines/edges, count sides & corners etc OR take the shape as a solid "block", rotate/resize it to some standard size & position, the compare it with a library of pre-defined shapes to see which it fits most closely OR write an adaptive learning system that "evolves" to "learn" shapes that are presented to it.
Option 2 is probably the easiest to code, but also the least generalisable.