ImageProcessor

パブリック クラス ImageProcessor

ImageProcessor は、TensorImage の前処理と後処理を行うヘルパークラスです。これは、 ImageOperator のチェーンを実行することで、TensorImage を別のものに変換できます。

使用例:

   ImageProcessor processor = new ImageProcessor.Builder()
       .add(new ResizeOp(224, 224, ResizeMethod.NEAREST_NEIGHBOR)
       .add(new Rot90Op())
       .add(new NormalizeOp(127.5f, 127.5f))
       .build();
   TensorImage anotherTensorImage = processor.process(tensorImage);
 

警告: ImageProcessor のインスタンスは、updateNumberOfRotations(int) ではスレッドセーフではありません。回転回数の更新と画像の処理( SequentialProcessor.process(T) など)を同時アクセスから保護する必要があります。1 つの Terraform 構成ファイルに スレッドごとに ImageProcessor 個のインスタンス。複数のスレッドが同時に ImageProcessor にアクセスする場合は、外部で同期する必要があります。

ネストされたクラス

クラス ImageProcessor.Builder 後で実行可能な ImageProcessor を作成するためのビルダー。

パブリック メソッド

RectF
inverseTransform(RectF rect、int inputImageHeight、int inputImageWidth)
結果画像の座標系から入力用の座標系に長方形を変換します。 説明します。
PointF
inverseTransform(PointF ポイント、int inputImageHeight、int inputImageWidth)
結果画像の座標系からいずれかの点を入力画像に変換します。 説明します。
TensorImage
processTensorImage イメージ)
準備された TensorOperator を使用して TensorImage オブジェクトを処理します。
無効
updateNumberOfRotations(int k)
この ImageProcessor の最初の Rot90Op の回転数を更新します。
同期済み 無効
updateNumberOfRotations(int k、int のオカレンス)
occurrence で指定された Rot90Op の回転数を更新します。 ImageProcessor

継承されるメソッド

パブリック メソッド

<ph type="x-smartling-placeholder"></ph> 一般公開 RectF inverseTransform (RectF rect、int inputImageHeight、int inputImageWidth)

結果画像の座標系から入力用の座標系に長方形を変換します。 説明します。

パラメータ
rect 座標系から長方形を指定します。
inputImageHeight 入力画像の高さ。
inputImageWidth 入力画像の幅。
戻り値
  • 入力画像の座標系の座標を持つ長方形。

<ph type="x-smartling-placeholder"></ph> 一般公開 PointF inverseTransform (PointF ポイント、int inputImageHeight、int inputImageWidth)

結果画像の座標系からいずれかの点を入力画像に変換します。 説明します。

パラメータ
ポイント 座標系から得た点を指定します。
inputImageHeight 入力画像の高さ。
inputImageWidth 入力画像の幅。
戻り値
  • 入力画像の座標系の座標を持つ点。

<ph type="x-smartling-placeholder"></ph> 一般公開 TensorImage をご覧ください。 プロセス TensorImage 画像)

準備された TensorOperator を使用して TensorImage オブジェクトを処理します。

パラメータ
画像
例外
IllegalArgumentException イメージがどの演算でもサポートされていない場合

<ph type="x-smartling-placeholder"></ph> 一般公開 無効 updateNumberOfRotations (int k)

この ImageProcessor の最初の Rot90Op の回転数を更新します。

警告: このメソッドはスレッドセーフではありません。回転数の更新と その場合、SequentialProcessor.process(T) を使用する画像処理は、同時アクセスから保護する必要があります。 追加の同期を行えます。

パラメータ
k 回転数
例外
IllegalStateException Rot90Op がこのImageProcessorに追加されていない場合

<ph type="x-smartling-placeholder"></ph> 一般公開 同期済み 無効 updateNumberOfRotations (int k, int オカレンス)

occurrence で指定された Rot90Op の回転数を更新します。 ImageProcessor

警告: このメソッドはスレッドセーフではありません。回転数の更新と その場合、SequentialProcessor.process(T) を使用する画像処理は、同時アクセスから保護する必要があります。 追加の同期を行えます。

パラメータ
k 回転数
この ImageProcessor の境界線 Rot90Op のインデックス。対象 たとえば、2 番目の Rot90Op を更新する必要がある場合は、occurrence を 1 に設定されます。
例外
IndexOutOfBoundsException occurrence が負の値または このImageProcessor内のRot90Opの数
IllegalStateException Rot90Op がこのImageProcessorに追加されていない場合