Module Expr Str Import alias identifier ImportFrom alias identifier ImportFrom alias alias Expr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Num Assign NameStore Call AttributeLoad NameLoad attr Num Num Assign NameStore BinOpAdd BinOpMult Num NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr ListLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpMult Num ListLoad TupleLoad Num Num AugAssignAdd NameStore BinOpMult Num Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Slice SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword AttributeLoad NameLoad attr AugAssignAdd NameStore BinOpMult Num NameLoad AugAssignAdd SubscriptStore NameLoad Slice Num BinOpMult Num SubscriptLoad NameLoad Slice Num AugAssignAdd SubscriptStore NameLoad Slice Num BinOpMult Num SubscriptLoad NameLoad Slice Num Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad keyword Num keyword Num keyword Num Assign NameStore CompareEq NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index TupleLoad NameLoad Num SubscriptLoad NameLoad Index TupleLoad NameLoad Num Str keyword Num keyword Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index TupleLoad NameLoad Num SubscriptLoad NameLoad Index TupleLoad NameLoad Num Str keyword Num keyword Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str keyword Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str keyword Str Expr Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr
N/A N/A 
=========================================
Robust line model estimation using RANSAC
=========================================

In this example we see how to robustly fit a line model to faulty data using
the RANSAC algorithm.

 N/A numpy np matplotlib pyplot plt skimage.measure LineModelND ransac N/A N/A N/A N/A np random seed seed 1 N/A x N/A N/A np arange -200 200 N/A y N/A N/A 0.2 x 20 N/A data N/A N/A np column_stack N/A x y N/A faulty N/A N/A np array N/A 30 N/A N/A 180.0 -100 N/A faulty N/A 5 N/A N/A N/A np random normal size N/A faulty shape N/A N/A data N/A N/A N/A faulty shape N/A 0 faulty N/A noise N/A N/A N/A np random normal size N/A data shape N/A data N/A 0.5 noise N/A N/A data N/A 2 N/A 5 N/A noise N/A 2 N/A N/A data N/A 4 N/A 20 N/A noise N/A 4 N/A model N/A LineModelND N/A N/A N/A model estimate data N/A N/A model_robust inliers N/A ransac data LineModelND min_samples 2 residual_threshold 1 max_trials 1000 N/A outliers N/A inliers False N/A line_x N/A N/A np arange -250 250 N/A line_y N/A N/A model predict_y line_x N/A line_y_robust N/A N/A model_robust predict_y line_x N/A N/A fig ax N/A N/A plt subplots N/A N/A N/A ax plot N/A data N/A N/A inliers 0 N/A data N/A N/A inliers 1 .b alpha 0.6 label Inlier data N/A N/A N/A ax plot N/A data N/A N/A outliers 0 N/A data N/A N/A outliers 1 .r alpha 0.6 label Outlier data N/A N/A N/A ax plot line_x line_y -k label Line model from all data N/A N/A N/A ax plot line_x line_y_robust -b label Robust line model N/A N/A N/A ax legend loc lower left N/A N/A N/A plt show