Loading autocnet/graph/edge.py +7 −8 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ class Edge(dict, MutableMapping): self['fundamental_matrix'] = None self.matches = pd.DataFrame() self.masks = pd.DataFrame() self.subpixel = pd.DataFrame() self.subpixel_matches = pd.DataFrame() self['weights'] = {} self['source_mbr'] = None self['destin_mbr'] = None Loading Loading @@ -299,8 +299,8 @@ class Edge(dict, MutableMapping): without being considered an outlier """ for column, default in {'x_offset': 0, 'y_offset': 0, 'correlation': 0, 'reference': -1}.items(): if column not in self.subpixel.columns: self.subpixel[column] = default if column not in self.subpixel_matches.columns: self.subpixel_matches[column] = default # Build up a composite mask from all of the user specified masks matches, mask = self.clean(clean_keys) Loading @@ -316,7 +316,6 @@ class Edge(dict, MutableMapping): source_image = (matches.iloc[0]['source_image']) # for each edge, calculate this for each keypoint pair subpixel_offests = [] for i, (idx, row) in enumerate(matches.iterrows()): s_idx = int(row['source_idx']) d_idx = int(row['destination_idx']) Loading @@ -329,17 +328,17 @@ class Edge(dict, MutableMapping): d_search = sp.clip_roi(d_img, d_keypoint, search_size) try: x_offset, y_offset, strength = sp.subpixel_offset(s_template, d_search, **kwargs) self.subpixel.loc[idx, ('x_offset', 'y_offset', 'correlation', 'reference')]= [x_offset, y_offset, strength, source_image] self.subpixel_matches.loc[idx, ('x_offset', 'y_offset', 'correlation', 'reference')]= [x_offset, y_offset, strength, source_image] except: warnings.warn('Template-Search size mismatch, failing for this correspondence point.') # Compute the mask for correlations less than the threshold threshold_mask = self.subpixel['correlation'] >= threshold threshold_mask = self.subpixel_matches['correlation'] >= threshold # Compute the mask for the point shifts that are too large query_string = 'x_offset <= -{0} or x_offset >= {0} or y_offset <= -{1} or y_offset >= {1}'.format(max_x_shift,max_y_shift) sp_shift_outliers = self.subpixel.query(query_string) shift_mask = pd.Series(True, index=self.subpixel.index) sp_shift_outliers = self.subpixel_matches.query(query_string) shift_mask = pd.Series(True, index=self.subpixel_matches.index) shift_mask.loc[sp_shift_outliers.index] = False # Generate the composite mask and write the masks to the mask data structure Loading Loading
autocnet/graph/edge.py +7 −8 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ class Edge(dict, MutableMapping): self['fundamental_matrix'] = None self.matches = pd.DataFrame() self.masks = pd.DataFrame() self.subpixel = pd.DataFrame() self.subpixel_matches = pd.DataFrame() self['weights'] = {} self['source_mbr'] = None self['destin_mbr'] = None Loading Loading @@ -299,8 +299,8 @@ class Edge(dict, MutableMapping): without being considered an outlier """ for column, default in {'x_offset': 0, 'y_offset': 0, 'correlation': 0, 'reference': -1}.items(): if column not in self.subpixel.columns: self.subpixel[column] = default if column not in self.subpixel_matches.columns: self.subpixel_matches[column] = default # Build up a composite mask from all of the user specified masks matches, mask = self.clean(clean_keys) Loading @@ -316,7 +316,6 @@ class Edge(dict, MutableMapping): source_image = (matches.iloc[0]['source_image']) # for each edge, calculate this for each keypoint pair subpixel_offests = [] for i, (idx, row) in enumerate(matches.iterrows()): s_idx = int(row['source_idx']) d_idx = int(row['destination_idx']) Loading @@ -329,17 +328,17 @@ class Edge(dict, MutableMapping): d_search = sp.clip_roi(d_img, d_keypoint, search_size) try: x_offset, y_offset, strength = sp.subpixel_offset(s_template, d_search, **kwargs) self.subpixel.loc[idx, ('x_offset', 'y_offset', 'correlation', 'reference')]= [x_offset, y_offset, strength, source_image] self.subpixel_matches.loc[idx, ('x_offset', 'y_offset', 'correlation', 'reference')]= [x_offset, y_offset, strength, source_image] except: warnings.warn('Template-Search size mismatch, failing for this correspondence point.') # Compute the mask for correlations less than the threshold threshold_mask = self.subpixel['correlation'] >= threshold threshold_mask = self.subpixel_matches['correlation'] >= threshold # Compute the mask for the point shifts that are too large query_string = 'x_offset <= -{0} or x_offset >= {0} or y_offset <= -{1} or y_offset >= {1}'.format(max_x_shift,max_y_shift) sp_shift_outliers = self.subpixel.query(query_string) shift_mask = pd.Series(True, index=self.subpixel.index) sp_shift_outliers = self.subpixel_matches.query(query_string) shift_mask = pd.Series(True, index=self.subpixel_matches.index) shift_mask.loc[sp_shift_outliers.index] = False # Generate the composite mask and write the masks to the mask data structure Loading