> ## 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.

# ImageProcessingTools オブジェクト（IImageProcessingTools インターフェイス）

このオブジェクトを使用すると、認識の前に画像を前処理できます。

このオブジェクトを使用する標準的な手順は次のとおりです。

1. **OpenImageFile** メソッドまたは **OpenImageFileFromStream** メソッドを使用して画像ファイルを開きます。これらのメソッドは、開いたファイルを [**ImageFile**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imagefile.md) オブジェクトとして返します。
2. **ImageFile** オブジェクトの [**OpenImagePage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imagefile-openimagepage.md) を使用して、画像ファイルのページを開きます。このメソッドを使用すると、画像ページに [**Image**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/image.md) オブジェクトとしてアクセスできます。
3. 用意されているメソッドのいずれかを使用して画像ページを前処理するか、独自の前処理アルゴリズムを実装します。用意されているメソッドでは、次の操作を実行できます。
   * カラー写真からノイズを除去する (**RemoveNoise**、**CreateDenoiseFilterParamsByImage** メソッド)
   * 写真からモーションブラーを除去し、明るさを均一化する (**RemoveMotionBlur**、**EqualizeBrightness** メソッド)
   * 画像の幾何学的な歪みを補正する、または画像を引き伸ばす (**CorrectImageGeometry**、**StretchTrapezoidToRectangle**、**StretchImage** メソッド)
   * 公的文書内のカラーオブジェクトを抑制する (**SuppressColorObjects** メソッド)
   * 画像からごみ (一定サイズより小さい余分なドット) を除去する (**RemoveGarbage** メソッド)
   * 画像を平滑化する (**SmoothImageBySquareAverage**、**SmoothImageByGaussianKernel** メソッド)
   * テクスチャを平滑化する (**SmoothTexture** メソッド)
   * 画像上のテキストの向きを検出し、事前定義の角度または任意の角度で画像を回転する (**DetectOrientationByText**、**RotateImageByRotationType**、**RotateImage** メソッド)
   * 画像を左右反転または白黒反転する (**MirrorImage**、**InvertRegion** メソッド)
   * 画像を切り抜く (**CropImage** メソッド)
   * 画像上の領域を指定した色で塗りつぶす (**FillRegionWithColor** メソッド)
   * 画像をグレーまたは白黒に変換する (**ConvertToGray**、**Binarize** メソッド)
   * 内部の画像プレーンをビットマップに変換する、またはその逆の変換を行う (**ImageToBitmap** および **BitmapToImage** メソッド)

## メソッド

