Extraction of object from contour and save it as new image

yes, and?

imagine asking this on Stack Overflow. their rules are a good idea to take as guidelines here.