Suppose a browser and a chat window are both open. I ask my desktop assistant, “What does the first search result say?” Just then a chat notification appears: “That approach is out of date.” A human can see who said it. An assistant reading all the text on screen in sequence might include that remark in the search summary. It could recognize every character correctly and still give the wrong answer.
While experimenting with an interview assistant, I was testing displaying microphone speech on a web page one segment at a time and wanted the assistant to read the screen too. For sound I could choose a microphone. What should I choose for the screen? I first asked about continuously extracting text from a screen recording, then simplified the interaction to one keyboard shortcut and one screenshot. Web tables and search results led to a more precise requirement: identify both the window the text came from and the lines within that window that originally belonged together.
With overlapping windows, which one should the assistant read?
My Python script listened for Ctrl+Alt+T, captured one monitor with mss, converted the image to grayscale, and separated text from background according to brightness in small regions. Finally pytesseract.image_to_string invoked Tesseract to recognize the characters. This is optical character recognition (OCR). The terminal printed the recognition time and some text, with no indication of whether it came from a browser or a chat window.1
For the opening question, the simplest approach is to have the user select the browser window. To compare it with something in chat, select the chat window too and label each image with its source. Capture methods matter. Cropping the browser rectangle from a desktop screenshot still shows a notification wherever it covered the browser. Asking the system to capture the selected window depends on the operating system and capture API for scope and handling of occluded areas. The web screen capture specification distinguishes a window’s drawable surface from the part actually visible on the monitor. With only a desktop screenshot, reading a completely hidden half-sentence requires another capture after the notification disappears.2
For automatic window separation, ask the desktop system for clues. On a Linux X11 desktop supporting the relevant specification, for example, the window manager can list the windows it manages and their stacking order from bottom to top. Align those positions with a simultaneous screenshot. Where two opaque windows overlap, visible pixels belong to the upper one. A screenshot sent by another person comes without that list, so having someone mark the region to read is a reasonable starting point. An overlay ad drawn by the web page still belongs to the browser window and survives this step.3
Why can the assistant still mix things up after choosing the right browser?
Below is part of the Google page I used to test models. I searched for ways to speed up Python’s pip package installer. Try reading only the first source card on the right. Under its title is a description beginning with a date, followed by the source “稀土掘金”. Follow the same horizontal level to the left and you’ll read a software mirror’s download address. Go a little too far down the right column and you’ll reach the second card.

