> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/application/image-vision.md).

# 影像視覺

運用多模態 AI 辨識發票、公文、名片、證件等圖片，直接輸出可串接業務系統的結構化 JSON 資料

企業在處理發票、帳單、公文、名片與證件時，往往仰賴人工逐欄鍵入系統，不僅耗時，也容易因疲勞而輸入錯誤。傳統 OCR 工具雖能讀出文字，卻缺乏對業務情境的理解——不同版面需要各自設計模板，讀出來的原始文字仍需大量後處理才能寫進系統。

MaiAgent 的影像視覺應用改以**多模態語言模型**處理這類工作：使用者只要在對話中上傳圖片，AI 助理就能依角色指令中定義的欄位規格，直接輸出結構化的 JSON 資料，可即時顯示於對話介面，或透過 API 串接至 ERP、CRM 等後續系統。

## Demo 影片 <a href="#demo-video" id="demo-video"></a>

{% embed url="<https://drive.google.com/file/d/1Xuso3cX8ZMChhWIa2rD7wafcDT2fUldr/view?usp=sharing>" %}

## 與傳統 OCR 的差異 <a href="#vs-traditional-ocr" id="vs-traditional-ocr"></a>

|       | 傳統 OCR 引擎     | MaiAgent 多模態 AI    |
| ----- | ------------- | ------------------ |
| 版面適應性 | 需針對每種版面設計模板   | 自動理解不同版面           |
| 欄位擴充  | 需修改程式碼        | 修改角色指令中的 JSON 欄位即可 |
| 業務規則  | 僅輸出文字，規則需另外實作 | 可在角色指令中直接描述判斷邏輯    |
| 部署成本  | 自建服務或購買授權     | 平台設定，無需撰寫程式碼       |

更完整的比較（含正反面處理、錯誤處理等）請見[證件辨識](/application/image-vision/id-card-recognition.md)。

## 適用情境 <a href="#use-cases" id="use-cases"></a>

* **財務報銷與帳務處理**：大量水電、電信、餐旅憑證需擷取發票號碼、日期、金額並寫入 ERP。
* **身分驗證流程**：金融開戶、人資報到、醫療掛號等需要從證件擷取基本資料並帶入表單。
* **名片建檔**：展會或拜訪取得的名片，自動轉為聯絡人資料匯入 CRM。
* **公文與文件歸檔**：掃描件需擷取文號、發文日期、主旨等欄位以利檢索與歸檔。

## 運作方式 <a href="#how-it-works" id="how-it-works"></a>

| 環節            | 內容                                       |
| ------------- | ---------------------------------------- |
| **① 上傳圖片**    | 使用者在對話中以附件上傳發票、名片、證件等圖片                  |
| **② AI 助理辨識** | 具視覺能力的多模態語言模型讀取圖片內容                      |
| **③ 角色指令定形**  | 依角色指令中的欄位定義、輸出範例與錯誤格式，決定要擷取哪些欄位、以什麼格式回覆  |
| **④ 結構化輸出**   | 產出 JSON 格式結果                             |
| **⑤ 後續應用**    | 於 Web Chat 即時顯示，或透過 API 串接 ERP、CRM 等業務系統 |

關鍵在於**角色指令**：您在角色指令中把 AI 助理定義成一支「辨識 API」，明確寫出要擷取哪些欄位、成功與失敗時的 JSON 輸出範例，AI 就會穩定依照該格式回覆。需要新增欄位時，改角色指令即可，不必改動任何程式碼。

## 建置流程 <a href="#setup-workflow" id="setup-workflow"></a>

### 1. 建立 AI 助理並選擇具視覺能力的模型 <a href="#step1-create-agent" id="step1-create-agent"></a>

於 <mark style="color:blue;">AI 助理</mark> 頁面[建立 AI 助理](/build/setup.md)。由於此類應用涉及圖片辨識與邏輯判斷，建議選用 Pro 等級以上的多模態模型以確保辨識精準度。

### 2. 以角色指令定義輸出格式 <a href="#step2-define-schema" id="step2-define-schema"></a>

在[角色指令](/build/system-prompt.md)中描述辨識任務與欄位規格，並附上成功與失敗的 JSON 範例。辨識不到的欄位建議保留欄位名稱、值設為 `null`，方便後續系統處理。

### 3. 上傳圖片測試 <a href="#step3-test" id="step3-test"></a>

在對話中以附件方式上傳實際單據，確認輸出欄位齊全、格式正確。建議同時測試模糊、傾斜、正反面等邊界情況。

### 4. 串接業務系統 <a href="#step4-integrate" id="step4-integrate"></a>

確認輸出穩定後，即可透過 API 將 AI 助理接入既有流程，把 JSON 結果直接寫入 ERP、CRM 或表單系統。串接狀況可於 [API 呼叫紀錄](/developer/api-logs.md)查看。

{% hint style="warning" %}
證件、發票等圖片多含個人資料，導入前請確認組織的權限設定與資料保存政策符合個資法規要求。
{% endhint %}

## 應用範例 <a href="#examples" id="examples"></a>

* [發票辨識](/application/image-vision/invoice-recognition.md)：擷取發票類型、字軌號碼、買賣方統編與品項明細，輸出為 JSON。
* [公文掃描](/application/image-vision/document-scan.md)：辨識公文掃描件的關鍵欄位以利歸檔與檢索。
* [名片掃描](/application/image-vision/business-card-scan.md)：將名片轉為姓名、職稱、公司、聯絡方式等結構化欄位。
* [證件辨識](/application/image-vision/id-card-recognition.md)：單張圖片同時辨識證件正反面，輸出標準欄位供開戶、報到等流程使用。

接下來各小節將以實際案例示範建置過程，協助您快速套用至自身的業務情境。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/application/image-vision.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
