Closed dafnevk closed 8 years ago
Write a helper function which converts axis lengths and angle to polynomial coefficients. The code should be equivalent to conversion_ellipse.m
Write a helper function binary_mask2ellipse_features which computes the ellipse features (coefficients) from a binary mask of 1 region type (holes|islands|indentations|protrusions). This code should be equivalent to the matlab code in binary_mask2features.m.
cv2.connectedComponentsWithStats doesn't give enough statistics needed for the region to ellipse representation, e.g. no axis length or orientation. We might need scikit-image for that :-(
I also came across the function fitellipse , is that of any help?
Not exactly. We actually don't need the ellipse itself, but rather some measurements of the region, namely defined as:
'MajorAxisLength' Returns a scalar that specifies the length (in pixels) of the major axis of the ellipse that has the same normalized second central moments as the region.
'MinorAxisLength' Returns a scalar that specifies the length (in pixels) of the minor axis of the ellipse that has the same normalized second central moments as the region.
'Orientation' Returns a scalar that specifies the angle between the x-axis and the major axis of the ellipse that has the same second-moments as the region.
I think we need code like this one: http://opencvpython.blogspot.nl/2012/04/contour-features.html
This code actually uses fitEllipse, so that might work, thanks!
it seems it might be as simple as (x,y),(MA,ma),angle = cv2.fitEllipse(cnt)
Issue moved to NLeSC/SalientDetector-python #5 via ZenHub.io
In order to evaluate the quality of the salient regions, we need to output the salient regions as files containing the coordinates and parameter of the corresponding ellipses. Part of the code (see comments) should be equivalent to the matlab code in binary_mask2features.m.