ResizeOp

公開類別 ResizeOp

做為處理圖片的運算單位,可將圖片調整為使用者指定的大小。

它會在圖片延展時插入像素,並在壓縮圖片時捨棄像素。

巢狀類別

列舉 ResizeOp.ResizeMethod 用於調整大小的演算法。

公用建構函式

ResizeOp(int targetHeight, int targetWidth, ResizeOp.ResizeMethod scaleMethod)
建立 ResizeOp,以指定方法中的指定大小調整圖片大小。

公用方法

TensorImage
apply(TensorImage 圖片)
對指定圖片套用定義的調整大小,然後傳回結果。
int
getOutputImageHeight(int inputImageHeight, int inputImageWidth)
指定輸入圖片大小時,計算預期輸出圖片的高度。
int
getOutputImageWidth(int inputImageHeight, int inputImageWidth)
指定輸入映像檔大小時,計算預期輸出圖片的寬度。
PointF
inverseTransform(PointF 點、int inputImageHeight、int inputImageWidth)
將結果圖片的座標系統,轉換為其中一張輸入圖片。

繼承的方法

公用建構函式

public ResizeOp (int targetHeight, int targetWidth、ResizeOp.ResizeMethod scaleMethod)

建立 ResizeOp,以指定方法中的指定大小調整圖片大小。

參數
targetHeight 調整大小後的圖片預期高度。
targetWidth 調整大小後的圖片預計寬度。
resizeMethod 用於調整大小的演算法。選項:ResizeOp.ResizeMethod

公用方法

公開 TensorImage 套用 (TensorImage 映像檔)

對指定圖片套用定義的調整大小,然後傳回結果。

注意:輸入 image 的內容會改變,而 image 是和輸出的同一個例項。

參數
圖片 輸入圖片
傳回
  • 輸出圖片。

public int getOutputImageHeight (int inputImageHeight, int inputImageWidth)

指定輸入圖片大小時,計算預期輸出圖片的高度。

參數
inputImageHeight
inputImageWidth

public int getOutputImageWidth (int inputImageHeight, int inputImageWidth)

指定輸入映像檔大小時,計算預期輸出圖片的寬度。

參數
inputImageHeight
inputImageWidth

public PointF inverseTransform (PointF Point、int inputImageHeight、int inputImageWidth)

將結果圖片的座標系統,轉換為其中一張輸入圖片。

參數
擷取自結果座標系統的點。
inputImageHeight 都與輸入圖片的高度有關
inputImageWidth 都與輸入圖片的寬度相等
傳回
  • 帶有輸入圖片座標系統座標的點。