Ask Your Question
0

fitEllipse bug? (for angle=180)

asked 2014-10-31 05:02:32 -0600

Hanna gravatar image

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

edit retag flag offensive close merge delete

Comments

Can you post your image and your code? It's hard to verify a bug if you don't provide a way to reproduce it.

FooBar gravatar imageFooBar ( 2014-10-31 05:11:47 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2014-11-03 02:08:30 -0600

Hanna gravatar image

updated 2014-11-03 02:59:52 -0600

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));
edit flag offensive delete link more

Comments

That's really strange. Have you already posted it on the bug-page?

FooBar gravatar imageFooBar ( 2014-11-03 04:08:35 -0600 )edit
Hanna gravatar imageHanna ( 2014-11-03 08:00:21 -0600 )edit

Question Tools

Stats

Asked: 2014-10-31 05:02:32 -0600

Seen: 661 times

Last updated: Nov 03 '14