1 | initial version |
Well saying I've used the code from the tutorial tells me you just copy pasted the code. Those samples are there for you to adapt it to your needs ... Questions like this never get decent support, because it tells us you did not try anything rather then copying the code.
You could follow these steps
CV_RETR_TREE
by CV_RETR_EXTERNAL
to remove useless contours and only keep the interesting contourscontourArea()
Using that final contour you can cut that part of the image out, using the region of interest approach.