MCPcopy
hub / github.com/BIT-DataLab/Edit-Banana / scan_line

Function scan_line

modules/basic_shape_processor.py:214–222  ·  view source on GitHub ↗
(pixels, limit)

Source from the content-addressed store, hash-verified

212 detected_widths = []
213
214 def scan_line(pixels, limit):
215 if len(pixels) < limit + 1:
216 return None
217 diffs = np.abs(np.diff(pixels[:limit+2].astype(int)))
218 threshold = 35 # 提高阈值,减少误检(原值20太敏感)
219 candidates = np.where(diffs > threshold)[0]
220 if len(candidates) > 0:
221 return candidates[0] + 1
222 return None
223
224 num_samples = 5
225

Callers 1

calculate_stroke_widthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected