> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FRPage オブジェクトの DetectOrientation メソッド

> ABBYY FineReader Engine API の FRPage オブジェクトの DetectOrientation メソッド — 画像上のテキストの向きを検出し、TextOrientation オブジェクトを返します。検出に失敗した場合は NULL を返します。

このメソッドは、画像上のテキストの向きを検出します。向きの検出に成功した場合は [TextOrientation](/ja/fine-reader/engine/api-reference/text-related-objects/textorientation) オブジェクトを返し、検出に失敗した場合は NULL を返します。

<div id="syntax">
  ## 構文
</div>

<div id="c">
  ### C++
</div>

```cpp theme={null}
HRESULT DetectOrientation(
  IObjectsExtractionParams*    ExtractionParams,
  IRecognizerParams*           RecognizerParams,
  ITextOrientation**           Result
);
```

### C\#

```csharp theme={null}
ITextOrientation DetectOrientation(
  IObjectsExtractionParams    ExtractionParams,
  IRecognizerParams           RecognizerParams
);
```

<div id="visual-basic-net">
  ### Visual Basic .NET
</div>

```vb theme={null}
Function DetectOrientation( _
  [ExtractionParams As IObjectsExtractionParams = Nothing], _
  [RecognizerParams As IRecognizerParams = Nothing] _
) As ITextOrientation
```

<div id="parameters">
  ## Parameters
</div>

ExtractionParams

\[in] この変数は、オブジェクト抽出のパラメータを格納する [ObjectsExtractionParams](/ja/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/objectsextractionparams) オブジェクトを参照します。このパラメータには 0 を指定できます。その場合、オブジェクトはデフォルトのパラメータで抽出されます。[プロファイル](/ja/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles)が読み込まれている場合は、そのプロファイルで設定されたパラメータが使用されます。

RecognizerParams

\[in] この変数は、ページ認識のパラメータを格納する [RecognizerParams](/ja/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/recognizerparams) オブジェクトを参照します。このパラメータには 0 を指定できます。その場合、デフォルトのパラメータが使用されます。[プロファイル](/ja/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles)が読み込まれている場合は、そのプロファイルで設定されたパラメータが使用されます。

Result

\[out, retval] [TextOrientation](/ja/fine-reader/engine/api-reference/text-related-objects/textorientation) 出力オブジェクトのインターフェースポインタを受け取る ITextOrientation\* ポインタ変数へのポインタです。このオブジェクトを通じて、ページ上のテキストの向きにアクセスできます。向きの検出に失敗した場合は、NULL が返されます。

<div id="return-values">
  ## 戻り値
</div>

このメソッドに固有の戻り値はありません。[ABBYY FineReader Engine 関数の標準的な戻り値](/ja/fine-reader/engine/api-reference/return-codes)を返します。

<div id="samples">
  ## サンプル
</div>

<Accordion title="C# コード">
  ```csharp theme={null}
  FREngine.IFRDocument frdoc;
  // ドキュメントが作成され、画像が追加済みであることを前提とします
  // ドキュメント内の各ページの向きを取得する
  int pagesCount = frDoc.Pages.Count;
  FREngine.RotationTypeEnum[] rotations = new FREngine.RotationTypeEnum[pagesCount];
  for (int i = 0; i < pagesCount; i++)
  {
   FREngine.IFRPage page = frDoc.Pages[i];
   FREngine.ITextOrientation ori = page.DetectOrientation(null, null);
   rotations[i] = FREngine.RotationTypeEnum.RT_UnknownRotation;
   if( ori != null ) {
    rotations[i] = ori.RotationType;
   }
  }
  ```
</Accordion>

<div id="see-also">
  ## 関連項目
</div>

[FRPage](/ja/fine-reader/engine/api-reference/document-related-objects/frpage)

[IPagePreprocessingParams::CorrectOrientationMode](/ja/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/pagepreprocessingparams#correctorientationmode)

[プロファイルの操作](/ja/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles)
