Module Expr Str Import alias Import alias Import alias Import alias identifier FunctionDef arguments args NameParam defaults body While NameLoad body Expr Yield NameLoad Assign NameStore Call AttributeLoad NameLoad attr decorator_list ClassDef bases body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Str NameLoad Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad Num AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr TupleLoad Num Num For NameStore Call NameLoad NameLoad body If CompareGtE Call NameLoad NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad AttributeLoad NameLoad attr For TupleStore NameStore TupleStore NameStore NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index TupleLoad Num NameLoad TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Num Num Num TupleLoad Num Num Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore TupleLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore TupleLoad Call AttributeLoad NameLoad attr BinOpMult SubscriptLoad NameLoad Index Num Num Call AttributeLoad NameLoad attr BinOpMult SubscriptLoad NameLoad Index Num Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Num Num NameLoad Num AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str NameLoad decorator_list decorator_list If CompareEq NameLoad Str body If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num AttributeLoad NameLoad attr orelse Assign NameStore Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Num Call NameLoad NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Num Expr Call AttributeLoad NameLoad attr Str Num Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad NameLoad Num Print Str Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str
N/A N/A 
This program is a demonstration of ellipse fitting.

Trackbar controls threshold parameter.

Gray lines are contours.  Colored lines are fit ellipses.

Original C implementation by:  Denis Burenkov.
Python implementation by: Roman Stanchak, James Bowman
 N/A sys N/A urllib2 N/A random N/A cv2.cv cv contour_iterator N/A N/A contour N/A N/A N/A contour N/A N/A N/A contour N/A contour N/A N/A contour h_next N/A FitEllipse N/A N/A __init__ N/A N/A self source_image slider_pos N/A N/A N/A N/A self source_image source_image N/A N/A N/A cv CreateTrackbar Threshold Result slider_pos 255 N/A self process_image N/A N/A N/A self process_image slider_pos N/A process_image N/A N/A self slider_pos N/A N/A N/A 
        This function finds contours, draws them and their approximation by ellipses.
         N/A stor N/A N/A cv CreateMemStorage N/A image02 N/A N/A cv CloneImage N/A self source_image N/A N/A N/A cv Zero image02 N/A image04 N/A N/A cv CreateImage N/A N/A cv GetSize N/A self source_image N/A cv IPL_DEPTH_8U 3 N/A N/A N/A cv Zero image04 N/A N/A N/A cv Threshold N/A self source_image image02 slider_pos 255 N/A cv CV_THRESH_BINARY N/A cont N/A N/A cv FindContours image02 stor N/A cv CV_RETR_LIST N/A cv CV_CHAIN_APPROX_NONE N/A 0 0 N/A c N/A contour_iterator cont N/A N/A N/A N/A len c 6 N/A N/A PointArray2D32f N/A N/A cv CreateMat 1 N/A len c N/A cv CV_32FC2 N/A N/A i N/A x y N/A enumerate c N/A N/A N/A PointArray2D32f N/A N/A 0 i N/A x y N/A gray N/A N/A cv CV_RGB 100 100 100 N/A N/A N/A cv DrawContours image04 c gray gray 0 1 8 N/A 0 0 N/A N/A center size angle N/A N/A cv FitEllipse2 PointArray2D32f N/A center N/A N/A N/A cv Round N/A center N/A 0 N/A N/A cv Round N/A center N/A 1 N/A size N/A N/A N/A cv Round N/A N/A size N/A 0 0.5 N/A N/A cv Round N/A N/A size N/A 1 0.5 N/A color N/A N/A cv CV_RGB N/A N/A random randrange 256 N/A N/A random randrange 256 N/A N/A random randrange 256 N/A N/A N/A cv Ellipse image04 center size angle 0 360 color 2 N/A cv CV_AA 0 N/A N/A N/A cv ShowImage Result image04 N/A N/A N/A N/A __name__ __main__ N/A N/A N/A N/A len N/A sys argv 1 N/A N/A source_image N/A N/A cv LoadImage N/A N/A sys argv N/A 1 N/A cv CV_LOAD_IMAGE_GRAYSCALE N/A N/A url https://raw.github.com/Itseez/opencv/master/samples/c/stuff.jpg N/A filedata N/A N/A N/A N/A urllib2 urlopen url read N/A imagefiledata N/A N/A cv CreateMatHeader 1 N/A len filedata N/A cv CV_8UC1 N/A N/A N/A cv SetData imagefiledata filedata N/A len filedata N/A source_image N/A N/A cv DecodeImage imagefiledata N/A cv CV_LOAD_IMAGE_GRAYSCALE N/A N/A N/A cv NamedWindow Source 1 N/A N/A N/A cv NamedWindow Result 1 N/A N/A N/A cv ShowImage Source source_image N/A fe N/A FitEllipse source_image 70 N/A Press any key to exit N/A N/A N/A cv WaitKey 0 N/A N/A N/A cv DestroyWindow Source N/A N/A N/A cv DestroyWindow Result