# Is there any way to find an ellipse representation of a convex polygon stored as a set of vertex points in a vector?

Greetings all,

I have a convex polygon stored as a set of vertex points within a vector. That is,

```
std::vector< cv::Point> polygon;
```

I want to find an ellipse representation of this polygon assuming it is solid. Does anyone know of an OpenCV function to find this? I tried using the following code I dug up from some documentation, but it results in an unlabeled unhandled runtime exception after attempting to run the `fitEllipse()`

function.

```
// Doesn't work.
cv::Mat polyMat( polygon);
cv::RotatedRect ellipse= cv::fitEllipse( polyMat);
```

Does anyone know of some way to get an ellipse representation of a polygon?

Thanks for your time.

In what sense does it not work?

The cv::fitEllipse(...) call results in a runtime exception.