NLeSC / LargeScaleImaging

Data, Software,Results and Publications for the Large Scale Imaging research @ NLeSc
Apache License 2.0
3 stars 0 forks source link

Write function to output file with ellipses #21

Closed dafnevk closed 8 years ago

dafnevk commented 8 years ago

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.

elboyran commented 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

elboyran commented 8 years ago

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.

elboyran commented 8 years ago

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 :-(

dafnevk commented 8 years ago

I also came across the function fitellipse , is that of any help?

elboyran commented 8 years ago

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.

elboyran commented 8 years ago

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!

elboyran commented 8 years ago

it seems it might be as simple as (x,y),(MA,ma),angle = cv2.fitEllipse(cnt)

dafnevk commented 8 years ago

Issue moved to NLeSC/SalientDetector-python #5 via ZenHub.io