Hi padvou,
You must think of OpenCV as a big 'set' of powerful functions for processing. The problem can be faced in different ways, but it will always work better if it has some 'clues' (as many as you can give it)
For instance:
Is it a preloaded image or real-time input from a camera?
in case of a circle: is it always filled with a color (and is it the same color)? Which is the (relative to picture dimensions) minimum and maximum size that it can have?
For square, nearly the same questions: also, will the square be aligned to picture edges or can it be in 'perspective'?
The 'optimum' way to program it will depend on the answers to these questions. With these answers (also, if you can send an example picture will be much better), I (or others) will try to help you.