Detail of a screenshot I saved on July 23, 2025, cropped to the two columns. Text and layout are from that Google search. The right column contains source cards. The floating ad was a separate interference scenario I raised while discussing search results.
If the assistant has access to the page itself, it can first identify the element representing one result, then read the title and description from its children. The web page organizes elements by containment into a tree called the DOM. Roles such as list item, table row, and column header can supply additional relationships. For this Google screenshot, one would have to inspect how the actual page marked up the two cards. Appearance alone doesn’t establish the presence of a “summary” field.4
With an image alone, first retain each word’s bounding box. The same Python library’s image_to_data returns text, bounding coordinates, and line numbers together. In a minimal test on this screenshot, separate the main content from the right column at the gutter, then split the right column into two cards at its horizontal line. Within the top card, read the title, date-led description, and site name separately. Draw the selected description box back onto the image. Even if OCR missed a character, you can see whether the assistant chose the right region. Test the rule again on a page without dividers. The engine’s line numbers won’t tell you “this is the first result.”1
Tables were another example I asked about. Suppose a table header says “original price, current price” and the next row says “80, 60”. To answer “what does it cost now?”, 60 must belong both to the correct product row and to the current-price column. Grouping four words into two rows still leaves the column relationship to resolve. I began looking for models that could produce HTML (tags expressing page structure) or Markdown (plain-text markup for headings, tables, and more) straight from images. I wanted rows and cells to remain connected in the output.
If the price table came from a PDF and you can get the original, there’s another route. In notes on local olmOCR deployment, AI超元域 describes “document anchoring”. With a PDF text layer, the program can extract text and its page coordinates and give both to the model along with the full-page image. That’s another way to check where “60” and “current price” appear. The preview in the notes shows original and extracted output side by side, making it easy to check whether 60 wandered into the original-price column. If only a desktop screenshot remains, the PDF text and coordinates aren’t available. Rows and columns still have to be inferred from pixels.5
Does a vision model know which region I mean?
I tried Tesseract first because getting any text out of a screenshot was enough to test the complete workflow. Although the page screenshots looked sufficiently sharp, recognition suffered when fonts and backgrounds got complicated. I went on to ask two questions. Could a model read the image directly and output structure? And could recognized text stay in its original position for selection and copying, as I’d seen in a drink-bottle ingredient reader? Those requirements affect model choice. A model that generates a table still needs to supply positions if the program is to overlay copyable text in the right places.
Which is given: location or text? In an introduction to mPLUG-DocOwl 1.5, sanji contrasted text localization with text recognition within a region: “前者预测给定文本的边界框,后者给定边界框后识别框中文本。” The former predicts the box for specified text, while the latter recognizes the text in a specified box. In the screenshot, giving the model “稀土掘金” and asking it to draw a rectangle around the phrase means finding a location for given text. Drawing a box around the two date-led lines in the upper-right card and requesting a transcript means reading text at a given location. GOT-OCR 2.0, also covered in the article, supports specifying the region by coordinates or a colored box drawn on the image. If I just say “read the description of the first result”, though, who chooses the box? The assistant still needs to distinguish the cards and find the description within the first.6
I actually tried Donut, a model that generates text sequences directly from document images. Downloads were unreliable, so I had the script load the model from a local directory and tested my saved screenshot. Its vocabulary contained <s_cord-v2>, <s_menu>, and <s_total_price>, corresponding to receipt parsing with fields for menu items and total price. I also tried asking questions of the image to extract only the first Google result’s description and got an empty output on one attempt. Rewording a question won’t teach a receipt model how titles, ads, and summaries relate on a search page. The empty output establishes that my combination didn’t deliver what I needed, but is not enough to pinpoint why.7
I also wondered whether a general multimodal model, one that reads both images and questions, would suit these constantly changing pages better. I read 双木的木’s introduction to Ollama-OCR. Its Python example runs Llama 3.2 Vision locally on an invoice and calls process_image with format_type="markdown". The output groups five services under a line-item heading and separately identifies the pre-discount subtotal (875). Ask “how much is due?” and the “total” label leads to 875. Even if a web screenshot also produces headings and lists, I still want to check which two lines in the right column were assigned to the first card.8
In a comparison, I’d ask the model to indicate the region containing the answer too. A fluent answer alone can hide the fact that it copied a neighboring ad. Following the search for open-source approaches, I read Pix2Struct examples and the paper. The abstract describes the pretraining task as “parse masked screenshots of web pages into simplified HTML”. The model learns to output simplified page structure from partly masked web screenshots. That suggested a different way to learn grouping. I read the paper then, but Donut was the model whose local run left me results.9
Was it the wrong window or a recognition error inside the right region?
Use the same question, “Please read the description on the first card on the right,” in three tests. First provide only the first right-hand card and check whether the assistant transcribes the date-led passage. Next provide the full two-column image and see whether its box includes a left-hand mirror address or the second title below. Finally overlap the browser with a chat window and repeat the question. If the first two work but the third picks up the chat, investigate window selection and occlusion. If it consistently identifies the correct description but misreads a digit in the date, inspect OCR on that small region.
My shortcut script could record only “at this instant, these words were read from the whole screen.” If I continued, I’d first add source window, selected region, and the original text in that region to the output. When the assistant mistakes “稀土掘金” for the description, I could see whether it boxed the site name or the body and decide whether to fix grouping or recognition.
Footnotes
-
Tesseract OCR contributors. (n.d.). Tesseract OCR. GitHub. 官方仓库 README 的 About 小节,识别引擎与命令行程序。Hoffstaetter, S., & contributors. (2024, August 16). Python-tesseract (Version 0.3.13). GitHub. README 的 Functions 小节,比较 image_to_string 与 image_to_data。 ↩ ↩2
-
World Wide Web Consortium. (2021, February 5). Screen Capture (Working Draft). W3C. 第 4 节,显示器、窗口及可见表面的区别。 ↩
-
freedesktop.org. (n.d.). Extended Window Manager Hints (Version 1.5). 第 3.2 节,窗口清单与叠放顺序。 ↩
-
World Wide Web Consortium. (2023, June 6). Accessible Rich Internet Applications (WAI-ARIA) 1.2. W3C. 列表项与表格行。 ↩
-
AI超元域. (2025, March 1). 本地部署最强OCR大模型olmOCR!支持结构化精准提取复杂PDF文件内容!完美识别中英文文档、模糊扫描件与复杂表格!本地部署与实际测试全过程!医疗法律行业必备!轻松应对企业级PDF批量转换需求. 知乎. “主要功能”的“文档锚定”条目及文末“关于HTML预览”。带文字层的 PDF 与纯图像输入的区别也可对照 olmOCR 论文第 2 节、图 2。 ↩
-
sanji. (2024, November 29). 万字分享多模态大模型OCR工作 OCR VLM. 知乎. 引文见“mPLUG-DocOwl 1.5”下“多粒度文本定位”第 2 段;区域提示见 GOT-OCR 2.0 的“细粒度可交互OCR数据”第 1 段。 ↩
-
Kim, G., Hong, T., Yim, M., Nam, J., Park, J., Yim, J., Hwang, W., Yun, S., Han, D., & Park, S. (2022, October 6). OCR-free Document Understanding Transformer (v5). arXiv. 论文与摘要。NAVER CLOVA. (n.d.). donut-base-finetuned-cord-v2. Hugging Face. CORD-v2 模型说明。 ↩
-
双木的木 [csdn_xmj]. (2025, January 3). OpenCV与AI深度学习 | Ollama-OCR:现在可作为 Python 包使用! CSDN(文中注明来源为公众号“OpenCV与AI深度学习”,许可为 CC BY-SA 4.0)。“如何使用”下的“简单和高级用法”,见 Python 调用及其后的发票示例。 ↩
-
Lee, K., Joshi, M., Turc, I. R., Hu, H., Liu, F., Eisenschlos, J. M., Khandelwal, U., Shaw, P., Chang, M.-W., & Toutanova, K. (2023). Pix2Struct: Screenshot parsing as pretraining for visual language understanding. Proceedings of Machine Learning Research, 202, 18893–18912. 摘要第 2 段,第 1 句。 ↩