After a whole night… fiuh… This is what I call “beautiful”.
cvFindContours and cvApproxPoly functions play the big role here. To remove the unexpected contours appear, filter it using how big the area the contours should have. To draw the nice red lines that adapt to sequence running (this is webcam), use cvPolyLine and cvCvtSeqToArray regarding to 4 points that is modeled by CvPoint. The green and blue circles are drawn using cvCircle.
Now time to stay away from the computer.