Extract an ellipse form from an image instead of drawing it inside
I have a rectangle that I want to extract the ellipse form of it from a given image. My code looks like:
RotatedRect ellipse ;
float p1 = (float) rect.width/2 + rect.x;
float p2 = (float) rect.height/2 + rect.y;
CvPoint2D32f p = cvPoint2D32f(p1,p2);
ellipse.center = p;
ellipse.angle = 0;
ellipse.size = cvSize2D32f((float)rect.width, (float)rect.height);
ellipse( image_colored, minEllipse, CV_RGB(255,255,255), 2, 8 );
The input of this code are: an image (image_colored) and CvRect (rect). The last line of code, draws a white ellipse inside the "image_colored", but I am looking to extract the generated ellipse in an other image or just color the rest of the image in black.
Any help, will be highly appreciated. Thank you.