# IronOCR을 사용하여 C#에서 읽기 결과를 추출하는 방법
IronOCR의 `Read` 메서드는 검색된 텍스트 및 정밀한 좌표, 크기, 텍스트 방향, 계층 구조 (단락, 라인, 단어, 문자 포함)를 포함한 자세한 메타데이터를 포함하는 `OcrResult` 객체를 반환합니다.
OCR 결과에는 감지된 단락, 줄, 단어 및 개별 문자에 대한 포괄적인 정보가 포함되어 있습니다.
각 요소에 대해 텍스트 내용, 정확한 X 및 Y 좌표, 크기 (너비 및 높이), 텍스트 방향 (왼쪽에서 오른쪽 또는 위쪽에서 아래쪽), [`CropRectangle`](/open-source/csharp/drawing/examples/convert-measurement-unit-of-croprectangle/) 객체 내 위치를 제공합니다.
*as-heading:2(빠른 시작: 처음 감지된 단어에서 단어 텍스트 가져오기)*
`IronTesseract`의 `Read` 메서드를 사용하여 이미지를 OCR하고 `단어s` 컬렉션을 사용하여 첫 번째 단어의 텍스트를 추출하세요.
```cs
:title=Read OCR Results Instantly
string wordText = new IronTesseract().Read("file.jpg").단어s[0].Text;
```
<div class="hsg-featured-snippet">
<h3>최소 워크플로우(5단계)</h3>
<ol>
<li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://nuget.org/packages/IronOcr/">읽기 결과에 접근하기 위한 C# 라이브러리를 다운로드하세요.</a></li>
<li>대상 이미지와 PDF 문서를 준비하세요.</li>
<li>가져온 문서에 OCR을 수행하려면 <code>Read</code> 메서드를 사용하십시오.</li>
<li><code>X</code>, <code>Y</code>, <code>너비</code>, <code>높이</code>, 및 <code>텍스트 방향</code>의 결과에 엑세스할 수 있습니다.</li>
<li>감지된 단락, 줄, 단어 및 문자 비교를 확인하세요.</li>
</ol>
</div>
## OCR 결과에서 어떤 데이터를 추출할 수 있나요?
결과 값에는 추출된 텍스트뿐만 아니라 IronOCR이 PDF 및 이미지 문서에서 발견한 페이지, 단락, 줄, 단어, 문자 및 바코드에 대한 정보도 포함됩니다. 이 정보를 반환된 [OcrResult 객체](https://ironsoftware.com/csharp/ocr/examples/results-objects/)에서 `Read` 메서드를 사용하여 액세스할 수 있습니다.
IronOCR의 포괄적인 결과 시스템은 강력한 [Tesseract 5 엔진을](https://ironsoftware.com/csharp/ocr/tutorials/c-sharp-tesseract-ocr/) 기반으로 구축되어 개발자에게 단순 텍스트 인식 이상의 구조화된 데이터 추출 기능을 제공합니다. [스캔된 문서](https://ironsoftware.com/csharp/ocr/examples/read-scanned-document/), [사진](https://ironsoftware.com/csharp/ocr/examples/read-photo/), 또는 [스크린샷](https://ironsoftware.com/csharp/ocr/examples/read-screenshot/)을 처리하는지 여부에 관계없이, `OcrResult` 클래스는 추출된 데이터에 대한 세분화된 제어를 제공합니다.
```csharp
:path=/static-assets/ocr/content-code-examples/how-to/read-results-output-information.cs
```
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/result.webp" alt="Visual Studio 디버거에서 일본어 비즈니스 문서의 OCR 추출 결과(좌표 및 텍스트 포함)를 보여줍니다." class="img-responsive add-shadow" />
</div>
</div>
### OCR 결과에서 텍스트 콘텐츠에 어떻게 접근할 수 있나요?
`OcrResult` 객체는 추출된 텍스트를 간단하고 직관적인 방식으로 제공하여 개발자가 이를 직접 사용하거나 다른 애플리케이션 구성 요소에 통합할 수 있도록 합니다. 계층적 구조는 자연 문서의 텍스트 구성을 반영하므로 다양한 세분화 수준에서 콘텐츠를 쉽게 다룰 수 있습니다.
[다국어 지원이](https://ironsoftware.com/csharp/ocr/how-to/ocr-multiple-languages/) 필요한 애플리케이션의 경우, IronOCR은 다국어 문서를 원활하게 처리하여 [지원되는 125개 언어](https://ironsoftware.com/csharp/ocr/examples/intl-languages/) 모두에서 동일한 구조화된 결과 형식을 유지합니다.
다음 코드 예제는 결과를 확인하기 위해 반복문을 사용하여 텍스트를 출력합니다.
```csharp
:path=/static-assets/ocr/content-code-examples/how-to/read-results-output-text.cs
```
#### 산출
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/result-text-output.webp" alt="마사요시 손과 야스미츠 시게타에 대한 OCR 단락 감지 결과 및 추출된 텍스트를 표시하는 터미널 화면." class="img-responsive add-shadow" />
</div>
</div>
콘솔 출력에는 IronOCR이 단락 텍스트를 한 줄씩 정확하게 추출하는 모습이 표시됩니다. 엔진은 단락 경계를 자동으로 감지하므로 여러 텍스트 블록이 포함된 복잡한 문서를 처리하는 데 이상적입니다.
### 감지된 텍스트의 위치 좌표를 어떻게 얻을 수 있나요?
추출된 텍스트 외에도, `OcrResult`은 자세한 위치 데이터를 제공합니다. 이러한 공간 정보는 레이아웃의 정확성을 유지하거나 문서의 특정 영역에서 텍스트를 선택적으로 추출해야 하는 애플리케이션에 매우 중요합니다. 좌표계는 페이지의 왼쪽 상단 모서리를 기준으로 표준 픽셀 측정값을 사용합니다.
좌표 기반 작업의 정확도를 높이려면 [OCR 영역 타겟팅을](https://ironsoftware.com/csharp/ocr/how-to/ocr-region-of-an-image/) 사용하여 특정 영역에 집중하거나 [컴퓨터 비전 기능을](https://ironsoftware.com/csharp/ocr/how-to/computer-vision/) 활용하여 텍스트 영역을 자동으로 식별하는 것을 고려하십시오.
다음 코드는 각 단락을 순회하며 해당 단락의 좌표(X 및 Y)를 콘솔에 출력하는 방법을 보여줍니다.
```csharp
:path=/static-assets/ocr/content-code-examples/how-to/read-results-output-coordinates.cs
```
#### 산출
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/result-coordinates-output.webp" alt="터미널 출력은 OCR이 감지한 단락 좌표와 X,Y 값을 보여줍니다: (29,30), (28,74), (27,362)" class="img-responsive add-shadow" />
</div>
</div>
출력 결과에는 세 개의 단락에 해당하는 세 세트의 좌표가 표시됩니다. 이러한 좌표는 경계 상자를 그리거나, 특정 영역을 추출하거나, 텍스트 요소 간의 공간적 관계를 유지하는 데 사용할 수 있습니다.
### OCR 결과에서 확인할 수 있는 다른 속성은 무엇인가요?
IronOCR은 텍스트와 텍스트 좌표 외에도 추가 정보를 제공합니다. 각 텍스트 요소(단락, 줄, 단어 및 개별 문자)에 대해 다음 정보를 확인할 수 있습니다.
- **텍스트:** 문자열 형태의 실제 텍스트.
- **X:** 페이지 왼쪽 가장자리로부터의 위치(픽셀 단위).
- **Y:** 페이지 상단 가장자리로부터의 위치(픽셀 단위).
- **Width:** 픽셀 단위의 너비.
- **높이:** 픽셀 단위의 높이.
- **텍스트 방향:** 텍스트가 읽히는 방향(왼쪽에서 오른쪽 또는 위에서 아래).
- **위치:** 이 텍스트가 페이지에서 픽셀 단위로 어디에 위치하는지 나타내는 사각형.
이러한 속성은 특히 다음과 같은 경우에 유용합니다.
- 텍스트 강조 표시 및 주석 시스템
- 자동 양식 필드 감지
- 문서 변환 시 레이아웃 유지
- 데이터 추출을 위한 공간 텍스트 분석
디버깅 및 시각화를 위해 [텍스트 강조 표시 기능을](https://ironsoftware.com/csharp/ocr/examples/highlight-texts-for-debugging/) 사용하여 감지된 영역의 정확도를 시각적으로 확인하십시오.
### 문단, 행, 단어, 그리고 등장인물은 어떻게 다를까요?
IronOCR의 계층적 텍스트 구조를 통해 개발자는 특정 사용 사례에 맞는 적절한 세부 수준에서 작업할 수 있습니다. 이러한 요소들 간의 차이점을 이해하면 애플리케이션에 적합한 세분성을 선택하는 데 도움이 됩니다.
아래는 감지된 단락, 줄, 단어 및 문자를 비교한 내용입니다.
<table class="table" style="text-align: center; background-color: #f1f9fb;">
<tr>
<td style="width: 50%;">
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/paragraph.webp" alt="일본 기술 기업가인 마사요시 손과 야스미쓰 시게타의 주요 인물 소개" class="img-responsive add-shadow" />
<p class="competitors__download-link" style="color: #181818; font-style: italic;">절</p>
</div>
</div>
</td>
<td style="width: 50%;">
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/line.webp" alt="붉은색으로 강조 표시된 문서는 일본 IT 기업 임원인 마사요시 손과 야스미쓰 시게타의 프로필을 보여줍니다." class="img-responsive add-shadow" />
<p class="competitors__download-link" style="color: #181818; font-style: italic;">선</p>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/word.webp" alt="기술 투자에 관한 단락에서 선택한 단어 위에 빨간색 상자를 씌워 표시하는 텍스트 강조 기능입니다." class="img-responsive add-shadow" />
<p class="competitors__download-link" style="color: #181818; font-style: italic;">단어</p>
</div>
</div>
</td>
<td>
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/character.webp" alt="OCR 결과에서 개별 문자 경계를 보여주는 문자 수준 텍스트 감지" class="img-responsive add-shadow" />
<p class="competitors__download-link" style="color: #181818; font-style: italic;">성격</p>
</div>
</div>
</td>
</tr>
</table>
각 세분화 수준은 서로 다른 목적을 수행합니다.
- **단락** : 문서 구조 분석 및 대량 텍스트 추출에 가장 적합합니다.
- **줄** : 읽기 순서를 유지하고 표 형식 데이터를 처리하는 데 유용합니다.
- **단어** : 검색 기능 및 텍스트 분석에 이상적입니다.
- **문자** : 맞춤법 검사 및 정밀한 텍스트 편집에 적합합니다.
## IronOCR은 바코드와 QR 코드를 읽을 수 있습니까?
네, IronOCR은 바코드와 QR 코드를 읽을 수 있습니다. 기능이 IronBarcode만큼 강력하지 않을 수 있지만 IronOCR은 일반적인 바코드 유형을 지원합니다. 바코드 검출을 활성화하려면 `Configuration.ReadBarCodes` 속성을 true로 설정하십시오. 이러한 통합 기능 덕분에 IronOCR은 송장, 배송 라벨 또는 제품 카탈로그와 같이 텍스트와 바코드가 모두 포함된 문서를 처리하는 데 탁월한 선택입니다.
또한, `IronSoftware.Drawing.Rectangle` 객체로 형식, 값, 좌표 (x,y), 높이, 너비 및 위치를 포함한 검출된 바코드에서 유용한 정보를 추출할 수 있습니다. [IronDrawing](/python/docs) 의 **Rectangle** 클래스를 사용하면 문서에서 정확한 위치에 배치할 수 있습니다.
보다 고급 바코드 판독 시나리오에 대해서는 문서에 있는 포괄적인 [바코드 판독 예제를](https://ironsoftware.com/csharp/ocr/examples/csharp-ocr-barcodes/) 참조하십시오.
```csharp
:path=/static-assets/ocr/content-code-examples/how-to/read-results-barcodes.cs
```
### 바코드 감지 결과 출력은 어떻게 나타나나요?
IronOCR의 바코드 감지 기능은 텍스트 추출 기능과 완벽하게 통합되어 텍스트 콘텐츠와 바코드 데이터를 모두 포함하는 통합 결과를 제공합니다. 이러한 이중 기능은 두 가지 유형의 정보를 모두 추출하고 상호 연관시켜야 하는 자동 문서 처리 워크플로에 유용합니다.
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/read-results/barcodes.webp" alt="QR 코드 및 EAN8 바코드 감지 결과와 형식, 값, 좌표를 보여주는 디버그 콘솔" class="img-responsive add-shadow" />
</div>
</div>
출력 결과는 IronOCR이 여러 바코드 유형을 동시에 감지하여 형식 식별(예: QR 코드 또는 EAN8), 디코딩된 값 및 감지된 각 코드에 대한 정확한 좌표 정보를 제공하는 기능을 보여줍니다. 이처럼 포괄적인 데이터를 통해 개발자는 다양한 콘텐츠 유형을 효율적으로 처리하는 정교한 문서 처리 애플리케이션을 구축할 수 있습니다.
결과 값에는 추출된 텍스트뿐만 아니라 IronOCR이 PDF 및 이미지 문서에서 발견한 페이지, 단락, 줄, 단어, 문자 및 바코드에 대한 정보도 포함됩니다. 이 정보를 반환된 OcrResult 객체에서 Read 메서드를 사용하여 액세스할 수 있습니다.
IronOCR의 포괄적인 결과 시스템은 강력한 Tesseract 5 엔진을 기반으로 구축되어 개발자에게 단순 텍스트 인식 이상의 구조화된 데이터 추출 기능을 제공합니다. 스캔된 문서, 사진, 또는 스크린샷을 처리하는지 여부에 관계없이, OcrResult 클래스는 추출된 데이터에 대한 세분화된 제어를 제공합니다.
using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Add imageusing var imageInput = new OcrImageInput("sample.jpg");// Perform OCROcrResult ocrResult = ocrTesseract.Read(imageInput);// Retrieve list of detected paragraphsParagraph[] paragraphs = ocrResult.Paragraphs;// Output information to consoleConsole.WriteLine($"Text: {paragraphs[0].Text}");Console.WriteLine($"X: {paragraphs[0].X}");Console.WriteLine($"Y: {paragraphs[0].Y}");Console.WriteLine($"Width: {paragraphs[0].Width}");Console.WriteLine($"Height: {paragraphs[0].Height}");Console.WriteLine($"Text direction: {paragraphs[0].TextDirection}");
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
// Retrieve list of detected paragraphs
Paragraph[] paragraphs = ocrResult.Paragraphs;
// Output information to console
Console.WriteLine($"Text: {paragraphs[0].Text}");
Console.WriteLine($"X: {paragraphs[0].X}");
Console.WriteLine($"Y: {paragraphs[0].Y}");
Console.WriteLine($"Width: {paragraphs[0].Width}");
Console.WriteLine($"Height: {paragraphs[0].Height}");
Console.WriteLine($"Text direction: {paragraphs[0].TextDirection}");
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractPrivate ocrTesseract As New IronTesseract()' Add imagePrivate imageInput = New OcrImageInput("sample.jpg")' Perform OCRPrivate ocrResult AsOcrResult = ocrTesseract.Read(imageInput)' Retrieve list of detected paragraphsPrivate paragraphs() AsParagraph = ocrResult.Paragraphs' Output information to consoleConsole.WriteLine($"Text: {paragraphs(0).Text}")Console.WriteLine($"X: {paragraphs(0).X}")Console.WriteLine($"Y: {paragraphs(0).Y}")Console.WriteLine($"Width: {paragraphs(0).Width}")Console.WriteLine($"Height: {paragraphs(0).Height}")Console.WriteLine($"Text direction: {paragraphs(0).TextDirection}")
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()
' Add image
Private imageInput = New OcrImageInput("sample.jpg")
' Perform OCR
Private ocrResult As OcrResult = ocrTesseract.Read(imageInput)
' Retrieve list of detected paragraphs
Private paragraphs() As Paragraph = ocrResult.Paragraphs
' Output information to console
Console.WriteLine($"Text: {paragraphs(0).Text}")
Console.WriteLine($"X: {paragraphs(0).X}")
Console.WriteLine($"Y: {paragraphs(0).Y}")
Console.WriteLine($"Width: {paragraphs(0).Width}")
Console.WriteLine($"Height: {paragraphs(0).Height}")
Console.WriteLine($"Text direction: {paragraphs(0).TextDirection}")
OCR 결과에서 텍스트 콘텐츠에 어떻게 접근할 수 있나요?
OcrResult 객체는 추출된 텍스트를 간단하고 직관적인 방식으로 제공하여 개발자가 이를 직접 사용하거나 다른 애플리케이션 구성 요소에 통합할 수 있도록 합니다. 계층적 구조는 자연 문서의 텍스트 구성을 반영하므로 다양한 세분화 수준에서 콘텐츠를 쉽게 다룰 수 있습니다.
다국어 지원이 필요한 애플리케이션의 경우, IronOCR은 다국어 문서를 원활하게 처리하여 지원되는 125개 언어 모두에서 동일한 구조화된 결과 형식을 유지합니다.
다음 코드 예제는 결과를 확인하기 위해 반복문을 사용하여 텍스트를 출력합니다.
using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Add imageusing var imageInput = new OcrImageInput("sampleText.png");// Perform OCROcrResult ocrResult = ocrTesseract.Read(imageInput);// Retrieve list of detected paragraphsParagraph[] paragraphs = ocrResult.Paragraphs;// Loop through each paragraph in the arrayConsole.WriteLine("--- All Detected Paragraphs ---");foreach (Paragraph paragraph in paragraphs){ // Print the text of the current paragraphConsole.WriteLine(paragraph.Text); // Add a blank line for better separation (optional)Console.WriteLine();}
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sampleText.png");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
// Retrieve list of detected paragraphs
Paragraph[] paragraphs = ocrResult.Paragraphs;
// Loop through each paragraph in the array
Console.WriteLine("--- All Detected Paragraphs ---");
foreach (Paragraph paragraph in paragraphs)
{
// Print the text of the current paragraph
Console.WriteLine(paragraph.Text);
// Add a blank line for better separation (optional)
Console.WriteLine();
}
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractDim ocrTesseract As New IronTesseract()' Add imageUsing imageInput As New OcrImageInput("sampleText.png") ' Perform OCR Dim ocrResult AsOcrResult = ocrTesseract.Read(imageInput) ' Retrieve list of detected paragraphs Dim paragraphs AsParagraph() = ocrResult.Paragraphs ' Loop through each paragraph in the arrayConsole.WriteLine("--- All Detected Paragraphs ---") For Each paragraph AsParagraphIn paragraphs ' Print the text of the current paragraphConsole.WriteLine(paragraph.Text) ' Add a blank line for better separation (optional)Console.WriteLine() NextEndUsing
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sampleText.png")
' Perform OCR
Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput)
' Retrieve list of detected paragraphs
Dim paragraphs As Paragraph() = ocrResult.Paragraphs
' Loop through each paragraph in the array
Console.WriteLine("--- All Detected Paragraphs ---")
For Each paragraph As Paragraph In paragraphs
' Print the text of the current paragraph
Console.WriteLine(paragraph.Text)
' Add a blank line for better separation (optional)
Console.WriteLine()
Next
End Using
산출
콘솔 출력에는 IronOCR이 단락 텍스트를 한 줄씩 정확하게 추출하는 모습이 표시됩니다. 엔진은 단락 경계를 자동으로 감지하므로 여러 텍스트 블록이 포함된 복잡한 문서를 처리하는 데 이상적입니다.
감지된 텍스트의 위치 좌표를 어떻게 얻을 수 있나요?
추출된 텍스트 외에도, OcrResult은 자세한 위치 데이터를 제공합니다. 이러한 공간 정보는 레이아웃의 정확성을 유지하거나 문서의 특정 영역에서 텍스트를 선택적으로 추출해야 하는 애플리케이션에 매우 중요합니다. 좌표계는 페이지의 왼쪽 상단 모서리를 기준으로 표준 픽셀 측정값을 사용합니다.
좌표 기반 작업의 정확도를 높이려면 OCR 영역 타겟팅을 사용하여 특정 영역에 집중하거나 컴퓨터 비전 기능을 활용하여 텍스트 영역을 자동으로 식별하는 것을 고려하십시오.
다음 코드는 각 단락을 순회하며 해당 단락의 좌표(X 및 Y)를 콘솔에 출력하는 방법을 보여줍니다.
using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Add imageusing var imageInput = new OcrImageInput("sampleText.png");// Perform OCROcrResult ocrResult = ocrTesseract.Read(imageInput);// Retrieve list of detected paragraphsParagraph[] paragraphs = ocrResult.Paragraphs;Console.WriteLine("--- All Detected Coordinates of Paragraphs ---");// Use a 'for' loop to get an index for each paragraphfor (int i = 0; i < paragraphs.Length; i++){ // Get the current paragraph Paragraph paragraph = paragraphs[i]; // Print the paragraph number, text, and its locationConsole.WriteLine($"X: {paragraph.X}"); // X-coordinate (left edge)Console.WriteLine($"Y: {paragraph.Y}"); // Y-coordinate (top edge) // Add a blank line for better separationConsole.WriteLine();}
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sampleText.png");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
// Retrieve list of detected paragraphs
Paragraph[] paragraphs = ocrResult.Paragraphs;
Console.WriteLine("--- All Detected Coordinates of Paragraphs ---");
// Use a 'for' loop to get an index for each paragraph
for (int i = 0; i < paragraphs.Length; i++)
{
// Get the current paragraph
Paragraph paragraph = paragraphs[i];
// Print the paragraph number, text, and its location
Console.WriteLine($"X: {paragraph.X}"); // X-coordinate (left edge)
Console.WriteLine($"Y: {paragraph.Y}"); // Y-coordinate (top edge)
// Add a blank line for better separation
Console.WriteLine();
}
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractDim ocrTesseract As New IronTesseract()' Add imageUsing imageInput As New OcrImageInput("sampleText.png") ' Perform OCR Dim ocrResult AsOcrResult = ocrTesseract.Read(imageInput) ' Retrieve list of detected paragraphs Dim paragraphs AsParagraph() = ocrResult.ParagraphsConsole.WriteLine("--- All Detected Coordinates of Paragraphs ---") ' Use a 'for' loop to get an index for each paragraph For i AsInteger = 0 To paragraphs.Length - 1 ' Get the current paragraph Dim paragraph AsParagraph = paragraphs(i) ' Print the paragraph number, text, and its locationConsole.WriteLine($"X: {paragraph.X}") ' X-coordinate (left edge)Console.WriteLine($"Y: {paragraph.Y}") ' Y-coordinate (top edge) ' Add a blank line for better separationConsole.WriteLine() NextEndUsing
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sampleText.png")
' Perform OCR
Dim ocrResult As OcrResult = ocrTesseract.Read(imageInput)
' Retrieve list of detected paragraphs
Dim paragraphs As Paragraph() = ocrResult.Paragraphs
Console.WriteLine("--- All Detected Coordinates of Paragraphs ---")
' Use a 'for' loop to get an index for each paragraph
For i As Integer = 0 To paragraphs.Length - 1
' Get the current paragraph
Dim paragraph As Paragraph = paragraphs(i)
' Print the paragraph number, text, and its location
Console.WriteLine($"X: {paragraph.X}") ' X-coordinate (left edge)
Console.WriteLine($"Y: {paragraph.Y}") ' Y-coordinate (top edge)
' Add a blank line for better separation
Console.WriteLine()
Next
End Using
산출
출력 결과에는 세 개의 단락에 해당하는 세 세트의 좌표가 표시됩니다. 이러한 좌표는 경계 상자를 그리거나, 특정 영역을 추출하거나, 텍스트 요소 간의 공간적 관계를 유지하는 데 사용할 수 있습니다.
OCR 결과에서 확인할 수 있는 다른 속성은 무엇인가요?
IronOCR은 텍스트와 텍스트 좌표 외에도 추가 정보를 제공합니다. 각 텍스트 요소(단락, 줄, 단어 및 개별 문자)에 대해 다음 정보를 확인할 수 있습니다.
텍스트: 문자열 형태의 실제 텍스트.
X: 페이지 왼쪽 가장자리로부터의 위치(픽셀 단위).
Y: 페이지 상단 가장자리로부터의 위치(픽셀 단위).
Width: 픽셀 단위의 너비.
높이: 픽셀 단위의 높이.
텍스트 방향: 텍스트가 읽히는 방향(왼쪽에서 오른쪽 또는 위에서 아래).
위치: 이 텍스트가 페이지에서 픽셀 단위로 어디에 위치하는지 나타내는 사각형.
이러한 속성은 특히 다음과 같은 경우에 유용합니다.
텍스트 강조 표시 및 주석 시스템
자동 양식 필드 감지
문서 변환 시 레이아웃 유지
데이터 추출을 위한 공간 텍스트 분석
디버깅 및 시각화를 위해 텍스트 강조 표시 기능을 사용하여 감지된 영역의 정확도를 시각적으로 확인하십시오.
문단, 행, 단어, 그리고 등장인물은 어떻게 다를까요?
IronOCR의 계층적 텍스트 구조를 통해 개발자는 특정 사용 사례에 맞는 적절한 세부 수준에서 작업할 수 있습니다. 이러한 요소들 간의 차이점을 이해하면 애플리케이션에 적합한 세분성을 선택하는 데 도움이 됩니다.
아래는 감지된 단락, 줄, 단어 및 문자를 비교한 내용입니다.
절
선
단어
성격
각 세분화 수준은 서로 다른 목적을 수행합니다.
단락 : 문서 구조 분석 및 대량 텍스트 추출에 가장 적합합니다.
줄 : 읽기 순서를 유지하고 표 형식 데이터를 처리하는 데 유용합니다.
단어 : 검색 기능 및 텍스트 분석에 이상적입니다.
문자 : 맞춤법 검사 및 정밀한 텍스트 편집에 적합합니다.
IronOCR은 바코드와 QR 코드를 읽을 수 있습니까?
네, IronOCR은 바코드와 QR 코드를 읽을 수 있습니다. 기능이 IronBarcode만큼 강력하지 않을 수 있지만 IronOCR은 일반적인 바코드 유형을 지원합니다. 바코드 검출을 활성화하려면 Configuration.ReadBarCodes 속성을 true로 설정하십시오. 이러한 통합 기능 덕분에 IronOCR은 송장, 배송 라벨 또는 제품 카탈로그와 같이 텍스트와 바코드가 모두 포함된 문서를 처리하는 데 탁월한 선택입니다.
또한, IronSoftware.Drawing.Rectangle 객체로 형식, 값, 좌표 (x,y), 높이, 너비 및 위치를 포함한 검출된 바코드에서 유용한 정보를 추출할 수 있습니다. IronDrawing 의 Rectangle 클래스를 사용하면 문서에서 정확한 위치에 배치할 수 있습니다.
보다 고급 바코드 판독 시나리오에 대해서는 문서에 있는 포괄적인 바코드 판독 예제를 참조하십시오.
using IronOcr;using System;using static IronOcr.OcrResult;// Instantiate IronTesseractIronTesseract ocrTesseract = new IronTesseract();// Enable barcodes detectionocrTesseract.Configuration.ReadBarCodes = true;// Add imageusing OcrInput ocrInput = new OcrInput();ocrInput.LoadPdf("sample.pdf");// Perform OCROcrResult ocrResult = ocrTesseract.Read(ocrInput);// Output information to consoleforeach(var barcode in ocrResult.Barcodes){Console.WriteLine("Format = " + barcode.Format);Console.WriteLine("Value = " + barcode.Value);Console.WriteLine("X = " + barcode.X);Console.WriteLine("Y = " + barcode.Y);}Console.WriteLine(ocrResult.Text);
using IronOcr;
using System;
using static IronOcr.OcrResult;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Enable barcodes detection
ocrTesseract.Configuration.ReadBarCodes = true;
// Add image
using OcrInput ocrInput = new OcrInput();
ocrInput.LoadPdf("sample.pdf");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(ocrInput);
// Output information to console
foreach(var barcode in ocrResult.Barcodes)
{
Console.WriteLine("Format = " + barcode.Format);
Console.WriteLine("Value = " + barcode.Value);
Console.WriteLine("X = " + barcode.X);
Console.WriteLine("Y = " + barcode.Y);
}
Console.WriteLine(ocrResult.Text);
ImportsIronOcrImportsSystemImportsIronOcr.OcrResult' Instantiate IronTesseractPrivate ocrTesseract As New IronTesseract()' Enable barcodes detectionocrTesseract.Configuration.ReadBarCodes = True' Add imageUsing ocrInput As New OcrInput() ocrInput.LoadPdf("sample.pdf") ' Perform OCR Dim ocrResult AsOcrResult = ocrTesseract.Read(ocrInput) ' Output information to console For Each barcode In ocrResult.BarcodesConsole.WriteLine("Format = " & barcode.Format)Console.WriteLine("Value = " & barcode.Value)Console.WriteLine("X = " & barcode.X)Console.WriteLine("Y = " & barcode.Y) Next barcodeConsole.WriteLine(ocrResult.Text)EndUsing
Imports IronOcr
Imports System
Imports IronOcr.OcrResult
' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()
' Enable barcodes detection
ocrTesseract.Configuration.ReadBarCodes = True
' Add image
Using ocrInput As New OcrInput()
ocrInput.LoadPdf("sample.pdf")
' Perform OCR
Dim ocrResult As OcrResult = ocrTesseract.Read(ocrInput)
' Output information to console
For Each barcode In ocrResult.Barcodes
Console.WriteLine("Format = " & barcode.Format)
Console.WriteLine("Value = " & barcode.Value)
Console.WriteLine("X = " & barcode.X)
Console.WriteLine("Y = " & barcode.Y)
Next barcode
Console.WriteLine(ocrResult.Text)
End Using
바코드 감지 결과 출력은 어떻게 나타나나요?
IronOCR의 바코드 감지 기능은 텍스트 추출 기능과 완벽하게 통합되어 텍스트 콘텐츠와 바코드 데이터를 모두 포함하는 통합 결과를 제공합니다. 이러한 이중 기능은 두 가지 유형의 정보를 모두 추출하고 상호 연관시켜야 하는 자동 문서 처리 워크플로에 유용합니다.
출력 결과는 IronOCR이 여러 바코드 유형을 동시에 감지하여 형식 식별(예: QR 코드 또는 EAN8), 디코딩된 값 및 감지된 각 코드에 대한 정확한 좌표 정보를 제공하는 기능을 보여줍니다. 이처럼 포괄적인 데이터를 통해 개발자는 다양한 콘텐츠 유형을 효율적으로 처리하는 정교한 문서 처리 애플리케이션을 구축할 수 있습니다.
자주 묻는 질문
OcrResult 객체에는 어떤 정보가 포함되어 있습니까?
IronOCR에서 생성된 OcrResult 객체에는 추출된 텍스트와 함께 정확한 X/Y 좌표, 크기(너비 및 높이), 텍스트 방향(왼쪽에서 오른쪽 또는 위에서 아래), 단락, 줄, 단어 및 개별 문자로 구성된 계층 구조를 포함한 자세한 메타데이터가 각 감지된 요소에 대해 포함되어 있습니다.
OCR 결과에서 첫 번째 단어를 빠르게 추출하는 방법은 무엇인가요?
IronOCR의 Read 메서드와 Words 컬렉션에 접근하여 첫 번째 단어의 텍스트를 추출할 수 있습니다. 예: `string wordText = new IronTesseract().Read("file.jpg").Words[0].Text;`. 이렇게 하면 OCR 결과에서 개별 단어 요소에 즉시 접근할 수 있습니다.
OCR 결과에서 사용할 수 있는 좌표 데이터 유형에는 어떤 것들이 있습니까?
IronOCR은 감지된 각 요소(단락, 줄, 단어 및 문자)에 대해 정확한 X 및 Y 좌표와 너비 및 높이 치수를 제공합니다. 이 좌표 데이터는 CropRectangle 객체를 통해 접근할 수 있으므로 텍스트 요소의 정확한 위치 추적이 가능합니다.
텍스트 콘텐츠 외에 메타데이터도 추출할 수 있나요?
네, IronOCR은 PDF 및 이미지 문서에서 페이지, 단락, 줄, 단어, 문자, 심지어 바코드까지 포함한 포괄적인 메타데이터를 추출합니다. OcrResult 객체를 통해 각 요소의 텍스트 방향, 계층 구조 및 공간 정보에 접근할 수 있습니다.
OCR 결과를 위해 처리할 수 있는 문서 유형은 무엇입니까?
IronOCR은 스캔 문서, 사진, 스크린샷, PDF 및 이미지 파일 등 다양한 문서 유형을 처리할 수 있습니다. Read 메서드는 이러한 형식에서 일관되게 작동하며, 전체 메타데이터가 포함된 동일한 구조의 OcrResult 객체를 반환합니다.
추출된 텍스트는 결과에서 어떻게 구성되어 있나요?
IronOCR은 추출된 텍스트를 자연 문서의 구조를 반영하는 계층적 구조로 정리합니다. OcrResult 객체는 전체 페이지부터 개별 문자까지 다양한 세분성 수준으로 콘텐츠를 제공하므로 애플리케이션에 적합한 수준에서 텍스트를 쉽게 작업할 수 있습니다.
Can IronOCR read barcodes and QR codes?
Yes, IronOCR can read common barcode types, including QR codes, by enabling barcode detection in the configuration. This integration allows for comprehensive processing of documents containing both text and barcodes.
How does IronOCR help with hierarchical text analysis?
IronOCR's hierarchical text structure allows developers to work at different granularity levels, such as paragraphs, lines, words, and characters, making it suitable for various applications like document structure analysis and text search functionality.
What advanced features does IronOCR offer for coordinate-based operations?
IronOCR offers OCR region targeting for focused text extraction and Computer Vision capabilities to automatically identify text regions, enhancing precision in coordinate-based applications.
What does the barcode detection output look like in IronOCR?
The barcode detection output in IronOCR includes format identification, decoded values, and precise coordinates, seamlessly integrated with text extraction for efficient processing of mixed content documents.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.