Ask Your Question

Hanna's profile - activity

2014-11-03 08:00:21 -0600 commented answer fitEllipse bug? (for angle=180)
2014-11-03 02:09:43 -0600 received badge  Editor (source)
2014-11-03 02:08:30 -0600 answered a question fitEllipse bug? (for angle=180)

ellipse_ver.png

see image attached.

the code:

std::string filename = "ellipse_ver.png"; 

cv::Mat image = cv::imread(filename, CV_LOAD_IMAGE_GRAYSCALE);

if (image.empty()){

    return -1;

}

std::vector<std::vector<cv::Point>> contours;

cv::findContours(image.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);

cv::RotatedRect r = cv::fitEllipse(contours.at(0));
2014-10-31 05:02:32 -0600 asked a question fitEllipse bug? (for angle=180)

hello there,

if I want to fit the ellipse for an input image which is already an exact ellipse (rotated 180° to x-axis - that means height=vertical > width=horizontal), then the opencv function fitEllipse returns the correct angle (=180) but the size is totally wrong.

e.g. for an ellipse with width=43, height=86 - it returns width=51, height=57

what is wrong here?

Cheers, Hanna