MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / ocr_items

Function ocr_items

app/services/tenvision_adapter.py:184–203  ·  view source on GitHub ↗
(result, x_offset=0, y_offset=0)

Source from the content-addressed store, hash-verified

182 for index, (poly, text, score) in enumerate(zip(boxes, txts, scores)):
183 poly = order_points(np.asarray(poly, dtype=np.float32))
184 bbox = poly_to_bbox(poly)
185 x, y, w, h = bbox
186 items.append(
187 {
188 'index': index,
189 'poly': poly,
190 'bbox': (x + x_offset, y + y_offset, w, h),
191 'text': normalize_text(str(text)),
192 'score': float(score),
193 'area': int(w * h),
194 }
195 )
196 return items
197
198
199def find_prompt_item(items, image_h, image_w):
200 prompt_candidates = []
201 for item in items:
202 text = item['text']
203 x, y, w, h = item['bbox']
204 if y > int(image_h * 0.22):
205 continue
206 chars = parse_prompt_chars(text)

Callers 2

build_prompt_charsFunction · 0.85
run_pipeline_bytesFunction · 0.85

Calls 4

to_listFunction · 0.85
order_pointsFunction · 0.85
poly_to_bboxFunction · 0.85
normalize_textFunction · 0.85

Tested by

no test coverage detected