17
17
18
18
19
19
class FitBezierCyl2DMask :
20
- def __init__ (self , fname_mask_image , stats_image , fname_calculated = None , fname_debug = None , b_recalc = False ):
20
+ def __init__ (self , fname_mask_image , fname_calculated = None , fname_debug = None , b_recalc = False ):
21
21
""" Read in the mask image, use the stats to start the quad fit, then fit the quad
22
22
@param fname_mask_image: Mask image name
23
- @param stats_image: the stats for this image
24
23
@param fname_calculated: the file name for the saved .json file; should be image name w/o _stats.json
25
24
@param fname_debug: the file name for a debug image showing the bounding box, etc
26
25
@param b_recalc: Force recalculate the result, y/n"""
@@ -98,11 +97,11 @@ def __init__(self, fname_mask_image, stats_image, fname_calculated=None, fname_d
98
97
@staticmethod
99
98
def create_bezier_crv_from_eigen_vectors (bezier_crv , im_mask , stats , params ):
100
99
""" Fit a quad to the mask, edge image
101
- @param bezier_crv - a blank bezier curve
100
+ @param bezier_crv - a blank bezier curve (class BezierCyl2D)
102
101
@param im_mask - the image mask
103
- @param stats - the stats from BaseStatsImage
102
+ @param stats - the stats from BaseStatsImage (class BaseStatsImage)
104
103
@param params - the parameters to use in the fit
105
- @return fitted quad and parameters used in the fit"""
104
+ @return fitted Bezier and parameters used in the fit"""
106
105
107
106
# Fit a Bezier curve to the mask - this does a bit of tweaking to try to extend the end points as
108
107
# far as possible
@@ -119,6 +118,7 @@ def create_bezier_crv_from_eigen_vectors(bezier_crv, im_mask, stats, params):
119
118
vec_len = vec_len * 1.1
120
119
121
120
bezier_crv = BezierCyl2D (pt_lower_left , pt_upper_right , 0.5 * stats ['width' ])
121
+ return bezier_crv , params
122
122
123
123
@staticmethod
124
124
def _adjust_bezier_crv_by_mask (fit_bezier_crv , im_mask , step_size = 40 , perc_width = 1.2 ):
0 commit comments