move the drawing of input image out of the for loop of drawing contours

I guess the input image just need to be drawn once