mirror of
https://github.com/microsoft/OmniParser.git
synced 2025-02-18 03:18:33 +03:00
adaptive bbox width for asthetics
This commit is contained in:
14
demo.ipynb
14
demo.ipynb
@@ -90,16 +90,18 @@
|
||||
"image_path = 'imgs/google_page.png'\n",
|
||||
"# image_path = 'imgs/windows_home.png'\n",
|
||||
"image_path = 'imgs/windows_multitab.png'\n",
|
||||
"draw_bbox_config = {\n",
|
||||
" 'text_scale': 0.8,\n",
|
||||
" 'text_thickness': 2,\n",
|
||||
" 'text_padding': 3,\n",
|
||||
" 'thickness': 3,\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"BOX_TRESHOLD = 0.03\n",
|
||||
"\n",
|
||||
"image = Image.open(image_path)\n",
|
||||
"image_rgb = image.convert('RGB')\n",
|
||||
"box_overlay_ratio = image.size[0] / 3200\n",
|
||||
"draw_bbox_config = {\n",
|
||||
" 'text_scale': 0.8 * box_overlay_ratio,\n",
|
||||
" 'text_thickness': max(int(2 * box_overlay_ratio), 1),\n",
|
||||
" 'text_padding': max(int(3 * box_overlay_ratio), 1),\n",
|
||||
" 'thickness': max(int(3 * box_overlay_ratio), 1),\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"ocr_bbox_rslt, is_goal_filtered = check_ocr_box(image_path, display_img = False, output_bb_format='xyxy', goal_filtering=None, easyocr_args={'paragraph': False, 'text_threshold':0.9}, use_paddleocr=True)\n",
|
||||
"text, ocr_bbox = ocr_bbox_rslt\n",
|
||||
|
||||
Reference in New Issue
Block a user