用法:
mxnet.image.imresize(src, w, h, *args, **kwargs)
- src:(
NDArray
) - 源圖像 - w:(
int
,
required
) - 調整大小的圖像的寬度。 - h:(
int
,
required
) - 調整大小圖像的高度。 - interp:(
int
,
optional
,
default=1
) - 插值方法(默認=cv2.INTER_LINEAR)。可能的值: 0:最近鄰插值。 1:雙線性插值。 2:4x4 像素鄰域的雙三次插值。 3:基於區域(使用像素區域關係重采樣)。它可能是圖像抽取的首選方法,因為它會給出moire-free 結果。但是當圖像被縮放時,它類似於最近鄰方法。 (默認使用)。 4:8x8 像素鄰域上的 Lanczos 插值。 9:放大的三次,縮小的麵積,其他的雙線性 10:從上麵提到的插值方法中隨機選擇。注意:在縮小圖像時,通常使用基於 AREA 的插值效果最好,而在放大圖像時,通常使用雙三次(慢)或雙線性(更快但看起來還不錯)效果最好。更多細節可以在OpenCV的文檔中找到,請參考http://docs.opencv.org/master/da/d54/group__imgproc__transform.html. - out:(
NDArray
,
optional
) - 輸出 NDArray 來保存結果。
- src:(
out:- 此函數的輸出。
NDArray 或 NDArray 列表
參數:
返回:
返回類型:
使用 OpenCV 調整圖像大小
注意:
imresize
使用 OpenCV(不是 CV2 Python 庫)。 MXNet 必須使用 USE_OPENCV=1 構建,imresize
才能工作。示例:
>>> with open("flower.jpeg", 'rb') as fp: ... str_image = fp.read() ... >>> image = mx.img.imdecode(str_image) >>> image <NDArray 2321x3482x3 @cpu(0)> >>> new_image = mx.img.resize(image, 240, 360) >>> new_image <NDArray 240x360x3 @cpu(0)>
相關用法
- Python mxnet.image.imread用法及代碼示例
- Python mxnet.image.imdecode用法及代碼示例
- Python mxnet.image.resize_short用法及代碼示例
- Python mxnet.image.random_crop用法及代碼示例
- Python mxnet.image.center_crop用法及代碼示例
- Python mxnet.image.CreateAugmenter用法及代碼示例
- Python mxnet.image.ImageIter.read_image用法及代碼示例
- Python mxnet.image.CreateMultiRandCropAugmenter用法及代碼示例
- Python mxnet.image.CreateDetAugmenter用法及代碼示例
- Python mxnet.image.ImageDetIter.sync_label_shape用法及代碼示例
- Python mxnet.image.ImageDetIter.draw_next用法及代碼示例
- Python mxnet.image.scale_down用法及代碼示例
- Python mxnet.io.PrefetchingIter用法及代碼示例
- Python mxnet.initializer.register用法及代碼示例
- Python mxnet.initializer.One用法及代碼示例
- Python mxnet.io.NDArrayIter用法及代碼示例
- Python mxnet.io.ResizeIter用法及代碼示例
- Python mxnet.initializer.Constant.dumps用法及代碼示例
- Python mxnet.initializer.Mixed用法及代碼示例
- Python mxnet.initializer.Zero用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.image.imresize。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。