| **名前** | **説明** |
| - | - |
| [**Binarize**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-binarize.md) | 画像を白黒に変換します。 |
| [**BitmapToImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-bitmaptoimage.md) | 指定したビットマップを [**Image**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/image.md) オブジェクトに変換します。 |
| [**CalcSuitableForOcr**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-calcsuitableforocr.md) | 画像が Optical Character Recognition (OCR) にどの程度適しているかを示します。値の範囲は 0.0 ～ 1.0 です。 |
| [**ConvertToGray**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-converttogray.md) | 画像をグレーに変換します。 |
| [**CorrectImageGeometry**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-correctimagegeometry.md) | 画像の形状 (遠近歪み、湾曲したテキスト行) を補正します。 |
| [**CreateDenoiseFilterParamsByImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-createdenoisefilterparamsbyimage.md) | 画像の ISO ノイズを測定し、その結果に基づいて [**DenoiseFilterParams**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/denoisefilterparams.md) オブジェクトを作成します。 |
| [**CropImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-cropimage.md) | 画像を切り抜きます。 |
| [**DetectEmpty**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-detectempty.md) | 画像が空白かどうかを検出します。 |
| [**DetectOrientationByText**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-detectorientationbytext.md) | テキスト行に基づいて画像の向きを検出します。 |
| [**DetectRequiredRotation**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-detectrequiredrotation.md) | 画像を通常の (正立した) 向きに戻すために必要な回転を検出します。 |
| [**EqualizeBrightness**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-equalizebrightness.md) | 画像の明るさを均一化します。 |
| [**FillRegionWithColor**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-fillregionwithcolor.md) | 指定した領域を色で塗りつぶします。 |
| [**FilterColor**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-filtercolor.md) | 画像全体またはその一部から、指定したカラーオブジェクトを除去します。 |
| [**ImageToBitmap**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-imagetobitmap.md) | [**Image**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/image.md) オブジェクトをビットマップに変換します。 |
| [**InvertRegion**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-invertregion.md) | 画像上の指定した領域、または画像全体を白黒反転します。 |
| [**IsSuitableForOcr**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-issuitableforocr.md) | 画像が OCR に適しているかどうかを確認します。 |
| [**MirrorImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-mirrorimage.md) | 画像を上下または左右に反転します。 |
| [**OpenImageFile**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-openimagefile.md) | 画像ファイルを開きます。 |
| [**OpenImageFileFromStream**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-openimagefilefromstream.md) | 指定したストリームから画像ファイルを読み込みます。 |
| [**PreprocessCameraImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-preprocesscameraimage.md) | さまざまな種類の写真向けに設計された事前定義の設定を使用して、写真を前処理します。 |
| [**RemoveGarbage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-removegarbage.md) | ごみと見なされる、指定したサイズの孤立したピクセルの塊を除去します。 |
| [**RemoveMotionBlur**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-removemotionblur.md) | 画像からモーションブラーを除去します。 |
| [**RemoveNoise**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-removenoise.md) | カラー写真から ISO ノイズを除去します。 |
| [**RotateImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-rotateimage.md) | 画像を指定した角度だけ回転します。 |
| [**RotateImageByRotationType**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-rotateimagebyrotationtype.md) | 画像を事前定義の角度 (時計回りに 90 度、反時計回りに 90 度、180 度) で回転します。 |
| [**SmoothImageByGaussianKernel**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-smoothimagebygaussiankernel.md) | ガウスカーネルを使用して画像を平滑化します。 |
| [**SmoothImageBySquareAverage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-smoothimagebysquareaverage.md) | 正方形近傍の平均値を用いて画像を平滑化します。 |
| [**SmoothTexture**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-smoothtexture.md) | 非線形フィルタを使用し、鋭いエッジを保持したまま画像のテクスチャを平滑化します。 |
| [**StretchImage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-stretchimage.md) | 画像を指定したサイズに拡大または縮小します。 |
| [**StretchTrapezoidToRectangle**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-stretchtrapezoidtorectangle.md) | 指定した台形が長方形になるように画像を変換します。軽度の遠近歪みを手動で補正する際に使用できます。 |
| [**SuppressColorObjects**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/imageprocessingtools-suppresscolorobjects.md) | 公文書内の指定した色のオブジェクトを除去します。 |

## 出力パラメーター

このオブジェクトは、[**Engine**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/engine.md) オブジェクトの [**CreateImageProcessingTools**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/engine-createxxx.md) メソッドの出力パラメーターです。

## サンプル

> [accordion] C# コード
>
> ```csharp theme={null}
> // カスタム画像ソースの実装サンプル
> class CustomPreprocessingImageSource : IImageSource
> {
>  public CustomPreprocessingImageSource( IEngine engine )
>  {
>   fileNames = new Queue();
>   imageTools = engine.CreateImageProcessingTools();
>  }
>  ...
>  // ImageProcessingTools オブジェクトを使用する IImageSource::GetNextImage の実装
>  public IImage GetNextImage()
>  {
>   while( true ) {
>    if( imageFile == null ) {
>     if( fileNames.Count > 0 ) {
>      imageFile = imageTools.OpenImageFile( (string)fileNames.Dequeue() );
>      nextPageIndex = 0;
>     } else {
>      return null;
>     }
>    }
>    assert( imageFile != null );
>    if( nextPageIndex < imageFile.PagesCount ) {
>     IImage nextPage = imageFile.OpenImagePage( nextPageIndex++ );
>     // ここで必要な前処理を適用できます
>     // ...
>     return nextPage;
>    } else {
>     imageFile = null;
>     continue;
>    }
>   }
>  }
>  IImageProcessingTools imageTools;
>  Queue fileNames;
>  IImageFile imageFile;
>  int nextPageIndex;
> };
> ```
